Skip to content

Commit

Permalink
🔥 remove(compose.yaml, botservice.mjs, botservice.ts): remove unneces…
Browse files Browse the repository at this point in the history
…sary 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.
  • Loading branch information
takuya-o committed Nov 7, 2023
1 parent 6c5599b commit 953872d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
MATTERMOST_BOTNAME: ${MATTERMOST_BOTNAME}
OPENAI_API_KEY: ${OPENAI_API_KEY}
OPENAI_MODEL_NAME: ${OPENAI_MODEL_NAME}
OPENAI_IMAGE_MODEL_NAME: ${OPENAI_IMAGE_MODEL_NAME}
OPENAI_MAX_TOKENS: ${OPENAI_MAX_TOKENS}
MAX_PROMPT_TOKENS: ${MAX_PROMPT_TOKENS}
PLUGINS: ${PLUGINS}
Expand Down
3 changes: 0 additions & 3 deletions dist/botservice.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,6 @@ function tokenCount(content) {
if (!global.FormData) {
global.FormData = FormData3;
}
if (!global.FormData) {
global.FormData = FormData3;
}
var name = process.env["MATTERMOST_BOTNAME"] || "@chatgpt";
var contextMsgCount = Number(process.env["BOT_CONTEXT_MSG"] ?? 100);
var SYSTEM_MESSAGE_HEADER = "// BOT System Message: ";
Expand Down
7 changes: 0 additions & 7 deletions src/botservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ declare const global: {
if (!global.FormData) {
global.FormData = FormData
}
if (!global.FormData) {
global.FormData = FormData
}
// Upstream
// if (!global.FormData) {
// global.FormData = require('form-data')
// }

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

0 comments on commit 953872d

Please sign in to comment.