fix(frontend): #1898 配音库AI配音增加情绪语言选择 #1904

Merged
auto-approve-bot merged 9 commits from fix/1898-tts-emotion-language into develop 2026-09-14 18:05:01 +08:00
Owner

背景

Fix #1898

配音库 AI 配音弹窗(TtsModal)目前只有语速滑块,缺少情绪和语言选择。后端 CosyVoice 已完整支持 emotion/language 参数透传(Schema 已定义),本次前端补控件并真实传参。

修改

新增组件(与 SpeedControl 风格一致,原生 select,沿用 CSS 变量)

  • tts-modal/constants.ts:TTS_EMOTION_OPTIONS(自然/兴奋/沉稳/亲切,默认 natural)、TTS_LANGUAGE_OPTIONS(中文 zh-CN/英文 en/日文 ja/韩文 ko,默认 zh-CN)、类型与默认值
  • tts-modal/EmotionControl.tsx:情绪下拉
  • tts-modal/LanguageControl.tsx:语言下拉

修改

  • api/tts/types.ts:TTSSynthesizeRequest 增加 emotion?: string;TTSPreviewRequest 增加 language?: string
  • tts-modal/types.ts:TtsModalProps 新增 ttsEmotion/ttsLanguage/onEmotionChange/onLanguageChange
  • components/TtsModal.tsx:在 VoiceSelector 下方用 grid 两列布局放 EmotionControl + LanguageControl,再放 SpeedControl
  • components/VoiceModals.tsx:透传 4 个新增 props
  • hooks/useTtsSynthesize.ts:新增 ttsEmotion/ttsLanguage 状态(含默认值)、synthesizeSpeech 请求体带 emotion/language、关闭弹窗时重置、return 暴露状态与 setters
  • VoiceLibrary.tsx:解构新状态,传给 VoiceModals

设计说明

  • 情绪/语言 放音色选择与语速之间(两列并排),保持弹窗宽度 560 不溢出
  • 未新增第三方依赖,沿用原生 select 与 CSS 变量,与现有 SpeedControl 视觉一致
  • useAudioPlayer 音色列表试听(固定 VOICE_PREVIEW_TEXT + speed:1.0)保持默认 emotion=natural、language=zh-CN(后端默认值),不受弹窗参数影响,避免破坏列表交互
  • 参数在试听(synthesizeSpeech) 和正式合成(同一函数)均带上,真正透传到后端,不是 UI 摆设

验收

  • 配音弹窗有情绪/语言下拉
  • 选择不同情绪/语言后点合成,请求体包含对应参数
  • 关闭弹窗再打开重置为默认(自然/中文)
  • 语速滑块、音色选择、合成、保存功能正常
  • CI 全绿
