From f1f8a7d808d7b3739becf64b50b26738847e46a5 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Wed, 13 Aug 2025 19:17:18 +0700 Subject: [PATCH] support resemble tts (#559) * support resemble tts * wip --- src/api/types.ts | 2 + .../views/applications/speech-selection.tsx | 2 + .../internal/views/speech-services/form.tsx | 77 +++++++++++++++++++ src/vendor/index.tsx | 5 ++ src/vendor/types.ts | 3 +- 5 files changed, 88 insertions(+), 1 deletion(-) diff --git a/src/api/types.ts b/src/api/types.ts index 6089461..2d02cf1 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -440,6 +440,8 @@ export interface SpeechCredential { deepgram_stt_use_tls: number; speechmatics_stt_uri: null | string; playht_tts_uri: null | string; + resemble_tts_uri: null | string; + resemble_tts_use_tls: number; } export interface Alert { diff --git a/src/containers/internal/views/applications/speech-selection.tsx b/src/containers/internal/views/applications/speech-selection.tsx index f7c1aa3..fd103c6 100644 --- a/src/containers/internal/views/applications/speech-selection.tsx +++ b/src/containers/internal/views/applications/speech-selection.tsx @@ -37,6 +37,7 @@ import { VENDOR_OPENAI, VENDOR_INWORLD, VENDOR_DEEPGRAM_RIVER, + VENDOR_RESEMBLE, } from "src/vendor"; import { LabelOptions, @@ -587,6 +588,7 @@ export const SpeechProviderSelection = ({ vendor.value != VENDOR_WELLSAID && vendor.value != VENDOR_ELEVENLABS && vendor.value != VENDOR_WHISPER && + vendor.value !== VENDOR_RESEMBLE && vendor.value !== VENDOR_CUSTOM, )} onChange={(e) => { diff --git a/src/containers/internal/views/speech-services/form.tsx b/src/containers/internal/views/speech-services/form.tsx index 733fba9..10164d0 100644 --- a/src/containers/internal/views/speech-services/form.tsx +++ b/src/containers/internal/views/speech-services/form.tsx @@ -54,6 +54,7 @@ import { VENDOR_OPENAI, VENDOR_INWORLD, VENDOR_DEEPGRAM_RIVER, + VENDOR_RESEMBLE, } from "src/vendor"; import { MSG_REQUIRED_FIELDS } from "src/constants"; import { @@ -207,6 +208,12 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { const [tmpPlayhtTtsUri, setTmpPlayhtTtsUri] = useState(""); const [initialPlayhtOnpremCheck, setInitialPlayhtOnpremCheck] = useState(false); + const [resembleTtsUri, setResembleTtsUri] = useState(""); + const [tmpResembleTtsUri, setTmpResembleTtsUri] = useState(""); + const [initialResembleOnpremCheck, setInitialResembleOnpremCheck] = + useState(false); + const [resembleTtsUseTls, setResembleTtsUseTls] = useState(false); + const [tmpResembleTtsUseTls, setTmpResembleTtsUseTls] = useState(false); const handleFile = (file: File) => { const handleError = () => { setGoogleServiceKey(null); @@ -481,6 +488,10 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { ...(vendor === VENDOR_PLAYHT && { playht_tts_uri: playhtTtsUri || null, }), + ...(vendor === VENDOR_RESEMBLE && { + resemble_tts_uri: resembleTtsUri || null, + resemble_tts_use_tls: resembleTtsUseTls ? 1 : 0, + }), }; if (credential && credential.data) { @@ -531,6 +542,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { vendor === VENDOR_WHISPER || vendor === VENDOR_CARTESIA || vendor === VENDOR_OPENAI || + vendor === VENDOR_RESEMBLE || vendor === VENDOR_DEEPGRAM_RIVER ? apiKey : null, @@ -798,6 +810,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { if (credential?.data?.playht_tts_uri) { setPlayhtTtsUri(credential.data.playht_tts_uri); } + if (credential?.data?.resemble_tts_uri) { + setResembleTtsUri(credential.data.resemble_tts_uri); + } } if (credential?.data?.options) { setOptions(credential.data.options); @@ -867,6 +882,15 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { setSpeechmaticsEndpoint(credential.data.speechmatics_stt_uri); } setInitialPlayhtOnpremCheck(hasValue(credential?.data?.playht_tts_uri)); + setInitialResembleOnpremCheck(hasValue(credential?.data?.resemble_tts_uri)); + if (credential?.data?.resemble_tts_use_tls) { + setResembleTtsUseTls( + credential?.data?.resemble_tts_use_tls > 0 ? true : false, + ); + setTmpResembleTtsUseTls( + credential?.data?.resemble_tts_use_tls > 0 ? true : false, + ); + } }, [credential]); const updateCustomVoices = ( @@ -1005,6 +1029,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { vendor !== VENDOR_PLAYHT && vendor !== VENDOR_RIMELABS && vendor !== VENDOR_INWORLD && + vendor !== VENDOR_RESEMBLE && vendor !== VENDOR_ELEVENLABS && (