jcromero / matrix-llm-bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Matrix-LLM


A bot to allow you to use Matrix to communicate with LLM's (for example ChatGPT).

This bot will require matrix-llm-api but for now it embeds node-chatgpt-api.


Setup Matrix Bot

Set ACCESS_TOKEN if available or set LOGINNAME & PASSWORD and follow instructions in error message.

  • cp .env.example .env and set values.

If you want to use the embedded matrix-llm-api:

  • cp llm-settings.js.example llm-settings.js and set values.

You now have two options (or you can use a mixture of both)

Run with Docker

The easiest way to get started is using Docker to run both the embedded matrix-llm-api and the bot.

  • docker-compose up -d --build llm-api to start the embedded API.
  • docker-compose up -d --build matrix-llm-bot to start the bot.
  • docker-compose logs --follow to see logs, ctrl+c to exit (bot & api keep running).

If you make changes to the code you need to run the 1st command below before building the Docker image.

Run without Docker

You can use the 1st command above to run the embedded matrix-llm-api using Docker if you prefer.

  • npm install to install dependencies.
  • npm dev for development, or npm start in production.

NPM commands

The following NPM commands are available when not using Docker:

npm run function
start Run build/index.js
dev Run & watch app/index.ts
build Build app/ into build/

Structure

  • app/
    • commands.ts: handles all commands including LLM stuff.
    • index.ts: basic boilerplate for the bot client.
    • settings.ts: see here for reference of bot settings.
  • assets/: Images (and an image script) for use in the README.
  • /
    • docker-compose.yml: setup required containers and useful extras.
    • Dockerfile: create a container just to run this bot.
    • build/: Made during runtime. Compiled javascript code.
    • .env: Manually made. Environment variables to use when running locally.
    • llm-settings.js: Manually made. Settings that will be passed by matrix-llm-api

License

This template is in the public domain. Matrix-Bot-Starter is licensed under the MIT License.

About

License:The Unlicense


Languages

Language:TypeScript 98.0%Language:Shell 1.5%Language:Dockerfile 0.5%