mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -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', () => {
|
describe('resetChat', () => {
|
||||||
it('should create a new chat session, clearing the old history', async () => {
|
it('should create a new chat session, clearing the old history', async () => {
|
||||||
// 1. Get the initial chat instance and add some history.
|
// 1. Get the initial chat instance and add some history.
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ export class GeminiClient {
|
|||||||
resumedSessionData?: ResumedSessionData,
|
resumedSessionData?: ResumedSessionData,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
this.chat = await this.startChat(history, resumedSessionData);
|
this.chat = await this.startChat(history, resumedSessionData);
|
||||||
|
this.updateTelemetryTokenCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
getChatRecordingService(): ChatRecordingService | undefined {
|
getChatRecordingService(): ChatRecordingService | undefined {
|
||||||
|
|||||||
Reference in New Issue
Block a user