do not set api_key for genai.configure when it is empty and env var present

Signed-off-by: bigcat88 <bigcat88@icloud.com>
This commit is contained in:
Alexander Piskun
2025-05-25 13:55:11 +03:00
committed by bigcat88
parent a1d99499d4
commit fe559461db
3 changed files with 12 additions and 2 deletions
+6
View File
@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file.
## [1.0.5 - 2025-05-25]
### Fixed
- Corrected support of the `GOOGLE_API_KEY` env variable.
## [1.0.4 - 2025-04-04]
### Added
+5 -1
View File
@@ -1,4 +1,5 @@
import logging
import os
import random
import google.generativeai as genai
@@ -73,7 +74,10 @@ class GeminiNode:
for image in [image_1, image_2, image_3]:
if image is not None:
images_to_send.extend(images_to_pillow(image))
genai.configure(api_key=api_key, transport="rest")
if "GOOGLE_API_KEY" in os.environ and not api_key:
genai.configure(transport="rest")
else:
genai.configure(api_key=api_key, transport="rest")
model = genai.GenerativeModel(model, safety_settings=safety_settings, system_instruction=system_instruction)
generation_config = genai.GenerationConfig(
response_mime_type="application/json" if response_type == "json" else "text/plain"
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "comfyui-gemini"
version = "1.0.4"
version = "1.0.5"
description = "Nodes for Google Gemini API, focusing on backward compatibility and stability within ComfyUI."
license = { file = "LICENSE" }
requires-python = ">=3.10"