chatGPTBox
chatGPTBox copied to clipboard
feat: Integrate Google Gemini API support
Adds support for using the Google Gemini API via an API key.
Key changes include:
-
Configuration:
- Added
geminiApiKeytodefaultConfiginsrc/config/index.mjs. - Defined
geminiApiModelKeysand added 'Gemini (API, Pro)' toModelsandModelGroups. - Added 'geminiApiPro' to the default
activeApiModes.
- Added
-
API Client:
- Created
src/services/apis/gemini-api.mjswith logic to connect to the Gemini API using the configured API key. Includes placeholder for the exact API endpoint and payload structure.
- Created
-
User Interface:
- Added an input field in
src/popup/sections/GeneralPart.jsxfor you to enter your Gemini API key. This field is conditionally displayed when a Gemini API model is active.
- Added an input field in
-
Integration:
- Updated
src/background/index.mjsto route requests to thegenerateAnswersWithGeminiApiclient when a Gemini model is selected.
- Updated
Manual testing with a valid Gemini API key is required to fully verify the functionality.
/review
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
| ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪ |
| 🧪 No relevant tests |
| 🔒 Security concerns Sensitive information exposure: |
⚡ Recommended focus areas for reviewError Handling
|
/improve
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.
PR Code Suggestions ✨
| Category | Suggestion | Impact |
| Possible issue |
Add conversation history supportInclude conversation history in the Gemini API request to maintain context src/services/apis/gemini-api.mjs [20-36]
Suggestion importance[1-10]: 7__ Why: This addresses a significant functional issue where the API would lose conversation context between messages. Including | Medium |
Use dynamic model selectionUse the model specified in the session rather than hardcoding 'gemini-pro'. This src/services/apis/gemini-api.mjs [6]
Suggestion importance[1-10]: 6__ Why: Good suggestion for future extensibility to support multiple Gemini models. Using | Low | |
Fix configuration parametersUncomment and fix the generationConfig section to properly use the user's src/services/apis/gemini-api.mjs [26-29]
Suggestion importance[1-10]: 5__ Why: Correctly identifies that | Low | |
| ||