From 8baae786920cd8cb05482d4515b8e82f193e0c8a Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Tue, 14 Apr 2026 17:14:12 -0300 Subject: [PATCH] feat: enhance thinking indicator with reasoning text support --- ui/suite/chat/chat.html | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ui/suite/chat/chat.html b/ui/suite/chat/chat.html index 3210ef4..5cb7332 100644 --- a/ui/suite/chat/chat.html +++ b/ui/suite/chat/chat.html @@ -816,7 +816,7 @@ function finalizeStreaming() { function processMessage(data) { // Handle thinking indicator from backend if (data.type === "thinking") { - showThinkingIndicator(); + showThinkingIndicator(data.content); return; } if (data.type === "thinking_clear") { @@ -861,8 +861,15 @@ function finalizeStreaming() { // Thinking indicator (shown while LLM is in reasoning mode) var thinkingIndicator = null; - function showThinkingIndicator() { - if (thinkingIndicator) return; // Already showing + function showThinkingIndicator(content) { + var text = content || "🤔 Pensando..."; + if (thinkingIndicator) { + var textEl = thinkingIndicator.querySelector(".thinking-text"); + if (textEl && content) { + textEl.textContent = text; + } + return; + } var messages = document.getElementById("messages"); if (!messages) return; @@ -872,7 +879,7 @@ function finalizeStreaming() { thinkingIndicator.className = "message bot"; thinkingIndicator.innerHTML = '
' + - '🤔 Pensando...' + + '' + escapeHtml(text) + '' + "
"; messages.appendChild(thinkingIndicator); scrollToBottom(true); @@ -1142,6 +1149,10 @@ function finalizeStreaming() { applyThemeData(contentObj.data || {}); return; } + if (contentObj.type === "thinking" || contentObj.type === "thinking_clear") { + processMessage(contentObj); + return; + } } catch (e) { // Content is not JSON, continue processing }