From 43ee943acb05dae1294461a653b95a9e2f9cde4c Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Tue, 15 Apr 2025 10:59:16 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E5=A4=9A=E8=BD=AE?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E8=B0=83=E7=94=A8=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/provider/sources/gemini_source.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/astrbot/core/provider/sources/gemini_source.py b/astrbot/core/provider/sources/gemini_source.py index 5209ccd56..e0d4b56e9 100644 --- a/astrbot/core/provider/sources/gemini_source.py +++ b/astrbot/core/provider/sources/gemini_source.py @@ -273,7 +273,10 @@ class ProviderGoogleGenAI(Provider): llm_response.role = "tool" llm_response.tools_call_name.append(part.function_call.name) llm_response.tools_call_args.append(part.function_call.args) - llm_response.tools_call_ids.append(part.function_call.id) + # gemini 返回的 function_call.id 可能为 None + llm_response.tools_call_ids.append( + part.function_call.id or part.function_call.name + ) elif part.inline_data and part.inline_data.mime_type.startswith("image/"): chain.append(Comp.Image.fromBytes(part.inline_data.data)) return MessageChain(chain=chain)