From 5cedd0cb5a09be5154b0646f25aa95e67766a09d Mon Sep 17 00:00:00 2001 From: nuck Date: Mon, 2 Feb 2026 21:28:47 -0500 Subject: [PATCH] Allow image-only Gemini responses --- comfy_api_nodes/nodes_gemini.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comfy_api_nodes/nodes_gemini.py b/comfy_api_nodes/nodes_gemini.py index 6a948ed62..78881c3e9 100644 --- a/comfy_api_nodes/nodes_gemini.py +++ b/comfy_api_nodes/nodes_gemini.py @@ -198,12 +198,18 @@ def get_parts_by_type(response: GeminiGenerateContentResponse, part_type: Litera if not parts: if blocked_reasons: raise ValueError(f"Gemini API blocked the request. Reasons: {blocked_reasons}") + if part_type == "text": + return [] details = _summarize_gemini_response_issues(response) if details: raise ValueError( 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." ) + 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