diff --git a/src/renderer/components/tool-confirm-modal.ts b/src/renderer/components/tool-confirm-modal.ts index c408420..63384ba 100644 --- a/src/renderer/components/tool-confirm-modal.ts +++ b/src/renderer/components/tool-confirm-modal.ts @@ -84,15 +84,17 @@ export function showToolConfirm(call: ToolCall): Promise { const onConfirm = (e: Event) => { e.stopPropagation(); + const r = resolveConfirm; cleanup(); logInfo(`已确认: ${call.function.name}`); - resolveConfirm?.(true); + r?.(true); }; const onCancel = (e: Event) => { e.stopPropagation(); + const r = resolveConfirm; cleanup(); logInfo(`已取消: ${call.function.name}`); - resolveConfirm?.(false); + r?.(false); }; const cleanup = () => { confirmBtn.removeEventListener('click', onConfirm);