Add debug logging to diagnose TTS queue issue with streamed messages
- Added console.log statements to streaming TTS logic - Will help identify why streamed messages aren't being added to TTS queue - Debug info includes autoPlayTTS state, completion status, buffer content
This commit is contained in:
parent
98b0ebab24
commit
853fac95a4
1 changed files with 9 additions and 0 deletions
|
|
@ -814,11 +814,20 @@ socket.on("message_chunk", (data) => {
|
|||
messageWrapper.insertBefore(buttonContainer, targetMessageElement);
|
||||
|
||||
// Auto-play TTS if enabled and message is complete (only when streaming finishes)
|
||||
console.log("DEBUG: Streaming complete check:", {
|
||||
autoPlayTTS: autoPlayTTS,
|
||||
is_complete: data.is_complete,
|
||||
hasBuffer: !!messageBuffers[data.id],
|
||||
bufferContent: messageBuffers[data.id] ? messageBuffers[data.id].substring(0, 50) + "..." : "none",
|
||||
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") {
|
||||
setTimeout(() => {
|
||||
const fullText = targetMessageElement.textContent || targetMessageElement.innerText;
|
||||
console.log("DEBUG: Queueing streaming TTS:", data.id, fullText.substring(0, 50) + "...");
|
||||
queueTTS(fullText, playButton, data.id);
|
||||
}, 50); // Small delay to let the message render
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue