From bf1816c1e00663bd4ac739818de1d0a1a1997653 Mon Sep 17 00:00:00 2001 From: kicer Date: Thu, 3 Sep 2026 00:17:27 +0800 Subject: [PATCH] =?UTF-8?q?AI=E5=A4=9A=E8=BD=AE=E4=BC=9A=E8=AF=9D=E4=B8=AD?= =?UTF-8?q?=E5=8F=B3=E4=B8=8B=E8=A7=92=E4=B8=80=E7=9B=B4=E8=BD=AC=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/server/public/css/style.css | 2 +- app/server/public/js/tasks.js | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/server/public/css/style.css b/app/server/public/css/style.css index e6e3e2e..f7ab2e7 100644 --- a/app/server/public/css/style.css +++ b/app/server/public/css/style.css @@ -508,7 +508,7 @@ body { border-radius: 6px; margin-top: 6px; cursor: zoom-in; } - /* 右下角「回到底部」按钮:上翻历史时出现;AI 输出中显示加载转圈 */ + /* 右下角「回到底部」按钮:上翻历史时出现;AI 工作期间(含多轮工具间隙)常驻转圈 */ .scroll-bottom-btn { position: absolute; right: 14px; bottom: 72px; width: 38px; height: 38px; border-radius: 50%; diff --git a/app/server/public/js/tasks.js b/app/server/public/js/tasks.js index 7dfd4c7..099df0c 100644 --- a/app/server/public/js/tasks.js +++ b/app/server/public/js/tasks.js @@ -435,6 +435,7 @@ async function renderDetail(detail) { const s = detail.session; state.status = s.status; updatePhaseUI({ model_id: s.model_id, queue_pos: detail.queue_pos }); + updateScrollBottomBtn(); // 打开仍在运行中的会话时,立即恢复右下角转圈 $('chat-title').textContent = s.title || s.id; for (const m of detail.messages) { const node = msgNode(m, state.toolCards); @@ -492,15 +493,20 @@ function bindScroll() { }, { passive: true }); } // 右下角「移动到底部」按钮:不在底部时显示;AI 正在输出时叠加加载转圈 +// AI 是否「正在干活」:流式输出中,或会话处于 active(含工具执行与多轮模型调用的间隙)。 +function runBusy() { return state.streaming || state.status === 'active'; } + function updateScrollBottomBtn() { const btn = $('scroll-bottom-btn'); if (!btn) return; - const show = !isNearBottom(); + const busy = runBusy(); + // 运行中即使贴着底部也保持显示:转圈即「AI 还活着」指示,多轮工具间隙不至于看着像挂掉 + const show = busy || !isNearBottom(); btn.classList.toggle('hidden', !show); const spinner = btn.querySelector('.sb-spinner'); - if (spinner) spinner.classList.toggle('hidden', !state.streaming); + if (spinner) spinner.classList.toggle('hidden', !busy); const arrow = btn.querySelector('.sb-arrow'); - if (arrow) arrow.classList.toggle('hidden', state.streaming); + if (arrow) arrow.classList.toggle('hidden', busy); } function clickScrollBottom() { userPaused = false; @@ -559,6 +565,7 @@ function connectStream() { const d = JSON.parse(ev.data); state.status = d.status; updatePhaseUI(d); + updateScrollBottomBtn(); // 状态切换同步右下角转圈(开始/结束干活) }); es.addEventListener('assistant_delta', ev => { const d = JSON.parse(ev.data);