From 5d78911d5bae4205a6f199d7a6e981a572d7862e Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Mon, 11 Aug 2025 13:35:06 -0400 Subject: [PATCH] Fix TTS queue bug for streamed messages - Fixed querySelector to find Play button specifically, not first button - Regular messages used Array.from().find() correctly - Streaming messages were using querySelector('button') which found Delete button - This explains why streamed messages never got added to TTS queue --- templates/chat.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/chat.html b/templates/chat.html index 47a2fe9..29c82d5 100644 --- a/templates/chat.html +++ b/templates/chat.html @@ -822,9 +822,9 @@ socket.on("message_chunk", (data) => { messageId: data.id }); if (autoPlayTTS && data.is_complete && messageBuffers[data.id] && messageBuffers[data.id].trim() !== "") { - const playButton = buttonContainer.querySelector("button"); - console.log("DEBUG: Found play button for streaming TTS:", playButton ? "YES" : "NO"); - if (playButton && playButton.textContent === "Play") { + const playButton = Array.from(buttonContainer.querySelectorAll("button")).find(btn => btn.textContent === "Play"); + console.log("DEBUG: Found play button for streaming TTS:", playButton ? "YES" : "NO", playButton?.textContent); + if (playButton) { setTimeout(() => { const fullText = targetMessageElement.textContent || targetMessageElement.innerText; console.log("DEBUG: Queueing streaming TTS:", data.id, fullText.substring(0, 50) + "...");