From 9c29df47bb60d339d3e739ef5c06a4e8216197d7 Mon Sep 17 00:00:00 2001 From: Raven95676 Date: Sun, 13 Apr 2025 01:09:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=B5=81=E5=BC=8F?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=A8=A1=E6=80=81=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AD=A6=E5=91=8A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/provider/sources/gemini_source.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/astrbot/core/provider/sources/gemini_source.py b/astrbot/core/provider/sources/gemini_source.py index cc026bb0b..580363069 100644 --- a/astrbot/core/provider/sources/gemini_source.py +++ b/astrbot/core/provider/sources/gemini_source.py @@ -119,8 +119,11 @@ class ProviderGoogleGenAI(Provider): """准备查询配置""" if not modalities: modalities = ["Text"] - if self.provider_config.get("gm_resp_image_modal", False): - modalities.append("Image") + + # 流式输出不支持图片模态 + if self.provider_settings.get("streaming_response", False): + logger.warning("流式输出不支持图片模态,已自动降级为文本模态") + modalities = ["Text"] tool_list = None if tools: @@ -372,16 +375,6 @@ class ProviderGoogleGenAI(Provider): yield llm_response break - if chunk.candidates[0].content.parts and any( - part.inline_data for part in chunk.candidates[0].content.parts - ): - llm_response = LLMResponse("assistant", is_chunk=False) - llm_response.result_chain = self._process_content_parts( - chunk, llm_response - ) - yield llm_response - break - if chunk.text: llm_response.result_chain = MessageChain(chain=[Comp.Plain(chunk.text)]) yield llm_response