From c5e7eb0d23f3806ca06c79250d0fb9f0d82f41ca Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:08:07 +0700 Subject: [PATCH] fix stt/tts regoin on wrong position (#380) * fix stt/tts regoin on wrong position * wip * fix speech credentials does not choose default model * fix speech credentials does not choose default model --- .../internal/views/recent-calls/player.tsx | 3 ++- .../internal/views/speech-services/form.tsx | 13 ++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/containers/internal/views/recent-calls/player.tsx b/src/containers/internal/views/recent-calls/player.tsx index 5c911b4..cba4b5e 100644 --- a/src/containers/internal/views/recent-calls/player.tsx +++ b/src/containers/internal/views/recent-calls/player.tsx @@ -287,7 +287,8 @@ export const Player = ({ call }: PlayerProps) => { const buildWavesurferRegion = () => { if (jaegerRoot) { const spans = getSpansFromJaegerRoot(jaegerRoot); - const startPoint = spans[0]; + const start = getSpansByNameRegex(spans, /background-record:listen/); + const startPoint = start ? start[0] : null; // there should be only one startPoint for background listen if (startPoint) { const gatherSpans = getSpansByNameRegex(spans, /:gather{/); diff --git a/src/containers/internal/views/speech-services/form.tsx b/src/containers/internal/views/speech-services/form.tsx index 87fbf4e..460d962 100644 --- a/src/containers/internal/views/speech-services/form.tsx +++ b/src/containers/internal/views/speech-services/form.tsx @@ -375,6 +375,12 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { ).then(({ json }) => { if (json.models) { setTtsModels(json.models); + if ( + json.models.length > 0 && + (vendor === VENDOR_ELEVENLABS || vendor === VENDOR_WHISPER) + ) { + setTtsModelId(json.models[0].value); + } } }); } else { @@ -597,13 +603,6 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { setRegion(""); setApiKey(""); setGoogleServiceKey(null); - if ( - ttsModels.length > 0 && - (e.target.value === VENDOR_ELEVENLABS || - e.target.value === VENDOR_WHISPER) - ) { - setTtsModelId(ttsModels[0].value); - } }} disabled={credential ? true : false} required