From 6f7f1dd993f36e830d5cf7b01bc4359d9b5ff3de Mon Sep 17 00:00:00 2001 From: Hawk Lee Date: Mon, 29 Dec 2025 09:57:52 +0800 Subject: [PATCH] fix: auto-format text input with speaker tags if missing (v1.5.00) --- aiia_vibevoice_nodes.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/aiia_vibevoice_nodes.py b/aiia_vibevoice_nodes.py index c4a68ae..d4da0eb 100644 --- a/aiia_vibevoice_nodes.py +++ b/aiia_vibevoice_nodes.py @@ -323,6 +323,27 @@ class AIIA_VibeVoice_TTS: print(f"[AIIA] Generating VibeVoice TTS... text length: {len(text)}") + # FIX: Processor expects script format "Speaker X: text" for raw strings + import re + if not re.search(r'^Speaker\s+\d+\s*:', text, re.IGNORECASE | re.MULTILINE): + print("[AIIA] No speaker tag found, adding default 'Speaker 1:' prefix") + # If multi-line, prefix each line that has content? + # Or just wrap the whole thing? + # VibeVoice supports multiple speakers. If user gives plain text, assume single speaker. + + # Simple approach: Prepend Speaker 1: to the whole block? + # The processor parsing logic splits by newline. + # If I wrap the whole text, newlines inside might be treated as... + # Processor parse_script iterates lines. Each line MUST start with Speaker X:. + + lines = text.split('\n') + formatted_lines = [] + for line in lines: + if line.strip(): + formatted_lines.append(f"Speaker 1: {line.strip()}") + text = "\n".join(formatted_lines) + print(f"[AIIA] Formatted input: {text[:50]}...") + # Prepare reference audio for processor voice_samples = None if reference_audio is not None: