The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
fix(api-nodes-nanobana): raise error when not output image is present (#13167)
Alexander Piskun6a2cdb817dfe
diff --git a/comfy_api_nodes/nodes_gemini.py b/comfy_api_nodes/nodes_gemini.pyindex 25d747e76..2b77a022e 100644--- a/comfy_api_nodes/nodes_gemini.py+++ b/comfy_api_nodes/nodes_gemini.py@@ -201,6 +201,16 @@ async def get_image_from_response(response: GeminiGenerateContentResponse, thougreturned_image = await download_url_to_image_tensor(part.fileData.fileUri)image_tensors.append(returned_image)if len(image_tensors) == 0:+ if not thought:+ # No images generated --> extract text response for a meaningful error+ model_message = get_text_from_response(response).strip()+ if model_message:+ raise ValueError(f"Gemini did not generate an image. Model response: {model_message}")+ raise ValueError(+ "Gemini did not generate an image. "+ "Try rephrasing your prompt or changing the response modality to 'IMAGE+TEXT' "+ "to see the model's reasoning."+ )return torch.zeros((1, 1024, 1024, 4))return torch.cat(image_tensors, dim=0)