refactor(core): decouple GeminiChat from uiTelemetryService via Usage events (#12196)

This commit is contained in:
Sandy Tao
2025-10-30 14:05:38 -07:00
committed by GitHub
parent 68afb7200e
commit 322feaafa6
6 changed files with 88 additions and 31 deletions

View File

@@ -8,7 +8,6 @@ import type { Content } from '@google/genai';
import type { Config } from '../config/config.js';
import type { GeminiChat } from '../core/geminiChat.js';
import { type ChatCompressionInfo, CompressionStatus } from '../core/turn.js';
import { uiTelemetryService } from '../telemetry/uiTelemetry.js';
import { tokenLimit } from '../core/tokenLimits.js';
import { getCompressionPrompt } from '../core/prompts.js';
import { getResponseText } from '../utils/partUtils.js';
@@ -102,7 +101,7 @@ export class ChatCompressionService {
};
}
const originalTokenCount = uiTelemetryService.getLastPromptTokenCount();
const originalTokenCount = chat.getLastPromptTokenCount();
// Don't compress if not forced and we are under the limit.
if (!force) {
@@ -204,7 +203,6 @@ export class ChatCompressionService {
},
};
} else {
uiTelemetryService.setLastPromptTokenCount(newTokenCount);
return {
newHistory: extraHistory,
info: {