Merge branch 'master' into alexis/add_output_save_nodes
Some checks are pending
Python Linting / Run Ruff (push) Waiting to run
Python Linting / Run Pylint (push) Waiting to run

This commit is contained in:
Alexis Rolland 2026-06-22 09:27:51 +08:00 committed by GitHub
commit 9833b2935b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 34 deletions

View File

@ -5,7 +5,6 @@ See: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/infer
import base64 import base64
import os import os
from enum import Enum
from fnmatch import fnmatch from fnmatch import fnmatch
from io import BytesIO from io import BytesIO
from typing import Any, Literal from typing import Any, Literal
@ -78,15 +77,6 @@ GEMINI_IMAGE_2_PRICE_BADGE = IO.PriceBadge(
) )
class GeminiImageModel(str, Enum):
"""
Gemini Image Model Names allowed by comfy-api
"""
gemini_2_5_flash_image_preview = "gemini-2.5-flash-image-preview"
gemini_2_5_flash_image = "gemini-2.5-flash-image"
async def create_image_parts( async def create_image_parts(
cls: type[IO.ComfyNode], cls: type[IO.ComfyNode],
images: Input.Image | list[Input.Image], images: Input.Image | list[Input.Image],
@ -243,21 +233,15 @@ def calculate_tokens_price(response: GeminiGenerateContentResponse) -> float | N
if not response.modelVersion: if not response.modelVersion:
return None return None
# Define prices (Cost per 1,000,000 tokens), see https://cloud.google.com/vertex-ai/generative-ai/pricing # Define prices (Cost per 1,000,000 tokens), see https://cloud.google.com/vertex-ai/generative-ai/pricing
if response.modelVersion in ("gemini-2.5-pro-preview-05-06", "gemini-2.5-pro"): if response.modelVersion == "gemini-2.5-pro":
input_tokens_price = 1.25 input_tokens_price = 1.25
output_text_tokens_price = 10.0 output_text_tokens_price = 10.0
output_image_tokens_price = 0.0 output_image_tokens_price = 0.0
elif response.modelVersion in ( elif response.modelVersion == "gemini-2.5-flash":
"gemini-2.5-flash-preview-04-17",
"gemini-2.5-flash",
):
input_tokens_price = 0.30 input_tokens_price = 0.30
output_text_tokens_price = 2.50 output_text_tokens_price = 2.50
output_image_tokens_price = 0.0 output_image_tokens_price = 0.0
elif response.modelVersion in ( elif response.modelVersion == "gemini-2.5-flash-image":
"gemini-2.5-flash-image-preview",
"gemini-2.5-flash-image",
):
input_tokens_price = 0.30 input_tokens_price = 0.30
output_text_tokens_price = 2.50 output_text_tokens_price = 2.50
output_image_tokens_price = 30.0 output_image_tokens_price = 30.0
@ -455,8 +439,6 @@ class GeminiNode(IO.ComfyNode):
IO.Combo.Input( IO.Combo.Input(
"model", "model",
options=[ options=[
"gemini-2.5-pro-preview-05-06",
"gemini-2.5-flash-preview-04-17",
"gemini-2.5-pro", "gemini-2.5-pro",
"gemini-2.5-flash", "gemini-2.5-flash",
"gemini-3-pro-preview", "gemini-3-pro-preview",
@ -904,8 +886,7 @@ class GeminiImage(IO.ComfyNode):
), ),
IO.Combo.Input( IO.Combo.Input(
"model", "model",
options=GeminiImageModel, options=["gemini-2.5-flash-image"],
default=GeminiImageModel.gemini_2_5_flash_image,
tooltip="The Gemini model to use for generating responses.", tooltip="The Gemini model to use for generating responses.",
), ),
IO.Int.Input( IO.Int.Input(

View File

@ -8,21 +8,37 @@
# # You can use is_default to mark that these folders should be listed first, and used as the default dirs for eg downloads # # You can use is_default to mark that these folders should be listed first, and used as the default dirs for eg downloads
# #is_default: true # #is_default: true
# checkpoints: models/checkpoints/ # checkpoints: models/checkpoints/
# configs: models/configs/
# loras: models/loras/
# vae: models/vae/
# text_encoders: | # text_encoders: |
# models/text_encoders/ # models/text_encoders/
# models/clip/ # legacy location still supported # models/clip/
# clip_vision: models/clip_vision/
# configs: models/configs/
# controlnet: models/controlnet/
# diffusion_models: | # diffusion_models: |
# models/diffusion_models # models/unet/
# models/unet # models/diffusion_models/
# clip_vision: models/clip_vision/
# style_models: models/style_models/
# embeddings: models/embeddings/ # embeddings: models/embeddings/
# loras: models/loras/ # diffusers: models/diffusers/
# vae_approx: models/vae_approx/
# controlnet: |
# models/controlnet/
# models/t2i_adapter/
# gligen: models/gligen/
# upscale_models: models/upscale_models/ # upscale_models: models/upscale_models/
# vae: models/vae/ # latent_upscale_models: models/latent_upscale_models/
# audio_encoders: models/audio_encoders/ # custom_nodes: custom_nodes/
# hypernetworks: models/hypernetworks/
# photomaker: models/photomaker/
# classifiers: models/classifiers/
# model_patches: models/model_patches/ # model_patches: models/model_patches/
# audio_encoders: models/audio_encoders/
# background_removal: models/background_removal/
# frame_interpolation: models/frame_interpolation/
# geometry_estimation: models/geometry_estimation/
# optical_flow: models/optical_flow/
# detection: models/detection/
#config for a1111 ui #config for a1111 ui
@ -45,8 +61,7 @@
# controlnet: models/ControlNet # controlnet: models/ControlNet
# For a full list of supported keys (style_models, vae_approx, hypernetworks, photomaker, # For the canonical list of supported keys and extensions, see folder_paths.py.
# model_patches, audio_encoders, classifiers, etc.) see folder_paths.py.
#other_ui: #other_ui:
# base_path: path/to/ui # base_path: path/to/ui