From c366f8f0d36d7e015d517afc724c5ceb8b0158fb Mon Sep 17 00:00:00 2001 From: retoor Date: Sun, 29 Jun 2025 19:58:40 +0200 Subject: [PATCH] Full STT and TTS. --- src/snek/static/chat-input.js | 9 ++++++++- src/snek/templates/app.html | 2 +- src/snek/templates/web.html | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/snek/static/chat-input.js b/src/snek/static/chat-input.js index 8b1b762..ff8972d 100644 --- a/src/snek/static/chat-input.js +++ b/src/snek/static/chat-input.js @@ -269,7 +269,14 @@ textToLeetAdvanced(text) { this.appendChild(this.textarea); this.ttsButton = document.createElement("stt-button"); - + + this.snekSpeaker = document.createElement("snek-speaker"); + this.appendChild(this.snekSpeaker); + + this.ttsButton.addEventListener("click", (e) => { + this.snekSpeaker.enable() + }); + this.appendChild(this.ttsButton); this.uploadButton = document.createElement("upload-button"); this.uploadButton.setAttribute("channel", this.channelUid); diff --git a/src/snek/templates/app.html b/src/snek/templates/app.html index 050712f..7069816 100644 --- a/src/snek/templates/app.html +++ b/src/snek/templates/app.html @@ -7,8 +7,8 @@ Snek - + diff --git a/src/snek/templates/web.html b/src/snek/templates/web.html index c3fa113..8969cab 100644 --- a/src/snek/templates/web.html +++ b/src/snek/templates/web.html @@ -215,6 +215,7 @@ app.addEventListener("channel-message", (data) => { } else if (!isMentionForSomeoneElse(data.message)) { if(data.is_final){ app.playSound("message"); + document.querySelector("snek-speaker").speak(data.message); } } }