mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 04:54:25 -07:00
feat(core): Improve request token calculation accuracy (#13824)
This commit is contained in:
@@ -154,6 +154,9 @@ describe('ChatCompressionService', () => {
|
||||
generateContent: mockGenerateContent,
|
||||
}),
|
||||
isInteractive: vi.fn().mockReturnValue(false),
|
||||
getContentGenerator: vi.fn().mockReturnValue({
|
||||
countTokens: vi.fn().mockResolvedValue({ totalTokens: 100 }),
|
||||
}),
|
||||
} as unknown as Config;
|
||||
|
||||
vi.mocked(tokenLimit).mockReturnValue(1000);
|
||||
@@ -286,6 +289,11 @@ describe('ChatCompressionService', () => {
|
||||
],
|
||||
} as unknown as GenerateContentResponse);
|
||||
|
||||
// Override mock to simulate high token count for this specific test
|
||||
vi.mocked(mockConfig.getContentGenerator().countTokens).mockResolvedValue({
|
||||
totalTokens: 10000,
|
||||
});
|
||||
|
||||
const result = await service.compress(
|
||||
mockChat,
|
||||
mockPromptId,
|
||||
|
||||
Reference in New Issue
Block a user