nodebb-plugin-openai 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library.js +8 -0
- package/package.json +2 -2
- package/templates/admin/plugins/openai.tpl +11 -1
- package/.eslintrc +0 -3
- package/public/lib/.eslintrc +0 -3
package/library.js
CHANGED
|
@@ -38,7 +38,15 @@ plugin.init = async (params) => {
|
|
|
38
38
|
if (settings && settings.apikey) {
|
|
39
39
|
openai = new OpenAI({
|
|
40
40
|
apiKey: settings.apikey,
|
|
41
|
+
baseURL: settings.apiBaseUrl || 'https://api.openai.com/v1',
|
|
41
42
|
});
|
|
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
|
+
|
|
42
50
|
plugin.openai = openai;
|
|
43
51
|
}
|
|
44
52
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-openai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "A NodeBB OpenAI plugin",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"repository": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"compatibility": "^3.2.0 || ^4.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"openai": "4.
|
|
39
|
+
"openai": "4.103.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@commitlint/cli": "19.3.0",
|
|
@@ -11,9 +11,18 @@
|
|
|
11
11
|
<label class="form-label" for="apikey">API Key</label>
|
|
12
12
|
<input type="text" id="apikey" name="apikey" title="API Key" class="form-control">
|
|
13
13
|
<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.
|
|
15
15
|
</p>
|
|
16
16
|
</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
|
+
|
|
17
26
|
<div class="mb-3">
|
|
18
27
|
<label class="form-label" for="chatgpt-username">ChatGPT Username</label>
|
|
19
28
|
<input type="text" id="chatgpt-username" name="chatgpt-username" title="ChatGPT Username" class="form-control">
|
|
@@ -40,6 +49,7 @@
|
|
|
40
49
|
<option value="gpt-4">gpt-4</option>
|
|
41
50
|
<option value="gpt-4.1-mini">gpt-4.1-mini</option>
|
|
42
51
|
<option value="gpt-4.1">gpt-4.1</option>
|
|
52
|
+
<option value="gemini-2.0-flash">gemini-2.0-flash</option>
|
|
43
53
|
</select>
|
|
44
54
|
</div>
|
|
45
55
|
<div class="">
|
package/.eslintrc
DELETED
package/public/lib/.eslintrc
DELETED