feat(web): TTS配音情感风格选择器 #2000

Merged
xiaoxia merged 1 commits from feat/tts-emotion-style into develop 2026-09-20 12:52:48 +08:00
Owner

改动概述

在所有TTS配音入口新增「配音风格」选择器,支持6种预设风格。

风格预设

value 标签 emoji 描述
natural 自然亲切(默认) 😊 亲切自然,像朋友聊天
excited 激动兴奋 🤩 语速稍快,充满活力
professional 沉稳专业 🧑‍💼 语速适中,正式可靠
sweet 温柔甜美 🌸 语速轻柔
news 新闻播报 📰 字正腔圆,严肃正式
livestream 直播带货 🎤 热情有感染力,有节奏感

改动范围

新增

  • src/api/tts/styles.ts — TTS_STYLE_OPTIONS 常量 + TtsStyle 类型 + DEFAULT_TTS_STYLE + getTtsStyle() 容错查找
  • src/components/voice/TtsStyleSelector/index.tsx — 共享风格选择器组件,支持 compact(3列小按钮)和 normal(3列卡片)两种模式,紫色主题 (#7c3aed)

修改

  • API类型
    • api/tts/types.ts:TTSSynthesizeRequest、TTSPreviewRequest 加 style?: string
    • api/template-editor/types.ts:SegmentTtsConfig 加 style?: string(为剪辑规划器TtsPanel预留,UI尚未开发)
    • pages/ai-avatar/api/aiAvatar.ts:previewTts、createLipsyncJob 加 style?: string
  • 配音库(voices):hook 新增 ttsStyle state → TtsModal 内嵌 compact 选择器 → synthesize payload 透传
  • 音色素材库(voice-materials):同上
  • 生成页 Step5 配音(generate):useGenerateFormState 新增 ttsStyle → TtsVoiceModal 内部/外部受控双模式 → synthesize payload + 叙事模式 tts_style 字段
  • 数字人对口型(ai-avatar):useAiAvatar 新增 style state → PanelVoiceSelector 紧凑选择器(语速下方) → previewTts + createLipsyncJob 两条路径都传 style;试听缓存key包含style避免串音

设计要点

  1. style 与现有 emotion(CosyVoice 7基础情绪)独立并存,互不影响;后端可将 style 映射为 emotion+speed+prompt 组合
  2. 所有 style 参数均为可选(style?: string),未传时后端默认 natural,无破坏性
  3. 共享组件统一紫色主题,与TtsVoiceModal主按钮色系一致
  4. 前端-only PR,后端接口稍后支持;传了就按情感合成,没传默认自然

验证

  • Prettier 已格式化
  • 本地无 ESLint/TS 依赖无法跑全量lint,依赖 CI 校验
## 改动概述 在所有TTS配音入口新增「配音风格」选择器,支持6种预设风格。 ## 风格预设 | value | 标签 | emoji | 描述 | |-------|------|-------|------| | natural | 自然亲切(默认) | 😊 | 亲切自然,像朋友聊天 | | excited | 激动兴奋 | 🤩 | 语速稍快,充满活力 | | professional | 沉稳专业 | 🧑‍💼 | 语速适中,正式可靠 | | sweet | 温柔甜美 | 🌸 | 语速轻柔 | | news | 新闻播报 | 📰 | 字正腔圆,严肃正式 | | livestream | 直播带货 | 🎤 | 热情有感染力,有节奏感 | ## 改动范围 ### 新增 - `src/api/tts/styles.ts` — TTS_STYLE_OPTIONS 常量 + TtsStyle 类型 + DEFAULT_TTS_STYLE + getTtsStyle() 容错查找 - `src/components/voice/TtsStyleSelector/index.tsx` — 共享风格选择器组件,支持 compact(3列小按钮)和 normal(3列卡片)两种模式,紫色主题 (#7c3aed) ### 修改 - **API类型**: - `api/tts/types.ts`:TTSSynthesizeRequest、TTSPreviewRequest 加 `style?: string` - `api/template-editor/types.ts`:SegmentTtsConfig 加 `style?: string`(为剪辑规划器TtsPanel预留,UI尚未开发) - `pages/ai-avatar/api/aiAvatar.ts`:previewTts、createLipsyncJob 加 `style?: string` - **配音库(voices)**:hook 新增 ttsStyle state → TtsModal 内嵌 compact 选择器 → synthesize payload 透传 - **音色素材库(voice-materials)**:同上 - **生成页 Step5 配音(generate)**:useGenerateFormState 新增 ttsStyle → TtsVoiceModal 内部/外部受控双模式 → synthesize payload + 叙事模式 tts_style 字段 - **数字人对口型(ai-avatar)**:useAiAvatar 新增 style state → PanelVoiceSelector 紧凑选择器(语速下方) → previewTts + createLipsyncJob 两条路径都传 style;试听缓存key包含style避免串音 ## 设计要点 1. style 与现有 emotion(CosyVoice 7基础情绪)独立并存,互不影响;后端可将 style 映射为 emotion+speed+prompt 组合 2. 所有 style 参数均为可选(`style?: string`),未传时后端默认 natural,无破坏性 3. 共享组件统一紫色主题,与TtsVoiceModal主按钮色系一致 4. 前端-only PR,后端接口稍后支持;传了就按情感合成,没传默认自然 ## 验证 - Prettier 已格式化 - 本地无 ESLint/TS 依赖无法跑全量lint,依赖 CI 校验
xiaoxia force-pushed feat/tts-emotion-style from 9d42c24b09 to d7a1c8ee07 2026-09-20 11:25:23 +08:00 Compare
xiaoxia added 1 commit 2026-09-20 11:30:41 +08:00
feat(web): add TTS emotion style selector across TTS modals and avatar panel
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 1s
CI/CD Pipeline / Check push changed paths (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) Successful in 1m0s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 1m16s
CI/CD Pipeline / PR Build API Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 57s
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been skipped
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 / PR Build Web Image (pull_request) Successful in 49s
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 / 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
AI Code Review / AI Code Review (pull_request) Successful in 7m49s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 8m43s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 10m36s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 32m35s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 34m58s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 42m0s
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 1s
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
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 31s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 5m7s
5e0e32b1c2
- Add TTS_STYLE_OPTIONS (6 presets: natural/excited/professional/sweet/news/livestream)
  with DEFAULT_TTS_STYLE=natural and shared getTtsStyle() helper
- Add reusable TtsStyleSelector component (compact + normal modes, purple theme)
- Wire style param through all TTS paths:
  * api/tts types: TTSSynthesizeRequest + TTSPreviewRequest add style?: string
  * voices library: hook state → TtsModal compact selector → synthesize payload
  * voice-materials library: hook state → TtsModal compact selector → payload
  * generate Step5: formState → TtsVoiceModal (internal/external controlled)
    → synthesize payload → narrative video payload tts_style
  * ai-avatar lipsync: hook state → PanelVoiceSelector → previewTts + createLipsyncJob
- SegmentTtsConfig adds style?: string for editing-planner TtsPanel (UI pending)
- All style params optional; backend will honor when supported, default natural
xiaoxia force-pushed feat/tts-emotion-style from d7a1c8ee07 to 5e0e32b1c2 2026-09-20 11:30:41 +08:00 Compare
auto-approve-bot approved these changes 2026-09-20 11:32:00 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-09-20 11:32:00 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #2000 | | 预览链接 | [https://pr-2000.preview.xiaoxiajianji.com](https://pr-2000.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
xiaoxia merged commit 8413713315 into develop 2026-09-20 12:52:48 +08:00
xiaoxia deleted branch feat/tts-emotion-style 2026-09-20 12:52:50 +08:00

🗑️ 预览环境已清理

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

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

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