feat: AI chat (#5383)

* chore: ai type

* chore: use patch to fix version issue

* chore: update

* chore: update

* chore: integrate client api

* chore: add schema

* chore: setup event

* chore: add event test

* chore: add test

* chore: update test

* chore: load chat message

* chore: load chat message

* chore: chat ui

* chore: disable create chat

* chore: update client api

* chore: disable chat

* chore: ui theme

* chore: ui theme

* chore: copy message

* chore: fix test

* chore: show error

* chore: update bloc

* chore: update test

* chore: lint

* chore: icon

* chore: hover

* chore: show unsupported page

* chore: adjust mobile ui

* chore: adjust view title bar

* chore: return related question

* chore: error page

* chore: error page

* chore: code format

* chore: prompt

* chore: fix test

* chore: ui adjust

* chore: disable create chat

* chore: add loading page

* chore: fix test

* chore: disable chat action

* chore: add maximum text limit
This commit is contained in:
Nathan.fooo
2024-06-03 14:27:28 +08:00
committed by GitHub
parent 4d42c9ea68
commit aec7bc847e
114 changed files with 5473 additions and 282 deletions

View File

@ -0,0 +1,3 @@
-- This file should undo anything in `up.sql`
drop table chat_table;
drop table chat_message_table;

View File

@ -0,0 +1,20 @@
-- Create table for chat documents
CREATE TABLE chat_table
(
chat_id TEXT PRIMARY KEY NOT NULL,
created_at BIGINT NOT NULL,
name TEXT NOT NULL DEFAULT ''
);
-- Create table for chat messages
CREATE TABLE chat_message_table
(
message_id BIGINT PRIMARY KEY NOT NULL,
chat_id TEXT NOT NULL,
content TEXT NOT NULL,
created_at BIGINT NOT NULL,
author_type BIGINT NOT NULL,
author_id TEXT NOT NULL,
reply_message_id BIGINT
);
CREATE INDEX idx_chat_messages_chat_id_message_id ON chat_message_table (chat_id, message_id);

View File

@ -1,5 +1,25 @@
// @generated automatically by Diesel CLI.
diesel::table! {
chat_message_table (message_id) {
message_id -> BigInt,
chat_id -> Text,
content -> Text,
created_at -> BigInt,
author_type -> BigInt,
author_id -> Text,
reply_message_id -> Nullable<BigInt>,
}
}
diesel::table! {
chat_table (chat_id) {
chat_id -> Text,
created_at -> BigInt,
name -> Text,
}
}
diesel::table! {
collab_snapshot (id) {
id -> Text,
@ -48,8 +68,10 @@ diesel::table! {
}
diesel::allow_tables_to_appear_in_same_query!(
collab_snapshot,
user_data_migration_records,
user_table,
user_workspace_table,
chat_message_table,
chat_table,
collab_snapshot,
user_data_migration_records,
user_table,
user_workspace_table,
);