Merge pull request #24 from Runware/feature-recraft

Feature: Add OpenAI video models and improve error handling
This commit is contained in:
Sirshendu Ganguly
2025-10-13 12:23:56 -04:00
committed by GitHub
3 changed files with 37 additions and 14 deletions
+6 -1
View File
@@ -121,6 +121,10 @@ class txt2img:
"min": 32,
"max": 128,
}),
"outputFormat": (["WEBP", "PNG", "JPEG", "SVG"], {
"tooltip": "Choose the output image format.",
"default": "WEBP",
}),
"batchSize": ("INT", {
"tooltip": "The number of images to generate in a single request.",
"default": 1,
@@ -218,6 +222,7 @@ class txt2img:
useSeed = kwargs.get("useSeed", True)
useClipSkip = kwargs.get("useClipSkip", True)
dimensions = kwargs.get("dimensions", "Square (512x512)")
outputFormat = kwargs.get("outputFormat", "WEBP")
batchSize = kwargs.get("batchSize", 1)
if (maskImage is not None and seedImage is None):
@@ -230,7 +235,7 @@ class txt2img:
"positivePrompt": positivePrompt,
"model": runwareModel,
"outputType": "base64Data",
"outputFormat": rwUtils.OUTPUT_FORMAT,
"outputFormat": outputFormat,
"outputQuality": rwUtils.OUTPUT_QUALITY,
"numberResults": batchSize,
}
+21 -7
View File
@@ -144,10 +144,14 @@ class txt2vid:
"default": "mp4",
"tooltip": "Choose the output video format.",
}),
"useSeed": ("BOOLEAN", {
"tooltip": "Enable to include seed parameter in API request. Disable if your model doesn't support seed.",
"default": True,
}),
"seed": ("INT", {
"tooltip": "A value used to randomize the video generation. If you want to make videos reproducible (generate the same video multiple times), you can use the same seed value. Leave empty or 0 to auto-generate. Note: Only supported by Wan models.",
"default": 0,
"min": 0,
"tooltip": "A value used to randomize the video generation. If you want to make videos reproducible (generate the same video multiple times), you can use the same seed value. Leave empty or 0 to auto-generate.",
"default": 1,
"min": 1,
"max": 9223372036854776000,
}),
"batchSize": ("INT", {
@@ -208,6 +212,7 @@ class txt2vid:
outputFormat = kwargs.get("outputFormat", "mp4")
batchSize = kwargs.get("batchSize", 1)
seed = kwargs.get("seed", 1)
useSeed = kwargs.get("useSeed", True)
# Handle model input - could be dict or string
if isinstance(runwareVideoModel, dict):
@@ -247,9 +252,9 @@ class txt2vid:
# Add duration parameter - unified for all models
genConfig[0]["duration"] = duration
# Add seed parameter only for supported models
# Add seed parameter only if enabled
if model in videoModelSearch.SEED_SUPPORTED_MODELS:
if useSeed:
genConfig[0]["seed"] = seed
if (negativePrompt is not None and negativePrompt != ""):
@@ -341,11 +346,20 @@ class txt2vid:
# Extract more detailed error info if available
if "responseContent" in error_info:
response_content = error_info["responseContent"]
detailed_message = response_content.get("message", "")
# Handle both string and dict response content
if isinstance(response_content, str):
detailed_message = response_content
elif isinstance(response_content, dict):
detailed_message = response_content.get("message", str(response_content))
else:
detailed_message = str(response_content)
if detailed_message:
error_message = f"{error_message}\nProvider Error: {detailed_message}"
raise Exception(f"Video generation failed: {error_message}")
# Include taskUUID for debugging
task_uuid = error_info.get("taskUUID", "unknown")
raise Exception(f"Video generation failed (Task: {task_uuid}): {error_message}")
if pollResult and "data" in pollResult and len(pollResult["data"]) > 0:
video_data = pollResult["data"][0]
+10 -6
View File
@@ -43,6 +43,10 @@ class videoModelSearch:
"runware:200@1 (Wan 2.1 1.3B)",
"runware:200@2 (Wan 2.1 14B)",
],
"OpenAI": [
"openai:3@1 (OpenAI Sora 3.1)",
"openai:3@0 (OpenAI Sora 3.0)",
],
}
# Model dimensions mapping
@@ -88,13 +92,12 @@ class videoModelSearch:
# Wan Models
"runware:200@1": {"width": 853, "height": 480}, # Wan 2.1 1.3B
"runware:200@2": {"width": 853, "height": 480}, # Wan 2.1 14B
# OpenAI Models
"openai:3@1": {"width": 1280, "height": 720}, # OpenAI Sora 3.1
"openai:3@0": {"width": 1280, "height": 720}, # OpenAI Sora 3.0
}
# Models that support seed parameter
SEED_SUPPORTED_MODELS = [
"runware:200@1", # Wan 2.1 1.3B
"runware:200@2", # Wan 2.1 14B
]
@classmethod
def INPUT_TYPES(cls):
@@ -116,7 +119,8 @@ class videoModelSearch:
"MiniMax",
"PixVerse",
"Vidu",
"Wan"
"Wan",
"OpenAI"
], {
"tooltip": "Choose Video Model Architecture To Filter Results.",
"default": "KlingAI",