2022-12-09 04:41:17 -05:00
Matrix ChatGPT Bot
==================
Talk to ChatGPT via your favourite Matrix client!
2022-12-09 05:09:42 -05:00
![Screenshot of Element iOS app showing conversation with bot ](img/matrix-chatgpt.png )
2023-01-27 13:43:53 -05:00
A Matrix bot that uses [transitive-bullshit/chatgpt-api ](https://github.com/transitive-bullshit/chatgpt-api ) to access the unofficial ChatGPT API.
2022-12-29 06:11:52 -05:00
2022-12-09 04:41:17 -05:00
# Usage
2023-01-27 13:43:53 -05:00
1. Create a room
2. Add the bot
3. Start chatting away!
2022-12-09 04:41:17 -05:00
2022-12-09 05:09:14 -05:00
# Features
- Shows typing indicator as ChatGPT is thinking!
2022-12-29 06:11:52 -05:00
- Supports encryption
2023-01-27 13:43:53 -05:00
- Stores context for ChatGPT conversations
# Configure
2022-12-09 04:41:17 -05:00
```
2023-01-27 13:43:53 -05:00
cp .env.example .env
2022-12-09 04:41:17 -05:00
```
2023-01-27 16:09:37 -05:00
You must adjust the settings in the `.env` file according to your needs.
2022-12-23 23:47:34 -05:00
2023-01-27 13:43:53 -05:00
## Matrix
You need a Matrix account on Matrix.org (or any other server).
2022-12-23 23:47:34 -05:00
2023-01-27 16:09:37 -05:00
The bot outputs `MATRIX_ACCESS_TOKEN` to the console if it is not already set but `MATRIX_BOT_USERNAME` & `MATRIX_BOT_PASSWORD` are.
2022-12-09 04:41:17 -05:00
2023-01-27 16:09:37 -05:00
You must set `MATRIX_ACCESS_TOKEN` to use this token. Do not use it with any other client.
2023-01-27 13:43:53 -05:00
2023-01-27 16:09:37 -05:00
You no longer need `MATRIX_BOT_PASSWORD` set but you can leave it if you want.
2023-01-27 13:43:53 -05:00
## OpenAI / ChatGPT
You must read the [authentication instructions ](https://www.npmjs.com/package/chatgpt#usage ) for chatgpt-api if you get stuck.
Using the same account at [chat.openai.com ](https://chat.openai.com ) may refresh tokens invalidating the bot's session.
Ensure your OpenAI account uses Google and set `OPENAI_LOGIN_TYPE` to `google` .
2022-12-09 04:41:17 -05:00
2023-01-27 13:43:53 -05:00
**If the Google account uses 2FA it will fail** but there is [a workaround ](https://github.com/transitive-bullshit/chatgpt-api/issues/169#issuecomment-1362206780 )
# Run
## with Docker
2023-01-28 08:12:23 -05:00
This is the recommended way to run this project. It will use the latest stable release.
```
docker run -it -v storage:/storage --env-file=./.env --name matrix-chatgpt-bot ghcr.io/matrixgpt/matrix-chatgpt-bot:latest
```
or to build locally from the latest unstable release (only do this if you have a good reason):
2022-12-22 10:19:17 -05:00
```
docker build . -t matrix-chatgpt-bot
2023-01-02 10:45:44 -05:00
docker run -it -v storage:/storage --env-file=./.env --name matrix-chatgpt-bot matrix-chatgpt-bot
2022-12-22 10:19:17 -05:00
```
Note: Without -it flags in the command above you won't be able to stop the container using Ctrl-C
2023-01-27 13:43:53 -05:00
## without Docker
It is strongly recommended you run this package under Docker.
- `yarn`
- `yarn build`
- `yarn start`
## in Development
You only need to do this if you want to contribute code to this package.
- Run `yarn`
- Run `yarn build`
2023-01-29 14:35:17 -05:00
# Reporting issues
You must report issues via Github if you want support. The chat room is for discussion not first line tech support.
2023-01-27 13:43:53 -05:00
# Discussion
Join [#matrix-chatgpt-bot:matrix.org ](https://matrix.to/#/#matrix-chatgpt-bot:matrix.org ) with any Matrix chat client or on the web!
If you've never set up a Matrix client before you can follow the prompts to get started.
2023-01-29 14:35:17 -05:00
Please use the search on Github and Matrix before asking for support.
2022-12-09 04:41:17 -05:00
# License
GNU AGPLv3. See LICENSE