CREATE TABLE IF NOT EXISTS `gglm_vector_param`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '名称',
    `URL` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'URL',
    `PROJECT_PREFIX` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目前缀',
    `TABLE_NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '数据库表名',
    `ATTRIBUTE_MAP` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '向量键值对',
    `REMARK` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '租户ID',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位',
    `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `SYNCHRONIZATION_TIME` datetime(0) NULL DEFAULT NULL COMMENT '同步时间',
    `SYNCHRONIZATION_REMARK` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '同步说明',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '向量库配置信息' ROW_FORMAT = Dynamic;

CREATE TABLE IF NOT EXISTS `gglm_vector_param_log`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `VECTOR_PARAM_ID` bigint(20) NOT NULL COMMENT '参数id',
    `CONTENT` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '日志内容',
    `TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '日志类型',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '租户ID',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位',
    `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '向量数据库操作日志' ROW_FORMAT = Dynamic;

CREATE TABLE IF NOT EXISTS `gglm_agent_log`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `chat_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '每轮对话的id',
    `q_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '问题ID',
    `model_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'hx自用',
    `agent` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'hx自用',
    `q` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '问题',
    `prompt` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '问题提示',
    `system` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
    `a` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '答案',
    `a_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '答案类型，0直接回答、1参数提取、2意图分类',
    `user_conclusion` tinyint(4) NULL DEFAULT NULL COMMENT '用户结论，0为错误，1为正确',
    `label_status` tinyint(4) NULL DEFAULT 0 COMMENT '标注状态，0为错误，1为正确',
    `label_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '标注内容，json字符串',
    `label_result` tinyint(4) NULL DEFAULT NULL COMMENT '标注结果，0为错误，1为正确',
    `label_operator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标注人名称',
    `label_time` datetime(0) NULL DEFAULT NULL COMMENT '标注时间',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '租户ID',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位',
    `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1833310958482192892 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

CREATE TABLE IF NOT EXISTS `knowledge_file_info`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '名称',
    `URL` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT 'URL',
    `SIZE` bigint(18) NULL DEFAULT NULL COMMENT '文件大小',
    `BRIEFS` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '简介',
    `TAGS` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '标签',
    `DOMAIN` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '业务领域',
    `AUTHORITY_CLASS` tinyint(4) NULL DEFAULT NULL COMMENT '权限等级,5个等级',
    `VISIBLE` tinyint(4) NULL DEFAULT 1 COMMENT '是否可见,0为不可见，1为可见',
    `FILE_STATUS` tinyint(4) NULL DEFAULT 0 COMMENT '文件状态,0为未入库，1为已入库，2为入库中',
    `REMARK` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
    `CREATE_USER_NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建人名称',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '租户ID',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位',
    `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '知识库文件信息表' ROW_FORMAT = Dynamic;

CREATE TABLE IF NOT EXISTS `knowledge_file_segment`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '租户ID',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位',
    `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `DOC_QS` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL,
    `DOC_CONTENT` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL,
    `DOC_PAGE_INDEX` int(11) NULL DEFAULT NULL,
    `DOC_ID` bigint(20) NULL DEFAULT NULL,
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '知识库文件分段表' ROW_FORMAT = Dynamic;

CREATE TABLE IF NOT EXISTS `question_answer_comment`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `CHAT_ID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '对话id',
    `QUESTION_ID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '问题id',
    `USER_ID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '用户id',
    `PRAISE` tinyint(4) NULL DEFAULT 0 COMMENT '点赞',
    `CONTENT` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL,
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '租户ID',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位',
    `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '问题评价' ROW_FORMAT = Dynamic;