feat: Integrate Google Gemini API support#859
feat: Integrate Google Gemini API support#859canweb221 wants to merge 1 commit intoChatGPTBox-dev:masterfrom
Conversation
Adds support for using the Google Gemini API via an API key.
Key changes include:
- Configuration:
- Added `geminiApiKey` to `defaultConfig` in `src/config/index.mjs`.
- Defined `geminiApiModelKeys` and added 'Gemini (API, Pro)' to `Models` and `ModelGroups`.
- Added 'geminiApiPro' to the default `activeApiModes`.
- API Client:
- Created `src/services/apis/gemini-api.mjs` with logic to connect to the
Gemini API using the configured API key. Includes placeholder for the
exact API endpoint and payload structure.
- User Interface:
- Added an input field in `src/popup/sections/GeneralPart.jsx` for you
to enter your Gemini API key. This field is conditionally displayed
when a Gemini API model is active.
- Integration:
- Updated `src/background/index.mjs` to route requests to the
`generateAnswersWithGeminiApi` client when a Gemini model is selected.
Manual testing with a valid Gemini API key is required to fully verify
the functionality.
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for the Google Gemini API by integrating a new API client, updating configuration, and adding a user interface input for the Gemini API key.
- Added a new service module for communicating with the Gemini API.
- Updated configuration and UI components to handle the Gemini API key.
- Integrated Gemini API support in the background routing for generating answers.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/services/apis/gemini-api.mjs | New API client added to connect to the Gemini API. |
| src/popup/sections/GeneralPart.jsx | Added conditional input field for Gemini API key. |
| src/config/index.mjs | Updated configuration with Gemini API keys and models. |
| src/background/index.mjs | Routed requests to the new Gemini API client. |
| {isUsingGeminiApiModel(config) && ( | ||
| <input | ||
| type="password" | ||
| style="width: 50%;" |
There was a problem hiding this comment.
In React, the style prop should be provided as an object (e.g., style={{ width: '50%' }}) rather than a string literal to ensure proper rendering.
| style="width: 50%;" | |
| style={{ width: '50%' }} |
|
/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:
|
|
/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 ✨
|
|||||||||||||
Adds support for using the Google Gemini API via an API key.
Key changes include:
Configuration:
geminiApiKeytodefaultConfiginsrc/config/index.mjs.geminiApiModelKeysand added 'Gemini (API, Pro)' toModelsandModelGroups.activeApiModes.API Client:
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.User Interface:
src/popup/sections/GeneralPart.jsxfor you to enter your Gemini API key. This field is conditionally displayed when a Gemini API model is active.Integration:
src/background/index.mjsto route requests to thegenerateAnswersWithGeminiApiclient when a Gemini model is selected.Manual testing with a valid Gemini API key is required to fully verify the functionality.