yGuy / chatgpt-mattermost-bot

A very simple implementation of a service for a mattermost bot that uses ChatGPT in the backend.
MIT License
145 stars 50 forks source link

Error 401 sending message to mattermost #27

Closed lamellama closed 1 year ago

lamellama commented 1 year ago

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?

lamellama commented 1 year ago

Nevermind, seems my API key was not working