fix: clarify streaming message handling logic with comments
All checks were successful
BotUI CI/CD / build (push) Successful in 40s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-14 20:17:20 -03:00
parent cf7462f1cb
commit 5fa187fd97

View file

@ -857,22 +857,25 @@ function processMessage(data) {
) {
renderSuggestions(data.suggestions);
}
} else {
if (!isStreaming) {
isStreaming = true;
streamingMessageId = "streaming-" + Date.now();
currentStreamingContent = data.content || "";
addMessage(
"bot",
currentStreamingContent,
streamingMessageId,
);
} else {
currentStreamingContent += data.content || "";
updateStreaming(currentStreamingContent);
}
}
}
} else {
// Streaming chunk received
if (!isStreaming) {
// New streaming response - create a new message element
isStreaming = true;
streamingMessageId = "streaming-" + Date.now();
currentStreamingContent = data.content || "";
addMessage(
"bot",
currentStreamingContent,
streamingMessageId,
);
} else {
// Continue streaming to existing message element
currentStreamingContent += data.content || "";
updateStreaming(currentStreamingContent);
}
}
}
// Thinking indicator (shown while LLM is in reasoning mode)
var thinkingIndicator = null;