update docs

This commit is contained in:
Cyberes 2024-04-08 00:38:21 -06:00
parent a41fa75dd3
commit bf0a3bde6a
3 changed files with 29 additions and 24 deletions

View File

@ -2,6 +2,11 @@
_Chatbots for Matrix._
This bot supports OpenAI, Anthropic, and locally hosted models that use an OpenAI-compatible endpoint. It can run multiple different models using
different triggers, such as `!c4` for GPT4 and `!ca` for Anthropic, all through the same bot.
<br>
## Install
1. Install requirements:
@ -9,36 +14,32 @@ _Chatbots for Matrix._
sudo apt install libolm-dev gcc python3-dev
pip install -r requirements.txt
```
2. Copy `config.sample.yaml` to `config.yaml` and fill it out with your bot's Matrix auth and your API key(s).
2. Copy `config.sample.yaml` to `config.yaml` and fill it out with the bot's Matrix authentication and your OpenAI and/or Anthropic API keys.
3. Start the bot with `python3 main.py`
[Pantalaimon](https://github.com/matrix-org/pantalaimon) is **required** for the bot to be able to talk in encrypted rooms.
I included a sample Systemd service (`matrixgpt.service`).
[Pantalaimon](https://github.com/matrix-org/pantalaimon) is **required** for the bot to be able to talk in encrypted
rooms.
I included a sample Systemd service.
## Use
Invite your bot to a room.
Start a chat by prefixing your message with your trigger (for example, `!c`). The bot will create a thread when it
replies to you and you don't need to use the trigger in the thread.
Don't try to use two bots in the same thread.
You can DM a bot for a private chat. Don't use the trigger prefix in a DM.
The bot will move its read marker when a new message is sent in the room.
The bot can give helpful reactions:
- 🚫 means that the user is not allowed to chat with the bot.
- ❌ means the bot encountered an exception. The bot restarts when it encounters an exception which means it will not be
able to respond for a short time after this reaction.
- ❌ 🔐 means there was a decryption failure.
First, invite your bot to a room. Then you can start a chat by prefixing your message with your trigger (for example, `!c hello!`). The bot will create a thread when it replies. You don't need to use the trigger in the thread.
Use `!matrixgpt` to view the bot's help. The bot also responds to `!bots`.
## Encryption
<br>
This bot supports encryption. I recommend using [Pantalaimon](https://github.com/matrix-org/pantalaimon/) to manage
encryption keys as the built-in solution is a little janky and may be unreliable.
- Don't try to use two bots in the same thread.
- You can DM a bot for a private chat. Don't use the trigger prefix in a DM.
- The bot will move its read marker when a new message is sent in the room.
<br>
The bot can give helpful reactions:
- 🚫 means permission denied (not allowed to chat with the bot).
- 🕒 means the API timed out.
- ❌ means the bot encountered an exception.
- ❌ 🔐 means there was a decryption failure.

View File

@ -40,6 +40,9 @@ allowed_to_invite:
response_timeout: 120
command:
# Define what models respond to what trigger.
# Try adding multiple triggers!
# What triggers this model.
- trigger: '!c4'

View File

@ -83,6 +83,7 @@ class ConfigManager:
if not self._config.config['openai']['api_key'] and not self._config.config['anthropic']['api_key']:
raise SchemeValidationError('You need an OpenAI or Anthropic API key')
self._parsed_config = self._merge_in_list_defaults()
# TODO: make sure there aren't duplicate triggers
self._command_prefixes = self._generate_command_prefixes()
def _merge_in_list_defaults(self):