mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
Simplify error messages when user runs into daily quotas. (#8556)
Co-authored-by: Srinath Padmanabhan <srithreepo@google.com>
This commit is contained in:
committed by
GitHub
parent
cf9b6ec1f6
commit
1407327a14
@@ -149,9 +149,7 @@ describe('parseAndFormatApiError', () => {
|
|||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'You have reached your daily gemini-2.5-pro quota limit',
|
'You have reached your daily gemini-2.5-pro quota limit',
|
||||||
);
|
);
|
||||||
expect(result).toContain(
|
expect(result).toContain('upgrade to get higher limits');
|
||||||
'upgrade to a Gemini Code Assist Standard or Enterprise plan',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should format a regular 429 API error with standard message for Google auth', () => {
|
it('should format a regular 429 API error with standard message for Google auth', () => {
|
||||||
@@ -230,9 +228,7 @@ describe('parseAndFormatApiError', () => {
|
|||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'We appreciate you for choosing Gemini Code Assist and the Gemini CLI',
|
'We appreciate you for choosing Gemini Code Assist and the Gemini CLI',
|
||||||
);
|
);
|
||||||
expect(result).not.toContain(
|
expect(result).not.toContain('upgrade to get higher limits');
|
||||||
'upgrade to a Gemini Code Assist Standard or Enterprise plan',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should format a 429 API error with Pro quota exceeded message for Google auth (Legacy tier)', () => {
|
it('should format a 429 API error with Pro quota exceeded message for Google auth (Legacy tier)', () => {
|
||||||
@@ -254,9 +250,7 @@ describe('parseAndFormatApiError', () => {
|
|||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'We appreciate you for choosing Gemini Code Assist and the Gemini CLI',
|
'We appreciate you for choosing Gemini Code Assist and the Gemini CLI',
|
||||||
);
|
);
|
||||||
expect(result).not.toContain(
|
expect(result).not.toContain('upgrade to get higher limits');
|
||||||
'upgrade to a Gemini Code Assist Standard or Enterprise plan',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle different Gemini 2.5 version strings in Pro quota exceeded errors', () => {
|
it('should handle different Gemini 2.5 version strings in Pro quota exceeded errors', () => {
|
||||||
@@ -286,12 +280,8 @@ describe('parseAndFormatApiError', () => {
|
|||||||
expect(resultPreview).toContain(
|
expect(resultPreview).toContain(
|
||||||
'You have reached your daily gemini-2.5-preview-pro quota limit',
|
'You have reached your daily gemini-2.5-preview-pro quota limit',
|
||||||
);
|
);
|
||||||
expect(result25).toContain(
|
expect(result25).toContain('upgrade to get higher limits');
|
||||||
'upgrade to a Gemini Code Assist Standard or Enterprise plan',
|
expect(resultPreview).toContain('upgrade to get higher limits');
|
||||||
);
|
|
||||||
expect(resultPreview).toContain(
|
|
||||||
'upgrade to a Gemini Code Assist Standard or Enterprise plan',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not match non-Pro models with similar version strings', () => {
|
it('should not match non-Pro models with similar version strings', () => {
|
||||||
@@ -349,9 +339,7 @@ describe('parseAndFormatApiError', () => {
|
|||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'We appreciate you for choosing Gemini Code Assist and the Gemini CLI',
|
'We appreciate you for choosing Gemini Code Assist and the Gemini CLI',
|
||||||
);
|
);
|
||||||
expect(result).not.toContain(
|
expect(result).not.toContain('upgrade to get higher limits');
|
||||||
'upgrade to a Gemini Code Assist Standard or Enterprise plan',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should format a regular 429 API error with standard message for Google auth (Standard tier)', () => {
|
it('should format a regular 429 API error with standard message for Google auth (Standard tier)', () => {
|
||||||
@@ -368,8 +356,6 @@ describe('parseAndFormatApiError', () => {
|
|||||||
expect(result).toContain(
|
expect(result).toContain(
|
||||||
'We appreciate you for choosing Gemini Code Assist and the Gemini CLI',
|
'We appreciate you for choosing Gemini Code Assist and the Gemini CLI',
|
||||||
);
|
);
|
||||||
expect(result).not.toContain(
|
expect(result).not.toContain('upgrade to get higher limits');
|
||||||
'upgrade to a Gemini Code Assist Standard or Enterprise plan',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ const getRateLimitErrorMessageGoogleProQuotaFree = (
|
|||||||
currentModel: string = DEFAULT_GEMINI_MODEL,
|
currentModel: string = DEFAULT_GEMINI_MODEL,
|
||||||
fallbackModel: string = DEFAULT_GEMINI_FLASH_MODEL,
|
fallbackModel: string = DEFAULT_GEMINI_FLASH_MODEL,
|
||||||
) =>
|
) =>
|
||||||
`\nYou have reached your daily ${currentModel} quota limit. You will be switched to the ${fallbackModel} model for the rest of this session. To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
`\nYou have reached your daily ${currentModel} quota limit. You will be switched to the ${fallbackModel} model for the rest of this session. To increase your limits, upgrade to get higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
||||||
|
|
||||||
const getRateLimitErrorMessageGoogleGenericQuotaFree = () =>
|
const getRateLimitErrorMessageGoogleGenericQuotaFree = () =>
|
||||||
`\nYou have reached your daily quota limit. To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
`\nYou have reached your daily quota limit. To increase your limits, upgrade to get higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
||||||
|
|
||||||
// Legacy/Standard Tier message functions
|
// Legacy/Standard Tier message functions
|
||||||
const getRateLimitErrorMessageGooglePaid = (
|
const getRateLimitErrorMessageGooglePaid = (
|
||||||
|
|||||||
Reference in New Issue
Block a user