From 5082876de3bb6d3c3a535e91925eaaf054bffe96 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Fri, 5 Sep 2025 17:20:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20v4.0.0=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=8B=E5=8F=AF=E8=83=BD=E6=97=A0=E6=B3=95=E5=BE=97?= =?UTF-8?q?=E5=88=B0=20LLM=20=E7=9A=84=E5=93=8D=E5=BA=94=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes: #2622 --- astrbot/core/config/default.py | 2 +- astrbot/core/pipeline/process_stage/method/llm_request.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index b1ee275e4..f123564a6 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -1929,7 +1929,7 @@ CONFIG_METADATA_3 = { }, "provider_settings.max_agent_step": { "description": "工具调用轮数上限", - "type": "bool", + "type": "int", }, "provider_settings.streaming_response": { "description": "流式回复", diff --git a/astrbot/core/pipeline/process_stage/method/llm_request.py b/astrbot/core/pipeline/process_stage/method/llm_request.py index c07ba0d70..6035b21e9 100644 --- a/astrbot/core/pipeline/process_stage/method/llm_request.py +++ b/astrbot/core/pipeline/process_stage/method/llm_request.py @@ -299,7 +299,9 @@ class LLMRequestSubStage(Stage): self.max_context_length - 1, ) self.streaming_response: bool = settings["streaming_response"] - self.max_step: int = settings.get("max_agent_step", 10) + self.max_step: int = settings.get("max_agent_step", 30) + if isinstance(self.max_step, bool): # workaround: #2622 + self.max_step = 30 self.show_tool_use: bool = settings.get("show_tool_use_status", True) for bwp in self.bot_wake_prefixs: @@ -434,7 +436,9 @@ class LLMRequestSubStage(Stage): provider_cfg = provider.provider_config.get("modalities", ["tool_use"]) # 如果模型不支持工具使用,但请求中包含工具列表,则清空。 if "tool_use" not in provider_cfg: - logger.debug(f"用户设置提供商 {provider} 不支持工具使用,清空工具列表。") + logger.debug( + f"用户设置提供商 {provider} 不支持工具使用,清空工具列表。" + ) req.func_tool = None # 插件可用性设置 if event.plugins_name is not None and req.func_tool: