V2.0.0 - Seedance api
This commit is contained in:
@@ -38,6 +38,12 @@ class PrimereApiProcessor:
|
||||
API_SCHEMAS_RAW = utility.json2tuple(_schema_file if Path(_schema_file).is_file() else _schema_example)
|
||||
API_SCHEMA_REGISTRY = api_schema_registry.normalize_registry(API_SCHEMAS_RAW)
|
||||
|
||||
SECTION_TITLES = [
|
||||
{"before": "processor", "name": "primere_api_proc", "title": "🧭 API Setup", "color": "#1B263B", "text_color": "#EAF1F8", "label": "Setup API processor, select related provider and service."},
|
||||
{"before": "auto_save_result", "name": "primere_save_api_result", "title": "💾 API result save", "color": "#1B263B", "text_color": "#EAF1F8", "label": "Save API results. Define main path, add subdirectory structure, add filename prefixes. Save related data to .txt or .json file."},
|
||||
{"after": "save_data_to_txt", "name": "primere_api_body", "title": "⚙ API body parameters", "color": "#1B263B", "text_color": "#EAF1F8", "label": "Set API body custom parameters."},
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
cls.required_inputs = {
|
||||
|
||||
+1365
-1060
File diff suppressed because one or more lines are too long
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from . import response_helper
|
||||
|
||||
|
||||
def handle_response(api_result, schema=None):
|
||||
try:
|
||||
json_object = json.loads(json.dumps(api_result))
|
||||
except (ValueError, TypeError) as exc:
|
||||
raise RuntimeError(f"Invalid JSON response received: {api_result}") from exc
|
||||
|
||||
video = json_object.get("video") if isinstance(json_object, dict) else None
|
||||
if not isinstance(video, dict):
|
||||
raise RuntimeError(f"No 'video' key in Seedance response: {json_object}")
|
||||
|
||||
video_url = video.get("url")
|
||||
if not video_url:
|
||||
raise RuntimeError(f"No URL in Seedance video response: {video}")
|
||||
|
||||
video_bytes = response_helper.fetch_url_bytes(video_url)
|
||||
return ["video_result", video_bytes]
|
||||
@@ -65,50 +65,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"VEO": {
|
||||
"provider": "Gemini",
|
||||
"service": "VEO",
|
||||
"reference_images_handler": "Gemini_VEO.py",
|
||||
"import_modules": [
|
||||
"from google import genai",
|
||||
"from google.genai import types"
|
||||
],
|
||||
"possible_parameters": {
|
||||
"model": ["veo-2.0-generate-001", "veo-3.1-fast-generate-preview", "veo-3.1-generate-preview"],
|
||||
"aspect_ratio": ["16:9", "16:10", "9:16", "10:16"],
|
||||
"duration_seconds": [4, 5, 6, 7, 8],
|
||||
"person_generation": ["allow_adult", "allow_all", "dont_allow"],
|
||||
"resolution": ["720p", "1080p", "4K"]
|
||||
},
|
||||
"request": {
|
||||
"method": "SDK",
|
||||
"endpoint": "client.models.generate_videos",
|
||||
"sdk_call": {
|
||||
"args": [],
|
||||
"kwargs": {
|
||||
"model": "{{model}}",
|
||||
"prompt": "{{prompt}}",
|
||||
"image": "{{first_image}}",
|
||||
"lastFrame": "{{last_image}}",
|
||||
"referenceImages": "{{reference_images}}",
|
||||
"video": "{{reference_video}}",
|
||||
"config": {
|
||||
"$call": "types.GenerateVideosConfig",
|
||||
"$args": [],
|
||||
"$kwargs": {
|
||||
"aspectRatio": "{{aspect_ratio}}",
|
||||
"number_of_videos": "{{batch}}",
|
||||
"resolution": "{{config_resolution}}",
|
||||
"durationSeconds": "{{duration_seconds}}",
|
||||
"personGeneration": "{{person_generation}}",
|
||||
"reference_images": "{{reference_images}}",
|
||||
"negative_prompt": "{{negative_prompt}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Imagen": {
|
||||
"provider": "Gemini",
|
||||
"service": "Imagen",
|
||||
@@ -149,134 +105,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"FAL": {
|
||||
"Seedream": {
|
||||
"provider": "FAL",
|
||||
"service": "Seedream",
|
||||
"response_handler": "FAL_Image.py",
|
||||
"import_modules": [
|
||||
"import fal_client"
|
||||
],
|
||||
"possible_parameters": {
|
||||
"enable_safety_checker": [false, true],
|
||||
"with_logs": [false, true],
|
||||
"enhance_prompt_mode": ["standard", "fast"],
|
||||
"model_type": ["text-to-image", "edit"],
|
||||
"version": ["v4.5", "v5/lite"]
|
||||
},
|
||||
"request_exclusions": [
|
||||
{
|
||||
"when": {"path": "model_type", "equals": "edit"},
|
||||
"remove": ["enhance_prompt_mode"]
|
||||
},
|
||||
{
|
||||
"when": {"path": "model_type", "equals": "text-to-image"},
|
||||
"remove": ["reference_images", "image_urls"]
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "SDK",
|
||||
"endpoint": "fal_client.submit",
|
||||
"sdk_call": {
|
||||
"args": [
|
||||
"fal-ai/bytedance/seedream/{{version}}/{{model_type}}"
|
||||
],
|
||||
"kwargs": {
|
||||
"arguments": {
|
||||
"prompt": "{{prompt}}",
|
||||
"image_urls": "{{reference_images}}",
|
||||
"image_size": {
|
||||
"width": "{{width}}",
|
||||
"height": "{{height}}"
|
||||
},
|
||||
"num_images": "{{batch}}",
|
||||
"max_images": 1,
|
||||
"enable_safety_checker": "{{enable_safety_checker}}",
|
||||
"enhance_prompt_mode": "{{enhance_prompt_mode}}",
|
||||
"seed": "{{seed}}",
|
||||
"with_logs": "{{with_logs}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Kling": {
|
||||
"provider": "FAL",
|
||||
"service": "Kling",
|
||||
"response_handler": "FAL_Kling.py",
|
||||
"reference_images_handler": "FAL_Kling.py",
|
||||
"import_modules": [
|
||||
"import fal_client"
|
||||
],
|
||||
"possible_parameters": {
|
||||
"aspect_ratio": ["16:9", "9:16", "1:1"],
|
||||
"duration": [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||
"generate_audio": [false, true],
|
||||
"with_logs": [false, true],
|
||||
"model_type": ["text-to-video", "image-to-video"],
|
||||
"version": ["v3/pro", "v3/standard", "o3/pro", "o3/standard"],
|
||||
"cfg_scale": "FLOAT"
|
||||
},
|
||||
"request_exclusions": [
|
||||
{
|
||||
"when": {"path": "version", "equals": "v3/pro"},
|
||||
"remove": ["image_url"]
|
||||
},
|
||||
{
|
||||
"when": {"path": "version", "equals": "v3/standard"},
|
||||
"remove": ["image_url"]
|
||||
},
|
||||
{
|
||||
"when": {"path": "version", "equals": "o3/standard"},
|
||||
"remove": ["negative_prompt", "cfg_scale", "start_image_url", "elements", "aspect_ratio"]
|
||||
},
|
||||
{
|
||||
"when": {"path": "version", "equals": "o3/pro"},
|
||||
"remove": ["negative_prompt", "cfg_scale", "start_image_url", "elements", "aspect_ratio"]
|
||||
},
|
||||
{
|
||||
"when": {"path": "model_type", "equals": "text-to-video"},
|
||||
"remove": ["multi_prompt", "start_image_url", "image_url", "elements"]
|
||||
}
|
||||
],
|
||||
"parameter_constraints": {
|
||||
"cfg_scale": {"max": 1.0}
|
||||
},
|
||||
"request": {
|
||||
"method": "SDK",
|
||||
"endpoint": "fal_client.subscribe",
|
||||
"sdk_call": {
|
||||
"args": [
|
||||
"fal-ai/kling-video/{{version}}/{{model_type}}"
|
||||
],
|
||||
"kwargs": {
|
||||
"arguments": {
|
||||
"prompt": "{{prompt}}",
|
||||
"negative_prompt": "{{negative_prompt}}",
|
||||
"multi_prompt": "{{multi_prompt}}",
|
||||
"cfg_scale": "{{cfg_scale}}",
|
||||
"start_image_url": "{{first_image}}",
|
||||
"image_url": "{{first_image}}",
|
||||
"end_image_url": "{{last_image}}",
|
||||
"elements": [
|
||||
{
|
||||
"reference_image_urls": "{{reference_images}}",
|
||||
"frontal_image_url": "{{frontal_image}}"
|
||||
},
|
||||
{
|
||||
"video_url": "{{reference_video}}"
|
||||
}
|
||||
],
|
||||
"duration": "{{duration}}",
|
||||
"aspect_ratio": "{{aspect_ratio}}",
|
||||
"generate_audio": "{{generate_audio}}",
|
||||
"with_logs": "{{with_logs}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"BlackForest": {
|
||||
"Flux": {
|
||||
"provider": "BlackForest",
|
||||
|
||||
@@ -2,7 +2,7 @@ import { app } from "/scripts/app.js";
|
||||
|
||||
// Add node names here to enable backend-driven title separators on those nodes.
|
||||
const TITLE_MANAGED_NODES = [
|
||||
"PrimereRasterix", "PrimereModelControl", "PrimereMetaSave", "PrimereRasterixLens", "PrimereMetaHandler", "PrimereCLIPEncoder"
|
||||
"PrimereRasterix", "PrimereModelControl", "PrimereMetaSave", "PrimereRasterixLens", "PrimereMetaHandler", "PrimereCLIPEncoder", "PrimereApiProcessor"
|
||||
];
|
||||
|
||||
const titleConfigCache = {};
|
||||
|
||||
@@ -1,57 +1,53 @@
|
||||
{
|
||||
"Gemini": {
|
||||
"Nanobanana_2": {
|
||||
"provider": "Gemini",
|
||||
"service": "Nanobanana_2",
|
||||
"response_handler": "Gemini_Nanobanana_2.py",
|
||||
"reference_images_handler": "Gemini.py",
|
||||
"FAL": {
|
||||
"Seedance": {
|
||||
"provider": "FAL",
|
||||
"service": "Seedance",
|
||||
"response_handler": "FAL_Seedance.py",
|
||||
"reference_images_handler": "FAL.py",
|
||||
"import_modules": [
|
||||
"import your_provider_sdk",
|
||||
"from your_provider_sdk import types"
|
||||
],
|
||||
"possible_parameters": {
|
||||
"aspect_ratio": [
|
||||
"fake_aspect_ratio_value_1",
|
||||
"fake_aspect_ratio_value_2"
|
||||
"audio_urls": [
|
||||
"fake_audio_urls_value_1",
|
||||
"fake_audio_urls_value_2"
|
||||
],
|
||||
"resolution": [
|
||||
"1K",
|
||||
"2K",
|
||||
"4K"
|
||||
"reference_image": [
|
||||
"fake_reference_image_value_1",
|
||||
"fake_reference_image_value_2"
|
||||
],
|
||||
"aspect_ratio": ["auto", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"],
|
||||
"duration": ["auto", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||
"resolution": ["480p", "720p"],
|
||||
"video_urls": [
|
||||
"fake_video_urls_value_1",
|
||||
"fake_video_urls_value_2"
|
||||
],
|
||||
"with_logs": [
|
||||
"fake_with_logs_value_1",
|
||||
"fake_with_logs_value_2"
|
||||
]
|
||||
},
|
||||
"request": {
|
||||
"method": "SDK",
|
||||
"endpoint": "client.models.generate_content",
|
||||
"endpoint": "fal_client.subscribe",
|
||||
"sdk_call": {
|
||||
"args": [],
|
||||
"args": [
|
||||
"bytedance/seedance-2.0/fast/reference-to-video"
|
||||
],
|
||||
"kwargs": {
|
||||
"model": "gemini-3.1-flash-image-preview",
|
||||
"contents": "{{prompt}}",
|
||||
"config": {
|
||||
"$call": "types.GenerateContentConfig",
|
||||
"$args": [],
|
||||
"$kwargs": {
|
||||
"response_modalities": [
|
||||
"IMAGE"
|
||||
],
|
||||
"image_config": {
|
||||
"$call": "types.ImageConfig",
|
||||
"$args": [],
|
||||
"$kwargs": {
|
||||
"aspect_ratio": "{{aspect_ratio}}",
|
||||
"image_size": "{{resolution}}"
|
||||
}
|
||||
},
|
||||
"thinking_config": {
|
||||
"$call": "types.ThinkingConfig",
|
||||
"$args": [],
|
||||
"$kwargs": {
|
||||
"thinking_level": "High",
|
||||
"include_thoughts": true
|
||||
}
|
||||
}
|
||||
}
|
||||
"arguments": {
|
||||
"prompt": "{{prompt}}",
|
||||
"image_urls": "{{reference_image}}",
|
||||
"video_urls": "{{video_urls}}",
|
||||
"audio_urls": "{{audio_urls}}",
|
||||
"resolution": "{{resolution}}",
|
||||
"seed": "{{seed}}",
|
||||
"duration": "{{duration}}",
|
||||
"aspect_ratio": "{{aspect_ratio}}",
|
||||
"with_logs": "{{with_logs}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-14
@@ -1,15 +1,13 @@
|
||||
response = client.models.generate_content(
|
||||
model="gemini-3.1-flash-image-preview",
|
||||
contents=prompt,
|
||||
config=types.GenerateContentConfig(
|
||||
response_modalities=['IMAGE'],
|
||||
image_config=types.ImageConfig(
|
||||
aspect_ratio=aspect_ratio,
|
||||
image_size=resolution
|
||||
),
|
||||
thinking_config=types.ThinkingConfig(
|
||||
thinking_level="High",
|
||||
include_thoughts=True
|
||||
),
|
||||
)
|
||||
result = fal_client.subscribe("bytedance/seedance-2.0/fast/reference-to-video",
|
||||
arguments={
|
||||
"prompt": prompt,
|
||||
"image_urls": reference_image,
|
||||
"video_urls": video_urls,
|
||||
"audio_urls": audio_urls,
|
||||
"resolution": resolution,
|
||||
"seed": seed,
|
||||
"duration": "auto",
|
||||
"aspect_ratio": "auto",
|
||||
"with_logs": with_logs
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user