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
This commit is contained in:
Hoan Luu Huu
2024-01-13 23:08:07 +07:00
committed by GitHub
parent 6ddcb82adc
commit c5e7eb0d23
2 changed files with 8 additions and 8 deletions
@@ -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{/);
@@ -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