fix(chat): 恢复提前停止后的继续入口

- 以最近有效台词判断继续能力,停止前未出字时仍可重试
This commit is contained in:
湛兮
2026-10-27 18:20:49 +08:00
parent 1f11112e04
commit ae2b58e0b8
2 changed files with 11 additions and 1 deletions
+9 -1
View File
@@ -184,7 +184,15 @@ export function DigitalHome({
books = boot?.catalog.filter((c) => c.kind === "worldbook") ?? [],
presets = boot?.catalog.filter((c) => c.kind === "preset") ?? [];
const conversationId = conversation?.id;
const lastReply = conversation?.messages.at(-1);
// 尚未产生正文的失败/停止不算新台词,继续时接回上一段;真实用户消息仍是边界。
const lastReply = conversation?.messages.findLast(
(m) =>
!(
m.role === "assistant" &&
["stopped", "failed"].includes(m.status) &&
!m.content.trim()
),
);
const canContinue =
lastReply?.role === "assistant" &&
["complete", "stopped"].includes(lastReply.status) &&