修复: 切会话残片覆盖回复与收尾工具卡丢失
- flushCurrentText 加非流式守卫,非流式只清不写 - 后台会话终止即清流式态,残片不跨轮引爆 - 异常收尾尾部工具气泡折进轨迹卡不再蒸发 - 停止与看门狗超时先保文再复位
This commit is contained in:
@@ -97,6 +97,10 @@ export function handleEvent(event: AiChatEvent) {
|
||||
if (event.type === 'AiCompleted' || event.type === 'AiError' || event.type === 'AiHelpRequired') {
|
||||
// 非当前会话终止:收敛会话状态(删 Map 项回不在生成)
|
||||
convStates.delete(convId || '')
|
||||
// 同步清该会话 per-conv 流式态。残留的 streaming/currentText 是死数据:切回时会被
|
||||
// switchConversation 恢复进 currentText,下轮发送的防御 flush 又把它写进上一轮气泡,
|
||||
// 把已完成回复覆盖为残片;回复正文以切换时 DB 加载为准,流式态无需保留。
|
||||
clearConvStreamState(convId || '')
|
||||
// FE1:后台会话终止只刷新列表(防抖调度,避免与 AiCompleted 收尾的 notify 双拉)。
|
||||
scheduleConversationsRefresh()
|
||||
// 后台会话终止也触发队列续发/清队(完成续发;错误清该会话队列)
|
||||
|
||||
Reference in New Issue
Block a user