Skip to content

Commit

Permalink
Merge remote-tracking branch 'm00nyONE/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
yGuy committed Feb 17, 2024
2 parents fd893b9 + 9382818 commit 1a9644b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ or when [running the docker image](#using-the-ready-made-docker-image) or when c
| PLUGINS | no | `graph-plugin, image-plugin` | The enabled plugins of the bot. By default all plugins (grpah-plugin and image-plugin) are enabled. |
| DEBUG_LEVEL | no | `TRACE` | a debug level used for logging activity, defaults to `INFO` |
| BOT_CONTEXT_MSG | no | `15` | The number of previous messages which are appended to the conversation with ChatGPT, defaults to 100 |
| BOT_INSTRUCTION | no | `Act like Elon Musk` | Extra instruction to give your assistance. How should the assistant behave? |

> **Note**
> The `YFILES_SERVER_URL` is used for automatically converting text information created by the bot into diagrams.
Expand Down
3 changes: 1 addition & 2 deletions helm/chatgpt-mattermost-bot/templates/chatbot-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ data:
DEBUG_LEVEL: "{{ .Values.config.DEBUG_LEVEL | default "INFO" }}"
BOT_CONTEXT_MSG: "{{ .Values.config.BOT_CONTEXT_MSG | default "100" }}"
NODE_ENV: "{{ .Values.config.NODE_ENV | default "production" }}"


BOT_INSTRUCTION: "{{ .Values.config.BOT_INSTRUCTION | default "" }}"
3 changes: 2 additions & 1 deletion helm/chatgpt-mattermost-bot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ image:
repository: chatgpt-mattermost-bot
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v2.1.2"
tag: ""

imagePullSecrets: []

Expand All @@ -26,6 +26,7 @@ config: # required: example: descriptio
DEBUG_LEVEL: "" # no TRACE a debug level used for logging activity, defaults to INFO
BOT_CONTEXT_MSG: "" # no 15 The number of previous messages which are appended to the conversation with ChatGPT, defaults to 100
NODE_ENV: "" # no development The mode NodeJS runs in. Defaults to production
BOT_INSTRUCTION: "" # no Act like Elon Musk Extra instruction to give your assistance. How should the assistant behave?


serviceAccount:
Expand Down
8 changes: 5 additions & 3 deletions src/botservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ if (!global.FormData) {

const name = process.env['MATTERMOST_BOTNAME'] || '@chatgpt'
const contextMsgCount = Number(process.env['BOT_CONTEXT_MSG'] ?? 100)
const additionalBotInstructions = process.env['BOT_INSTRUCTION'] || "You are a helpful assistant. Whenever users asks you for help you will " +
"provide them with succinct answers formatted using Markdown. You know the user's name as it is provided within the " +
"meta data of the messages."

/* List of all registered plugins */
const plugins: PluginBase<any>[] = [
Expand All @@ -30,9 +33,8 @@ const plugins: PluginBase<any>[] = [
]

/* The main system instruction for GPT */
const botInstructions = "Your name is " + name + " and you are a helpful assistant. Whenever users asks you for help you will " +
"provide them with succinct answers formatted using Markdown. You know the user's name as it is provided within the " +
"meta data of the messages."
const botInstructions = "Your name is " + name + ". " + additionalBotInstructions
botLog.debug({botInstructions: botInstructions})

async function onClientMessage(msg: WebSocketMessage<JSONMessageData>, meId: string) {
if (msg.event !== 'posted' || !meId) {
Expand Down

0 comments on commit 1a9644b

Please sign in to comment.