Skip to content

Commit 58a91db

Browse files
committed
feat: add support for google gemini
1 parent c2e757e commit 58a91db

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

.eslintrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

library.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ plugin.init = async (params) => {
3838
if (settings && settings.apikey) {
3939
openai = new OpenAI({
4040
apiKey: settings.apikey,
41+
baseURL: settings.apiBaseUrl || 'https://api.openai.com/v1',
4142
});
43+
44+
// Uncomment the following lines to list available models
45+
// const list = await openai.models.list();
46+
// for await (const model of list) {
47+
// console.log(model.id);
48+
// }
49+
4250
plugin.openai = openai;
4351
}
4452

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"compatibility": "^3.2.0 || ^4.0.0"
3737
},
3838
"dependencies": {
39-
"openai": "4.98.0"
39+
"openai": "4.103.0"
4040
},
4141
"devDependencies": {
4242
"@commitlint/cli": "19.3.0",

public/lib/.eslintrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

templates/admin/plugins/openai.tpl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,18 @@
1111
<label class="form-label" for="apikey">API Key</label>
1212
<input type="text" id="apikey" name="apikey" title="API Key" class="form-control">
1313
<p class="form-text">
14-
Get your <a href="https://platform.openai.com/api-keys">API Key</a> and enter it above. Requires a restart.
14+
Get your <a href="https://platform.openai.com/api-keys">API Key</a> and enter it above. You can enter a Google Gemini API key if you want to use Google Gemini. Don't forget to change the model used to a gemini variant. Requires a restart.
1515
</p>
1616
</div>
17+
18+
<div class="mb-3">
19+
<label class="form-label" for="apiBaseUrl">API Base Url</label>
20+
<input type="text" id="apiBaseUrl" name="apiBaseUrl" title="API Base Url" class="form-control">
21+
<p class="form-text">
22+
If you want to use Google's Gemini API, enter the base URL here (https://generativelanguage.googleapis.com/v1beta/openai/). Otherwise, leave it blank to use OpenAI's API. Requires a restart.
23+
</p>
24+
</div>
25+
1726
<div class="mb-3">
1827
<label class="form-label" for="chatgpt-username">ChatGPT Username</label>
1928
<input type="text" id="chatgpt-username" name="chatgpt-username" title="ChatGPT Username" class="form-control">
@@ -40,6 +49,7 @@
4049
<option value="gpt-4">gpt-4</option>
4150
<option value="gpt-4.1-mini">gpt-4.1-mini</option>
4251
<option value="gpt-4.1">gpt-4.1</option>
52+
<option value="gemini-2.0-flash">gemini-2.0-flash</option>
4353
</select>
4454
</div>
4555
<div class="">

0 commit comments

Comments
 (0)