Skip to content

Commit 953872d

Browse files
committed
🔥 remove(compose.yaml, botservice.mjs, botservice.ts): remove unnecessary code and add new environment variable
Added a new environment variable OPENAI_IMAGE_MODEL_NAME in compose.yaml. This allows setting the image model name for OpenAI on docker image. Also, removed the duplicate check for global.FormData in botservice.mjs and botservice.ts. This reduces code redundancy and improves readability.
1 parent 6c5599b commit 953872d

File tree

3 files changed

+1
-10
lines changed

3 files changed

+1
-10
lines changed

‎compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
MATTERMOST_BOTNAME: ${MATTERMOST_BOTNAME}
1111
OPENAI_API_KEY: ${OPENAI_API_KEY}
1212
OPENAI_MODEL_NAME: ${OPENAI_MODEL_NAME}
13+
OPENAI_IMAGE_MODEL_NAME: ${OPENAI_IMAGE_MODEL_NAME}
1314
OPENAI_MAX_TOKENS: ${OPENAI_MAX_TOKENS}
1415
MAX_PROMPT_TOKENS: ${MAX_PROMPT_TOKENS}
1516
PLUGINS: ${PLUGINS}

‎dist/botservice.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,6 @@ function tokenCount(content) {
464464
if (!global.FormData) {
465465
global.FormData = FormData3;
466466
}
467-
if (!global.FormData) {
468-
global.FormData = FormData3;
469-
}
470467
var name = process.env["MATTERMOST_BOTNAME"] || "@chatgpt";
471468
var contextMsgCount = Number(process.env["BOT_CONTEXT_MSG"] ?? 100);
472469
var SYSTEM_MESSAGE_HEADER = "// BOT System Message: ";

‎src/botservice.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ declare const global: {
2222
if (!global.FormData) {
2323
global.FormData = FormData
2424
}
25-
if (!global.FormData) {
26-
global.FormData = FormData
27-
}
28-
// Upstream
29-
// if (!global.FormData) {
30-
// global.FormData = require('form-data')
31-
// }
3225

3326
const name = process.env['MATTERMOST_BOTNAME'] || '@chatgpt'
3427
const contextMsgCount = Number(process.env['BOT_CONTEXT_MSG'] ?? 100)

0 commit comments

Comments
 (0)