nodebb-plugin-openai 1.3.2 → 1.4.1
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/languages/en-GB/openai.json +20 -2
- package/languages/en-US/openai.json +20 -2
- package/languages/he/openai.json +23 -0
- package/library.js +8 -0
- package/package.json +2 -2
- package/public/lib/main.js +1 -1
- package/templates/admin/plugins/openai.tpl +29 -19
- package/.eslintrc +0 -3
- package/public/lib/.eslintrc +0 -3
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"error.need-x-reputation-to-mention": "You need at least %1 reputation for mentioning chatgpt",
|
|
3
3
|
"summarize-topic": "Summarize Topic",
|
|
4
|
-
"topic-summary": "Topic Summary"
|
|
5
|
-
|
|
4
|
+
"topic-summary": "Topic Summary",
|
|
5
|
+
|
|
6
|
+
"admin.general": "General",
|
|
7
|
+
"admin.apikey": "API Key",
|
|
8
|
+
"admin.apikey-help": "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.",
|
|
9
|
+
"admin.api-base-url": "API Base Url",
|
|
10
|
+
"admin.api-base-url-help": "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.",
|
|
11
|
+
"admin.chatgpt-username": "ChatGPT Username",
|
|
12
|
+
"admin.chatgpt-username-help": "<a href=\"%1/admin/manage/users\">Create a user</a> and enter their username. Other users can mention this user to ask questions to ChatGPT or send private messages if enabled below.",
|
|
13
|
+
"admin.enable-private-messages": "Enable Private Messages",
|
|
14
|
+
"admin.enable-private-messages-help": "If enabled users can send ChatGPT user private messages.",
|
|
15
|
+
"admin.model": "Model",
|
|
16
|
+
"admin.system-prompt": "System Prompt",
|
|
17
|
+
"admin.system-prompt-placeholder": "You are a helpful assistant",
|
|
18
|
+
"admin.restrictions": "Restrictions",
|
|
19
|
+
"admin.minimum-reputation": "Minimum Reputation",
|
|
20
|
+
"admin.minimum-reputation-help": "Minimum reputation required to mention chatgpt user. (0 to disable)",
|
|
21
|
+
"admin.allowed-groups": "Allowed Groups",
|
|
22
|
+
"admin.allowed-groups-help": "Only users in these groups will be able to mention the chatgpt user. Leave blank to allow all groups."
|
|
23
|
+
}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"error.need-x-reputation-to-mention": "You need at least %1 reputation for mentioning chatgpt",
|
|
3
3
|
"summarize-topic": "Summarize Topic",
|
|
4
|
-
"topic-summary": "Topic Summary"
|
|
5
|
-
|
|
4
|
+
"topic-summary": "Topic Summary",
|
|
5
|
+
|
|
6
|
+
"admin.general": "General",
|
|
7
|
+
"admin.apikey": "API Key",
|
|
8
|
+
"admin.apikey-help": "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.",
|
|
9
|
+
"admin.api-base-url": "API Base Url",
|
|
10
|
+
"admin.api-base-url-help": "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.",
|
|
11
|
+
"admin.chatgpt-username": "ChatGPT Username",
|
|
12
|
+
"admin.chatgpt-username-help": "<a href=\"%1/admin/manage/users\">Create a user</a> and enter their username. Other users can mention this user to ask questions to ChatGPT or send private messages if enabled below.",
|
|
13
|
+
"admin.enable-private-messages": "Enable Private Messages",
|
|
14
|
+
"admin.enable-private-messages-help": "If enabled users can send ChatGPT user private messages.",
|
|
15
|
+
"admin.model": "Model",
|
|
16
|
+
"admin.system-prompt": "System Prompt",
|
|
17
|
+
"admin.system-prompt-placeholder": "You are a helpful assistant",
|
|
18
|
+
"admin.restrictions": "Restrictions",
|
|
19
|
+
"admin.minimum-reputation": "Minimum Reputation",
|
|
20
|
+
"admin.minimum-reputation-help": "Minimum reputation required to mention chatgpt user. (0 to disable)",
|
|
21
|
+
"admin.allowed-groups": "Allowed Groups",
|
|
22
|
+
"admin.allowed-groups-help": "Only users in these groups will be able to mention the chatgpt user. Leave blank to allow all groups."
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"error.need-x-reputation-to-mention": "דרושה לך מוניטין של %1 לפחות כדי לאזכר את chatgpt",
|
|
3
|
+
"summarize-topic": "סכם נושא",
|
|
4
|
+
"topic-summary": "סיכום הנושא",
|
|
5
|
+
|
|
6
|
+
"admin.general": "כללי",
|
|
7
|
+
"admin.apikey": "מפתח API",
|
|
8
|
+
"admin.apikey-help": "השג את <a href=\"https://platform.openai.com/api-keys\">מפתח ה-API</a> שלך והזן אותו למעלה. ניתן להזין מפתח API של Google Gemini אם ברצונך להשתמש ב-Google Gemini. אל תשכח לשנות את המודל שבשימוש לגרסת gemini. דורש הפעלה מחדש.",
|
|
9
|
+
"admin.api-base-url": "כתובת בסיס של API",
|
|
10
|
+
"admin.api-base-url-help": "אם ברצונך להשתמש ב-API של Google Gemini, הזן כאן את כתובת הבסיס (https://generativelanguage.googleapis.com/v1beta/openai/). אחרת, השאר ריק כדי להשתמש ב-API של OpenAI. דורש הפעלה מחדש.",
|
|
11
|
+
"admin.chatgpt-username": "שם משתמש של ChatGPT",
|
|
12
|
+
"admin.chatgpt-username-help": "<a href=\"%1/admin/manage/users\">צור משתמש</a> והזן את שם המשתמש שלו. משתמשים אחרים יוכלו לאזכר את המשתמש הזה כדי לשאול שאלות את ChatGPT, או לשלוח הודעות פרטיות אם הדבר מאופשר למטה.",
|
|
13
|
+
"admin.enable-private-messages": "אפשר הודעות פרטיות",
|
|
14
|
+
"admin.enable-private-messages-help": "אם מאופשר, משתמשים יוכלו לשלוח הודעות פרטיות למשתמש ChatGPT.",
|
|
15
|
+
"admin.model": "מודל",
|
|
16
|
+
"admin.system-prompt": "הנחיית מערכת",
|
|
17
|
+
"admin.system-prompt-placeholder": "אתה עוזר מועיל",
|
|
18
|
+
"admin.restrictions": "הגבלות",
|
|
19
|
+
"admin.minimum-reputation": "מוניטין מזערי",
|
|
20
|
+
"admin.minimum-reputation-help": "המוניטין המזערי הנדרש כדי לאזכר את משתמש chatgpt. (0 לביטול)",
|
|
21
|
+
"admin.allowed-groups": "קבוצות מורשות",
|
|
22
|
+
"admin.allowed-groups-help": "רק משתמשים בקבוצות אלו יוכלו לאזכר את משתמש chatgpt. השאר ריק כדי לאפשר לכל הקבוצות."
|
|
23
|
+
}
|
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.1",
|
|
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",
|
package/public/lib/main.js
CHANGED
|
@@ -5,34 +5,43 @@
|
|
|
5
5
|
<div id="spy-container" class="col-12 col-md-8 px-0 mb-4" tabindex="0">
|
|
6
6
|
<form role="form" class="openai-settings">
|
|
7
7
|
<div class="mb-4">
|
|
8
|
-
<h5 class="fw-bold tracking-tight settings-header">
|
|
8
|
+
<h5 class="fw-bold tracking-tight settings-header">[[openai:admin.general]]</h5>
|
|
9
9
|
|
|
10
10
|
<div class="mb-3">
|
|
11
|
-
<label class="form-label" for="apikey">
|
|
12
|
-
<input type="text" id="apikey" name="apikey" title="
|
|
11
|
+
<label class="form-label" for="apikey">[[openai:admin.apikey]]</label>
|
|
12
|
+
<input type="text" id="apikey" name="apikey" title="[[openai:admin.apikey]]" class="form-control">
|
|
13
13
|
<p class="form-text">
|
|
14
|
-
|
|
14
|
+
[[openai:admin.apikey-help]]
|
|
15
15
|
</p>
|
|
16
16
|
</div>
|
|
17
|
+
|
|
18
|
+
<div class="mb-3">
|
|
19
|
+
<label class="form-label" for="apiBaseUrl">[[openai:admin.api-base-url]]</label>
|
|
20
|
+
<input type="text" id="apiBaseUrl" name="apiBaseUrl" title="[[openai:admin.api-base-url]]" class="form-control">
|
|
21
|
+
<p class="form-text">
|
|
22
|
+
[[openai:admin.api-base-url-help]]
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
17
26
|
<div class="mb-3">
|
|
18
|
-
<label class="form-label" for="chatgpt-username">
|
|
19
|
-
<input type="text" id="chatgpt-username" name="chatgpt-username" title="
|
|
27
|
+
<label class="form-label" for="chatgpt-username">[[openai:admin.chatgpt-username]]</label>
|
|
28
|
+
<input type="text" id="chatgpt-username" name="chatgpt-username" title="[[openai:admin.chatgpt-username]]" class="form-control">
|
|
20
29
|
<p class="form-text">
|
|
21
|
-
|
|
30
|
+
[[openai:admin.chatgpt-username-help, {config.relative_path}]]
|
|
22
31
|
</p>
|
|
23
32
|
</div>
|
|
24
33
|
|
|
25
34
|
<div class="form-check form-switch">
|
|
26
35
|
<input type="checkbox" class="form-check-input" id="enablePrivateMessages" name="enablePrivateMessages">
|
|
27
|
-
<label for="enablePrivateMessages" class="form-check-label">
|
|
36
|
+
<label for="enablePrivateMessages" class="form-check-label">[[openai:admin.enable-private-messages]]</label>
|
|
28
37
|
<p class="form-text">
|
|
29
|
-
|
|
38
|
+
[[openai:admin.enable-private-messages-help]]
|
|
30
39
|
</p>
|
|
31
40
|
</div>
|
|
32
41
|
|
|
33
42
|
<div class="mb-3">
|
|
34
|
-
<label class="form-label" for="model">
|
|
35
|
-
<select class="form-select" id="model" name="model" title="
|
|
43
|
+
<label class="form-label" for="model">[[openai:admin.model]]</label>
|
|
44
|
+
<select class="form-select" id="model" name="model" title="[[openai:admin.model]]">
|
|
36
45
|
<option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
|
|
37
46
|
<option value="gpt-4o-mini">gpt-4o-mini</option>
|
|
38
47
|
<option value="gpt-4o">gpt-4o</option>
|
|
@@ -40,33 +49,34 @@
|
|
|
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="">
|
|
46
|
-
<label class="form-label" for="systemPrompt">
|
|
47
|
-
<textarea class="form-control" id="systemPrompt" name="systemPrompt" title="
|
|
56
|
+
<label class="form-label" for="systemPrompt">[[openai:admin.system-prompt]]</label>
|
|
57
|
+
<textarea class="form-control" id="systemPrompt" name="systemPrompt" title="[[openai:admin.system-prompt]]" placeholder="[[openai:admin.system-prompt-placeholder]]" rows="8"></textarea>
|
|
48
58
|
</div>
|
|
49
59
|
</div>
|
|
50
60
|
|
|
51
61
|
<div class="">
|
|
52
|
-
<h5 class="fw-bold tracking-tight settings-header">
|
|
62
|
+
<h5 class="fw-bold tracking-tight settings-header">[[openai:admin.restrictions]]</h5>
|
|
53
63
|
|
|
54
64
|
<div class="mb-3">
|
|
55
|
-
<label class="form-label" for="minimumReputation">
|
|
56
|
-
<input type="text" id="minimumReputation" name="minimumReputation" title="
|
|
65
|
+
<label class="form-label" for="minimumReputation">[[openai:admin.minimum-reputation]]</label>
|
|
66
|
+
<input type="text" id="minimumReputation" name="minimumReputation" title="[[openai:admin.minimum-reputation]]" class="form-control">
|
|
57
67
|
<p class="form-text">
|
|
58
|
-
|
|
68
|
+
[[openai:admin.minimum-reputation-help]]
|
|
59
69
|
</p>
|
|
60
70
|
</div>
|
|
61
71
|
<div class="mb-3">
|
|
62
|
-
<label class="form-label" form="allowedGroups">
|
|
72
|
+
<label class="form-label" form="allowedGroups">[[openai:admin.allowed-groups]]</label>
|
|
63
73
|
<select class="form-select" multiple id="allowedGroups" name="allowedGroups" size="10">
|
|
64
74
|
{{{ each groups }}}
|
|
65
75
|
<option value="{./displayName}">{./displayName}</option>
|
|
66
76
|
{{{ end }}}
|
|
67
77
|
</select>
|
|
68
78
|
<p class="form-text">
|
|
69
|
-
|
|
79
|
+
[[openai:admin.allowed-groups-help]]
|
|
70
80
|
</p>
|
|
71
81
|
</div>
|
|
72
82
|
</div>
|
package/.eslintrc
DELETED
package/public/lib/.eslintrc
DELETED