From 4fcd955ea38de82a7dac548f606ed3a72fe5ea22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E6=98=AD=E6=B4=8B?= <1241877130@qq.com> Date: Wed, 22 Apr 2026 11:44:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0gpt-image-2-all=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vector_engine_node.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/vector_engine_node.py b/vector_engine_node.py index 0ae0cdc..03b0463 100644 --- a/vector_engine_node.py +++ b/vector_engine_node.py @@ -338,6 +338,9 @@ class VectorEngineGPT(VectorEngineBase): def INPUT_TYPES(cls): return { "required": { + "model": (["gpt-image-1.5", "gpt-image-2-all"], { + "default": "gpt-image-1.5" + }), "prompt": ("STRING", { "multiline": True, "default": "A beautiful landscape with mountains and a lake." @@ -365,17 +368,20 @@ class VectorEngineGPT(VectorEngineBase): FUNCTION = "generate_image" CATEGORY = "VectorEngine" - def generate_image(self, prompt, size, seed, + def generate_image(self, model, prompt, size, seed, image_1=None, image_2=None, image_3=None, image_4=None, image_5=None): """ Generate or edit image using GPT API via Vector Engine """ - model = "gpt-image-1.5" - # Collect input images images = [image_1, image_2, image_3, image_4, image_5] input_images = [img for img in images if img is not None] + # gpt-image-2-all only supports generation, not editing + if model == "gpt-image-2-all" and len(input_images) > 0: + print(f"[VectorEngine GPT] Warning: {model} does not support image editing, input images will be ignored") + input_images = [] + try: conn = http.client.HTTPSConnection("api.vectorengine.ai") @@ -383,10 +389,10 @@ class VectorEngineGPT(VectorEngineBase): total_encode_time = 0.0 # Determine endpoint based on whether images are provided - if image_count > 0: - # Use /v1/images/edits with multipart/form-data + if image_count > 0 and model == "gpt-image-1.5": + # Use /v1/images/edits with multipart/form-data (only for gpt-image-1.5) endpoint = "/v1/images/edits" - print(f"[VectorEngine GPT] Edit mode - Size: {size}, Images: {image_count}") + print(f"[VectorEngine GPT] Edit mode - Model: {model}, Size: {size}, Images: {image_count}") boundary = 'wL36Yn8afVp8Ag7AmP8qZ0SA4n1v9T' dataList = [] @@ -428,7 +434,7 @@ class VectorEngineGPT(VectorEngineBase): else: # Use /v1/images/generations with JSON endpoint = "/v1/images/generations" - print(f"[VectorEngine GPT] Generation mode - Size: {size}") + print(f"[VectorEngine GPT] Generation mode - Model: {model}, Size: {size}") payload = json.dumps({ "model": model,