-
Notifications
You must be signed in to change notification settings - Fork 822
feat: Integrate Google Gemini API support #859
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
base: master
Are you sure you want to change the base?
feat: Integrate Google Gemini API support #859
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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%' }} |
Copilot uses AI. Check for mistakes.
/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:
geminiApiKey
todefaultConfig
insrc/config/index.mjs
.geminiApiModelKeys
and added 'Gemini (API, Pro)' toModels
andModelGroups
.activeApiModes
.API Client:
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:
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:
src/background/index.mjs
to route requests to thegenerateAnswersWithGeminiApi
client when a Gemini model is selected.Manual testing with a valid Gemini API key is required to fully verify the functionality.