diff options
| author | Jacob MacDonald <[email protected]> | 2025-06-17 08:44:54 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-17 15:44:54 +0000 |
| commit | e59c872b3dea9dee8206f990a761e3bfee3a1194 (patch) | |
| tree | 88ee78b1ba1957dd5c504f577bee0db00078cb43 /packages/core/src | |
| parent | c3971754bf4bd5877d7a57c523b981c09d4fa35d (diff) | |
code review followup for compress command (#1097)
Followup to https://github.com/google-gemini/gemini-cli/pull/986
Diffstat (limited to 'packages/core/src')
| -rw-r--r-- | packages/core/src/core/client.ts | 10 | ||||
| -rw-r--r-- | packages/core/src/core/turn.ts | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/packages/core/src/core/client.ts b/packages/core/src/core/client.ts index 94c598bf..9cc8f328 100644 --- a/packages/core/src/core/client.ts +++ b/packages/core/src/core/client.ts @@ -475,9 +475,11 @@ export class GeminiClient { await cg.countTokens({ model: this.model, contents: newHistory }) ).totalTokens; - return { - originalTokenCount, - newTokenCount, - }; + return originalTokenCount && newTokenCount + ? { + originalTokenCount, + newTokenCount, + } + : null; } } diff --git a/packages/core/src/core/turn.ts b/packages/core/src/core/turn.ts index 4c0a297e..5a8b57e0 100644 --- a/packages/core/src/core/turn.ts +++ b/packages/core/src/core/turn.ts @@ -110,13 +110,13 @@ export type ServerGeminiErrorEvent = { }; export interface ChatCompressionInfo { - originalTokenCount: number | undefined; - newTokenCount: number | undefined; + originalTokenCount: number; + newTokenCount: number; } export type ServerGeminiChatCompressedEvent = { type: GeminiEventType.ChatCompressed; - value: ChatCompressionInfo; + value: ChatCompressionInfo | null; }; export type ServerGeminiUsageMetadataEvent = { |
