修复ComfyUI方式tts传参问题
This commit is contained in:
@@ -219,10 +219,10 @@ class TTSService(ComfyBaseService):
|
||||
# 2. Build workflow parameters
|
||||
workflow_params = {"text": text}
|
||||
|
||||
# Add optional TTS parameters
|
||||
# Add optional TTS parameters (only if explicitly provided and not None)
|
||||
if voice is not None:
|
||||
workflow_params["voice"] = voice
|
||||
if speed != 1.0:
|
||||
if speed is not None and speed != 1.0:
|
||||
workflow_params["speed"] = speed
|
||||
|
||||
# Add any additional parameters
|
||||
@@ -259,19 +259,28 @@ class TTSService(ComfyBaseService):
|
||||
# Check for audio files in result.audios (if available)
|
||||
if hasattr(result, 'audios') and result.audios:
|
||||
audio_path = result.audios[0]
|
||||
logger.debug(f"✅ Found audio in result.audios: {audio_path}")
|
||||
# Check for files in result.files
|
||||
elif hasattr(result, 'files') and result.files:
|
||||
audio_path = result.files[0]
|
||||
logger.debug(f"✅ Found audio in result.files: {audio_path}")
|
||||
# Check in outputs dictionary
|
||||
elif hasattr(result, 'outputs') and result.outputs:
|
||||
logger.debug(f"Searching for audio file in result.outputs: {result.outputs}")
|
||||
# Try to find audio file in outputs
|
||||
for key, value in result.outputs.items():
|
||||
if isinstance(value, str) and any(value.endswith(ext) for ext in ['.mp3', '.wav', '.flac']):
|
||||
audio_path = value
|
||||
logger.debug(f"✅ Found audio in result.outputs[{key}]: {audio_path}")
|
||||
break
|
||||
|
||||
if not audio_path:
|
||||
logger.error("No audio file generated")
|
||||
logger.error(f"❌ Result analysis:")
|
||||
logger.error(f" - result.audios: {getattr(result, 'audios', 'NOT_FOUND')}")
|
||||
logger.error(f" - result.files: {getattr(result, 'files', 'NOT_FOUND')}")
|
||||
logger.error(f" - result.outputs: {getattr(result, 'outputs', 'NOT_FOUND')}")
|
||||
logger.error(f" - Full __dict__: {result.__dict__}")
|
||||
raise Exception("No audio file generated by workflow")
|
||||
|
||||
# If output_path provided and audio_path is URL, download to local
|
||||
|
||||
Reference in New Issue
Block a user