## 背景 Fix #1898 配音库 AI 配音弹窗(TtsModal)目前只有语速滑块,缺少情绪和语言选择。后端 CosyVoice 已完整支持 emotion/language 参数透传(Schema 已定义),本次前端补控件并真实传参。 ## 修改 ### 新增组件(与 SpeedControl 风格一致,原生 select,沿用 CSS 变量) - `tts-modal/constants.ts`:TTS_EMOTION_OPTIONS(自然/兴奋/沉稳/亲切,默认 natural)、TTS_LANGUAGE_OPTIONS(中文 zh-CN/英文 en/日文 ja/韩文 ko,默认 zh-CN)、类型与默认值 - `tts-modal/EmotionControl.tsx`:情绪下拉 - `tts-modal/LanguageControl.tsx`:语言下拉 ### 修改 - `api/tts/types.ts`:`TTSSynthesizeRequest` 增加 `emotion?: string`;`TTSPreviewRequest` 增加 `language?: string` - `tts-modal/types.ts`:`TtsModalProps` 新增 ttsEmotion/ttsLanguage/onEmotionChange/onLanguageChange - `components/TtsModal.tsx`:在 VoiceSelector 下方用 grid 两列布局放 EmotionControl + LanguageControl,再放 SpeedControl - `components/VoiceModals.tsx`:透传 4 个新增 props - `hooks/useTtsSynthesize.ts`:新增 ttsEmotion/ttsLanguage 状态(含默认值)、synthesizeSpeech 请求体带 emotion/language、关闭弹窗时重置、return 暴露状态与 setters - `VoiceLibrary.tsx`:解构新状态,传给 VoiceModals ## 设计说明 - 情绪/语言 放音色选择与语速之间(两列并排),保持弹窗宽度 560 不溢出 - 未新增第三方依赖,沿用原生 select 与 CSS 变量,与现有 SpeedControl 视觉一致 - useAudioPlayer 音色列表试听(固定 VOICE_PREVIEW_TEXT + speed:1.0)保持默认 emotion=natural、language=zh-CN(后端默认值),不受弹窗参数影响,避免破坏列表交互 - 参数在试听(synthesizeSpeech) 和正式合成(同一函数)均带上,真正透传到后端,不是 UI 摆设 ## 验收 - 配音弹窗有情绪/语言下拉 - 选择不同情绪/语言后点合成,请求体包含对应参数 - 关闭弹窗再打开重置为默认(自然/中文) - 语速滑块、音色选择、合成、保存功能正常 - CI 全绿
xiaoxia added 9 commits 2026-09-14 17:51:34 +08:00
- TTS 弹窗新增情绪下拉(自然/兴奋/沉稳/亲切,默认自然)和语言下拉(中文/英文/日文/韩文,默认中文)
- 新增 EmotionControl、LanguageControl 组件,与 SpeedControl 风格一致(tts-modal 目录下)
- useTtsSynthesize hook 管理 emotion/language 状态,关闭弹窗时重置
- synthesizeSpeech 请求真实传递 emotion 和 language 参数到后端
- VoiceModals/VoiceLibrary 全链路透传新增 props
- api/tts/types 的 TTSSynthesizeRequest 和 TTSPreviewRequest 补充 emotion/language 类型
- TTS 弹窗新增情绪下拉(自然/兴奋/沉稳/亲切,默认自然)和语言下拉(中文/英文/日文/韩文,默认中文)
- 新增 EmotionControl、LanguageControl 组件,与 SpeedControl 风格一致(tts-modal 目录下)
- useTtsSynthesize hook 管理 emotion/language 状态,关闭弹窗时重置
- synthesizeSpeech 请求真实传递 emotion 和 language 参数到后端
- VoiceModals/VoiceLibrary 全链路透传新增 props
- api/tts/types 的 TTSSynthesizeRequest 和 TTSPreviewRequest 补充 emotion/language 类型
- TTS 弹窗新增情绪下拉(自然/兴奋/沉稳/亲切,默认自然)和语言下拉(中文/英文/日文/韩文,默认中文)
- 新增 EmotionControl、LanguageControl 组件,与 SpeedControl 风格一致(tts-modal 目录下)
- useTtsSynthesize hook 管理 emotion/language 状态,关闭弹窗时重置
- synthesizeSpeech 请求真实传递 emotion 和 language 参数到后端
- VoiceModals/VoiceLibrary 全链路透传新增 props
- api/tts/types 的 TTSSynthesizeRequest 和 TTSPreviewRequest 补充 emotion/language 类型
- TTS 弹窗新增情绪下拉(自然/兴奋/沉稳/亲切,默认自然)和语言下拉(中文/英文/日文/韩文,默认中文)
- 新增 EmotionControl、LanguageControl 组件,与 SpeedControl 风格一致(tts-modal 目录下)
- useTtsSynthesize hook 管理 emotion/language 状态,关闭弹窗时重置
- synthesizeSpeech 请求真实传递 emotion 和 language 参数到后端
- VoiceModals/VoiceLibrary 全链路透传新增 props
- api/tts/types 的 TTSSynthesizeRequest 和 TTSPreviewRequest 补充 emotion/language 类型
- TTS 弹窗新增情绪下拉(自然/兴奋/沉稳/亲切,默认自然)和语言下拉(中文/英文/日文/韩文,默认中文)
- 新增 EmotionControl、LanguageControl 组件,与 SpeedControl 风格一致(tts-modal 目录下)
- useTtsSynthesize hook 管理 emotion/language 状态,关闭弹窗时重置
- synthesizeSpeech 请求真实传递 emotion 和 language 参数到后端
- VoiceModals/VoiceLibrary 全链路透传新增 props
- api/tts/types 的 TTSSynthesizeRequest 和 TTSPreviewRequest 补充 emotion/language 类型
- TTS 弹窗新增情绪下拉(自然/兴奋/沉稳/亲切,默认自然)和语言下拉(中文/英文/日文/韩文,默认中文)
- 新增 EmotionControl、LanguageControl 组件,与 SpeedControl 风格一致(tts-modal 目录下)
- useTtsSynthesize hook 管理 emotion/language 状态,关闭弹窗时重置
- synthesizeSpeech 请求真实传递 emotion 和 language 参数到后端
- VoiceModals/VoiceLibrary 全链路透传新增 props
- api/tts/types 的 TTSSynthesizeRequest 和 TTSPreviewRequest 补充 emotion/language 类型
- TTS 弹窗新增情绪下拉(自然/兴奋/沉稳/亲切,默认自然)和语言下拉(中文/英文/日文/韩文,默认中文)
- 新增 EmotionControl、LanguageControl 组件,与 SpeedControl 风格一致(tts-modal 目录下)
- useTtsSynthesize hook 管理 emotion/language 状态,关闭弹窗时重置
- synthesizeSpeech 请求真实传递 emotion 和 language 参数到后端
- VoiceModals/VoiceLibrary 全链路透传新增 props
- api/tts/types 的 TTSSynthesizeRequest 和 TTSPreviewRequest 补充 emotion/language 类型
- TTS 弹窗新增情绪下拉(自然/兴奋/沉稳/亲切,默认自然)和语言下拉(中文/英文/日文/韩文,默认中文)
- 新增 EmotionControl、LanguageControl 组件,与 SpeedControl 风格一致(tts-modal 目录下)
- useTtsSynthesize hook 管理 emotion/language 状态,关闭弹窗时重置
- synthesizeSpeech 请求真实传递 emotion 和 language 参数到后端
- VoiceModals/VoiceLibrary 全链路透传新增 props
- api/tts/types 的 TTSSynthesizeRequest 和 TTSPreviewRequest 补充 emotion/language 类型
fix(frontend): #1898 配音库AI配音增加情绪语言选择
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m6s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m43s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 1m49s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m50s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m14s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 5m17s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 5m29s
AI Code Review / AI Code Review (pull_request) Successful in 6m27s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 12m41s
CI/CD Pipeline / CI Gate (pull_request) Successful in 5s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 11m32s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 6s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 1m9s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 45h19m26s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 45h31m49s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 45h31m59s
CI/CD Pipeline / PR Build API Image (pull_request) Failing after 45h32m7s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 45h31m26s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 45h31m31s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 45h31m36s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 45h31m40s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 45h31m41s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 45h31m41s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 45h31m43s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 45h31m16s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 45h18m53s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 45h18m58s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 45h18m53s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 45h18m58s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 45h31m21s
CI/CD Pipeline / PR Build Worker Image (pull_request) Failing after 45h31m36s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 45h31m40s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 45h31m40s
2091e0bd70
- TTS 弹窗新增情绪下拉(自然/兴奋/沉稳/亲切,默认自然)和语言下拉(中文/英文/日文/韩文,默认中文)
- 新增 EmotionControl、LanguageControl 组件,与 SpeedControl 风格一致(tts-modal 目录下)
- useTtsSynthesize hook 管理 emotion/language 状态,关闭弹窗时重置
- synthesizeSpeech 请求真实传递 emotion 和 language 参数到后端
- VoiceModals/VoiceLibrary 全链路透传新增 props
- api/tts/types 的 TTSSynthesizeRequest 和 TTSPreviewRequest 补充 emotion/language 类型
auto-approve-bot approved these changes 2026-09-14 17:53:27 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

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

CI全绿,自动审批通过。

CI全绿,自动审批通过。

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1904 | | 预览链接 | [https://pr-1904.preview.xiaoxiajianji.com](https://pr-1904.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot merged commit 4f377d4fd3 into develop 2026-09-14 18:05:01 +08:00
auto-approve-bot deleted branch fix/1898-tts-emotion-language 2026-09-14 18:05:02 +08:00

🗑️ 预览环境已清理

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

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

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