fix: stop audio stream
This commit is contained in:
@@ -160,7 +160,7 @@ export default function ChatBOX(props: {
|
|||||||
client.temperature = chatStore.temperature;
|
client.temperature = chatStore.temperature;
|
||||||
client.enable_temperature = chatStore.temperature_enabled;
|
client.enable_temperature = chatStore.temperature_enabled;
|
||||||
client.top_p = chatStore.top_p;
|
client.top_p = chatStore.top_p;
|
||||||
client.enable_top_p = chatStore.top_p_enabled
|
client.enable_top_p = chatStore.top_p_enabled;
|
||||||
client.frequency_penalty = chatStore.frequency_penalty;
|
client.frequency_penalty = chatStore.frequency_penalty;
|
||||||
client.presence_penalty = chatStore.presence_penalty;
|
client.presence_penalty = chatStore.presence_penalty;
|
||||||
client.messages = chatStore.history
|
client.messages = chatStore.history
|
||||||
@@ -660,6 +660,11 @@ export default function ChatBOX(props: {
|
|||||||
audioChunks.push(event.data);
|
audioChunks.push(event.data);
|
||||||
});
|
});
|
||||||
mediaRecorder.addEventListener("stop", async () => {
|
mediaRecorder.addEventListener("stop", async () => {
|
||||||
|
// Stop the MediaRecorder
|
||||||
|
mediaRecorder.stop();
|
||||||
|
// Stop the media stream
|
||||||
|
mediaRecorder.stream.getTracks()[0].stop();
|
||||||
|
|
||||||
setIsRecording("Transcribing");
|
setIsRecording("Transcribing");
|
||||||
const audioBlob = new Blob(audioChunks);
|
const audioBlob = new Blob(audioChunks);
|
||||||
const audioUrl = URL.createObjectURL(audioBlob);
|
const audioUrl = URL.createObjectURL(audioBlob);
|
||||||
|
|||||||
Reference in New Issue
Block a user