diff --git a/core/main_terminal.py b/core/main_terminal.py index d405334..ad69330 100644 --- a/core/main_terminal.py +++ b/core/main_terminal.py @@ -145,6 +145,7 @@ class MainTerminal: ) self.easter_egg_manager = EasterEggManager() self._announced_sub_agent_tasks = set() + self.silent_tool_disable = False # 是否静默工具禁用提示 self.current_session_id = 0 # 用于标识不同的任务会话 # 工具类别(可被管理员动态覆盖) self.tool_categories_map = dict(TOOL_CATEGORIES) @@ -428,6 +429,9 @@ class MainTerminal: except ValueError: logger.warning("忽略无效默认运行模式: %s", preferred_mode) + # 静默禁用工具提示 + self.silent_tool_disable = bool(effective_config.get("silent_tool_disable")) + def _handle_read_tool(self, arguments: Dict) -> Dict: """集中处理 read_file 工具的三种模式。""" @@ -664,6 +668,8 @@ class MainTerminal: def _format_disabled_tool_notice(self) -> Optional[str]: """生成禁用工具提示信息 / Format disabled tool notice.""" + if getattr(self, "silent_tool_disable", False): + return None if not self.disabled_notice_tools: return None @@ -2508,6 +2514,10 @@ class MainTerminal: {"role": "system", "content": system_prompt} ] + workspace_system = self.context_manager._build_workspace_system_message(context) + if workspace_system: + messages.append({"role": "system", "content": workspace_system}) + if self.tool_category_states.get("todo", True): todo_prompt = self.load_prompt("todo_guidelines").strip() if todo_prompt: diff --git a/modules/personalization_manager.py b/modules/personalization_manager.py index d61c720..99fd6b8 100644 --- a/modules/personalization_manager.py +++ b/modules/personalization_manager.py @@ -38,6 +38,7 @@ DEFAULT_PERSONALIZATION_CONFIG: Dict[str, Any] = { "tool_intent_enabled": True, "default_model": "kimi-k2.5", "image_compression": "original", # original / 1080p / 720p / 540p + "silent_tool_disable": False, # 禁用工具时不向模型插入提示 } __all__ = [ @@ -164,6 +165,12 @@ def sanitize_personalization_payload( elif base.get("image_compression") not in allowed_image_modes: base["image_compression"] = "original" + # 静默禁用工具提示 + if "silent_tool_disable" in data: + base["silent_tool_disable"] = bool(data.get("silent_tool_disable")) + else: + base["silent_tool_disable"] = bool(base.get("silent_tool_disable")) + return base diff --git a/prompts/main_system.txt b/prompts/main_system.txt index 6624cef..602bb38 100644 --- a/prompts/main_system.txt +++ b/prompts/main_system.txt @@ -136,22 +136,7 @@ --- -## 7. 工作区信息 - -- **运行环境**:隔离容器中(挂载目录 {container_path}),宿主机路径已隐藏 -- **资源限制**:CPU {container_cpus} 核,内存 {container_memory},磁盘配额 {project_storage} -- **当前时间**:{current_time} -- **项目结构**: - -``` -{file_tree} -``` - -- **长期记忆**:{memory} - ---- - -## 8. 核心原则 +## 7. 核心原则 1. **安全第一**:只操作授权范围内的文件 2. **沟通为主**:不确定时多问,不要自作主张 @@ -159,8 +144,6 @@ 4. **用户友好**:用简单的语言解释复杂的操作 5. **正确执行**:主动确认细节,获得明确许可后再开始 ---- - -## 9. 个性化配置 +## 8. 个性化配置 当用户的个性化信息与上文冲突时,以用户的个性化信息为准。 diff --git a/prompts/main_system_qwenvl.txt b/prompts/main_system_qwenvl.txt index 74218fc..7d31573 100644 --- a/prompts/main_system_qwenvl.txt +++ b/prompts/main_system_qwenvl.txt @@ -154,22 +154,7 @@ --- -## 7. 工作区信息 - -- **运行环境**:隔离容器中(挂载目录 {container_path}),宿主机路径已隐藏 -- **资源限制**:CPU {container_cpus} 核,内存 {container_memory},磁盘配额 {project_storage} -- **当前时间**:{current_time} -- **项目结构**: - -``` -{file_tree} -``` - -- **长期记忆**:{memory} - ---- - -## 8. 核心原则 +## 7. 核心原则 1. **安全第一**:只操作授权范围内的文件 2. **沟通为主**:不确定时多问,不要自作主张 @@ -177,8 +162,6 @@ 4. **用户友好**:用简单的语言解释复杂的操作 5. **正确执行**:主动确认细节,获得明确许可后再开始 ---- - -## 9. 个性化配置 +## 8. 个性化配置 当用户的个性化信息与上文冲突时,以用户的个性化信息为准。 diff --git a/prompts/workspace_system.txt b/prompts/workspace_system.txt new file mode 100644 index 0000000..6c9a8da --- /dev/null +++ b/prompts/workspace_system.txt @@ -0,0 +1,12 @@ +## 工作区信息 + +- **运行环境**:{runtime_environment} +- **资源限制**:{resource_limit} +- **当前时间**:{current_time} +- **项目结构**: + +``` +{file_tree} +``` + +- **长期记忆**:{memory} diff --git a/static/src/components/personalization/PersonalizationDrawer.vue b/static/src/components/personalization/PersonalizationDrawer.vue index f809118..7c6e104 100644 --- a/static/src/components/personalization/PersonalizationDrawer.vue +++ b/static/src/components/personalization/PersonalizationDrawer.vue @@ -63,6 +63,7 @@ +
仅作用于当前工作区,可随时在左下角开关。
使用新版堆叠动画展示思考/工具块,超过 6 条自动收纳为“更多”。默认开启。
默认开启;关闭后标题将沿用首条消息。
开启后,调用工具时会先用约15字告诉你要做什么,替代“正在/完成”文案。
选择后,这些类别在新任务中会保持关闭,也可随时通过快捷菜单临时开启。
禁用工具时不再注入提示消息,模型不会感知被禁用项。