mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-11 22:51:00 -07:00
Fix maxOutputTokens compression bug. (#8026)
This commit is contained in:
committed by
GitHub
parent
f6f2fff724
commit
c8dfab9ec6
@@ -652,34 +652,6 @@ describe('Gemini Client (client.ts)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('attempts to compress with a maxOutputTokens set to the original token count', async () => {
|
||||
vi.mocked(tokenLimit).mockReturnValue(1000);
|
||||
vi.mocked(mockContentGenerator.countTokens).mockResolvedValue({
|
||||
totalTokens: 999,
|
||||
});
|
||||
|
||||
mockGetHistory.mockReturnValue([
|
||||
{ role: 'user', parts: [{ text: '...history...' }] },
|
||||
]);
|
||||
|
||||
// Mock the summary response from the chat
|
||||
mockSendMessage.mockResolvedValue({
|
||||
role: 'model',
|
||||
parts: [{ text: 'This is a summary.' }],
|
||||
});
|
||||
|
||||
await client.tryCompressChat('prompt-id-2', true);
|
||||
|
||||
expect(mockSendMessage).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
config: expect.objectContaining({
|
||||
maxOutputTokens: 999,
|
||||
}),
|
||||
}),
|
||||
'prompt-id-2',
|
||||
);
|
||||
});
|
||||
|
||||
it('should not trigger summarization if token count is below threshold', async () => {
|
||||
const MOCKED_TOKEN_LIMIT = 1000;
|
||||
vi.mocked(tokenLimit).mockReturnValue(MOCKED_TOKEN_LIMIT);
|
||||
|
||||
@@ -845,7 +845,6 @@ export class GeminiClient {
|
||||
},
|
||||
config: {
|
||||
systemInstruction: { text: getCompressionPrompt() },
|
||||
maxOutputTokens: originalTokenCount,
|
||||
},
|
||||
},
|
||||
prompt_id,
|
||||
|
||||
Reference in New Issue
Block a user