Add Nano Banana 2.1 and preserve image workflow values
This commit is contained in:
@@ -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(模型, 宽高比, 分辨率)
|
||||
|
||||
@@ -424,7 +424,7 @@ class NanoBanana(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} 不支持此宽高比"
|
||||
@@ -458,7 +458,7 @@ class NanoBanana(io.ComfyNode):
|
||||
default="",
|
||||
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,
|
||||
@@ -468,7 +468,7 @@ class NanoBanana(io.ComfyNode):
|
||||
"思考等级",
|
||||
options=["低", "高"],
|
||||
default="高",
|
||||
tooltip="仅 Nano Banana 2 生效:低=minimal,高=high。",
|
||||
tooltip="仅 Nano Banana 2 / 2.1 生效:低=minimal,高=high。",
|
||||
),
|
||||
io.Combo.Input("分辨率", options=["1K", "2K", "4K"], default="2K"),
|
||||
io.Combo.Input("宽高比", options=[
|
||||
@@ -527,7 +527,7 @@ class NanoBanana(io.ComfyNode):
|
||||
模型线路 = kwargs.pop("计费", 模型线路)
|
||||
unlimited_downloads = kwargs.pop("_o1key_unlimited_downloads", False) is True
|
||||
requested_google_search = kwargs.pop("_o1key_google_search", False) is True
|
||||
google_search = model_name == "Nano Banana 2" and requested_google_search
|
||||
google_search = model_name in {"Nano Banana 2.1", "Nano Banana 2"} and requested_google_search
|
||||
resize_mode = str(缩放图片)
|
||||
if resize_mode not in {"不缩放", "智能缩放"}:
|
||||
raise ValueError("缩放图片参数无效")
|
||||
@@ -538,7 +538,7 @@ class NanoBanana(io.ComfyNode):
|
||||
raise ValueError("思考等级无效,仅支持:低、高")
|
||||
thinking_level = (
|
||||
THINKING_LEVEL_MAP[思考等级]
|
||||
if model_name == "Nano Banana 2"
|
||||
if model_name in {"Nano Banana 2.1", "Nano Banana 2"}
|
||||
else None
|
||||
)
|
||||
|
||||
|
||||
@@ -530,7 +530,7 @@ class O1keyImageGenerator(io.ComfyNode):
|
||||
io.Combo.Input(
|
||||
"模型",
|
||||
options=UNIFIED_IMAGE_MODEL_OPTIONS,
|
||||
default="Nano Banana 2",
|
||||
default="Nano Banana 2.1",
|
||||
socketless=True,
|
||||
),
|
||||
io.Combo.Input(
|
||||
@@ -663,7 +663,7 @@ class O1keyImageGenerator(io.ComfyNode):
|
||||
"在线搜索",
|
||||
options=["关闭", "打开"],
|
||||
default="关闭",
|
||||
tooltip="仅 Nano Banana 2 生效;打开时发送 google_search=true。",
|
||||
tooltip="仅 Nano Banana 2 / 2.1 生效;打开时发送 google_search=true。",
|
||||
socketless=True,
|
||||
),
|
||||
io.Boolean.Input(
|
||||
@@ -688,7 +688,7 @@ class O1keyImageGenerator(io.ComfyNode):
|
||||
async def execute(
|
||||
cls,
|
||||
prompt: str,
|
||||
模型: str = "Nano Banana 2",
|
||||
模型: str = "Nano Banana 2.1",
|
||||
模型线路: str = "畅速",
|
||||
思考等级: str = "低",
|
||||
分辨率: str = UNIFIED_IMAGE_SMART_RESOLUTION,
|
||||
@@ -731,7 +731,7 @@ class O1keyImageGenerator(io.ComfyNode):
|
||||
raise ValueError("缩放图片参数无效")
|
||||
if 在线搜索 not in {"关闭", "打开"}:
|
||||
raise ValueError("在线搜索参数无效")
|
||||
google_search = 模型 == "Nano Banana 2" and 在线搜索 == "打开"
|
||||
google_search = 模型 in {"Nano Banana 2.1", "Nano Banana 2"} and 在线搜索 == "打开"
|
||||
|
||||
image_count = int(生图数量)
|
||||
if is_gpt_image_model(模型):
|
||||
|
||||
Reference in New Issue
Block a user