From f3ea6a692e65e13bf44a44cae6bef87bf2d00a25 Mon Sep 17 00:00:00 2001 From: Windpicker-owo <3431391539@qq.com> Date: Wed, 19 Nov 2025 01:51:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E7=8A=B6=E6=80=81=E7=BC=93=E5=AD=98=E5=92=8C?= =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=96=E5=B7=A5=E5=85=B7=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=AE=A1=E7=90=86=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugin_system/core/tool_use.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/plugin_system/core/tool_use.py b/src/plugin_system/core/tool_use.py index 2614ab2bf..bde5048a6 100644 --- a/src/plugin_system/core/tool_use.py +++ b/src/plugin_system/core/tool_use.py @@ -117,6 +117,16 @@ class ToolExecutor: self.llm_model = LLMRequest(model_set=model_config.model_task_config.tool_use, request_type="tool_executor") + # 工具调用状态缓存 + self._pending_step_two_tools: dict[str, dict[str, Any]] = {} + """存储待执行的二阶段工具调用,格式为 {tool_name: step_two_definition}""" + self._log_prefix_initialized = False + + # 标准化工具历史记录管理器 + self.history_manager = get_stream_tool_history_manager(self.chat_id) + + # logger.info(f"{self.log_prefix}工具执行器初始化完成") # 挪到异步初始化阶段 + def _apply_config_defaults(self) -> None: tool_cfg = getattr(global_config, "tool", None) if not tool_cfg: @@ -130,17 +140,6 @@ class ToolExecutor: if timeout: self.execution_config.tool_timeout = max(1.0, float(timeout)) - - # 二步工具调用状态管理 - self._pending_step_two_tools: dict[str, dict[str, Any]] = {} - """待处理的第二步工具调用,格式为 {tool_name: step_two_definition}""" - self._log_prefix_initialized = False - - # 流式工具历史记录管理器 - self.history_manager = get_stream_tool_history_manager(chat_id) - - # logger.info(f"{self.log_prefix}工具执行器初始化完成") # 移到异步初始化中 - async def _initialize_log_prefix(self): """异步初始化log_prefix和chat_stream""" if not self._log_prefix_initialized: