diff --git a/src/api/types.ts b/src/api/types.ts index a2f1a0d..e7f616e 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -423,6 +423,7 @@ export interface SpeechCredential { model: null | string; options: null | string; deepgram_stt_uri: null | string; + deepgram_tts_uri: null | string; deepgram_stt_use_tls: number; } diff --git a/src/containers/internal/views/speech-services/form.tsx b/src/containers/internal/views/speech-services/form.tsx index 9e69115..048ec35 100644 --- a/src/containers/internal/views/speech-services/form.tsx +++ b/src/containers/internal/views/speech-services/form.tsx @@ -160,12 +160,13 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { const [options, setOptions] = useState(""); const [tmpOptions, setTmpOptions] = useState(""); const [deepgramSttUri, setDeepgramSttUri] = useState(""); + const [deepgramTtsUri, setDeepgramTtsUri] = useState(""); const [tmpDeepgramSttUri, setTmpDeepgramSttUri] = useState(""); + const [tmpDeepgramTtsUri, setTmpDeepgramTtsUri] = useState(""); const [deepgramSttUseTls, setDeepgramSttUseTls] = useState(false); const [tmpDeepgramSttUseTls, setTmpDeepgramSttUseTls] = useState(false); const [initialDeepgramOnpremCheck, setInitialDeepgramOnpremCheck] = useState(false); - const [isDeepgramOnpremEnabled, setIsDeepgramOnpremEnabled] = useState(false); const [awsCredentialType, setAwsCredentialType] = useState( AWS_CREDENTIAL_ACCESS_KEY, ); @@ -356,6 +357,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { }), ...(vendor === VENDOR_DEEPGRAM && { deepgram_stt_uri: deepgramSttUri || null, + deepgram_tts_uri: deepgramTtsUri || null, deepgram_stt_use_tls: deepgramSttUseTls ? 1 : 0, }), ...(vendor === VENDOR_VERBIO && { @@ -632,13 +634,15 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { if (credential?.data?.deepgram_stt_uri) { setDeepgramSttUri(credential.data.deepgram_stt_uri); } + if (credential?.data?.deepgram_tts_uri) { + setDeepgramTtsUri(credential.data.deepgram_tts_uri); + } if (credential?.data?.deepgram_stt_use_tls) { setDeepgramSttUseTls( credential?.data?.deepgram_stt_use_tls > 0 ? true : false, ); } setInitialDeepgramOnpremCheck(hasValue(credential?.data?.deepgram_stt_uri)); - setIsDeepgramOnpremEnabled(hasValue(credential?.data?.deepgram_stt_uri)); if (credential?.data?.user_id) { setUserId(credential.data.user_id); @@ -1384,22 +1388,6 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { /> )} - {vendor === VENDOR_DEEPGRAM && ( -
- )} {(vendor == VENDOR_ELEVENLABS || vendor == VENDOR_WHISPER || vendor == VENDOR_RIMELABS) && @@ -1602,11 +1590,52 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { disabled={hasValue(credential)} hidden name="use_hosted_deepgram_service" + label="Use hosted Deepgram Service" + initialCheck={!initialDeepgramOnpremCheck} + handleChecked={(e) => { + setInitialDeepgramOnpremCheck(!e.target.checked); + + if (e.target.checked) { + setTmpDeepgramSttUri(deepgramSttUri); + setDeepgramSttUri(""); + setTmpDeepgramSttUseTls(deepgramSttUseTls); + setDeepgramSttUseTls(false); + setTmpDeepgramTtsUri(deepgramTtsUri); + setDeepgramTtsUri(""); + } else { + if (tmpDeepgramSttUri) { + setDeepgramSttUri(tmpDeepgramSttUri); + } + if (tmpDeepgramSttUseTls) { + setDeepgramSttUseTls(tmpDeepgramSttUseTls); + } + if (tmpDeepgramTtsUri) { + setDeepgramTtsUri(tmpDeepgramTtsUri); + } + } + }} + > + +