From 22e04d65a76971f86ad16f96cbf45fd1c603f6a8 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 30 Sep 2026 20:42:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(viral-video):=20#2106=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=20=5Fstep=5Fmusetalk=20=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 爆款视频由 Seedance 2.5 直接生成人物口型,不需要 MuseTalk 事后对口型。 MuseTalk 是 AI 数字人路线(上传人物视频+配音→对嘴型)用的,跟爆款视频是两条不同路线。 - 删除 _step_musetalk 函数 - resume_pipeline 直接把 render 输出传给 upload - 更新流水线 docstring 为 9 步 - 删除/更新对应单测 - ViralVideoStage.MUSETALK 枚举值保留以避免前端 breaking change --- apps/worker/worker_app/tasks/viral_video.py | 27 ++++++--------------- tests/unit/test_viral_video.py | 3 --- tests/unit/test_viral_video_p0.py | 15 ------------ 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/apps/worker/worker_app/tasks/viral_video.py b/apps/worker/worker_app/tasks/viral_video.py index 6ebedcb07..835ed0683 100644 --- a/apps/worker/worker_app/tasks/viral_video.py +++ b/apps/worker/worker_app/tasks/viral_video.py @@ -1,6 +1,6 @@ """爆款视频 Celery 编排器 — ViralVideoOrchestrator. -10 步流水线: +9 步流水线(Seedance 2.5 直生口型,不再走 MuseTalk): 1. 图片 VLM 分析 1.5 [v1.3] 视频风格分析(如用户上传参考视频) 2. 用户文案意图解析 @@ -8,10 +8,9 @@ 4. 分镜脚本生成 5. 合规审核(6 维度,不通过自动重写 1 次) 6. CosyVoice 配音 - 7. BGM 选择 - 8. UnifiedRenderService 渲染 - 9. 数字人口型(MuseTalk) - 10. OSS 上传 + 通知 + 扣点 + 7. BGM 选择(素材未就绪时跳过) + 8. Seedance 逐分镜生成 + ffmpeg concat + 混 TTS + 9. OSS 上传 + 通知 + 扣点 """ from __future__ import annotations @@ -593,14 +592,6 @@ def _make_placeholder_clip(tmpdir, idx: int, duration: int): return out -def _step_musetalk(job: ViralVideoJob, video_path: str) -> str: - """步骤 9: 数字人口型。P1:MuseTalk GPU 端点未就绪前统一跳过。""" - if not job.persona_id: - return video_path - logger.info("[爆款视频] persona_id=%s 已设置,但 MuseTalk GPU 端点未就绪,跳过口型同步", job.persona_id) - return video_path - - def _step_upload(job: ViralVideoJob, video_path: str) -> str: """步骤 10: OSS 上传。""" try: @@ -760,14 +751,10 @@ def resume_viral_video_pipeline(self: Task, job_id: str) -> dict: video_path = _step_render(job, storyboard, tts_path, bgm) _emit_progress(job_id, ViralVideoStage.RENDERING, 88.0, "渲染完成") - # ── Step 9: MuseTalk(P1:端点未就绪前跳过) ── - _emit_progress(job_id, ViralVideoStage.MUSETALK, 90.0, "正在处理数字人口型...") - final_video_path = _step_musetalk(job, video_path) - _emit_progress(job_id, ViralVideoStage.MUSETALK, 93.0, "数字人处理完成") - - # ── Step 10: OSS 上传 + 扣点 ── + # ── Step 9: OSS 上传 + 扣点 ── + # 注:爆款视频由 Seedance 2.5 直接生成口型,不需要 MuseTalk 事后对口型(MuseTalk 是 AI 数字人路线用的)。 _emit_progress(job_id, ViralVideoStage.UPLOADING, 95.0, "正在上传视频...") - video_url = _step_upload(job, final_video_path) + video_url = _step_upload(job, video_path) job.credits_cost = CREDITS_VIRAL_VIDEO_COST # TODO: 调用 credits.deduct() 实际扣点(#1895 总开关为 false 时不扣,保留 TODO) diff --git a/tests/unit/test_viral_video.py b/tests/unit/test_viral_video.py index 73cc13f43..a18bf35b7 100755 --- a/tests/unit/test_viral_video.py +++ b/tests/unit/test_viral_video.py @@ -456,7 +456,6 @@ class TestPipelineIntegration: """流水线端到端集成测试(mock 外部依赖)。""" @patch("apps.worker.worker_app.tasks.viral_video._step_upload") - @patch("apps.worker.worker_app.tasks.viral_video._step_musetalk") @patch("apps.worker.worker_app.tasks.viral_video._step_render") @patch("apps.worker.worker_app.tasks.viral_video._step_bgm_select") @patch("apps.worker.worker_app.tasks.viral_video._step_tts") @@ -481,7 +480,6 @@ class TestPipelineIntegration: mock_tts, mock_bgm, mock_render, - mock_musetalk, mock_upload, ): """测试 resume 流水线能从确认状态走到完成。""" @@ -509,7 +507,6 @@ class TestPipelineIntegration: mock_tts.return_value = None # P1: TTS 返回 Path|None,mock 用 None 跳过混音 mock_bgm.return_value = None # P1: BGM 未就绪前返回 None mock_render.return_value = "/tmp/video.mp4" - mock_musetalk.return_value = "/tmp/video_final.mp4" mock_upload.return_value = "https://oss.example.com/final.mp4" result = resume_viral_video_pipeline.run("job-001") diff --git a/tests/unit/test_viral_video_p0.py b/tests/unit/test_viral_video_p0.py index 7417b9d84..d5d98b8c4 100644 --- a/tests/unit/test_viral_video_p0.py +++ b/tests/unit/test_viral_video_p0.py @@ -155,21 +155,6 @@ class TestBGMSkip: assert _step_bgm_select(mock_job) is None -class TestMuseTalkSkip: - def test_musetalk_no_persona_passes_through(self, mock_job): - from apps.worker.worker_app.tasks.viral_video import _step_musetalk - - mock_job.persona_id = "" - assert _step_musetalk(mock_job, "/tmp/video.mp4") == "/tmp/video.mp4" - - def test_musetalk_with_persona_still_skips(self, mock_job): - """GPU 端点未就绪前,即使有 persona 也直接返回原路径。""" - from apps.worker.worker_app.tasks.viral_video import _step_musetalk - - mock_job.persona_id = "persona-1" - assert _step_musetalk(mock_job, "/tmp/video.mp4") == "/tmp/video.mp4" - - # ── P0-1: call_video_generation 参数构造 ────────────────────────── -- 2.54.0