From 719a8a34aa643eeecd4fde7613156509c3c04f1a Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 5 Jun 2026 11:37:00 +0800 Subject: [PATCH] :sparkles: AI Agent https://github.com/siyuan-note/siyuan/issues/17797 Signed-off-by: Daniel <845765@qq.com> --- app/src/layout/dock/AgentChat.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/layout/dock/AgentChat.ts b/app/src/layout/dock/AgentChat.ts index 8f629a6f5..432e6d675 100644 --- a/app/src/layout/dock/AgentChat.ts +++ b/app/src/layout/dock/AgentChat.ts @@ -754,7 +754,9 @@ export class AgentChat extends Model { this.sessionTotalDuration += Date.now() - this.requestStartTime; this.requestStartTime = 0; } + this.updateTokenDisplay(); this.setStreaming(false); + // line 754 area if (!this.hasTitled && this.messages.length >= 2) { this.hasTitled = true; this.generateTitle(); @@ -773,9 +775,10 @@ export class AgentChat extends Model { this.currentToolCalls = []; if (this.requestStartTime) { this.sessionTotalDuration += Date.now() - this.requestStartTime; - this.requestStartTime = 0; - } - this.setStreaming(false); + this.requestStartTime = 0; + } + this.updateTokenDisplay(); + this.setStreaming(false); if (!this.hasTitled && this.messages.length >= 2) { this.hasTitled = true; @@ -851,9 +854,10 @@ export class AgentChat extends Model { } if (this.requestStartTime) { this.sessionTotalDuration += Date.now() - this.requestStartTime; - this.requestStartTime = 0; - } - this.setStreaming(false); + this.requestStartTime = 0; + } + this.updateTokenDisplay(); + this.setStreaming(false); } private insertBeforeAI(el: HTMLElement) { @@ -878,7 +882,7 @@ export class AgentChat extends Model { '