Skip to content
This repository was archived by the owner on Jul 27, 2026. It is now read-only.

dominiwe/matrix-ai-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matrix AI Assistant

This is a small bot for matrix which brings chatgpt functionality into any matrix room so that it can be collaboratively used.

Once the bot is invited to a room, it will join and wait until it is mentioned in a message. The bot supports multiple sessions just like the chatgpt webinterface and saves session history in a SQLite database. Sessions can be managed with different commands (see examples).

Please note:

  • Currently it only works in unencrypted rooms.
  • This is hacky, I created it in a few hours.

Examples

Here are some example screenshots. The help command is used to get a list of available commands.

Help command

With no commands, the bot will respond with an answer generated by the openai API.

No command

The new command starts a session.

New session command

There are multiple commands to manage the sessions.

Show active session

Delete sessions

List sessions

Install & run

Poetry is used for dependency management.

Install dependencies:

poetry install

Provide environment variables or a .env file with these variables:

# Set to true to run productively.
PRODUCTION=false
# Path to an sqlite db. If it doesn't exist, it will be automatically created!
DB_PATH="./mydb.db"
# Matrix homeserver url.
MATRIX_HOMESERVER="https://my.matrix.home.server"
# User name of the user used as the bot.
MATRIX_BOT_USERNAME="ai-assistant"
# An access token fot the user.
MATRIX_ACCESS_TOKEN="syt_MY_SECRET_TOKEN"
# An OpenAI API access key
OPENAI_API_KEY="my-secret-openai-api-key"

(More configuration options will be added in the future.)

Finally, run the bot:

poetry run matrix-ai-assistant