fix(#549): 预设配音无声 - 顶层voice_id+custom_text与tts配置路径不匹配
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 21s
AI Code Review / AI Code Review (pull_request) Failing after 24s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 2m3s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m31s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 2m34s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 1396h45m41s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1396h45m59s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1396h46m0s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 1396h46m4s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 1396h45m59s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 1396h46m4s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1396h45m59s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 1396h46m1s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 1396h46m1s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 1396h46m2s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 1396h46m4s
CI/CD Pipeline / Check if frontend-only change (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1397h18m6s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 1397h18m9s

根因:前端一键生成页面传 config.voice_id + config.custom_text(顶层字段),
      统一渲染引擎从 config.tts 嵌套对象读取TTS配置,路径完全不匹配,
      导致 TTS 配音从未被触发,选了预设配音也等于没选。

修复:在 _maybe_add_voiceover_layer 增加桥接兼容逻辑——
      当 tts.enabled 为 False 但顶层有 voice_id + custom_text 时,
      自动映射为 tts 配置并触发配音生成。

新增4个单元测试覆盖:桥接触发、tts配置优先、缺文本不触发、无配置不触发。
This commit is contained in:
CI Bot
2026-07-20 10:42:53 +08:00
parent d42965bba1
commit d919650fdf
2 changed files with 155 additions and 0 deletions
@@ -675,6 +675,27 @@ class UnifiedRenderService:
config = self.plan.config or {}
tts_cfg = config.get("tts", {}) or {}
# 兼容前端顶层字段:voice_id / custom_text / voice_clone_profile_id
# 前端一键生成页面传 config.voice_id + config.custom_text,
# 统一渲染引擎从 config.tts 读,这里做桥接映射。
if not tts_cfg.get("enabled"):
top_voice_id = config.get("voice_id", "") or ""
top_text = config.get("custom_text", "") or ""
if top_voice_id and top_text:
tts_cfg = {
"enabled": True,
"voice_id": top_voice_id,
"text": top_text,
"align_mode": "full",
"overlap_mode": "replace",
}
logger.info(
"[unified-render] 检测到顶层 voice_id+custom_text,桥接到 tts 配置: plan_id=%s voice_id=%s text_len=%d",
self.plan.id,
top_voice_id,
len(top_text),
)
tts_config = TtsConfig.parse(tts_cfg)
if not tts_config.enabled:
return False