From 81d120effaa465ed1cbd704bc0f1b91ec2de11e6 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 21 Feb 2025 10:51:21 -0800 Subject: [PATCH] Tweak chat stream rate computation again Now, just ignoring the initial pause entirely. Don't start counting until we have some words. This is especially helpful for Claude which has a long initial pause. Previously the timer would be started by some references showing up. --- src/vs/workbench/contrib/chat/common/chatViewModel.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/common/chatViewModel.ts b/src/vs/workbench/contrib/chat/common/chatViewModel.ts index 88d973ecc41d1..063bd4b0a7f5e 100644 --- a/src/vs/workbench/contrib/chat/common/chatViewModel.ts +++ b/src/vs/workbench/contrib/chat/common/chatViewModel.ts @@ -588,9 +588,13 @@ export class ChatResponseViewModel extends Disposable implements IChatResponseVi const now = Date.now(); const wordCount = countWords(_model.entireResponse.getMarkdown()); - if (wordCount > 0 && wordCount === this._contentUpdateTimings.lastWordCount) { + if (wordCount === this._contentUpdateTimings.lastWordCount) { this.trace('onDidChange', `Update- no new words`); } else { + if (this._contentUpdateTimings.lastWordCount === 0) { + this._contentUpdateTimings.lastUpdateTime = now; + } + const timeDiff = Math.min(now - this._contentUpdateTimings.lastUpdateTime, 1000); const newTotalTime = Math.max(this._contentUpdateTimings.totalTime + timeDiff, 250); const impliedWordLoadRate = wordCount / (newTotalTime / 1000);