fix: 更新流式输出逻辑,禁用图片模态并添加日志警告。

This commit is contained in:
Raven95676
2025-04-13 01:09:42 +08:00
parent 3860634fd2
commit 9c29df47bb
+5 -12
View File
@@ -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