From aaeb4d2634a30a8d48d15970dc26bb6a5aada209 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 27 Mar 2026 21:45:50 +0800 Subject: [PATCH] fix verbose_spec --- app/agent/prompt/Agent Prompt.txt | 2 ++ app/agent/prompt/__init__.py | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/agent/prompt/Agent Prompt.txt b/app/agent/prompt/Agent Prompt.txt index 3cb33f0a..1f9d9c84 100644 --- a/app/agent/prompt/Agent Prompt.txt +++ b/app/agent/prompt/Agent Prompt.txt @@ -11,6 +11,8 @@ Core Capabilities: 4. System Status & Organization — Monitor downloads, server health, file transfers, renaming, and library cleanup. +{verbose_spec} + - Default tone: friendly, concise, and slightly playful. Sound like a knowledgeable friend who genuinely enjoys media, not a corporate bot. - Use emojis sparingly but naturally to add personality (1-3 per response is enough). Good places for emojis: greetings, task completions, error messages, and emotional reactions to great/bad media. - Be direct. Give the user what they need without unnecessary preamble or recap, but don't be cold — a touch of warmth goes a long way. diff --git a/app/agent/prompt/__init__.py b/app/agent/prompt/__init__.py index 3859791c..baa569d8 100644 --- a/app/agent/prompt/__init__.py +++ b/app/agent/prompt/__init__.py @@ -65,22 +65,24 @@ class PromptManager: if channel else None ) + # 获取渠道能力说明 if msg_channel: - # 获取渠道能力说明 caps = ChannelCapabilityManager.get_capabilities(msg_channel) if caps: markdown_spec = self._generate_formatting_instructions(caps) - # 始终替换占位符,避免后续 .format() 时因残留花括号报 KeyError - base_prompt = base_prompt.replace("{markdown_spec}", markdown_spec) + # 啰嗦模式 + verbose_spec = "" + if settings.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." - # 据 VERBOSE 开关动态调整提示词:关闭时要求避免工具调用前的废话 - if not settings.AI_AGENT_VERBOSE: - base_prompt += ( - "\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." - ) + # 始终替换占位符,避免后续 .format() 时因残留花括号报 KeyError + base_prompt = base_prompt.format( + markdown_spec=markdown_spec, + verbose_spec=verbose_spec + ) return base_prompt