fix(chat): 允许空中止后继续上一段

- 跳过未产生正文的停止或失败尝试,但不越过真实用户消息

- 补充提前停止、失败后重试及用户发言边界回归
This commit is contained in:
湛兮
2026-10-27 18:20:49 +08:00
parent 17b0668557
commit 57c89f4f32
3 changed files with 49 additions and 5 deletions
+2 -1
View File
@@ -301,7 +301,8 @@ export async function streamChat(
content: string;
status: string;
}>(
"SELECT role,content,status FROM dh_messages WHERE conversation_id=? ORDER BY sequence_id DESC LIMIT 1",
// 空的中止/失败尝试没有新台词,继续时沿用上一段已说出的内容;不能跳过真实用户消息。
"SELECT role,content,status FROM dh_messages WHERE conversation_id=? AND NOT (role='assistant' AND status IN ('stopped','failed') AND TRIM(content)='') ORDER BY sequence_id DESC LIMIT 1",
[id],
c,
);