fix: 用户隔离完整性 + 聊天去重
1. 启动时不加载历史消息(等第一条消息确定身份后按需恢复) 2. MemoryStore 改为 HashMap<user_id, Vec<mem>>,按用户隔离缓存 3. session.current_user_id 与外部 mutex 同步 4. chat_records.message_id 加 UNIQUE 索引 + ON CONFLICT DO NOTHING
This commit is contained in:
@@ -70,6 +70,7 @@ pub async fn insert_chat_record(
|
||||
r#"
|
||||
INSERT INTO chat_records (direction, user_id, account_id, text, source, context_token, message_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
ON CONFLICT (message_id) DO NOTHING
|
||||
RETURNING id
|
||||
"#,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user