yguy / chatgpt-mattermost-bot Goto Github PK
View Code? Open in Web Editor NEWA very simple implementation of a service for a mattermost bot that uses ChatGPT in the backend.
License: MIT License
A very simple implementation of a service for a mattermost bot that uses ChatGPT in the backend.
License: MIT License
See the attached screenshot, as soon as i mentioned @chatgpt
once as a string (not even a tag) on the red cross. he started to pollute my conversation with my team. This is especially annoying as my team would like to discuss the response from ChatGPT in the same thread. For us, ChatGPT should only been triggered on the reply where he is explicitly mentioned.
Would there be a way to have different mode of triggering chatGPT sometimes in full interactive mode (as now) and sometime in a more on-demand way. This is especially true for ChatGPT4 with an API limit of 24 requests per 3hours, you don't want to trigger him at every reply. Still when summoned on-demand ChatGPT should be able to use all the previous messages of the thread.
Dear Team,
I've already deploy docker chatgpt-mattermost-bot using yFiles HTML, but the image is now show correctly
it show like this https://prnt.sc/9z9Nt8pY8jek
<GRAPH>{
"nodes":[
{"id":"Herbivore","label":"Herbivore","type":"animal"},
{"id":"Plants","label":"Plants","type":"food"},
],
"edges":[
{"from":"Herbivore","to":"Plants","label":"eats","type":"consumes"}
],
"types":[
{"name":"animal","shape":"ellipse","color":"#fff","thickness":2,"size":30},
{"name":"food","shape":"ellipse","color":"#fff","thickness":2,"size":25},
{"name":"consumes","thickness":1,"color":"#000","label":"consumes"}
],
"layout":"organic"
}</GRAPH>
In the console log
chatgpt-mattermost-bot-chatbot-1 | {"level":"ERROR","time":"2023-05-10T05:45:32.466Z","name":"bot","msg":"request to http://localhost:4242/json-to-svg failed, reason: connect ECONNREFUSED 127.0.0.1:4242","pid":1,"hostname":"ece245de25a2","diff":0,"err":{"msg":"request to http://localhost:4242/json-to-svg failed, reason: connect ECONNREFUSED 127.0.0.1:4242","name":"FetchError","stack":"FetchError: request to http://localhost:4242/json-to-svg failed, reason: connect ECONNREFUSED 127.0.0.1:4242\n at ClientRequest.<anonymous> (/app/node_modules/node-fetch/lib/index.js:1505:11)\n at ClientRequest.emit (node:events:513:28)\n at Socket.socketErrorListener (node:_http_client:494:9)\n at Socket.emit (node:events:513:28)\n at emitErrorNT (node:internal/streams/destroy:157:8)\n at emitErrorCloseNT (node:internal/streams/destroy:122:3)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)","message":"request to http://localhost:4242/json-to-svg failed, reason: connect ECONNREFUSED 127.0.0.1:4242","type":"system","errno":"ECONNREFUSED","code":"ECONNREFUSED"}}
Is that issue compatibility or still development features if using yFiles?
I see there is a documentation for docker users only. Is there a roadmap for MATTERMOST self-hosted (ubuntu) users? Can anyone help on how to set it up?
I've followed the instruction to connect the bot to my Mattermost instance and I'm facing 429 error from ChatGPT.
Any idea?
Thanks
1st off thank you for this implementation with MM. Works really well.
I have pulled the latest code and build it into a docker image and wanted to test out the custom name option. Atm I am unable to get it working in any way. I have tried to use the exiting MM bot with it, a new one but nothing works and there are no error logs at all. It just doesn't respond.
Any info on that front?
Tried to use the variable with " ", with ' ', with or without @ but nothing helps.
Any info on this would be great!
Thanks again!
Would it be possible?
Working on this. Pull request will follow
Hello!
Is there any way to set the new GPT-4 api instead of 3.5?
BR
In code the plugins
environment variable is checked, however the Dockerfile uses PLUGINS
as the default, so by default neither the image nor the graph plugin are enabled.
chatgpt-mattermost-bot/Dockerfile
Line 18 in dab85a8
We should be using the upper case names in the code, too.
Workaround for now is to use plugin
as environment variable name.
I have a llama server running on another local server in the house. I have my mattermost stack running on a synology server. I was able to get the openai bot into mattermost and its working great. I would like to add another bot into the mattermost stack but reaching out to the other localmachine running the dalai server.
I noticed you have 2 branches a main and a llama branch. I am port forwarding correctly for port 3000.
chatgpt:
image: ghcr.io/yguy/chatgpt-mattermost-bot:latest
container_name: chatgpt
environment:
MATTERMOST_URL: 'https://'
MATTERMOST_TOKEN: ''
OPENAI_API_KEY: '**********************'
MATTERMOST_BOTNAME: '@chatgpt'
DEBUG_LEVEL: 'TRACE'
NODE_ENV: 'production'
restart: always
llamagpt:
image: ghcr.io/yguy/chatgpt-mattermost-bot:latest
container_name: llamagpt
environment:
MATTERMOST_URL: '***'
MATTERMOST_TOKEN: ''
DALAI_SERVER_URL: 'http://ipofcomputerrunningdalaiserve:3000'
MATTERMOST_BOTNAME: '@llamagpt'
DEBUG_LEVEL: 'TRACE'
NODE_ENV: 'production'
restart: always
I am not getting a response but it looks like its trying.
is there anything else
what am i doing wrong?
PS i did ask about the diagram bot and am excited. Thank you for everything you do.
Hello
Thanks for this work
I try to use it but I have this error in the log.
chatgpt | websocket connecting to wss://mattermost.**********.com/api/v4/websocket
chatgpt | node:internal/url:565
chatgpt | throw new ERR_INVALID_URL(input);
chatgpt | ^
chatgpt |
chatgpt | TypeError [ERR_INVALID_URL]: Invalid URL
chatgpt | at new NodeError (node:internal/errors:387:5)
chatgpt | at URL.onParseError (node:internal/url:565:9)
chatgpt | at new URL (node:internal/url:641:5)
chatgpt | at Object.<anonymous> (/app/src/process-graph-response.js:7:24)
chatgpt | at Module._compile (node:internal/modules/cjs/loader:1191:14)
chatgpt | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
chatgpt | at Module.load (node:internal/modules/cjs/loader:1069:32)
chatgpt | at Function.Module._load (node:internal/modules/cjs/loader:904:12)
chatgpt | at Module.require (node:internal/modules/cjs/loader:1093:19)
chatgpt | at require (node:internal/modules/cjs/helpers:108:18) {
chatgpt | input: '/json-to-svg',
chatgpt | code: 'ERR_INVALID_URL'
chatgpt | }
This looks like a fun thing for my digital mentors.
I got it all running and chatbot is communicating in direct conversations with me. However, I don't seem to be able to add chatbot to any of my channels?
When I type it's name in add people, nothing shows
Have maybe seen this before and know the solution?
I got another bot, which is showing as expected
Cannot get response from the ChatGPT even with the paid Plus ChatGPT account:
{
"level": "ERROR",
"time": "2023-04-18T09:46:19.306Z",
"name": "bot",
"msg": "Request failed with status code 429",
"pid": 1,
"hostname": "2b5d342ab71e",
"diff": 253,
"err": {
"name": "Error",
"stack": "Error: Request failed with status code 429\n at createError (/app/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/app/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:322:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)",
"config": {
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
},
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"User-Agent": "OpenAI/NodeJS/3.2.1",
"Authorization": "Bearer **MY_TOKEN_API_KEY**",
"Content-Length": 247
},
"method": "post",
"data": "{\"messages\":[{\"role\":\"system\",\"content\":\"You are a helpful assistant named @chatgpt who provides succinct answers in Markdown format.\"},{\"role\":\"user\",\"content\":\"@chatgpt now with OPENAI_MAX_TOKENS=100\"}],\"model\":\"gpt-3.5-turbo\",\"max_tokens\":100}",
"url": "https://api.openai.com/v1/chat/completions"
},
"status": 429
}
}
Here is the debug log in the docker container:
chatgpt-mattermost-bot-chatbot-1 | {"level":"ERROR","time":"2023-04-26T11:22:12.976Z","name":"bot","msg":"Request failed with status code 401","pid":1,"hostname":"64484852c59c","diff":158,"err":{"name":"Error","stack":"Error: Request failed with status code 401\n at createError (/app/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/app/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:322:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","User-Agent":"OpenAI/NodeJS/3.2.1","Authorization":"Bearer sk_HIDDEN","Content-Length":232},"method":"post","data":"{\"messages\":[{\"role\":\"system\",\"content\":\"You are a helpful assistant named @chatgpt who provides succinct answers in Markdown format.\"},{\"role\":\"user\",\"content\":\"@chatgpt what do you do?\"}],\"model\":\"gpt-3.5-turbo\",\"max_tokens\":2000}","url":"https://api.openai.com/v1/chat/completions"},"status":401}}
The only thing I didn't do was the cert stuff, I'm not sure what that was about so could it be ssl related?
Recently, we are getting errors from OpenAI API which result in non gracefully exited threads. IMO it would be great to introduce some simple error handling like described in https://www.npmjs.com/package/openai?activeTab=readme#Usage
Working on this right now. Pull request will follow.
Starting the program with npm start
(and the right env), it works for few minutes. After a bit (or when I leave the convo in Mattermost?) the program just ends like this:
{"level":"DEBUG","name":"mattermost","msg":{"event":"thread_updated","data":[obfuscated],"diff":25080}
{"level":"INFO","name":"bot-ws","msg":"websocket closed","diff":180288}
{"level":"ERROR","name":"bot","msg":"undefined","diff":0}
Using latest Node LTS on a Debian system.
Can the ChatGPT Mattermost bot be used in direct messages with other team members? When I use "@chatgpt" in a direct message, nothing happens.
I have added the bot to my team, and now I can directly message the bot or add it to a channel and use "@chatgpt" to trigger the bot. However, it does not work when I mention the bot in a direct message with someone else.
A friend of mine has build a similar bot for slack.
One thing he can do with it, is to summarize the conversations of a channel in a specific time frame (see screenshot).
It would be nice if this bot could also do something like this. In my opinion an UI isn't needed. A short command to chatgpt with the params should be enough.
It could also be used for different commands that have channel content as context.
Result:
This is more like a known issue issue rather than a bug report, but we might consider implementing workarounds for this problem in the ChatGPT LLM in the future.
If you ask ChatGPT mathematical questions, it will hallucinate the existence of a "python" plugin and call that plugin to compute the results. However there is no "python" plugin available.
I guess that plugin is available at OpenAI and the LLM was finetuned to make use of that plugin. However we don't have an implementation of that plugin and thus the bot's plugin mechanism detects an error and will tell you:
"Sorry, but it seems there was an error when using the plugin python
".
Keeping this around for other people to find if they run into this.
If you came across similar messages with non-existent plugins, please report them, here and possibly the prompt that caused it to appear.
I have been looking to get a bot like this setup in Mattermost and got it up and running yesterday thanks to your code. There was no Readme at the time so I had to learn by reverse engineering as I am not a programmer. Came to check in today and see you've updated a lot including docker. Its very interesting to see this project get built out, I am learning a lot. Thank you!
I have not explicitly disabled any of the plugins. "Exit" plugin works.
Whenever I ask for an image to be generated the bot refuses by stating that it can only respond via text.
It seems OpenAI has pretty strict rules for user names.
We need to sanitize the names before sending them to OpenAI, so that it will accept the user names.
The bot fails when there is a "." in the user name, e.g.
I am not sure what changed in the code but initially I was able to create a thread to a message and mention @chatgpt and the bot was able to pull information from the original message.
For example, I had an automation that forwarded emails to a Mattermost channel called ~emails . I would then hit 'reply' on a message that was sent to the ~email channel and mention @chatgpt to draft a response. The bot was able to draft an email response based on original message I was replying to.
Would it be possible to get this functionality back?
I set the environment variable "OPENAI_MODEL_NAME" with the value "gpt-4" but still it uses gpt3.5.
based on OpenAI API documentation the value "gpt-4" is correct.
Used config:
docker run -d --restart unless-stopped
-e MATTERMOST_URL=https://********
-e MATTERMOST_TOKEN=*********
-e OPENAI_API_KEY=********
-e OPENAI_MODEL_NAME=gpt-4 --name testGPT ghcr.io/yguy/chatgpt-mattermost-bot:latest
People seem to be running into this error, which seems to have two causes:
https://help.openai.com/en/articles/5955604-how-can-i-solve-429-too-many-requests-errors
Initial run of the bot, returns nothing after questions are asked.
Running with TRACE shows the following:
{"level":"ERROR","name":"bot-ws","msg":"(node:27143) UnhandledPromiseRejectionWarning: Error: Request failed with status code 429\n
Unsure what is causing the 429 error as this is the first time attempting to run/use a specific AI token, so would not expect any rate limiting to have been hit?
Hi talents,
I want to deploy this chatgpt bot to another machine, Could you please tell me how to implement the feature? And I want to seperate this bot from mattermost server.
Thanks.
Is there a way for us to make bot reply with "chatgpt writing" as it takes longer time for bot to reply and it seems nothing is happening when it is replying to our prompt.
You only see image error icons from imgur.com or a mini icon of a broken graphic. Is any bot configuration necessary? Bot as admin or as a team user?
Had this up and running and just started receiving this error:
{\"role\":\"user\",\"content\":\"hey are you still there? \"}],\"model\":\"gpt-3.5-turbo\",\"max_tokens\":2000}","url":"https://api.openai.com/v1/chat/completions"},"status":400}}
Any idea what might be causing this?
Would be great to be able to azure open ai api, which is not 100% compatible but almost.
Hi there! What about scaling one? I found adjustable "replics number" in the helm-chart values, so is it mean, that I can to up any number pods without conflicting?
Sending messages directly to the bot should also receive from openai.
This still needs some investigation, but it seems that the bot replies to arbitrary messages that are posted by the person who initially invited the bot into a channel, even outside of the thread that it had been invited to.
This is a severe problem, likely introduced with the refactorings in 2.0.0.
I would recommend sticking with the 1.x version until this has been resolved, unless you are OK with the bot sometimes replying (and thus sending your input to OpenAI).
Note that OpenAI will not use this data for training data, but possibly sensitive chat data might still be sent to OpenAI. Check their data processing rules to find out if this is problem for you. If so: revert to 1.x or disable the bot - removing it from a channel should also make it technically impossible for the bot to process and react to the messages in the channel.
Note that you can notice when this happens, because the bot always reacts when it reads messages and sends contents to OpenAI. So if you do not see spurious replies, you are not affected by this issue.
The bot seems to be functioning on my Mattermost installation, but when I check the logs, I encounter the following messages:
chatgpt | websocket connecting to wss://mattermost.zeppelinlg.com/api/v4/websocket
chatgpt | {"level":"ERROR","time":"2023-03-30T16:15:00.682Z","name":"bot","msg":"undefined","pid":1,"hostname":"52ed9da46fb8","diff":0}
chatgpt | {"level":"INFO","time":"2023-03-30T16:15:00.667Z","name":"bot-ws","msg":"websocket closed","pid":1,"hostname":"52ed9da46fb8","diff":0}
Additionally, the container seems to be restarting regularly. Any assistance with resolving these issues would be appreciated.
Dear yGuy,
Thank you for the great api.
I have recently in stalled the lattest Mattermost on docker with Portainer.
And thus also you container ghcr.io/yguy/chatgpt-mattermost-bot:latest:
My versions:
version: '3.7'
I am not sure how I can set the model to gpt4 but befor I digress see the log response below.
Log :
On first run it has the following log:
2023-10-01T07:51:05.523Z INFO name=bot-ws msg=websocket connecting to wss://removed-for-privacy/api/v4/websocket pid=1 hostname=1af6ed135303 diff=0
2023-10-01T07:51:05.792Z LOG name=bot msg=Connected to Mattermost. pid=1 hostname=1af6ed135303 diff=0
Then as soon as you try to talk to it you get:
2023-10-01T07:56:49.002Z ERROR name=bot msg=Request failed with status code 429 pid=1 hostname=1af6ed135303 diff=343210 err={"name":"Error","stack":"Error: Request failed with status code 429\n at createError (/app/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/app/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:322:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections(node:internal/process/task_queues:83:21)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json","User-Agent":"OpenAI/NodeJS/3.3.0","Authorization":"Bearer Removed-For-Privacy","Content-Length":1452},"method":"post","data":"{"model":"gpt-3.5-turbo","messages":[{"role":"system","content":"Your name is @chatgpt 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."},{"role":"user","name":"Crim","content":"hi @chatgpt can you help me"}],"max_tokens":2000,"temperature":1,"functions":[{"name":"image-plugin","description":"Generates an image based on a given image description.","parameters":{"type":"object","properties":{"imageDescription":{"type":"string","description":"The description of the image provided by the user"}},"required":["imageDescription"]}},{"name":"exit-plugin","description":"Says goodbye to the user and wish him a good day.","parameters":{"type":"object","properties":{},"required":[]}},{"name":"message-collect-plugin","description":"Collects messages in the thread for a specific user or time","parameters":{"type":"object","properties":{"lookBackTime":{"type":"number","description":"The time in milliseconds to look back in time and collect messages which were posted within this timespan. Omit this parameter if the collected messages are independent from the time they were sent."},"messageCount":{"type":"number","description":"The number of messages which should be collected. Omit this parameter if you want to collect all messages."}},"required":[]}}],"function_call":"auto"}","url":"https://api.openai.com/v1/chat/completions"},"status":429}
Thank you and I hope you can give me some insight.
Kind Regards
Bot is caught in a reboot loop on a mattermost server behind an nginx proxy failing to login to mattermost. Here's the offending log entry causing a reboot loop:
/app/node_modules/@mattermost/client/lib/client4.js:1793
throw new ClientError(this.getUrl(), {
^
ClientError: Invalid or expired session, please login again.
at Client4.<anonymous> (/app/node_modules/@mattermost/client/lib/client4.js:1793:19)
at Generator.next (<anonymous>)
at fulfilled (/app/node_modules/@mattermost/client/lib/client4.js:7:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
url: 'https://chat.arcadalabs.com/api/v4/users/me',
server_error_id: 'api.context.session_expired.app_error',
status_code: 401
}
and the relevant section of my nginx config:
server {
server_name chat.arcadalabs.com;
location ~ /api/v[0-9]+/(users/)?websocket$ {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 50M;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
client_body_timeout 60;
send_timeout 300;
lingering_timeout 5;
proxy_connect_timeout 90;
proxy_send_timeout 300;
proxy_read_timeout 90s;
proxy_pass http://chat;
}
location / {
client_max_body_size 50M;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_cache mattermost_cache;
proxy_cache_revalidate on;
proxy_cache_min_uses 2;
proxy_cache_use_stale timeout;
proxy_cache_lock on;
proxy_http_version 1.1;
proxy_pass http://chat;
}
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/chat.arcadalabs.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/chat.arcadalabs.com/privkey.pem; # managed by Certbot
# include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
http2_push_preload on; # Enable HTTP/2 Server Push
# Enable TLS versions (TLSv1.3 is required upcoming HTTP/3 QUIC).
ssl_protocols TLSv1.2 TLSv1.3;
# Enable TLSv1.3's 0-RTT. Use $ssl_early_data when reverse proxying to
# prevent replay attacks.
#
# @see: https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_early_data
ssl_early_data on;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:50m;
# HSTS (ngx_http_headers_module is required) (15768000 seconds = six months)
add_header Strict-Transport-Security max-age=15768000;
# OCSP Stapling ---
# fetch OCSP records from URL in ssl_certificate and cache them
ssl_stapling on;
ssl_stapling_verify on;
add_header X-Early-Data $tls1_3_early_data;
}
server {
if ($host = chat.arcadalabs.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name chat.arcadalabs.com;
listen 80;
return 404; # managed by Certbot
}
# This block is useful for debugging TLS v1.3. Please feel free to remove this
# and use the `$ssl_early_data` variable exposed by NGINX directly should you
# wish to do so.
map $ssl_early_data $tls1_3_early_data {
"~." $ssl_early_data;
default "";
}
I also posted about this here: https://forum.mattermost.com/t/chatgpt-bot-failing-to-connect-docker-instance-caught-in-reboot-loop/15746
I super appreciate any help, thank you!
Hey, absolutely love this bot. It shuts down every few minutes and I have a script that restarts it automatically, but thats not what I'm here for. Could you add support for DALL-E-3? I tried updating the script and use docker-compose, but the openai package also needs updating and there are several errors, sadly I'm not an expert.
model: 'dall-e-3',
quality: 'hd',
resolution: '1024x1024',
Basically stuff like this needs to be added to the request.
it would be awesome if we would get the ability to customize the line here
chatgpt-mattermost-bot/src/botservice.ts
Line 33 in 4cae8f9
For some features (summarization, e.g.) we transmit the user names to OpenAI, but there are very strict limits about the user names in place at OpenAI.
We should rather come up with unique dummy user names that adhere to the strict limits and send them to OpenAI, instead. When the response comes back we should search and replace the dummy names with the real names again. This would allow having arbitrary user names and also adds a little bit of privacy.
This tool will not work if Mattermost is installed on Subpath.
$ sudo head -3 /opt/mattermost/config/config.json
{
"ServiceSettings": {
"SiteURL": "http://localhost:8065/mattermost",
$ export MATTERMOST_URL=http://localhost:8065/mattermost
$ node src/botservice.js
websocket connecting to ws://localhost:8065/api/v4/websocket
{"level":"INFO","name":"bot-ws","msg":"websocket error","diff":0}
{"level":"INFO","name":"bot-ws","diff":1}
{"level":"INFO","name":"bot-ws","msg":"websocket closed","diff":1}
ERROR bot +0ms
diff --git a/src/mm-client.js b/src/mm-client.js
index abb3820..1d89947 100644
--- a/src/mm-client.js
+++ b/src/mm-client.js
@@ -16,7 +16,8 @@ client.setToken(mattermostToken)
const wsClient = new WebSocketClient();
let matterMostURL = new URL(matterMostURLString);
-const wsUrl = `${matterMostURL.protocol === 'https:' ? 'wss' : 'ws'}://${matterMostURL.host}/api/v4/websocket`
+const pathname = matterMostURL.pathname.replace(/\/+$/, '');
+const wsUrl = `${matterMostURL.protocol === 'https:' ? 'wss' : 'ws'}://${matterMostURL.host}${pathname}/api/v4/websocket`
new Promise((resolve, reject) => {
wsClient.addCloseListener(connectFailCount => reject())
Best regards.
Hello - fantastic plugin super valuable for having ChatGPT built into mattermost.
I am experiencing a small bug in the software in which when the bot is marked as "away" after end of day when the workers are no longer using it, the bot will fail to wakeup again the morning when users start messaging it - requiring a restart of the container in order to continue using the plugin.
I think I have gotten everything right, but the docker logs just show the following error (URL and IP are edited :):
/app/node_modules/node-fetch/lib/index.js:1505
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
^
FetchError: request to https://example.com/api/v4/users/me failed, reason: connect ETIMEDOUT 123.456.789.000:443
at ClientRequest.<anonymous> (/app/node_modules/node-fetch/lib/index.js:1505:11)
at ClientRequest.emit (node:events:513:28)
at TLSSocket.socketErrorListener (node:_http_client:494:9)
at TLSSocket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT'
}
I can get the bot to respond using curl, but there seems to be nothing going on the docker side of things.
Herein used package openai
allows to set the temperature of the model (see https://platform.openai.com/docs/api-reference/chat/create ). The user should be allowed to set this value to a float in [0,2]
.
Working on this right now. Pull request will follow.
I don't really think a chatbot is as helpful as it would be to have a personal bot where we could grant singular channel access to GPT via OpenAI and/or ChatGPT and then allow it to go back through all history of a channel and extract data / context and information for you.
Having it available for an entire team would also be helpful.
An example interaction might be:
Hey (Chat)GPT, could you please go through the history of ~some-channel and summarize the discussions that Roberto had with everyone about Client-X or that were associated with them?
or
Please review the entire history of Team-X and summarize all mentions of Project-Y from November 2019 to July 2022.
I'm completely new to web development and programming, so I'd like to apologize for asking such a basic question.
I've been telling my team that i can build a great chat app with chatgpt, and now I'm regretting it. I've been searching for two weeks and still haven't solved it.
I'm running mattermost with docker on my synology NAS
I followed this manual : https://mariushosting.com/how-to-install-mattermost-on-your-synology-nas/
Mattermost's site URL is a reverse proxy set up on the synology nas. It's in the form of "https://chat.nickname.synology.me" and I've also created a websocket custom header.
And when I run the chatgpt-mattermost-bot container, I always get an error log about websocket and it won't run.
Testing with npm install -> npm run start tells me that there is a problem with MATTERMOST_URL.
For the value of MATTERMOST_URL, I put "https://caht.nickname.synology.me" from the /admin_console/environment/web_server path, but maybe I'm wrong.
I'm writing in a translator, so again, I apologize if the context is weird.
(error) container log.txt
(error) npm run start.txt
docker-compose.txt
logs
websocket connecting to ws://192.168.88.200/api/v4/websocket
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.