mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-08 04:22:36 +08:00
Allow image-only Gemini responses
This commit is contained in:
parent
674454d539
commit
5cedd0cb5a
@ -198,12 +198,18 @@ def get_parts_by_type(response: GeminiGenerateContentResponse, part_type: Litera
|
|||||||
if not parts:
|
if not parts:
|
||||||
if blocked_reasons:
|
if blocked_reasons:
|
||||||
raise ValueError(f"Gemini API blocked the request. Reasons: {blocked_reasons}")
|
raise ValueError(f"Gemini API blocked the request. Reasons: {blocked_reasons}")
|
||||||
|
if part_type == "text":
|
||||||
|
return []
|
||||||
details = _summarize_gemini_response_issues(response)
|
details = _summarize_gemini_response_issues(response)
|
||||||
if details:
|
if details:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Gemini API returned no {part_type} parts. Details: {details}. "
|
f"Gemini API returned no {part_type} parts. Details: {details}. "
|
||||||
"If you are using the `IMAGE` modality, try `IMAGE+TEXT` to see why image generation failed."
|
"If you are using the `IMAGE` modality, try `IMAGE+TEXT` to see why image generation failed."
|
||||||
)
|
)
|
||||||
|
raise ValueError(
|
||||||
|
f"Gemini API returned no {part_type} parts. "
|
||||||
|
"If you are using the `IMAGE` modality, try `IMAGE+TEXT` to see why image generation failed."
|
||||||
|
)
|
||||||
|
|
||||||
return parts
|
return parts
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user