feat(web): TTS 情绪扩展为 7 种 + 系统音色语言限 zh/en + 清理残留代码 #1915
Reference in New Issue
Block a user
Delete Branch "feat/1915-tts-emotion-7options"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
变更概览
1. TTS 情绪选项 4 种 → 7 种(对齐 CosyVoice)
旧:自然/兴奋/沉稳/亲切 → natural/excited/calm/friendly
新:
影响文件:
pages/voices/components/tts-modal/constants.ts:TTS_EMOTION_OPTIONS 重写为 7 项,默认值 neutralpages/voices/components/tts-modal/EmotionControl.tsx:沿用新常量pages/ai-avatar/types.ts:VoiceEmotion 类型 + VOICE_EMOTION_OPTIONS 重写pages/ai-avatar/utils/contract.ts:normalizeEmotion() 支持新枚举,并兼容旧 4 种英文枚举与旧中文标签(自然/兴奋/沉稳/亲切)自动映射,后端老数据不炸pages/ai-avatar/hooks/useAiAvatar.ts:默认情绪 naturalpages/ai-avatar/api/aiAvatar.ts:注释更新api/tts/types.ts:TTSPreviewRequest.emotion 注释更新2. 系统预置音色语言限制为 zh/en
影响文件:
pages/voices/components/tts-modal/constants.ts:拆分为 PRESET_TTS_LANGUAGE_OPTIONS / CLONE_TTS_LANGUAGE_OPTIONSpages/voices/components/tts-modal/LanguageControl.tsx:新增 options prop,自动 fallback 非法值到中文pages/voices/components/TtsModal.tsx:根据当前音色是否克隆决定语言选项pages/voices/hooks/useTtsSynthesize.ts:新增 handleVoiceChange,切换音色时做语言回退;合成前防御校验pages/voices/VoiceLibrary.tsx:接入 handleVoiceChangepages/ai-avatar/types.ts:拆分为 PRESET_VOICE_LANGUAGE_OPTIONS / CLONE_VOICE_LANGUAGE_OPTIONS,预置默认 zhpages/ai-avatar/components/PanelVoiceSelector.tsx:根据 voiceSource 动态过滤语言选项pages/ai-avatar/hooks/useAiAvatar.ts:默认语言 zh3. 清理残留
测试
🚀 预览环境已部署
CI全绿,自动审批通过。
CI全绿,自动审批通过。
🗑️ 预览环境已清理
PR #1915 已关闭或合并,对应的预览环境已被清理。