You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fu-hsi-service/docker/docker-compose/sql/20241126/migration_2.1.sql

70 lines
4.7 KiB
SQL

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `conversation`;
CREATE TABLE `conversation` (
`id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`title` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '标题',
`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '类型',
`case_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '案件ID',
`user_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '用户ID',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '会话记录表' ROW_FORMAT = DYNAMIC;
DROP TABLE IF EXISTS `conversation_qa`;
CREATE TABLE `conversation_qa` (
`id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`type` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '问答类型 0DIFY问答 1NX_LLM问答',
`intent_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '意图类型 0指标结果 1案件分析结果 2案件概况 3案件证据指引',
`dialog_count` int(11) NULL DEFAULT NULL COMMENT '多轮对话轮数',
`question` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`complete_question` text CHARACTER SET utf8 COLLATE utf8_bin NULL,
`question_time` datetime NOT NULL,
`answer` text CHARACTER SET utf8 COLLATE utf8_bin NULL,
`answer_map` text CHARACTER SET utf8 COLLATE utf8_bin NULL,
`segment_list` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT 'RAG片段',
`complete_answer` text CHARACTER SET utf8 COLLATE utf8_bin NULL,
`answer_time` datetime NULL DEFAULT NULL,
`time_interval` int(11) NULL DEFAULT NULL,
`user_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`case_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`conversation_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = DYNAMIC;
alter table model_case
add knowledge_base_id varchar(64) null comment '知识库id' after id;
ALTER TABLE `nx_llm`.`note_record_split`
ADD COLUMN `note_file_id` varchar(64) NULL COMMENT '笔录文件ID' AFTER `person_name`;
create table audit_log
(
id varchar(64) not null comment '主键id'
primary key,
record_type varchar(64) null comment '记录类型0-正常操作记录1-异常记录',
user_id varchar(64) null comment '用户id',
user_name varchar(128) null comment '用户名',
ip varchar(255) null comment '操作人ip地址',
method varchar(64) null comment '请求类型 GET POST PUT DELETE',
url varchar(1024) null comment 'url地址',
request_params text null comment '请求参数',
cost_time int null comment '操作耗时 单位ms',
response text null comment '响应结果',
exception_desc text null comment '异常描述',
create_time datetime null comment '创建时间',
create_user_id varchar(64) null comment '创建人',
update_time datetime null comment '更新时间',
update_user_id varchar(255) null comment '更新用户id'
)
comment '日志审计表';
create index audit_log_record_type_index
on audit_log (record_type);
create index audit_log_user_id_index
on audit_log (user_id);
UPDATE model_atomic_index SET query_lang = 'select * from note_record where case_id = #{caseId} and role = \'4\';' WHERE id = '2d678232-3ea7-4bad-a7e3-875eb2aa9242';