
CREATE TABLE base_ai_chat (
                              "f_id" varchar(50) NOT NULL,
                              "f_full_name" varchar(200),
                              "f_enabled_mark" int4,
                              "f_sort_code" int8,
                              "f_creator_time" timestamp,
                              "f_creator_user_id" varchar(50),
                              "f_last_modify_time" timestamp,
                              "f_last_modify_user_id" varchar(50),
                              "f_delete_time" timestamp,
                              "f_delete_user_id" varchar(50),
                              "f_delete_mark" int4,
                              "f_tenant_id" varchar(50) NOT NULL 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" varchar(50) NOT NULL,
                                 "f_chat_id" varchar(50),
                                 "f_question_text" text,
                                 "f_content" text,
                                 "f_type" int4,
                                 "f_enabled_mark" int4,
                                 "f_sort_code" int8,
                                 "f_creator_time" timestamp,
                                 "f_creator_user_id" varchar(50),
                                 "f_last_modify_time" timestamp,
                                 "f_last_modify_user_id" varchar(50),
                                 "f_delete_time" timestamp,
                                 "f_delete_user_id" varchar(50),
                                 "f_delete_mark" int4,
                                 "f_tenant_id" varchar(50) NOT NULL 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';
