mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-13 04:45:19 +00:00
refac
This commit is contained in:
parent
374f647048
commit
d7ce408d25
1 changed files with 18 additions and 14 deletions
|
|
@ -131,24 +131,28 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const playAudio = (idx) => {
|
const playAudio = (idx) => {
|
||||||
return new Promise((res) => {
|
if ($showCallOverlay) {
|
||||||
assistantAudioIdx = idx;
|
return new Promise((res) => {
|
||||||
const audioElement = document.getElementById('audioElement');
|
assistantAudioIdx = idx;
|
||||||
const audio = assistantAudio[idx];
|
const audioElement = document.getElementById('audioElement');
|
||||||
|
const audio = assistantAudio[idx];
|
||||||
|
|
||||||
audioElement.src = audio.src; // Assume `assistantAudio` has objects with a `src` property
|
audioElement.src = audio.src; // Assume `assistantAudio` has objects with a `src` property
|
||||||
audioElement.play();
|
audioElement.play();
|
||||||
|
|
||||||
audioElement.onended = async (e) => {
|
audioElement.onended = async (e) => {
|
||||||
await new Promise((r) => setTimeout(r, 300));
|
await new Promise((r) => setTimeout(r, 300));
|
||||||
|
|
||||||
if (Object.keys(assistantAudio).length - 1 === idx) {
|
if (Object.keys(assistantAudio).length - 1 === idx) {
|
||||||
assistantSpeaking = false;
|
assistantSpeaking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
res(e);
|
res(e);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getOpenAISpeech = async (text) => {
|
const getOpenAISpeech = async (text) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue