feat(voices): TtsModal 根据音色来源切换语言选项(预置限 zh/en)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React from "react"
|
||||
import React, { useMemo } from "react"
|
||||
import { Modal } from "antd"
|
||||
import { type TtsModalProps, type TtsStatus } from "./tts-modal/types"
|
||||
import TextInputSection from "./tts-modal/TextInputSection"
|
||||
@@ -9,6 +9,7 @@ import LanguageControl from "./tts-modal/LanguageControl"
|
||||
import SynthesizeButton from "./tts-modal/SynthesizeButton"
|
||||
import ErrorAlert from "./tts-modal/ErrorAlert"
|
||||
import ResultPanel from "./tts-modal/ResultPanel"
|
||||
import { PRESET_TTS_LANGUAGE_OPTIONS, CLONE_TTS_LANGUAGE_OPTIONS } from "./tts-modal/constants"
|
||||
|
||||
/** AI 配音弹窗 */
|
||||
const TtsModal: React.FC<TtsModalProps> = ({
|
||||
@@ -32,6 +33,13 @@ const TtsModal: React.FC<TtsModalProps> = ({
|
||||
onSynthesize,
|
||||
onSave,
|
||||
}) => {
|
||||
// 预置音色(含空默认)仅支持 zh/en;克隆音色支持全语言列表
|
||||
const isCloneVoice = useMemo(
|
||||
() => !!ttsVoiceId && clonedVoices.some((v) => v.id === ttsVoiceId),
|
||||
[ttsVoiceId, clonedVoices],
|
||||
)
|
||||
const languageOptions = isCloneVoice ? CLONE_TTS_LANGUAGE_OPTIONS : PRESET_TTS_LANGUAGE_OPTIONS
|
||||
|
||||
return (
|
||||
<Modal title="AI 配音" open={open} onCancel={onClose} footer={null} width={560}>
|
||||
<div
|
||||
@@ -57,7 +65,11 @@ const TtsModal: React.FC<TtsModalProps> = ({
|
||||
}}
|
||||
>
|
||||
<EmotionControl emotion={ttsEmotion} onChange={onEmotionChange} />
|
||||
<LanguageControl language={ttsLanguage} onChange={onLanguageChange} />
|
||||
<LanguageControl
|
||||
language={ttsLanguage}
|
||||
onChange={onLanguageChange}
|
||||
options={languageOptions}
|
||||
/>
|
||||
</div>
|
||||
<SpeedControl speed={ttsSpeed} onChange={onSpeedChange} />
|
||||
<SynthesizeButton status={ttsStatus} text={ttsText} onClick={onSynthesize} />
|
||||
|
||||
Reference in New Issue
Block a user