feat: 完成管理端聊天工作台收口

- 新增管理端聊天工作台与会话级额外知识库持久化

- 补齐发布态聊天、历史会话只读判断与答案版本切换

- 新增 chat_round 热数据与主线消息读取支撑
This commit is contained in:
2026-05-14 20:22:46 +08:00
parent 2ad8935a61
commit 47c2bad839
63 changed files with 8609 additions and 136 deletions

View File

@@ -197,6 +197,28 @@ export class SseClient {
return;
}
const contentType = res.headers.get('content-type') || '';
if (!contentType.includes('text/event-stream')) {
let errorMessage = '请求失败,请稍后再试';
try {
const body = await res.json();
errorMessage =
body?.error ?? body?.message ?? body?.data?.message ?? errorMessage;
} catch {
try {
const text = await res.text();
if (text.trim()) {
errorMessage = text.trim();
}
} catch {
// ignore body parse failures and keep fallback message
}
}
showErrorOnce(errorMessage);
options?.onError?.(new Error(errorMessage));
return;
}
// 在开始事件流之前检查是否还是同一个请求
if (this.currentRequestId !== currentRequestId) {
return;