feat:增加gpt-image-2-all模型
This commit is contained in:
+13
-7
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user