diff --git a/src/api/constants.ts b/src/api/constants.ts index 3061e7a..f60a9b8 100644 --- a/src/api/constants.ts +++ b/src/api/constants.ts @@ -1,5 +1,6 @@ import type { Currency, + ElevenLabsOptions, LimitField, LimitUnitOption, PasswordSettings, @@ -210,6 +211,15 @@ export const GOOGLE_CUSTOM_VOICES_REPORTED_USAGE = [ { name: "REALTIME", value: "REALTIME" }, { name: "OFFLINE", value: "OFFLINE" }, ]; +// Eleven Labs options +export const DEFAULT_ELEVENLABS_OPTIONS: Partial = { + optimize_streaming_latency: 100, + voice_settings: { + stability: 0.5, + similarity_boost: 0.5, + use_speaker_boost: true, + }, +}; /** Password Length options */ export const PASSWORD_MIN = 8; diff --git a/src/api/types.ts b/src/api/types.ts index e9a3219..c91f6fc 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -417,6 +417,7 @@ export interface SpeechCredential { cobalt_server_uri: null | string; model_id: null | string; model: null | string; + options: null | string; } export interface Alert { @@ -712,3 +713,13 @@ export interface GetLanguages extends GetVoices { export interface LanguageOption extends SelectorOptions { [key: string]: unknown; } + +export interface ElevenLabsOptions { + optimize_streaming_latency: number; + voice_settings: Partial<{ + similarity_boost: number; + stability: number; + style: number; + use_speaker_boost: boolean; + }>; +} diff --git a/src/containers/internal/views/speech-services/form.tsx b/src/containers/internal/views/speech-services/form.tsx index 90de11f..a0e56a3 100644 --- a/src/containers/internal/views/speech-services/form.tsx +++ b/src/containers/internal/views/speech-services/form.tsx @@ -66,6 +66,7 @@ import type { } from "src/api/types"; import { setAccountFilter, setLocation } from "src/store/localStore"; import { + DEFAULT_ELEVENLABS_OPTIONS, DEFAULT_GOOGLE_CUSTOM_VOICES_REPORTED_USAGE, DISABLE_CUSTOM_SPEECH, GOOGLE_CUSTOM_VOICES_REPORTED_USAGE, @@ -140,6 +141,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { const [customVoices, setCustomVoices] = useState([]); const [customVoicesMessage, setCustomVoicesMessage] = useState(""); const ttsModels = useTtsModels(); + const [optionsInitialChecked, setOptionsInitialChecked] = useState(false); + const [options, setOptions] = useState(""); + const [tmpOptions, setTmpOptions] = useState(""); const handleFile = (file: File) => { const handleError = () => { @@ -285,6 +289,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { ...((vendor === VENDOR_ELEVENLABS || vendor === VENDOR_WHISPER) && { model_id: ttsModelId || null, }), + ...(vendor === VENDOR_ELEVENLABS && { + options: options || null, + }), }; if (credential && credential.data) { @@ -502,6 +509,10 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { setTtsModelId(credential.data.model_id); } } + if (credential?.data?.options) { + setOptions(credential.data.options); + setOptionsInitialChecked(true); + } if (credential?.data?.vendor === VENDOR_GOOGLE) { // let try to check if there is custom voices getGoogleCustomVoices({ @@ -1124,6 +1135,86 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { /> )} + {vendor === VENDOR_ELEVENLABS && ( +
+