diff --git a/ui/suite/partials/chat.html b/ui/suite/partials/chat.html index 32b5581..782eb19 100644 --- a/ui/suite/partials/chat.html +++ b/ui/suite/partials/chat.html @@ -309,17 +309,16 @@ function addMessage(sender, content, msgId) { ""; } else { var cleanContent = stripMarkdownBlocks(content); - // Check if content has HTML (any tag, including comments) var hasHtmlTags = /<\/?[a-zA-Z][^>]*>|/i.test(cleanContent); console.log("Bot message - hasHtmlTags:", hasHtmlTags, "content length:", cleanContent.length, "msgId:", msgId); var parsed; - if (hasHtmlTags && msgId) { - // Streaming HTML content - don't show raw HTML, show loading indicator - // Content will be rendered at finalizeStreaming + // When msgId is present, we're in streaming mode - show loading until complete + // This prevents raw HTML from flashing during streaming + if (msgId) { parsed = '
...
'; } else if (hasHtmlTags) { - // Complete HTML content - render directly + // Complete HTML content (not streaming) - render directly parsed = cleanContent; } else { // Markdown content @@ -791,15 +790,8 @@ function updateStreaming(content) { msgContent.innerHTML = renderMentionInMessage(cleanContent); lastRenderTime = Date.now(); if (!isUserScrolling) scrollToBottom(true); - } else { - // Tags not balanced yet - show escaped HTML to avoid showing raw tags - // This prevents HTML from appearing as raw text before it's ready - var escapedContent = escapeHtml(cleanContent); - // Only update if content changed to avoid flickering - if (msgContent.textContent !== cleanContent) { - msgContent.textContent = cleanContent; - } } + // If not balanced, keep showing loading - don't show raw HTML text! } else { // Standard markdown/text rendering var parsed = typeof marked !== "undefined" && marked.parse