fix(ai-avatar): 修复三个bug——封面重影/标题字号缩放/对口型音频截断 #1876

Merged
xiaoxia merged 2 commits from fix/ai-avatar-three-bugs-0913 into develop 2026-09-13 14:15:31 +08:00
Owner

修复内容

Bug1:封面展示区重复叠加标题(重影)

  • 删除 PanelCoverAndGenerate.tsx 封面展示区重复叠加的标题 div(成片帧已经通过 Canvas PNG overlay 带标题,CSS 叠字造成重影)
  • 删除未使用的 FONT_FAMILY_MAP/getFontFamily/titleOverlayStyle/showTitleOverlay/titleConfig prop
  • 父组件 AiAvatarPage.tsx 同步移除 titleConfig prop 传参

Bug2:标题字号没有按视频分辨率缩放(预览与成片字号不一致)

  • titleCanvas.ts:约定 titleConfig.size 语义为「720p 基准宽度下的字号(px)」,新增 scale = videoWidth / 720,字号/lineGap/PAD/shadowBlur/shadowOffsetY/strokeWidth 等所有长度参数统一 Math.round 乘 scale
  • PanelLipsyncPreview.tsx:使用 useRef + ResizeObserver 动态测量预览容器实际 clientWidth,算出 previewScale = containerWidth / 720,字号/padding/WebkitTextStroke 宽度/textShadow 模糊半径与偏移都按 previewScale 缩放;拖拽定位 pos_x/pos_y 已是百分比,无需改动

Bug3:对口型视频时长截断(enable_video_loop 默认 false)

  • 前端 AiAvatarPage.tsxenable_video_loop: falsetrue
  • 后端 schemas/lipsync.py:CreateLipsyncJobRequest 默认值改为 True
  • 后端 services/lipsync_service.py create_job 默认值改为 True
  • 后端 services/mediakit_client.py submit_lipsync 默认值改为 True,且始终显式传 enable_video_loop(之前只在 True 时传,显式 False 会丢失)
  • 同步更新对应单测断言

测试

  • 后端 pytest:tests/unit/test_video_filter_builder.py tests/unit/test_lipsync_tts_preview.py tests/unit/test_sentence_timings.py tests/unit/test_lipsync_tts.py tests/unit/test_lipsync_routes.py tests/unit/test_mediakit_client.py 共 210 个用例全部通过
## 修复内容 ### Bug1:封面展示区重复叠加标题(重影) - 删除 `PanelCoverAndGenerate.tsx` 封面展示区重复叠加的标题 div(成片帧已经通过 Canvas PNG overlay 带标题,CSS 叠字造成重影) - 删除未使用的 `FONT_FAMILY_MAP`/`getFontFamily`/`titleOverlayStyle`/`showTitleOverlay`/`titleConfig` prop - 父组件 `AiAvatarPage.tsx` 同步移除 `titleConfig` prop 传参 ### Bug2:标题字号没有按视频分辨率缩放(预览与成片字号不一致) - `titleCanvas.ts`:约定 `titleConfig.size` 语义为「720p 基准宽度下的字号(px)」,新增 `scale = videoWidth / 720`,字号/lineGap/PAD/shadowBlur/shadowOffsetY/strokeWidth 等所有长度参数统一 Math.round 乘 scale - `PanelLipsyncPreview.tsx`:使用 useRef + ResizeObserver 动态测量预览容器实际 clientWidth,算出 `previewScale = containerWidth / 720`,字号/padding/WebkitTextStroke 宽度/textShadow 模糊半径与偏移都按 previewScale 缩放;拖拽定位 pos_x/pos_y 已是百分比,无需改动 ### Bug3:对口型视频时长截断(enable_video_loop 默认 false) - 前端 `AiAvatarPage.tsx`:`enable_video_loop: false` → `true` - 后端 `schemas/lipsync.py`:CreateLipsyncJobRequest 默认值改为 True - 后端 `services/lipsync_service.py` create_job 默认值改为 True - 后端 `services/mediakit_client.py` submit_lipsync 默认值改为 True,且始终显式传 `enable_video_loop`(之前只在 True 时传,显式 False 会丢失) - 同步更新对应单测断言 ## 测试 - 后端 pytest:`tests/unit/test_video_filter_builder.py tests/unit/test_lipsync_tts_preview.py tests/unit/test_sentence_timings.py tests/unit/test_lipsync_tts.py tests/unit/test_lipsync_routes.py tests/unit/test_mediakit_client.py` 共 210 个用例全部通过
xiaoxia added 1 commit 2026-09-13 13:29:06 +08:00
fix(ai-avatar): 修复三个bug——封面重影/标题字号缩放/对口型音频截断
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 / PR Build API Image (pull_request) Successful in 1m12s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m28s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 1m33s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m49s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m48s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 2m16s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 2m28s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 2m54s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m8s
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (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 Merge on CI Green + Approved (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 73h54m41s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 73h54m24s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 73h54m13s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 73h54m18s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 73h54m0s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 73h54m0s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 73h54m7s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 73h54m12s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 73h54m12s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 73h54m18s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 73h54m19s
5f128d175d
1. 删除封面展示区重复叠加的标题div(成片帧已含标题,不再CSS叠字)
2. 标题字号按视频分辨率等比缩放,预览容器动态测量宽度计算scale
3. enable_video_loop默认改为true,防止TTS音频长于出镜视频时被截断

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1876 | | 预览链接 | [https://pr-1876.preview.xiaoxiajianji.com](https://pr-1876.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot added 1 commit 2026-09-13 13:32:54 +08:00
style: auto-format with black + isort + ruff + prettier [skip ci-format-check]
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 5s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 26s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 32s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 47s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 49s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m50s
AI Code Review / AI Code Review (pull_request) Successful in 6m16s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Failing after 12m8s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m2s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 10m34s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m36s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 1m43s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 2m4s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 5m28s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 9m34s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 4s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 10s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 17s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 73h50m43s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 73h29m8s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 73h50m44s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 73h50m44s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 73h50m21s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 73h50m21s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 73h28m45s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 73h28m42s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 73h50m20s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 73h50m20s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 73h50m21s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 73h50m26s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 73h28m42s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 73h28m45s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 73h38m21s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 73h50m20s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 73h50m21s
9be89484e6
xiaoxia merged commit c613f35662 into develop 2026-09-13 14:15:31 +08:00

🗑️ 预览环境已清理

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

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

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