feat: 工作台聊天室功能

This commit is contained in:
2026-05-31 02:37:23 +08:00
parent 83cf9eab94
commit f83f434863
33 changed files with 2520 additions and 265 deletions

View File

@@ -0,0 +1,24 @@
CREATE TABLE `conversations` (
`created_at` text NOT NULL,
`id` text PRIMARY KEY NOT NULL,
`model_id` text NOT NULL,
`project_id` text NOT NULL,
`title` text DEFAULT '新会话' NOT NULL,
`updated_at` text NOT NULL,
FOREIGN KEY (`model_id`) REFERENCES `models`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE INDEX `conversations_project_id_idx` ON `conversations` (`project_id`);
--> statement-breakpoint
CREATE TABLE `messages` (
`content` text DEFAULT '' NOT NULL,
`conversation_id` text NOT NULL,
`created_at` text NOT NULL,
`id` text PRIMARY KEY NOT NULL,
`parts` text,
`role` text NOT NULL,
FOREIGN KEY (`conversation_id`) REFERENCES `conversations`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `messages_conversation_id_idx` ON `messages` (`conversation_id`);