From db46000337c2fbfa835adb77e6908fcaa7a89fd2 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 23 Mar 2025 22:22:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20style:=20format=20codes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/pipeline/process_stage/method/llm_request.py | 4 +--- astrbot/core/provider/sources/anthropic_source.py | 2 +- astrbot/core/provider/sources/gemini_source.py | 8 ++++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/astrbot/core/pipeline/process_stage/method/llm_request.py b/astrbot/core/pipeline/process_stage/method/llm_request.py index acde70c27..d13a101ef 100644 --- a/astrbot/core/pipeline/process_stage/method/llm_request.py +++ b/astrbot/core/pipeline/process_stage/method/llm_request.py @@ -292,9 +292,7 @@ class LLMRequestSubStage(Stage): # tool calls result if req.tool_calls_result: - contexts.extend( - req.tool_calls_result.to_openai_messages() - ) + contexts.extend(req.tool_calls_result.to_openai_messages()) contexts.append( {"role": "assistant", "content": llm_response.completion_text} diff --git a/astrbot/core/provider/sources/anthropic_source.py b/astrbot/core/provider/sources/anthropic_source.py index 90efdee91..fd19c40ca 100644 --- a/astrbot/core/provider/sources/anthropic_source.py +++ b/astrbot/core/provider/sources/anthropic_source.py @@ -104,7 +104,7 @@ class ProviderAnthropic(ProviderOpenAIOfficial): func_tool: FuncCall = None, contexts=[], system_prompt=None, - tool_calls_result: ToolCallsResult=None, + tool_calls_result: ToolCallsResult = None, **kwargs, ) -> LLMResponse: if not prompt: diff --git a/astrbot/core/provider/sources/gemini_source.py b/astrbot/core/provider/sources/gemini_source.py index 1caccf2b1..ec0337389 100644 --- a/astrbot/core/provider/sources/gemini_source.py +++ b/astrbot/core/provider/sources/gemini_source.py @@ -162,7 +162,9 @@ class ProviderGoogleGenAI(Provider): { "functionCall": { "name": tool_call["function"]["name"], - "args": json.loads(tool_call["function"]["arguments"]), + "args": json.loads( + tool_call["function"]["arguments"] + ), } } ) @@ -204,7 +206,9 @@ class ProviderGoogleGenAI(Provider): llm_response.role = "tool" llm_response.tools_call_args.append(candidate["functionCall"]["args"]) llm_response.tools_call_name.append(candidate["functionCall"]["name"]) - llm_response.tools_call_ids.append(candidate["functionCall"]["name"]) # 没有 tool id + llm_response.tools_call_ids.append( + candidate["functionCall"]["name"] + ) # 没有 tool id llm_response.completion_text = llm_response.completion_text.strip() return llm_response