chore: standardize package references (#9346)

This commit is contained in:
liuyi
2024-12-26 19:08:42 +08:00
committed by GitHub
parent 37747369bc
commit 00980077c4
45 changed files with 146 additions and 101 deletions

View File

@@ -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",

View File

@@ -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;
}
}
}

View File

@@ -1,2 +0,0 @@
export const CHAT_BLOCK_WIDTH = 300;
export const CHAT_BLOCK_HEIGHT = 320;

View File

@@ -1,3 +0,0 @@
export * from './ai-chat-model';
export * from './consts';
export * from './types';

View File

@@ -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;
};

View File

@@ -1 +0,0 @@
export * from './ai-chat-block';

View File

@@ -1 +0,0 @@
export * from './blocks';

View File

@@ -1,6 +1,5 @@
export * from './app-config-storage';
export * from './atom';
export * from './blocksuite';
export * from './framework';
export * from './initialization';
export * from './livedata';