fix: 定时器15秒间隔 + 滚动rAF + 闲置追踪

- 流式进度定时器改为15秒间隔
- lastContentTime 追踪真正的无新内容时长
- appendToolCardDOM/renderToolCalls 用 rAF 确保布局后滚动
This commit is contained in:
thzxx
2026-06-13 07:42:40 +08:00
parent 45777a5945
commit 87d3364886
2 changed files with 21 additions and 16 deletions
+8 -4
View File
@@ -831,8 +831,10 @@ function appendToolCardDOM(tc: ToolCallRecord): void {
if (card) {
card.dataset.toolName = tc.name;
container.appendChild(card);
// 新卡片出现时始终滚到底部(用户需要看到最新的工具状态)
container.scrollTop = container.scrollHeight;
// 等浏览器完成布局后再滚到底部
requestAnimationFrame(() => {
container.scrollTop = container.scrollHeight;
});
}
}
@@ -936,8 +938,10 @@ function renderToolCalls(): void {
html += renderToolCard(tc);
}
container.innerHTML = html;
// 全量渲染后滚到底部
container.scrollTop = container.scrollHeight;
// 等浏览器完成布局后再滚到底部
requestAnimationFrame(() => {
container.scrollTop = container.scrollHeight;
});
}
function getToolDisplayName(name: string): string {