Skip to content

Commit a268fcd

Browse files
author
m00nyONE
committed
add customizable Prompt for the bot
1 parent c6e5471 commit a268fcd

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

helm/chatgpt-mattermost-bot/templates/chatbot-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ data:
1717
DEBUG_LEVEL: "{{ .Values.config.DEBUG_LEVEL | default "INFO" }}"
1818
BOT_CONTEXT_MSG: "{{ .Values.config.BOT_CONTEXT_MSG | default "100" }}"
1919
NODE_ENV: "{{ .Values.config.NODE_ENV | default "production" }}"
20-
21-
20+
BOT_INSTRUCTION: "{{ .Values.config.BOT_INSTRUCTION | default "" }}"

helm/chatgpt-mattermost-bot/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ config: # required: example: descriptio
2626
DEBUG_LEVEL: "" # no TRACE a debug level used for logging activity, defaults to INFO
2727
BOT_CONTEXT_MSG: "" # no 15 The number of previous messages which are appended to the conversation with ChatGPT, defaults to 100
2828
NODE_ENV: "" # no development The mode NodeJS runs in. Defaults to production
29+
BOT_INSTRUCTION: "" # no Act like Elon Musk Extra instruction to give your assistance. How should the assistant behave?
2930

3031

3132
serviceAccount:

src/botservice.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ if (!global.FormData) {
2020

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

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

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

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

0 commit comments

Comments
 (0)