From 811ae717bb8a06fab3ccd9477c487d85e295afbb Mon Sep 17 00:00:00 2001 From: thzxx Date: Wed, 24 Jun 2026 21:49:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E8=BF=87=E6=97=A9?= =?UTF-8?q?=E7=9A=84"=E5=85=A8=E9=83=A8=E5=AE=8C=E6=88=90"=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E4=BF=A1=E5=8F=B7=20=E2=80=94=20=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E8=AF=8D=E5=8C=B9=E9=85=8D=E6=97=A0=E6=B3=95=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9C=9F=E5=AE=9E=E5=AE=8C=E6=88=90=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/services/agent-engine.ts | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/renderer/services/agent-engine.ts b/src/renderer/services/agent-engine.ts index ec81264..c53b012 100644 --- a/src/renderer/services/agent-engine.ts +++ b/src/renderer/services/agent-engine.ts @@ -1030,8 +1030,6 @@ async function handleThinking( const firstUserMsg = ctx.messages.find(m => m.role === 'user'); const userText = firstUserMsg?.content || ''; const pending = detectPendingActions(userText, ctx.allToolRecords); - // 同时获取用户提及的全部动作(用于判断是否全部完成) - const allMentioned = detectAllMentionedActions(userText); if (pending.length > 0) { ctx.messages.push({ role: 'user', @@ -1039,19 +1037,10 @@ async function handleThinking( ephemeral: true, }); logInfo('待办追踪: 注入未完成任务提醒', pending.join(', ')); - } else if (allMentioned.length > 0) { - // 全部待办已完成 → 注入 system 级别确认信号(去重:不重复注入) - const alreadySignaled = ctx.messages.slice(-3).some( - m => m.role === 'system' && m.content?.includes('待办检测:用户请求中的全部操作已实际执行完成') - ); - if (!alreadySignaled) { - ctx.messages.push({ - role: 'system', - content: `✅ 待办检测:用户请求中的全部操作已实际执行完成(${allMentioned.join('、')})。不要再调用工具,直接输出最终回答。`, - }); - logInfo('待办追踪: 全部完成,注入完成确认', allMentioned.join(', ')); - } } + // 注:不再注入"全部完成"确认信号。工具调用数量≠任务完成度, + // 例如"删除3个文件"调用1次 delete_file 不能算完成。 + // AI 应根据工具返回的实际结果自行判断任务是否完成。 } // Token 预算警告