create table ai_question_chat
(
    id               bigint auto_increment
        primary key,
    business_type    varchar(255)  not null comment '业务类型，用于分配模型，如lyrics,tool,chat',
    messages_type    varchar(255)  not null comment '会话消息类型，用于后续处理逻辑，如completion,pending,user_inputs',
    messages_json    json          not null,
    question_content varchar(3000) null,
    create_time      datetime      not null,
    update_time      datetime      not null,
    status           int default 0 not null
);



create table history_chat
(
    id            bigint auto_increment
        primary key,
    business_type varchar(255)  not null comment '业务类型，用于分配模型，如lyrics,tool,chat',
    messages_type varchar(255)  not null comment '会话消息类型，用于后续处理逻辑，如completion,pending,user_inputs',
    messages_json json          not null,
    create_time   datetime      not null,
    update_time   datetime      not null,
    status        int default 0 not null
);

create table pre_handle_chat
(
    id            bigint auto_increment
        primary key,
    business_type varchar(255)  not null comment '业务类型，用于分配模型，如lyrics,tool,chat',
    messages_type varchar(255)  not null comment '会话消息类型，用于后续处理逻辑，如completion,pending,user_inputs',
    messages_json json          not null,
    create_time   datetime      not null,
    update_time   datetime      not null,
    status        int default 0 not null
);

create index range_index
    on pre_handle_chat (business_type, messages_type, create_time, status);

