From ada757bbb3898ed12d0a5421f41320da628b3a38 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Wed, 17 Jun 2026 10:45:40 +0800 Subject: [PATCH] fix: improve type checking for tool calls in Google Gemini provider --- astrbot/core/provider/sources/gemini_source.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/astrbot/core/provider/sources/gemini_source.py b/astrbot/core/provider/sources/gemini_source.py index 47998ff68..7b9640b78 100644 --- a/astrbot/core/provider/sources/gemini_source.py +++ b/astrbot/core/provider/sources/gemini_source.py @@ -371,9 +371,10 @@ class ProviderGoogleGenAI(Provider): and thinking_signature and "tool_calls" in message and any( - tool.get("extra_content", {}) - .get("google", {}) - .get("thought_signature") + isinstance(tool, dict) + and isinstance(tool.get("extra_content"), dict) + and isinstance(tool["extra_content"].get("google"), dict) + and tool["extra_content"]["google"].get("thought_signature") for tool in message["tool_calls"] ) ):