in frontend/src/hooks/useWebsocket.ts [100:121]
function sendAudioMessage(audio: Int16Array<ArrayBuffer>) {
if (!websocket.current) {
throw new Error("Websocket not connected");
}
websocket.current.send(
JSON.stringify({
type: "history.update",
inputs: history,
})
);
websocket.current.send(
JSON.stringify({
type: "input_audio_buffer.append",
delta: arrayBufferToBase64(audio.buffer),
})
);
websocket.current.send(
JSON.stringify({
type: "input_audio_buffer.commit",
})
);
}