优化: 会话状态 per-conv 化与交互守卫
- 待审批跨会话 per-conv 合并,审批类事件全局放行 - 看门狗/重试计数/流式残段按会话键控迁移 - 输入草稿与子代理完成卡数据按会话隔离 - 切换兜底 activeId,收敛守卫防幽灵气泡 - 发送错误按限流/额度/网络分类文案
This commit is contained in:
@@ -14,7 +14,7 @@ import { useAppSettingsStore } from '@/stores/appSettings'
|
||||
import { state } from '@/stores/ai'
|
||||
import { setStreaming } from './streamingGuard'
|
||||
import { syncHighRiskTools } from './useToolApproval'
|
||||
import { nextMsgId } from './aiShared'
|
||||
import { nextMsgId, setConvPendingApprovals } from './aiShared'
|
||||
import { t } from '@/i18n/i18n-helpers'
|
||||
import type { AiMessage, AiProviderConfig } from '@/api/types'
|
||||
|
||||
@@ -188,7 +188,12 @@ async function clearChat() {
|
||||
await aiApi.clearChat()
|
||||
state.messages = []
|
||||
state.currentText = ''
|
||||
state.pendingApprovals = []
|
||||
// 清空的是当前会话:其 per-conv 挂起集合同步清(其他会话集合不动)
|
||||
if (state.activeConversationId) {
|
||||
setConvPendingApprovals(state.activeConversationId, [])
|
||||
} else {
|
||||
state.pendingApprovals = []
|
||||
}
|
||||
setStreaming(false, { reason: 'clearChat' })
|
||||
} catch (e) {
|
||||
// A2-B9(G3.2):清空失败需反馈,原裸 await 失败静默(异常进 unhandledrejection,用户无感)。
|
||||
|
||||
Reference in New Issue
Block a user