mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
fix(core): update telemetry token count after session resume (#15491)
Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
@@ -303,6 +303,17 @@ describe('Gemini Client (client.ts)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('resumeChat', () => {
|
||||
it('should update telemetry token count when a chat is resumed', async () => {
|
||||
const history: Content[] = [
|
||||
{ role: 'user', parts: [{ text: 'resumed message' }] },
|
||||
];
|
||||
await client.resumeChat(history);
|
||||
|
||||
expect(uiTelemetryService.setLastPromptTokenCount).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('resetChat', () => {
|
||||
it('should create a new chat session, clearing the old history', async () => {
|
||||
// 1. Get the initial chat instance and add some history.
|
||||
|
||||
@@ -269,6 +269,7 @@ export class GeminiClient {
|
||||
resumedSessionData?: ResumedSessionData,
|
||||
): Promise<void> {
|
||||
this.chat = await this.startChat(history, resumedSessionData);
|
||||
this.updateTelemetryTokenCount();
|
||||
}
|
||||
|
||||
getChatRecordingService(): ChatRecordingService | undefined {
|
||||
|
||||
Reference in New Issue
Block a user