fix(prompt): merge disabled-tool notice into leading system prompts
This commit is contained in:
parent
209dbf5532
commit
b4f2c8f143
@ -140,7 +140,7 @@ class MainTerminal(MainTerminalCommandMixin, MainTerminalContextMixin, MainTermi
|
||||
)
|
||||
self.easter_egg_manager = EasterEggManager()
|
||||
self._announced_sub_agent_tasks = set()
|
||||
self.silent_tool_disable = False # 是否静默工具禁用提示
|
||||
self.silent_tool_disable = True # 是否静默工具禁用提示(默认开启)
|
||||
self.current_session_id = 0 # 用于标识不同的任务会话
|
||||
# 工具类别(可被管理员动态覆盖)
|
||||
self.tool_categories_map = dict(TOOL_CATEGORIES)
|
||||
|
||||
@ -292,6 +292,14 @@ class MainTerminalContextMixin:
|
||||
if isinstance(custom_system_prompt, str) and custom_system_prompt.strip():
|
||||
messages.append({"role": "system", "content": custom_system_prompt.strip()})
|
||||
|
||||
# 禁用工具提示也作为“开头 system prompt”注入,便于后续统一合并。
|
||||
disabled_notice = self._format_disabled_tool_notice()
|
||||
if disabled_notice:
|
||||
messages.append({
|
||||
"role": "system",
|
||||
"content": disabled_notice
|
||||
})
|
||||
|
||||
# 添加对话历史(保留完整结构,包括tool_calls和tool消息)
|
||||
conversation = context["conversation"]
|
||||
replaced_tool_count = 0
|
||||
@ -377,13 +385,6 @@ class MainTerminalContextMixin:
|
||||
})
|
||||
|
||||
# 当前用户输入已经在conversation中了,不需要重复添加
|
||||
|
||||
disabled_notice = self._format_disabled_tool_notice()
|
||||
if disabled_notice:
|
||||
messages.append({
|
||||
"role": "system",
|
||||
"content": disabled_notice
|
||||
})
|
||||
if shallow_replace_enabled:
|
||||
print(f"[ContextCompression] build_messages 替换tool占位符: {replaced_tool_count} 条")
|
||||
return messages
|
||||
|
||||
@ -75,7 +75,7 @@ DEFAULT_PERSONALIZATION_CONFIG: Dict[str, Any] = {
|
||||
"shallow_compress_trigger_tool_calls_interval": None,
|
||||
"shallow_compress_keep_user_turn_tools": None, # 保留最近N次用户输入后的工具不压缩(默认3)
|
||||
"deep_compress_trigger_tokens": None,
|
||||
"silent_tool_disable": False, # 禁用工具时不向模型插入提示
|
||||
"silent_tool_disable": True, # 禁用工具时不向模型插入提示(默认开启)
|
||||
"enhanced_tool_display": True, # 增强工具显示
|
||||
"versioning_restore_mode": "overwrite", # 版本回溯模式固定为 overwrite
|
||||
"agents_md_auto_inject": False, # AGENTS.md 自动注入开关
|
||||
|
||||
Loading…
Reference in New Issue
Block a user