fix(preview): 预览渲染支持标题配置,解决封面标题时序问题 #1378

Merged
auto-approve-bot merged 2 commits from fix/preview-title-before-cover into develop 2026-08-15 17:06:00 +08:00
Owner

根因

封面抽帧发生在预览视频渲染时(Step 3),但用户选标题在渲染之后(Step 4),导致封面天然没有标题。

修复方案

彻底方案:调整步骤时序,标题步骤移到预览之前,预览渲染时烧录标题到视频中。

前端改动(前端 Agent 负责)

  • 步骤顺序:模板→素材→配音→标题→预览→封面→确认
  • 预览接口传 title_config 参数

后端改动

  1. 预览 API schema: 新增 title_config dict 字段(可选)
  2. 预览路由: 序列化 title_config → JSON 存入 custom_title 传给 Worker
  3. Worker 渲染: 解析 JSON 格式 custom_title,合并标题文本+样式到 plan.config["title"]
  4. 封面 API: 移除 PR #1375 的 drawtext 临时方案(视频已带标题,不需要图片叠加)

向后兼容

  • title_config 全部可选,不传时行为不变
  • custom_title 支持 JSON(新)和纯文本(旧)两种格式

测试

  • 新增 12 个测试(test_preview_title_config.py)
  • 删除旧的 12 个测试(test_cover_title_overlay.py)
  • 全量测试 13654 passed
## 根因 封面抽帧发生在预览视频渲染时(Step 3),但用户选标题在渲染之后(Step 4),导致封面天然没有标题。 ## 修复方案 彻底方案:调整步骤时序,标题步骤移到预览之前,预览渲染时烧录标题到视频中。 ### 前端改动(前端 Agent 负责) - 步骤顺序:模板→素材→配音→**标题**→预览→封面→确认 - 预览接口传 title_config 参数 ### 后端改动 1. **预览 API schema**: 新增 `title_config` dict 字段(可选) 2. **预览路由**: 序列化 title_config → JSON 存入 `custom_title` 传给 Worker 3. **Worker 渲染**: 解析 JSON 格式 custom_title,合并标题文本+样式到 `plan.config["title"]` 4. **封面 API**: 移除 PR #1375 的 drawtext 临时方案(视频已带标题,不需要图片叠加) ### 向后兼容 - `title_config` 全部可选,不传时行为不变 - `custom_title` 支持 JSON(新)和纯文本(旧)两种格式 ### 测试 - 新增 12 个测试(test_preview_title_config.py) - 删除旧的 12 个测试(test_cover_title_overlay.py) - 全量测试 13654 passed
xiaoxia added 1 commit 2026-08-15 16:49:58 +08:00
fix(preview): 预览渲染支持标题配置,解决封面标题时序问题
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 / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
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 / Check if frontend-only change (pull_request) Successful in 24s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m2s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m20s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m28s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m44s
CI/CD Pipeline / Validate - Code Quality (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
8f1e03ba4c
根因:封面抽帧发生在预览视频渲染时,但用户选标题在渲染之后,
导致封面天然没有标题。

修复方案(彻底方案):
1. 调整步骤时序:前端将标题步骤移到预览之前
2. 预览 API 接收 title_config(标题文本+样式),渲染时烧录进视频
3. 封面抽帧从已带标题的视频中取帧,自然包含标题

后端改动:
- generation_task.py schema: 新增 title_config dict 字段
- generation_tasks.py command: 新增 title_config 字段
- generation_preview.py: 序列化 title_config 为 JSON 存入 custom_title
- generation.py worker: 解析 JSON 格式 custom_title,合并标题文本+样式到 plan.config["title"]
- generation_cover.py: 移除 PR#1375 的 drawtext 临时方案(不再需要)
- 删除 test_cover_title_overlay.py,新增 test_preview_title_config.py(12测试)

向后兼容:
- title_config 全部可选,不传时行为和之前一致
- custom_title 支持 JSON(新)和纯文本(旧)两种格式

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1378 | | 预览链接 | [https://pr-1378.preview.xiaoxiajianji.com](https://pr-1378.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot added 1 commit 2026-08-15 16:53:58 +08:00
style: auto-format with black + isort + prettier [skip ci-format-check]
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 / Check if frontend-only change (pull_request) Successful in 1m4s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m33s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 2m39s
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m58s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m28s
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
PR Automation / Auto Approve on CI Green (pull_request) Successful in 4m34s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 5m34s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 3m49s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 3m49s
AI Code Review / AI Code Review (pull_request) Successful in 7m9s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m44s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 6m37s
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 / 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
CI/CD Pipeline / CI Gate (pull_request) Successful in 5s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 57s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 57s
be6bc7dacb
auto-approve-bot approved these changes 2026-08-15 17:00:30 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-08-15 17:00:30 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot merged commit 474d7d77e5 into develop 2026-08-15 17:06:00 +08:00
auto-approve-bot deleted branch fix/preview-title-before-cover 2026-08-15 17:06:01 +08:00

🗑️ 预览环境已清理

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

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

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