"...experiment/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "0e835aa9117b835ac00d3fdec7b31ef9ba9b1c9a"
Commit d7ce408d authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac

parent 374f6470
......@@ -131,24 +131,28 @@
};
const playAudio = (idx) => {
return new Promise((res) => {
assistantAudioIdx = idx;
const audioElement = document.getElementById('audioElement');
const audio = assistantAudio[idx];
if ($showCallOverlay) {
return new Promise((res) => {
assistantAudioIdx = idx;
const audioElement = document.getElementById('audioElement');
const audio = assistantAudio[idx];
audioElement.src = audio.src; // Assume `assistantAudio` has objects with a `src` property
audioElement.play();
audioElement.src = audio.src; // Assume `assistantAudio` has objects with a `src` property
audioElement.play();
audioElement.onended = async (e) => {
await new Promise((r) => setTimeout(r, 300));
audioElement.onended = async (e) => {
await new Promise((r) => setTimeout(r, 300));
if (Object.keys(assistantAudio).length - 1 === idx) {
assistantSpeaking = false;
}
if (Object.keys(assistantAudio).length - 1 === idx) {
assistantSpeaking = false;
}
res(e);
};
});
res(e);
};
});
} else {
return Promise.resolve();
}
};
const getOpenAISpeech = async (text) => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment