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
This commit is contained in:
Russell Ballestrini 2025-08-11 13:35:06 -04:00
parent 853fac95a4
commit 5d78911d5b

View file

@ -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) + "...");