mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-10 13:22:51 -07:00
improve performance of shell commands with lots of output (#7680)
This commit is contained in:
@@ -132,6 +132,7 @@ class ShellToolInvocation extends BaseToolInvocation<
|
||||
);
|
||||
|
||||
let cumulativeOutput = '';
|
||||
let outputChunks: string[] = [cumulativeOutput];
|
||||
let lastUpdateTime = Date.now();
|
||||
let isBinaryStream = false;
|
||||
|
||||
@@ -149,9 +150,11 @@ class ShellToolInvocation extends BaseToolInvocation<
|
||||
switch (event.type) {
|
||||
case 'data':
|
||||
if (isBinaryStream) break;
|
||||
cumulativeOutput = event.chunk;
|
||||
currentDisplayOutput = cumulativeOutput;
|
||||
outputChunks.push(event.chunk);
|
||||
if (Date.now() - lastUpdateTime > OUTPUT_UPDATE_INTERVAL_MS) {
|
||||
cumulativeOutput = outputChunks.join('');
|
||||
outputChunks = [cumulativeOutput];
|
||||
currentDisplayOutput = cumulativeOutput;
|
||||
shouldUpdate = true;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user