-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Improve logic for Gemini free request limits #2303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve logic for Gemini free request limits #2303
Conversation
Refactor the handling of Gemini free request limits (RPM) to be data-driven instead of hardcoded in the UI. Limits are now defined per-model within `geminiModels` in `src/shared/api.ts` using the new `freeRequestsRpm` property in the `ModelInfo` schema. This centralizes the configuration logic, enhancing maintainability and flexibility to support varying limits across different Gemini models, resolving the previous inflexibility where limits were determined by string matching in `ModelInfoView`.
|
| <VSCodeLink href="https://ai.google.dev/pricing" className="text-sm"> | ||
| {t("settings:modelInfo.gemini.pricingDetails")} | ||
| </VSCodeLink> | ||
| : modelInfo.freeRequestsRpm && modelInfo.freeRequestsRpm > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repeated condition modelInfo.freeRequestsRpm && modelInfo.freeRequestsRpm > 0 is used twice. Consider extracting it into a variable (e.g. const hasFreeRequests = modelInfo.freeRequestsRpm > 0) to improve readability and avoid potential repetition errors.
|
@mrubens Could you lend me a hand here, please? |
|
Sorry I haven't gotten to this one yet - have been swamped with all things Gemini (particularly caching). Still on my list to take a look. As always, your contributions are greatly appreciated. |
|
@mrubens, since the PR hasn't been reviewed for a while, there have been a few code base conflicts. If it's more convenient, I can update or rewrite the code once reviewers are available. |
Context
Improve the logic for Gemini free request limits by moving the configuration from the UI to the centralized API. Previously, the limits (15 for flash models, 2 for others) were hardcoded in ModelInfoView, which reduced flexibility.
Implementation
freeRequestsRPMproperty to the ModelInfo schema.geminiModelsinsrc/shared/api.tsto include the appropriate freeRequestsRPM values (15 for flash models, 2 for others).How to Test
I encountered issues running
npm run buildeven for the main branch and could not test the changes. Please review and test the modifications.My
npm run buildlog:Important
Centralizes Gemini free request limits by adding
freeRequestsRpmto the API and updating the UI to use this centralized configuration.freeRequestsRpmtoModelInfoschema inindex.ts.geminiModelsinapi.tsto includefreeRequestsRpmvalues (15 for flash models, 2 for others).ModelInfoViewinModelInfoView.tsxto displayfreeRequestsRpmfrommodelInfo.freeRequestsRpmtoProviderSettingsinroo-code.d.tsandtypes.ts.This description was created by
for 59538d1. It will automatically update as commits are pushed.