Skip to content

Commit

Permalink
web safari fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyeo1010 committed Jun 3, 2024
1 parent 9761f8f commit 6f3d28c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions recipes/llm-voice-assistant/web/public/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ window.onload = () => {
onText: (text) => {
addMessage(llmElem, text);
},
onStream: (pcm) => {
onStream: async (pcm) => {
audioStream.stream(pcm);
if (streamCalls > 1) {
audioStream.play();
Expand All @@ -137,16 +137,16 @@ window.onload = () => {
streamCalls = 0;
},
});
if (!audioStream) {
audioStream = new Picovoice.AudioStream(Picovoice.getStreamSampleRate());
}

initBlock.style.display = 'none';
chatBlock.style.display = 'flex';
status.innerText = "Loading complete."

await Picovoice.start();
message.innerText = "Say `Picovoice`"

if (!audioStream) {
audioStream = new Picovoice.AudioStream(Picovoice.getStreamSampleRate());
}
} catch (e) {
writeError(e.message);
} finally {
Expand Down

0 comments on commit 6f3d28c

Please sign in to comment.