diff --git a/apps/web/src/api/tts/types.ts b/apps/web/src/api/tts/types.ts index ab4dda8b8..9bfec5498 100644 --- a/apps/web/src/api/tts/types.ts +++ b/apps/web/src/api/tts/types.ts @@ -105,7 +105,7 @@ export interface TTSPreviewRequest { speed?: number pitch?: number language?: string - emotion?: string // 情绪参数:natural/excited/calm/friendly + emotion?: string // 情绪参数:neutral/happy/sad/angry/surprised/fearful/disgusted(后端 normalize_emotion() 兼容旧 natural/excited/calm/friendly 与中文标签) } /** TTS 试听响应 */ diff --git a/apps/web/src/pages/ai-avatar/api/aiAvatar.ts b/apps/web/src/pages/ai-avatar/api/aiAvatar.ts index ae3a4159d..152c7a193 100644 --- a/apps/web/src/pages/ai-avatar/api/aiAvatar.ts +++ b/apps/web/src/pages/ai-avatar/api/aiAvatar.ts @@ -55,7 +55,7 @@ export const createLipsyncJob = async (data: { script_text?: string /** 语速 0.5~2.0,默认 1.0(TTS 直生模式用) */ speed?: number - /** 情绪英文枚举:natural/excited/calm/friendly(TTS 直生模式用) */ + /** 情绪英文枚举:neutral/happy/sad/angry/surprised/fearful/disgusted(TTS 直生模式用;前端经 normalizeEmotion 归一化) */ emotion?: string enable_video_loop?: boolean project_id?: string diff --git a/apps/web/src/pages/ai-avatar/components/PanelVoiceSelector.tsx b/apps/web/src/pages/ai-avatar/components/PanelVoiceSelector.tsx index 6269e7663..58cd92f33 100644 --- a/apps/web/src/pages/ai-avatar/components/PanelVoiceSelector.tsx +++ b/apps/web/src/pages/ai-avatar/components/PanelVoiceSelector.tsx @@ -13,7 +13,8 @@ import { type VoiceEmotion, type VoiceLanguage, VOICE_EMOTION_OPTIONS, - VOICE_LANGUAGE_OPTIONS, + PRESET_VOICE_LANGUAGE_OPTIONS, + CLONE_VOICE_LANGUAGE_OPTIONS, } from "../types" interface PanelVoiceSelectorProps { @@ -91,6 +92,12 @@ export function PanelVoiceSelector({ const NO_PREVIEW_TIP = "该音色暂无试听音频,请先用此音色生成一段配音后再试听" + // 系统预置音色仅支持 zh/en;克隆音色支持全语言 + const languageOptions = + voiceSource === "clone" ? CLONE_VOICE_LANGUAGE_OPTIONS : PRESET_VOICE_LANGUAGE_OPTIONS + // 当前语言不在可选列表(切回预置时 ja/ko/cantonese/mandarin 失效)→ 自动回退到中文 + const effectiveLanguage = languageOptions.some((o) => o.value === language) ? language : "zh" + /** 用指定 URL 真实播放(抽取公共) */ const playAudioUrl = (voiceId: string, url: string) => { // 临时兼容:后端 /tts/preview 返回 HTTP URL,staging 是 HTTPS,Mixed Content 会阻止加载 @@ -289,10 +296,12 @@ export function PanelVoiceSelector({