From a318e03dc2c9aae3bcb877ca89c6fa191d189660 Mon Sep 17 00:00:00 2001 From: JueMing Date: Tue, 22 Jul 2025 00:13:27 +0800 Subject: [PATCH] fix bug --- nodes/text_to_speech.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nodes/text_to_speech.py b/nodes/text_to_speech.py index 488e8d1..310d7be 100644 --- a/nodes/text_to_speech.py +++ b/nodes/text_to_speech.py @@ -29,9 +29,9 @@ class TextToSpeech: "volume": ("FLOAT", {"default": 1.0, "min": 0.1, "max": 10.0, "step": 0.1}), "pitch": ("INT", {"default": 0, "min": -12, "max": 12, "step": 1}), "emotion": (["", "happy", "sad", "angry", "fearful", "disgusted", "surprised", "neutral"], {"default": ""}), - "subtitle_enable": ("BOOLEAN", {"default": False}), +fi "subtitle_enable": ("BOOLEAN", {"default": False}), "filename_prefix": ("STRING", {"default": "tts_output", "multiline": False}), - "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), + "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "step": 1}), }, "optional": { "custom_voice_id": ("STRING", { @@ -55,6 +55,16 @@ class TextToSpeech: if not api_key or not group_id: raise ValueError("API Key and Group ID must be provided") + # Handle seed parameter type conversion and validation + try: + if seed is None or seed == "" or seed == "": + seed = 0 # Default to 0 for random seed + else: + seed = int(seed) # Ensure it's an integer + except (ValueError, TypeError): + print(f"⚠️ 无效的seed值: {seed},使用默认值 0") + seed = 0 + # Log seed for execution tracking (seed is not sent to API, just for ComfyUI execution control) print(f"🎲 执行种子 (Seed): {seed}")