fix(viral-video): 三阶段 pipeline 补齐 voice_id/voice_source/video_ratio 字段 #2123

Merged
auto-approve-bot merged 1 commits from fix/2122-three-stage-missing-fields into develop 2026-10-01 13:05:40 +08:00
Owner

问题

前端对接三阶段 API(PR #2122)后发现 AnalyzeImagesRequest/GenerateCopyRequest/ConfirmCopyRequest 三个请求类型缺少 STEP1 选的音色、STEP3 选的视频比例字段,导致 _step_tts 和 call_video_generation 无法拿到正确参数。

方案

采用「方案A」:

  • POST /analyze-images 允许携带 voice_id/voice_source/video_ratio(STEP1 选定的音色先存下)
  • POST /{id}/generate-copy 接收并持久化 voice_id/voice_source/video_ratio/style_guide(阶段2一次传齐),会覆盖阶段1传的值
  • confirm-copy 不再单独加字段(STEP3 的参数在阶段2都已传齐)

变更

  • domain/model/session 幂等迁移:新增 voice_id/voice_source/video_ratio 三列
  • 仓储 _to_domain/save/update 同步字段
  • schemas:三个请求 schema + ViralVideoJobResponse 加字段
  • routes:analyze-images 创建 job 时写入;generate-copy 覆盖写入;_to_response 返回
  • worker:
    • _step_tts 优先 job.voice_id → job.persona_id → 默认 longxiaochun_v3
    • _run_render_pipeline 调用 call_video_generation 使用 job.video_ratio(默认 9:16,首帧图模式会自动不传 ratio,保持 #2110 修复)
  • 前端 TS types:AnalyzeImagesRequest/GenerateCopyRequest/ViralVideoJob 加字段(可选,保持向后兼容)
  • 95 个 viral 单测全通过(含 2 个新增用例验证字段持久化)

兼容性

  • 所有字段都带默认值,旧调用方不传不会报错
  • 旧 /generate + /confirm-intent 路径 persona_id 仍可作为 voice_id 兜底
  • 数据库迁移是幂等 ALTER TABLE,staging/prod 启动时自动补列
## 问题 前端对接三阶段 API(PR #2122)后发现 AnalyzeImagesRequest/GenerateCopyRequest/ConfirmCopyRequest 三个请求类型缺少 STEP1 选的音色、STEP3 选的视频比例字段,导致 _step_tts 和 call_video_generation 无法拿到正确参数。 ## 方案 采用「方案A」: - POST /analyze-images 允许携带 voice_id/voice_source/video_ratio(STEP1 选定的音色先存下) - POST /{id}/generate-copy 接收并持久化 voice_id/voice_source/video_ratio/style_guide(阶段2一次传齐),会覆盖阶段1传的值 - confirm-copy 不再单独加字段(STEP3 的参数在阶段2都已传齐) ## 变更 - domain/model/session 幂等迁移:新增 voice_id/voice_source/video_ratio 三列 - 仓储 _to_domain/save/update 同步字段 - schemas:三个请求 schema + ViralVideoJobResponse 加字段 - routes:analyze-images 创建 job 时写入;generate-copy 覆盖写入;_to_response 返回 - worker: - _step_tts 优先 job.voice_id → job.persona_id → 默认 longxiaochun_v3 - _run_render_pipeline 调用 call_video_generation 使用 job.video_ratio(默认 9:16,首帧图模式会自动不传 ratio,保持 #2110 修复) - 前端 TS types:AnalyzeImagesRequest/GenerateCopyRequest/ViralVideoJob 加字段(可选,保持向后兼容) - 95 个 viral 单测全通过(含 2 个新增用例验证字段持久化) ## 兼容性 - 所有字段都带默认值,旧调用方不传不会报错 - 旧 /generate + /confirm-intent 路径 persona_id 仍可作为 voice_id 兜底 - 数据库迁移是幂等 ALTER TABLE,staging/prod 启动时自动补列
xiaoxia force-pushed fix/2122-three-stage-missing-fields from 0615075d5d to b8ae1283f4 2026-10-01 12:40:51 +08:00 Compare
xiaoxia added 1 commit 2026-10-01 12:49:37 +08:00
fix(viral-video): #2122 三阶段 pipeline 补齐 voice_id/voice_source/video_ratio 字段
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 1m21s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m41s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m54s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 2m7s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 2m9s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m30s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 5m13s
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Validate - Style (pull_request) Successful in 5m40s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 6m35s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 6m49s
AI Code Review / AI Code Review (pull_request) Successful in 7m1s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 10m22s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 15m18s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 2s
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 8m8s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 42s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 1m17s
e989ca3a59
- domain/model/schema 新增 voice_id/voice_source/video_ratio 三个字段
- 幂等 ALTER TABLE 迁移补列(voice_id VARCHAR(200) / voice_source VARCHAR(20) / video_ratio VARCHAR(10))
- POST /analyze-images 接收音色/比例参数,创建 job 时持久化
- POST /{id}/generate-copy 接收 voice_id/voice_source/video_ratio/style_guide,写回 job
- _step_tts 优先使用 job.voice_id,空则回退 job.persona_id,再空用默认 longxiaochun_v3
- _run_render_pipeline 调用 call_video_generation 时使用 job.video_ratio(默认 9:16)
- GET /{id} 返回 voice_id/voice_source/video_ratio
- 前端 TS types 同步补字段(AnalyzeImagesRequest/GenerateCopyRequest/ViralVideoJob)
- 新增 2 个单测验证字段持久化;viral 全量 95 个单测通过
xiaoxia force-pushed fix/2122-three-stage-missing-fields from b8ae1283f4 to e989ca3a59 2026-10-01 12:49:37 +08:00 Compare

🚀 预览环境已部署

项目 详情
PR号 #2123
预览链接 https://pr-2123.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #2123 | | 预览链接 | [https://pr-2123.preview.xiaoxiajianji.com](https://pr-2123.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot merged commit 069544da38 into develop 2026-10-01 13:05:40 +08:00
auto-approve-bot deleted branch fix/2122-three-stage-missing-fields 2026-10-01 13:05:45 +08:00

🗑️ 预览环境已清理

PR #2123 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #2123 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Sign in to join this conversation.