From a8ecdc8206278f3d47197d6e4d4f90fd40d6aa61 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 27 Mar 2026 22:01:08 +0800 Subject: [PATCH] refactor: Invert AI agent verbose mode condition and strengthen silence instructions for tool calls. --- app/agent/prompt/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/agent/prompt/__init__.py b/app/agent/prompt/__init__.py index 35255114..acaa7b57 100644 --- a/app/agent/prompt/__init__.py +++ b/app/agent/prompt/__init__.py @@ -74,10 +74,14 @@ class PromptManager: # 啰嗦模式 verbose_spec = "" - if settings.AI_AGENT_VERBOSE: - verbose_spec = "\n\n[Important Instruction] If you need to call a tool, DO NOT output any conversational " - "text or explanations before calling the tool. Call the tool directly without transitional " - "phrases like 'Let me check', 'I will look this up', etc." + if not settings.AI_AGENT_VERBOSE: + verbose_spec = ( + "\n\n[Important Instruction] STRICTLY ENFORCED: DO NOT output any conversational " + "text, thinking processes, or explanations before or during tool calls. Call tools " + "directly without any transitional phrases. " + "You MUST remain completely silent until the task is completely finished. " + "DO NOT output any content whatsoever until your final summary reply." + ) # 始终替换占位符,避免后续 .format() 时因残留花括号报 KeyError base_prompt = base_prompt.format(