新增: 技能注入反馈闭环与项目扫描前端接线
技能注入成功/失败 toast 与事件类型监听接线 项目级技能扫描前端传参点就绪
This commit is contained in:
@@ -195,6 +195,8 @@ let _unlistenToolSlow: (() => void) | null = null
|
||||
let _unlistenAutoApproved: (() => void) | null = null
|
||||
// P1-e-d: 审批失败 toast unlistener(useAiApproval 审批 IPC 未送达经事件总线 emit,同 _unlistenToolSlow 模式)
|
||||
let _unlistenAiToast: (() => void) | null = null
|
||||
// 技能注入反馈 toast unlistener(后端 AiSkillInjected 经 ai-chat-event 直达,见 onMounted)
|
||||
let _unlistenSkillInjected: (() => void) | null = null
|
||||
|
||||
// 第二批抽离: inputText/inputEl/图片输入/技能/实体联想/handleSend 已迁移至 ChatInput.vue
|
||||
// chatInputRef: 父调 expose(focus/startEditFocus/clearInput/hasUnsentInput/sendExamplePrompt)
|
||||
@@ -477,6 +479,7 @@ onBeforeUnmount(() => {
|
||||
if (_unlistenToolSlow) { _unlistenToolSlow(); _unlistenToolSlow = null } // B-260616-12
|
||||
if (_unlistenAutoApproved) { _unlistenAutoApproved(); _unlistenAutoApproved = null } // AE-2025-04
|
||||
if (_unlistenAiToast) { _unlistenAiToast(); _unlistenAiToast = null } // P1-e-d
|
||||
if (_unlistenSkillInjected) { _unlistenSkillInjected(); _unlistenSkillInjected = null } // 技能注入反馈 toast
|
||||
// toast timer 清理由 useToast composable 的 onUnmounted 自动管理
|
||||
})
|
||||
|
||||
@@ -520,6 +523,16 @@ onMounted(async () => {
|
||||
_unlistenAiToast = await listen<{ msg: string; type: 'info' | 'error' | 'warning' | 'success' }>('ai-toast', (e) => {
|
||||
showToast(e.payload.msg, e.payload.type)
|
||||
})
|
||||
// 技能注入反馈闭环(注入成功/失败轻 toast):后端 resolve_and_inject 双写 ai-chat-event,
|
||||
// 此处独立 listen 过滤 AiSkillInjected(不动 useAiEvents 分发器,toast 归组件本地副作用)。
|
||||
_unlistenSkillInjected = await listen<{ name: string; ok: boolean }>('ai-chat-event', (e) => {
|
||||
const p = e.payload as { type?: string; name?: string; ok?: boolean }
|
||||
if (p?.type !== 'AiSkillInjected' || !p.name) return
|
||||
showToast(
|
||||
p.ok ? t('aiChat.skillInjectedToast', { name: p.name }) : t('aiChat.skillNotFoundToast', { name: p.name }),
|
||||
p.ok ? 'success' : 'warning',
|
||||
)
|
||||
})
|
||||
// F-15 阶段2: 注册上下文管理事件监听器(清空/压缩生命周期事件 → toast/刷新)
|
||||
await initContextEventListeners()
|
||||
// 恢复生成中态(刷新后/分离窗口接管):
|
||||
|
||||
Reference in New Issue
Block a user