mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
ReplyOnPause and ReplyOnStopWords can be interrupted (#119)
* Add all this code * add code * Fix demo --------- Co-authored-by: Freddy Boulton <freddyboulton@hf-freddy.local>
This commit is contained in:
@@ -193,7 +193,8 @@
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="transcript-container" id="transcript"></div>
|
||||
<div class="transcript-container" id="transcript">
|
||||
</div>
|
||||
<div class="controls">
|
||||
<button id="start-button">Start Recording</button>
|
||||
</div>
|
||||
@@ -220,13 +221,23 @@
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function handleMessage(event) {
|
||||
async function handleMessage(event) {
|
||||
// Handle any WebRTC data channel messages if needed
|
||||
const eventJson = JSON.parse(event.data);
|
||||
if (eventJson.type === "error") {
|
||||
showError(eventJson.message);
|
||||
} else if (eventJson.type === "send_input") {
|
||||
const response = await fetch('/send_input', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
webrtc_id: webrtc_id,
|
||||
transcript: ""
|
||||
})
|
||||
});
|
||||
}
|
||||
console.log('Received message:', event.data);
|
||||
|
||||
}
|
||||
|
||||
function updateButtonState() {
|
||||
|
||||
Reference in New Issue
Block a user