Files
yunzerwebsiteallinone/go/docs/sql/create_platform_ai_chat.sql
T

26 lines
1.2 KiB
SQL

-- 平台 AI Playground 会话与消息表
CREATE TABLE IF NOT EXISTS `yz_platform_ai_chat_session` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL DEFAULT '' COMMENT '会话标题(首条用户消息摘要)',
`provider_id` bigint unsigned NOT NULL DEFAULT 0 COMMENT '服务商配置ID',
`model` varchar(100) NOT NULL DEFAULT '' COMMENT '模型ID',
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`delete_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_delete_time` (`delete_time`),
KEY `idx_update_time` (`update_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台AI会话';
CREATE TABLE IF NOT EXISTS `yz_platform_ai_chat_message` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`session_id` bigint unsigned NOT NULL DEFAULT 0,
`role` varchar(20) NOT NULL DEFAULT '' COMMENT 'user/assistant/system',
`content` text COMMENT 'user存原始content JSON(可含附件);assistant存纯文本',
`think` text COMMENT 'assistant思考过程',
`seq` int NOT NULL DEFAULT 0 COMMENT '消息序号',
`create_time` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `idx_session_seq` (`session_id`, `seq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台AI会话消息';