From 9e72eaef1a3ac348a83dbeef84106c0df7ccfc49 Mon Sep 17 00:00:00 2001 From: XianYuDaXian Date: Tue, 24 Mar 2026 21:51:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(chat):=20=E4=BF=AE=E5=A4=8D=E6=80=9D?= =?UTF-8?q?=E8=80=83=E5=9D=97=E5=86=85=E5=9B=BE=E6=A0=87=E6=97=8B=E8=BD=AC?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/public/css/chat.css | 4 ++++ app/static/public/js/chat.js | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/static/public/css/chat.css b/app/static/public/css/chat.css index 1fefc32..e609ddb 100644 --- a/app/static/public/css/chat.css +++ b/app/static/public/css/chat.css @@ -848,6 +848,10 @@ body { content: ""; width: 20px; height: 20px; + display: inline-flex; + align-items: center; + justify-content: center; + flex: 0 0 20px; border-radius: 50%; background: conic-gradient(from 180deg, #f59e0b, #f97316, #22c55e, #0ea5e9, #f59e0b); border: 1px solid #fff; diff --git a/app/static/public/js/chat.js b/app/static/public/js/chat.js index ecf159a..99a8489 100644 --- a/app/static/public/js/chat.js +++ b/app/static/public/js/chat.js @@ -1234,7 +1234,8 @@ startedAt: Date.now(), firstTokenAt: null, hasThink: false, - thinkElapsed: null + thinkElapsed: null, + thinkingActive: false }; return entry; } @@ -1535,8 +1536,9 @@ restoreScrollState(entry.contentNode, '.think-rollout-body', savedThinkRolloutBodyScroll); } if (entry.hasThink) { + entry.thinkingActive = !finalize; if (finalize && (entry.thinkElapsed === null || typeof entry.thinkElapsed === 'undefined')) { - entry.thinkElapsed = 0; + entry.thinkElapsed = Math.max(1, Math.round((Date.now() - (entry.startedAt || Date.now())) / 1000)); } updateThinkSummary(entry, entry.thinkElapsed); } @@ -1612,7 +1614,7 @@ node.textContent = text; const block = node.closest('.think-block'); if (!block) return; - if (typeof elapsedSec === 'number') { + if (!entry.thinkingActive) { block.removeAttribute('data-thinking'); node.style.removeProperty('--think-spin-delay'); block.querySelectorAll('.think-agent summary').forEach((summary) => { @@ -2639,6 +2641,7 @@ } if (!assistantEntry.hasThink && assistantText.includes('')) { assistantEntry.hasThink = true; + assistantEntry.thinkingActive = true; assistantEntry.thinkElapsed = null; updateThinkSummary(assistantEntry, null); }