diff --git a/web/components/output_preview.py b/web/components/output_preview.py index 9d252ef..6b97bfe 100644 --- a/web/components/output_preview.py +++ b/web/components/output_preview.py @@ -244,23 +244,30 @@ def render_batch_output(pixelle_video, video_params): # Prepare shared config shared_config = { "title_prefix": video_params.get("title_prefix"), - "n_scenes": video_params.get("n_scenes", 5), + "n_scenes": video_params.get("n_scenes") or 5, "image_workflow": video_params.get("image_workflow"), "frame_template": video_params.get("frame_template"), - "prompt_prefix": video_params.get("prompt_prefix", ""), + "prompt_prefix": video_params.get("prompt_prefix") or "", "bgm_path": video_params.get("bgm_path"), - "bgm_volume": video_params.get("bgm_volume", 0.2), - "tts_inference_mode": video_params.get("tts_inference_mode", "local"), + "bgm_volume": video_params.get("bgm_volume") or 0.2, + "tts_inference_mode": video_params.get("tts_inference_mode") or "local", } - # Add TTS parameters + # Add TTS parameters based on mode (only add non-None values) if shared_config["tts_inference_mode"] == "local": - shared_config["tts_voice"] = video_params.get("tts_voice") - shared_config["tts_speed"] = video_params.get("tts_speed") - else: - shared_config["tts_workflow"] = video_params.get("tts_workflow") - if video_params.get("ref_audio"): - shared_config["ref_audio"] = str(video_params["ref_audio"]) + tts_voice = video_params.get("tts_voice") + tts_speed = video_params.get("tts_speed") + if tts_voice: + shared_config["tts_voice"] = tts_voice + if tts_speed: + shared_config["tts_speed"] = tts_speed + else: # comfyui + tts_workflow = video_params.get("tts_workflow") + if tts_workflow: + shared_config["tts_workflow"] = tts_workflow + ref_audio = video_params.get("ref_audio") + if ref_audio: + shared_config["ref_audio"] = str(ref_audio) # Add template parameters if video_params.get("template_params"): diff --git a/web/utils/batch_manager.py b/web/utils/batch_manager.py index b9bb9c4..b9060be 100644 --- a/web/utils/batch_manager.py +++ b/web/utils/batch_manager.py @@ -91,9 +91,10 @@ class SimpleBatchManager: "mode": "generate", # Fixed mode } - # Merge shared config, excluding title_prefix + # Merge shared config, excluding title_prefix and None values + # Filter out None values to avoid interfering with parameter logic in generate_video for key, value in shared_config.items(): - if key != "title_prefix": + if key != "title_prefix" and value is not None: task_params[key] = value # Generate title using title_prefix