diff --git a/src/containers/internal/views/applications/form.tsx b/src/containers/internal/views/applications/form.tsx
index 1af2e93..4dcdea2 100644
--- a/src/containers/internal/views/applications/form.tsx
+++ b/src/containers/internal/views/applications/form.tsx
@@ -922,6 +922,9 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
serviceProviderSid={
currentServiceProvider?.service_provider_sid || ""
}
+ application_speech_synthesis_voice={
+ application?.data?.speech_synthesis_voice
+ }
accountSid={accountSid}
credentials={credentials}
ttsVendor={[synthVendor, setSynthVendor]}
@@ -952,6 +955,9 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
currentServiceProvider?.service_provider_sid || ""
}
accountSid={accountSid}
+ application_speech_synthesis_voice={
+ application?.data?.fallback_speech_synthesis_voice
+ }
credentials={credentials}
ttsVendor={[
fallbackSpeechSynthsisVendor,
diff --git a/src/containers/internal/views/applications/speech-selection.tsx b/src/containers/internal/views/applications/speech-selection.tsx
index d2aa3f8..a32a7d4 100644
--- a/src/containers/internal/views/applications/speech-selection.tsx
+++ b/src/containers/internal/views/applications/speech-selection.tsx
@@ -44,6 +44,7 @@ import {
type SpeechProviderSelectionProbs = {
accountSid: string;
serviceProviderSid: string;
+ application_speech_synthesis_voice: string | null | undefined;
credentials: SpeechCredential[] | undefined;
ttsVendor: [
keyof SynthesisVendors,
@@ -67,6 +68,7 @@ type SpeechProviderSelectionProbs = {
export const SpeechProviderSelection = ({
accountSid,
serviceProviderSid,
+ application_speech_synthesis_voice,
credentials,
ttsVendor: [synthVendor, setSynthVendor],
ttsVendorOptions,
@@ -242,10 +244,6 @@ export const SpeechProviderSelection = ({
// Extract model
if (json.models && json.models.length) {
setSynthesisModelOptions(json.models);
- if (synthVendor === VENDOR_DEEPGRAM) {
- setSynthVoice(json.models[0].value);
- return;
- }
}
if (json.tts && json.tts.length) {
@@ -337,6 +335,7 @@ export const SpeechProviderSelection = ({
const updateTtsVoice = (language: string, voice: string) => {
if (shouldUpdateTtsVoice.current) {
+ console.log("xhoaluu");
setSynthLang(language);
setSynthVoice(voice);
shouldUpdateTtsVoice.current = false;
@@ -387,6 +386,20 @@ export const SpeechProviderSelection = ({
toastError(error.msg);
});
};
+
+ useEffect(() => {
+ if (
+ synthVendor === VENDOR_DEEPGRAM &&
+ synthesisModelOptions.length > 0 &&
+ !synthesisModelOptions.some(
+ (m) => m.value === application_speech_synthesis_voice,
+ )
+ ) {
+ setSynthVoice(synthesisModelOptions[0].value);
+ } else {
+ setSynthVoice(application_speech_synthesis_voice || "");
+ }
+ }, [synthesisModelOptions, application_speech_synthesis_voice]);
return (
<>
)}
- {vendor == VENDOR_OPENAI && sttModels.length > 0 && (
-
- )}
+ {(vendor == VENDOR_OPENAI || vendor === VENDOR_DEEPGRAM) &&
+ sttModels.length > 0 && (
+
+ )}
{(vendor === VENDOR_ELEVENLABS ||
vendor === VENDOR_PLAYHT ||
vendor === VENDOR_CARTESIA ||