
CREATE TABLE base_ai_chat (
                              "F_ID" NVARCHAR2(50) NOT NULL,
                              "F_FULL_NAME" NVARCHAR2(200),
                              "F_ENABLED_MARK" NUMBER,
                              "F_SORT_CODE" NUMBER,
                              "F_CREATOR_TIME" TIMESTAMP,
                              "F_CREATOR_USER_ID" NVARCHAR2(50),
                              "F_LAST_MODIFY_TIME" TIMESTAMP,
                              "F_LAST_MODIFY_USER_ID" NVARCHAR2(50),
                              "F_DELETE_TIME" TIMESTAMP,
                              "F_DELETE_USER_ID" NVARCHAR2(50),
                              "F_DELETE_MARK" NUMBER,
                              "F_TENANT_ID" NVARCHAR2(50) DEFAULT '0'

    , PRIMARY KEY (f_id,f_tenant_id)
);
COMMENT ON TABLE base_ai_chat IS 'ai会话列表';
COMMENT ON COLUMN base_ai_chat."F_ID" IS '自然主键';
COMMENT ON COLUMN base_ai_chat."F_FULL_NAME" IS '会话标题';
COMMENT ON COLUMN base_ai_chat."F_ENABLED_MARK" IS '有效标志';
COMMENT ON COLUMN base_ai_chat."F_SORT_CODE" IS '排序';
COMMENT ON COLUMN base_ai_chat."F_CREATOR_TIME" IS '创建时间';
COMMENT ON COLUMN base_ai_chat."F_CREATOR_USER_ID" IS '创建用户';
COMMENT ON COLUMN base_ai_chat."F_LAST_MODIFY_TIME" IS '修改时间';
COMMENT ON COLUMN base_ai_chat."F_LAST_MODIFY_USER_ID" IS '修改用户';
COMMENT ON COLUMN base_ai_chat."F_DELETE_TIME" IS '删除时间';
COMMENT ON COLUMN base_ai_chat."F_DELETE_USER_ID" IS '删除用户';
COMMENT ON COLUMN base_ai_chat."F_DELETE_MARK" IS '删除标志';
COMMENT ON COLUMN base_ai_chat."F_TENANT_ID" IS '租户id';
CREATE TABLE base_ai_history (
                                 "F_ID" NVARCHAR2(50) NOT NULL,
                                 "F_CHAT_ID" NVARCHAR2(50),
                                 "F_QUESTION_TEXT" CLOB,
                                 "F_CONTENT" CLOB,
                                 "F_TYPE" NUMBER,
                                 "F_ENABLED_MARK" NUMBER,
                                 "F_SORT_CODE" NUMBER,
                                 "F_CREATOR_TIME" TIMESTAMP,
                                 "F_CREATOR_USER_ID" NVARCHAR2(50),
                                 "F_LAST_MODIFY_TIME" TIMESTAMP,
                                 "F_LAST_MODIFY_USER_ID" NVARCHAR2(50),
                                 "F_DELETE_TIME" TIMESTAMP,
                                 "F_DELETE_USER_ID" NVARCHAR2(50),
                                 "F_DELETE_MARK" NUMBER,
                                 "F_TENANT_ID" NVARCHAR2(50) DEFAULT '0'

    , PRIMARY KEY (f_id,f_tenant_id)
);
COMMENT ON TABLE base_ai_history IS 'ai会话记录';
COMMENT ON COLUMN base_ai_history."F_ID" IS '自然主键';
COMMENT ON COLUMN base_ai_history."F_CHAT_ID" IS '会话id';
COMMENT ON COLUMN base_ai_history."F_QUESTION_TEXT" IS '问题内容';
COMMENT ON COLUMN base_ai_history."F_CONTENT" IS '会话内容';
COMMENT ON COLUMN base_ai_history."F_TYPE" IS '类型（0-ai，1-用户）';
COMMENT ON COLUMN base_ai_history."F_ENABLED_MARK" IS '有效标志';
COMMENT ON COLUMN base_ai_history."F_SORT_CODE" IS '排序';
COMMENT ON COLUMN base_ai_history."F_CREATOR_TIME" IS '创建时间';
COMMENT ON COLUMN base_ai_history."F_CREATOR_USER_ID" IS '创建用户';
COMMENT ON COLUMN base_ai_history."F_LAST_MODIFY_TIME" IS '修改时间';
COMMENT ON COLUMN base_ai_history."F_LAST_MODIFY_USER_ID" IS '修改用户';
COMMENT ON COLUMN base_ai_history."F_DELETE_TIME" IS '删除时间';
COMMENT ON COLUMN base_ai_history."F_DELETE_USER_ID" IS '删除用户';
COMMENT ON COLUMN base_ai_history."F_DELETE_MARK" IS '删除标志';
COMMENT ON COLUMN base_ai_history."F_TENANT_ID" IS '租户id';
