利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
fix(cli): allow the ElevenLabs background music mode
c020627ec1fc340b366
diff --git a/cli.py b/cli.pyindex 6c0f3ff1..b2d2f203 100644--- a/cli.py+++ b/cli.py@@ -168,10 +168,10 @@ def _bgm_type(value: str) -> str:normalized = value.strip().lower()if normalized == "none":return ""- if normalized in {"", "random", "custom", "sonilo"}:+ if normalized in {"", "random", "custom", "sonilo", "elevenlabs"}:return normalizedraise argparse.ArgumentTypeError(- "bgm-type must be one of: none, random, custom, sonilo"+ "bgm-type must be one of: none, random, custom, sonilo, elevenlabs")@@ -427,11 +427,11 @@ Batch manifests:"--bgm-type",type=_bgm_type,default=None,- metavar="{none,random,custom,sonilo}",+ metavar="{none,random,custom,sonilo,elevenlabs}",help=("background music mode; Sonilo reads its API key from config.toml or "- "SONILO_API_KEY; --bgm-file implies custom when omitted "- "(default: random)"+ "SONILO_API_KEY, ElevenLabs from config.toml or ELEVENLABS_API_KEY; "+ "--bgm-file implies custom when omitted (default: random)"),)audio_group.add_argument(@@ -1126,8 +1126,10 @@ def _validate_batch_task_params(if value is not None and value < 1:raise ValueError(f"{name} must be >= 1")- if params.bgm_type not in {"", "random", "custom", "sonilo"}:- raise ValueError("bgm_type must be one of: none, random, custom, sonilo")+ if params.bgm_type not in {"", "random", "custom", "sonilo", "elevenlabs"}:+ raise ValueError(+ "bgm_type must be one of: none, random, custom, sonilo, elevenlabs"+ )if params.bgm_file and params.bgm_type != "custom":raise ValueError("bgm_file requires bgm_type=custom")if params.sonilo_bgm_prompt and params.bgm_type != "sonilo":diff --git a/test/services/test_cli.py b/test/services/test_cli.pyindex de79e8e3..8bc55ffd 100644--- a/test/services/test_cli.py+++ b/test/services/test_cli.py@@ -556,6 +556,20 @@ class TestCli(unittest.TestCase):params = cli.build_video_params(args)self.assertEqual(params.bgm_type, "")+ def test_video_music_providers_are_selectable_from_the_cli(self):+ # --bgm-type must reach every video-matched music provider the runtime+ # dispatches on, otherwise CLI users cannot use a mode the WebUI and the+ # API already accept. Deriving the expectation from the runtime registry+ # keeps the two lists from drifting apart again.+ from app.services import task as task_service++ for provider in sorted(task_service._VIDEO_MUSIC_PROVIDERS):+ args = cli.parse_args(+ ["--video-subject", "test", "--bgm-type", provider]+ )+ params = cli.build_video_params(args)+ self.assertEqual(params.bgm_type, provider)+def test_sonilo_prompt_implies_sonilo_bgm_mode(self):args = cli.parse_args([