From a268fcd35fe20d0639f15af3021fb11eb45f0867 Mon Sep 17 00:00:00 2001 From: m00nyONE <> Date: Fri, 17 Nov 2023 17:50:29 +0100 Subject: [PATCH 1/3] add customizable Prompt for the bot --- helm/chatgpt-mattermost-bot/templates/chatbot-config.yaml | 3 +-- helm/chatgpt-mattermost-bot/values.yaml | 1 + src/botservice.ts | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/helm/chatgpt-mattermost-bot/templates/chatbot-config.yaml b/helm/chatgpt-mattermost-bot/templates/chatbot-config.yaml index 0cbf81b..a403775 100644 --- a/helm/chatgpt-mattermost-bot/templates/chatbot-config.yaml +++ b/helm/chatgpt-mattermost-bot/templates/chatbot-config.yaml @@ -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 "" }}" \ No newline at end of file diff --git a/helm/chatgpt-mattermost-bot/values.yaml b/helm/chatgpt-mattermost-bot/values.yaml index fb70ae7..b9fb901 100644 --- a/helm/chatgpt-mattermost-bot/values.yaml +++ b/helm/chatgpt-mattermost-bot/values.yaml @@ -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: diff --git a/src/botservice.ts b/src/botservice.ts index 3c43d7c..9054503 100644 --- a/src/botservice.ts +++ b/src/botservice.ts @@ -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[] = [ @@ -30,9 +33,8 @@ const plugins: PluginBase[] = [ ] /* 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, meId: string) { if (msg.event !== 'posted' || !meId) { From 3a26710546bf9b132c544a73c5cc5e0b8031409b Mon Sep 17 00:00:00 2001 From: m00nyONE <> Date: Fri, 17 Nov 2023 17:53:34 +0100 Subject: [PATCH 2/3] edit README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 586f41e..d9462ff 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,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. From 9382818b126b1ced3c6cc175730a52d401abc82c Mon Sep 17 00:00:00 2001 From: m00nyONE <> Date: Fri, 17 Nov 2023 18:27:19 +0100 Subject: [PATCH 3/3] remove redundant tag redefinition --- helm/chatgpt-mattermost-bot/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/chatgpt-mattermost-bot/values.yaml b/helm/chatgpt-mattermost-bot/values.yaml index b9fb901..a37ec2a 100644 --- a/helm/chatgpt-mattermost-bot/values.yaml +++ b/helm/chatgpt-mattermost-bot/values.yaml @@ -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: []