From c9d02f0132b318c7c79269e507e4f11db9fa4777 Mon Sep 17 00:00:00 2001 From: Bradley Priest Date: Tue, 20 Jan 2026 20:16:43 +1300 Subject: [PATCH] ui(chat): separate tool/thinking output and add toggle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Render assistant reasoning as a distinct block (not merged into message text).\n- Detect tool-like messages reliably and style them separately.\n- Add a "🧠" toggle to hide/show tool + thinking output, persisted in UI settings. --- ui/src/styles/chat/grouped.css | 5 +++ ui/src/styles/chat/legacy.css | 8 ++++- ui/src/styles/chat/text.css | 16 +++++++++ ui/src/ui/app-render.helpers.ts | 12 +++++++ ui/src/ui/app-render.ts | 1 + ui/src/ui/chat/grouped-render.ts | 32 +++++++++++++---- ui/src/ui/chat/legacy-render.ts | 22 ++++++++---- ui/src/ui/chat/message-normalizer.test.ts | 26 +++++++------- ui/src/ui/chat/message-normalizer.ts | 43 +++++++++++++++++++---- ui/src/ui/storage.ts | 6 ++++ ui/src/ui/views/chat.ts | 28 ++++++++++----- 11 files changed, 156 insertions(+), 43 deletions(-) diff --git a/ui/src/styles/chat/grouped.css b/ui/src/styles/chat/grouped.css index 879a0c8bc..d0e05e508 100644 --- a/ui/src/styles/chat/grouped.css +++ b/ui/src/styles/chat/grouped.css @@ -84,6 +84,11 @@ color: rgba(150, 150, 150, 1); } +.chat-avatar.tool { + background: rgba(134, 142, 150, 0.2); + color: rgba(134, 142, 150, 1); +} + /* Minimal Bubble Design - dynamic width based on content */ .chat-bubble { display: inline-block; diff --git a/ui/src/styles/chat/legacy.css b/ui/src/styles/chat/legacy.css index 90601d0ca..7a802b716 100644 --- a/ui/src/styles/chat/legacy.css +++ b/ui/src/styles/chat/legacy.css @@ -12,10 +12,16 @@ } .chat-line.assistant, -.chat-line.other { +.chat-line.other, +.chat-line.tool { justify-content: flex-start; } +.chat-line.tool .chat-bubble { + border-style: dashed; + opacity: 0.95; +} + .chat-msg { display: grid; gap: 6px; diff --git a/ui/src/styles/chat/text.css b/ui/src/styles/chat/text.css index 5e42b258d..3d01dd493 100644 --- a/ui/src/styles/chat/text.css +++ b/ui/src/styles/chat/text.css @@ -2,6 +2,22 @@ CHAT TEXT STYLING ============================================= */ +.chat-thinking { + margin-bottom: 10px; + padding: 10px 12px; + border-radius: 10px; + border: 1px dashed rgba(255, 255, 255, 0.18); + background: rgba(255, 255, 255, 0.04); + color: var(--muted); + font-size: 12px; + line-height: 1.4; +} + +:root[data-theme="light"] .chat-thinking { + border-color: rgba(16, 24, 40, 0.18); + background: rgba(16, 24, 40, 0.03); +} + .chat-text { font-size: 14px; line-height: 1.5; diff --git a/ui/src/ui/app-render.helpers.ts b/ui/src/ui/app-render.helpers.ts index a9dee71d6..6658d99be 100644 --- a/ui/src/ui/app-render.helpers.ts +++ b/ui/src/ui/app-render.helpers.ts @@ -92,6 +92,18 @@ export function renderChatControls(state: AppViewState) { ${refreshIcon} | +