fix: Worker 配音下载 fallback 到 voice_ids 修复预览无声 (#1320)
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 40s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 59s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m41s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 3m16s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 5m16s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 5m24s
CI/CD Pipeline / Integration Tests (push) Successful in 1m21s
CI/CD Pipeline / Unit Tests (push) Successful in 8m50s
CI/CD Pipeline / Build Staging API Image (push) Successful in 12m12s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m25s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 38s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m13s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 3m29s
CI/CD Pipeline / Canary Release to Production (push) Failing after 913h2m53s
CI/CD Pipeline / Production Browser E2E (push) Failing after 913h10m55s
CI/CD Pipeline / CI Gate (push) Failing after 913h10m56s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 913h10m56s
CI/CD Pipeline / Build Production API Image (push) Failing after 913h10m57s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 913h19m45s
CI/CD Pipeline / PR Build API Image (push) Failing after 913h19m47s
CI/CD Pipeline / Frontend Lint (push) Failing after 913h19m48s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 913h19m49s
CI/CD Pipeline / Deploy Production (push) Failing after 913h44m21s
CI/CD Pipeline / Build Production Web Image (push) Failing after 913h44m22s
CI/CD Pipeline / PR Build Web Image (push) Failing after 913h53m11s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 40s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 59s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m41s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 3m16s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 5m16s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 5m24s
CI/CD Pipeline / Integration Tests (push) Successful in 1m21s
CI/CD Pipeline / Unit Tests (push) Successful in 8m50s
CI/CD Pipeline / Build Staging API Image (push) Successful in 12m12s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m25s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 38s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m13s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 3m29s
CI/CD Pipeline / Canary Release to Production (push) Failing after 913h2m53s
CI/CD Pipeline / Production Browser E2E (push) Failing after 913h10m55s
CI/CD Pipeline / CI Gate (push) Failing after 913h10m56s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 913h10m56s
CI/CD Pipeline / Build Production API Image (push) Failing after 913h10m57s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 913h19m45s
CI/CD Pipeline / PR Build API Image (push) Failing after 913h19m47s
CI/CD Pipeline / Frontend Lint (push) Failing after 913h19m48s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 913h19m49s
CI/CD Pipeline / Deploy Production (push) Failing after 913h44m21s
CI/CD Pipeline / Build Production Web Image (push) Failing after 913h44m22s
CI/CD Pipeline / PR Build Web Image (push) Failing after 913h53m11s
This commit was merged in pull request #1320.
This commit is contained in:
@@ -1058,6 +1058,7 @@ def _download_all_assets(
|
||||
task_asset_ids: list[str],
|
||||
voice_library_id: str,
|
||||
task_id: str,
|
||||
voice_ids: list[str] | None = None,
|
||||
) -> tuple[list[Path], str | None]:
|
||||
"""下载视频素材和配音素材。
|
||||
|
||||
@@ -1066,6 +1067,9 @@ def _download_all_assets(
|
||||
|
||||
Note: gen_task 不传入下载函数(session 已关闭),
|
||||
主函数在下载前后已有汇总日志。
|
||||
|
||||
配音下载逻辑:优先使用 voice_library_id(配音素材库资产);
|
||||
若为空则 fallback 到 voice_ids[0](前端选择的音频 asset_id)。
|
||||
"""
|
||||
logger.info("[task_id=%s] [下载素材] 开始下载视频素材", task_id)
|
||||
download_start = time.monotonic()
|
||||
@@ -1085,11 +1089,24 @@ def _download_all_assets(
|
||||
)
|
||||
|
||||
audio_path: str | None = None
|
||||
if voice_library_id:
|
||||
# 配音下载:优先 voice_library_id,fallback 到 voice_ids[0]
|
||||
effective_voice_id = voice_library_id
|
||||
if not effective_voice_id and voice_ids:
|
||||
effective_voice_id = voice_ids[0]
|
||||
logger.info(
|
||||
"[task_id=%s] [下载配音] voice_library_id 为空,fallback 到 voice_ids[0]=%s",
|
||||
task_id,
|
||||
effective_voice_id,
|
||||
)
|
||||
if effective_voice_id:
|
||||
local_audio = temp_path / "voice.mp3"
|
||||
if _download_voice_asset(voice_library_id, local_audio):
|
||||
if _download_voice_asset(effective_voice_id, local_audio):
|
||||
audio_path = str(local_audio)
|
||||
logger.info("[task_id=%s] [下载配音] 配音下载成功", task_id)
|
||||
logger.info(
|
||||
"[task_id=%s] [下载配音] 配音下载成功 (source=%s)",
|
||||
task_id,
|
||||
"voice_library_id" if voice_library_id else "voice_ids",
|
||||
)
|
||||
|
||||
return downloaded_videos, audio_path
|
||||
|
||||
@@ -1422,6 +1439,7 @@ def generate_video(self, task_id: str) -> dict:
|
||||
task_asset_ids=task_asset_ids,
|
||||
voice_library_id=voice_library_id,
|
||||
task_id=task_id,
|
||||
voice_ids=task_info.get("voice_ids", []),
|
||||
)
|
||||
|
||||
if gen_task:
|
||||
|
||||
Reference in New Issue
Block a user