[Partner Nodes] fix(GPT Image): make custom_width/custom_height optional

OpenAIGPTImageNodeV2 declared the gpt-image-2 custom size widgets as
required nested inputs, so a prompt that picked a preset size and omitted
them failed validation with required_input_missing. execute() already
reads both with a 1024 default, and the deprecated OpenAIGPTImage1 node
in the same file already marks them optional.
This commit is contained in:
Matt Miller
2026-07-27 23:59:47 -07:00
parent 6e36e12970
commit b4e6b3a91c
2 changed files with 29 additions and 0 deletions

View File

@@ -747,6 +747,7 @@ class OpenAIGPTImageNodeV2(IO.ComfyNode):
max=3840,
step=16,
tooltip="Used only when `size` is 'Custom'. Must be a multiple of 16.",
optional=True,
),
IO.Int.Input(
"custom_height",
@@ -755,6 +756,7 @@ class OpenAIGPTImageNodeV2(IO.ComfyNode):
max=3840,
step=16,
tooltip="Used only when `size` is 'Custom'. Must be a multiple of 16.",
optional=True,
),
IO.Combo.Input(
"background",

View File

@@ -0,0 +1,27 @@
from comfy_api.latest._io import get_finalized_class_inputs
from comfy_api_nodes.nodes_openai import OpenAIGPTImageNodeV2
def _finalized_inputs(live_inputs):
class_inputs, _, _ = get_finalized_class_inputs(
OpenAIGPTImageNodeV2.INPUT_TYPES(), live_inputs
)
return class_inputs
def test_gpt_image_2_custom_size_inputs_are_optional():
"""A preset `size` must not require the custom width/height widgets to be present."""
class_inputs = _finalized_inputs({"model": "gpt-image-2", "model.size": "1536x1024"})
assert "model.custom_width" not in class_inputs["required"]
assert "model.custom_height" not in class_inputs["required"]
assert "model.custom_width" in class_inputs["optional"]
assert "model.custom_height" in class_inputs["optional"]
assert "model.size" in class_inputs["required"]
def test_gpt_image_legacy_models_have_no_custom_size_inputs():
for model in ("gpt-image-1", "gpt-image-1.5"):
class_inputs = _finalized_inputs({"model": model, "model.size": "1536x1024"})
assert "model.custom_width" not in class_inputs["required"]
assert "model.custom_width" not in class_inputs["optional"]