优化: 会话状态键控与提示补全

- 队列清空/发送失败补提示,错误接入分类文案
- 审批超时气泡按会话归属,流守卫按会话清理
- 会话操作失败就近反馈,拖拽非法流转提示原因
This commit is contained in:
lxy
2026-10-03 16:27:39 +08:00
parent 8710a09be2
commit 31f7a9570b
6 changed files with 118 additions and 26 deletions
+6 -2
View File
@@ -9,7 +9,7 @@ import { emit } from '@tauri-apps/api/event'
import { useAppSettingsStore } from '@/stores/appSettings'
import { state } from '@/stores/ai'
import { t } from '@/i18n/i18n-helpers'
import { nextMsgId, convStates, clearApprovalTimer, flushCurrentText, clearAllToolSlowTimers, friendlyError, notifyConversationChanged, clearLastDelta, discardConvPendingApprovals } from './aiShared'
import { nextMsgId, convStates, clearApprovalTimer, flushCurrentText, clearAllToolSlowTimers, friendlyError, notifyConversationChanged, clearLastDelta, discardConvPendingApprovals, notifyQueueCleared } from './aiShared'
import { clearTextIdleTimer, pendingMaxRounds, pendingHelp, pendingDirAuths } from './useAiPendingState'
import { clearStreamWatchdog, clearResumeAttempts } from './useAiStream'
import { setStreaming } from './streamingGuard'
@@ -176,10 +176,14 @@ export function handleLifecycleEvent(event: AiChatEvent): boolean {
case 'AiError': {
cleanupTerminatedConversation(event.conversation_id || '', 'AiError')
// 只清除出错会话的队列项,不误伤其他会话的排队消息
// 只清除出错会话的队列项,不误伤其他会话的排队消息;
// UX-P2-A2:清队从静默改 toast 提示条数(用户排队的消息无声消失原无任何反馈)
if (event.conversation_id) {
const dropped = state.queue.filter(q => q.conversationId === event.conversation_id).length
state.queue = state.queue.filter(q => q.conversationId !== event.conversation_id)
notifyQueueCleared(dropped)
} else {
notifyQueueCleared(state.queue.length)
state.queue = []
}
state.messages.push({