From 5fa187fd971061ea5685d380e9476c539dd8757e Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Tue, 14 Apr 2026 20:17:20 -0300 Subject: [PATCH] fix: clarify streaming message handling logic with comments --- ui/suite/chat/chat.html | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/ui/suite/chat/chat.html b/ui/suite/chat/chat.html index 2114920..129b121 100644 --- a/ui/suite/chat/chat.html +++ b/ui/suite/chat/chat.html @@ -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;