mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
chore: standardize package references (#9346)
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
"private": true,
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
"./blocksuite": "./src/blocksuite/index.ts",
|
||||
"./storage": "./src/storage/index.ts",
|
||||
"./utils": "./src/utils/index.ts",
|
||||
"./app-config-storage": "./src/app-config-storage.ts",
|
||||
@@ -15,7 +14,6 @@
|
||||
"@affine/debug": "workspace:*",
|
||||
"@affine/env": "workspace:*",
|
||||
"@affine/templates": "workspace:*",
|
||||
"@blocksuite/affine": "workspace:*",
|
||||
"@datastructures-js/binary-search-tree": "^5.3.2",
|
||||
"eventemitter2": "^6.4.9",
|
||||
"foxact": "^0.2.43",
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
import {
|
||||
type GfxCommonBlockProps,
|
||||
GfxCompatible,
|
||||
} from '@blocksuite/affine/block-std/gfx';
|
||||
import { BlockModel, defineBlockSchema } from '@blocksuite/affine/store';
|
||||
|
||||
type AIChatProps = {
|
||||
messages: string; // JSON string of ChatMessage[]
|
||||
sessionId: string; // forked session id
|
||||
rootWorkspaceId: string; // workspace id of root chat session
|
||||
rootDocId: string; // doc id of root chat session
|
||||
} & Omit<GfxCommonBlockProps, 'rotate'>;
|
||||
|
||||
export const AIChatBlockSchema = defineBlockSchema({
|
||||
flavour: 'affine:embed-ai-chat',
|
||||
props: (): AIChatProps => ({
|
||||
xywh: '[0,0,0,0]',
|
||||
index: 'a0',
|
||||
lockedBySelf: false,
|
||||
scale: 1,
|
||||
messages: '',
|
||||
sessionId: '',
|
||||
rootWorkspaceId: '',
|
||||
rootDocId: '',
|
||||
}),
|
||||
metadata: {
|
||||
version: 1,
|
||||
role: 'content',
|
||||
children: [],
|
||||
},
|
||||
toModel: () => {
|
||||
return new AIChatBlockModel();
|
||||
},
|
||||
});
|
||||
|
||||
export class AIChatBlockModel extends GfxCompatible<AIChatProps>(BlockModel) {}
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace BlockSuite {
|
||||
interface EdgelessBlockModelMap {
|
||||
'affine:embed-ai-chat': AIChatBlockModel;
|
||||
}
|
||||
interface BlockModels {
|
||||
'affine:embed-ai-chat': AIChatBlockModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
export const CHAT_BLOCK_WIDTH = 300;
|
||||
export const CHAT_BLOCK_HEIGHT = 320;
|
||||
@@ -1,3 +0,0 @@
|
||||
export * from './ai-chat-model';
|
||||
export * from './consts';
|
||||
export * from './types';
|
||||
@@ -1,25 +0,0 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
// Define the Zod schema
|
||||
const ChatMessageSchema = z.object({
|
||||
id: z.string(),
|
||||
content: z.string(),
|
||||
role: z.union([z.literal('user'), z.literal('assistant')]),
|
||||
createdAt: z.string(),
|
||||
attachments: z.array(z.string()).optional(),
|
||||
userId: z.string().optional(),
|
||||
userName: z.string().optional(),
|
||||
avatarUrl: z.string().optional(),
|
||||
});
|
||||
|
||||
export const ChatMessagesSchema = z.array(ChatMessageSchema);
|
||||
|
||||
// Derive the TypeScript type from the Zod schema
|
||||
export type ChatMessage = z.infer<typeof ChatMessageSchema>;
|
||||
|
||||
export type MessageRole = 'user' | 'assistant';
|
||||
export type MessageUserInfo = {
|
||||
userId?: string;
|
||||
userName?: string;
|
||||
avatarUrl?: string;
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
export * from './ai-chat-block';
|
||||
@@ -1 +0,0 @@
|
||||
export * from './blocks';
|
||||
@@ -1,6 +1,5 @@
|
||||
export * from './app-config-storage';
|
||||
export * from './atom';
|
||||
export * from './blocksuite';
|
||||
export * from './framework';
|
||||
export * from './initialization';
|
||||
export * from './livedata';
|
||||
|
||||
Reference in New Issue
Block a user