Add Nano Banana 2.1 and preserve image workflow values

This commit is contained in:
Jony
2026-10-07 13:33:40 +08:00
parent 10a8700589
commit 5212a59047
18 changed files with 480 additions and 295 deletions
+4 -4
View File
@@ -422,7 +422,7 @@ class BatchNanoBananaPro(io.ComfyNode):
# Nano Banana 2 系列特有的宽高比
nano_2_exclusive_ratios = {"1:4", "1:8", "4:1", "8:1"}
# 其他模型使用了 Nano Banana 2 系列专属宽高比
if model_name not in {"Nano Banana 2", "Nano Banana 2 Lite"} and aspect_ratio in nano_2_exclusive_ratios:
if model_name not in {"Nano Banana 2.1", "Nano Banana 2", "Nano Banana 2 Lite"} and aspect_ratio in nano_2_exclusive_ratios:
raise ValueError(
f"宽高比 {aspect_ratio} 仅支持 Nano Banana 2 系列模型,"
f"当前模型 {model_name} 不支持此宽高比"
@@ -463,7 +463,7 @@ class BatchNanoBananaPro(io.ComfyNode):
default="一个中国女子的OOTD",
multiline=True,
),
io.Combo.Input("模型", options=NANO_BANANA_MODEL_OPTIONS, default="Nano Banana 2"),
io.Combo.Input("模型", options=NANO_BANANA_MODEL_OPTIONS, default="Nano Banana 2.1"),
io.Combo.Input(
"模型线路",
options=NANO_BANANA_ROUTE_OPTIONS,
@@ -1132,10 +1132,10 @@ class BatchNanoBananaPro(io.ComfyNode):
was_interrupted = False
skip_balance_query = False
# 只有 Nano Banana 2 支持思考等级;其他模型不向接口传该字段。
# Nano Banana 2 / 2.1 支持思考等级;其他模型不向接口传该字段。
if 思考等级 not in THINKING_LEVEL_MAP:
raise ValueError(f"不支持的思考等级: {思考等级}")
thinking_level = THINKING_LEVEL_MAP[思考等级] if 模型 == "Nano Banana 2" else None
thinking_level = THINKING_LEVEL_MAP[思考等级] if 模型 in {"Nano Banana 2.1", "Nano Banana 2"} else None
# 验证模型配置是否合法(使用与 NanoBanana 相同的验证逻辑)
self._validate_model_config(模型, 宽高比, 分辨率)