优化: aichat 工具体验补强(切生成会话占位气泡治丢首响应/read_symbol符号级提示/失败引导/审批失败toast) + 修复 WorkflowDagDisplay 崩页与 aiChat i18n 缺key
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
//! - _pendingApprovalIds:审批按钮防抖守卫(同 useAiSend 原实现)
|
||||
|
||||
import { ref } from 'vue'
|
||||
import { emit } from '@tauri-apps/api/event'
|
||||
import { aiApi } from '@/api'
|
||||
import { state } from '@/stores/ai'
|
||||
import { t } from '@/i18n/i18n-helpers'
|
||||
@@ -99,9 +100,14 @@ async function approveToolCall(toolCallId: string, approved: boolean, decision?:
|
||||
// 仅 IPC 真失败(审批已处理/网络断)走到这里:后端工具失败已改走 emit completed,不进此分支
|
||||
// 不回滚 pending_approval(会卡死按钮),改设 completed + 错误提示,让用户知晓失败
|
||||
console.error('[AI] 审批操作未送达后端:', e)
|
||||
// P1-e-d:审批失败给用户可见反馈——composable 无组件上下文,经 Tauri 事件总线
|
||||
// emit('ai-toast'),由 AiChat.vue listen 弹本地 toast(对齐 ai-tool-slow-toast 先例)。
|
||||
// 文案复用 ai.approvalNotDelivered(与下方 tc.result 同源)。
|
||||
const errMsg = e instanceof Error ? e.message : String(e)
|
||||
void emit('ai-toast', { msg: t('ai.approvalNotDelivered', { error: errMsg }), type: 'error' })
|
||||
if (tc) {
|
||||
tc.status = 'completed'
|
||||
tc.result = t('ai.approvalNotDelivered', { error: e instanceof Error ? e.message : String(e) })
|
||||
tc.result = t('ai.approvalNotDelivered', { error: errMsg })
|
||||
}
|
||||
throw e
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user