chore: reorder suno inputs and drop persona
This commit is contained in:
@@ -134,7 +134,6 @@ def run_suno_generate(
|
||||
style_weight: float | None = None,
|
||||
weirdness_constraint: float | None = None,
|
||||
audio_weight: float | None = None,
|
||||
persona_id: str | None = None,
|
||||
poll_interval_s: float = 30.0,
|
||||
timeout_s: int = 1800,
|
||||
log: bool = True,
|
||||
@@ -144,7 +143,8 @@ def run_suno_generate(
|
||||
raise RuntimeError("Invalid model. Use the pinned enum options.")
|
||||
if vocal_gender and vocal_gender not in VOCAL_GENDER_OPTIONS:
|
||||
raise RuntimeError("vocal_gender must be 'm' or 'f'.")
|
||||
# callback_url intentionally omitted; polling mode only
|
||||
if not callback_url:
|
||||
raise RuntimeError("callback_url is required by the API spec.")
|
||||
|
||||
prompt_text = (prompt or "").strip()
|
||||
style_text = (style or "").strip()
|
||||
@@ -165,14 +165,15 @@ def run_suno_generate(
|
||||
raise RuntimeError("prompt is required when custom_mode is disabled.")
|
||||
_validate_length("prompt", prompt_text, 500)
|
||||
# Spec says other fields should be empty in non-custom mode.
|
||||
if any([style_text, title_text, negative_tags, vocal_gender, persona_id]):
|
||||
raise RuntimeError("style/title/negative_tags/vocal_gender/persona_id must be empty when custom_mode is false.")
|
||||
if any([style_text, title_text, negative_tags, vocal_gender]):
|
||||
raise RuntimeError("style/title/negative_tags/vocal_gender must be empty when custom_mode is false.")
|
||||
|
||||
payload: dict[str, Any] = {
|
||||
"prompt": prompt_text,
|
||||
"customMode": bool(custom_mode),
|
||||
"instrumental": bool(instrumental),
|
||||
"model": model,
|
||||
"callBackUrl": callback_url,
|
||||
}
|
||||
if style_text:
|
||||
payload["style"] = style_text
|
||||
@@ -188,8 +189,6 @@ def run_suno_generate(
|
||||
payload["weirdnessConstraint"] = weirdness_constraint
|
||||
if audio_weight is not None:
|
||||
payload["audioWeight"] = audio_weight
|
||||
if persona_id:
|
||||
payload["personaId"] = persona_id
|
||||
|
||||
api_key = _load_api_key()
|
||||
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
|
||||
|
||||
@@ -730,16 +730,18 @@ KIE Suno Music (Generate)
|
||||
Create a Suno music generation task via KIE API. Returns a taskId.
|
||||
|
||||
Inputs:
|
||||
- title: Track title (required in custom mode)
|
||||
- style: Style text (required in custom mode)
|
||||
- prompt: Text prompt (lyrics in custom mode when instrumental is false)
|
||||
- custom_mode: Enable custom mode (required)
|
||||
- instrumental: Instrumental-only mode (required)
|
||||
- model: V4 / V4_5 / V4_5PLUS / V4_5ALL / V5
|
||||
- callback_url: Webhook URL for results (required by API; can be dummy)
|
||||
- style: Required in custom mode
|
||||
- title: Required in custom mode
|
||||
- negative_tags: Optional tags to avoid
|
||||
- vocal_gender: m or f (custom mode only)
|
||||
- style_weight / weirdness_constraint / audio_weight: 0..1
|
||||
- persona_id: Optional persona (custom mode only)
|
||||
- log: Console logging on/off
|
||||
|
||||
Outputs:
|
||||
@@ -752,20 +754,20 @@ Inputs:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"title": ("STRING", {"default": ""}),
|
||||
"style": ("STRING", {"default": ""}),
|
||||
"prompt": ("STRING", {"multiline": True}),
|
||||
"custom_mode": ("BOOLEAN", {"default": True}),
|
||||
"instrumental": ("BOOLEAN", {"default": True}),
|
||||
"model": ("COMBO", {"options": SUNO_MODEL_OPTIONS, "default": "V4_5"}),
|
||||
"callback_url": ("STRING", {"default": "https://example.com/kie-suno-callback"}),
|
||||
},
|
||||
"optional": {
|
||||
"style": ("STRING", {"default": ""}),
|
||||
"title": ("STRING", {"default": ""}),
|
||||
"negative_tags": ("STRING", {"default": ""}),
|
||||
"vocal_gender": ("COMBO", {"options": ["m", "f"], "default": "m"}),
|
||||
"style_weight": ("FLOAT", {"default": 0.65, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
"weirdness_constraint": ("FLOAT", {"default": 0.65, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
"audio_weight": ("FLOAT", {"default": 0.65, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
"persona_id": ("STRING", {"default": ""}),
|
||||
"log": ("BOOLEAN", {"default": True}),
|
||||
},
|
||||
}
|
||||
@@ -777,18 +779,18 @@ Inputs:
|
||||
|
||||
def generate(
|
||||
self,
|
||||
title: str,
|
||||
style: str,
|
||||
prompt: str,
|
||||
custom_mode: bool,
|
||||
instrumental: bool,
|
||||
model: str,
|
||||
style: str = "",
|
||||
title: str = "",
|
||||
callback_url: str,
|
||||
negative_tags: str = "",
|
||||
vocal_gender: str = "m",
|
||||
style_weight: float = 0.65,
|
||||
weirdness_constraint: float = 0.65,
|
||||
audio_weight: float = 0.65,
|
||||
persona_id: str = "",
|
||||
log: bool = True,
|
||||
):
|
||||
audio_output, task_id, raw_json = run_suno_generate(
|
||||
@@ -796,6 +798,7 @@ Inputs:
|
||||
custom_mode=custom_mode,
|
||||
instrumental=instrumental,
|
||||
model=model,
|
||||
callback_url=callback_url,
|
||||
style=style,
|
||||
title=title,
|
||||
negative_tags=negative_tags,
|
||||
@@ -803,7 +806,6 @@ Inputs:
|
||||
style_weight=style_weight,
|
||||
weirdness_constraint=weirdness_constraint,
|
||||
audio_weight=audio_weight,
|
||||
persona_id=persona_id,
|
||||
log=log,
|
||||
)
|
||||
return (audio_output, task_id, raw_json)
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
Create a Suno music generation task via KIE API. This node polls until completion and returns an AUDIO output.
|
||||
|
||||
## Inputs
|
||||
- **title** (STRING, required): Track title (required in custom mode).
|
||||
- **style** (STRING, required): Style text (required in custom mode).
|
||||
- **prompt** (STRING, required): Prompt text (lyrics in custom mode when instrumental is false).
|
||||
- **custom_mode** (BOOLEAN, required): Enable custom mode.
|
||||
- **instrumental** (BOOLEAN, required): Instrumental-only mode.
|
||||
- **model** (COMBO, required): `V4`, `V4_5`, `V4_5PLUS`, `V4_5ALL`, `V5`
|
||||
- **callback_url** (STRING, required): Webhook URL (can be a placeholder if only polling).
|
||||
Optional:
|
||||
- **style** (STRING): Required in custom mode. Length limit depends on model.
|
||||
- **title** (STRING): Required in custom mode. Max 80 chars.
|
||||
- **negative_tags** (STRING): Optional.
|
||||
- **vocal_gender** (COMBO): `m` or `f` (custom mode only).
|
||||
- **style_weight** (FLOAT): 0..1
|
||||
- **weirdness_constraint** (FLOAT): 0..1
|
||||
- **audio_weight** (FLOAT): 0..1
|
||||
- **persona_id** (STRING): Optional (custom mode only).
|
||||
- **log** (BOOLEAN): Enable console logging.
|
||||
|
||||
## Outputs
|
||||
|
||||
Reference in New Issue
Block a user