Skip to content

Latest commit

 

History

History
104 lines (82 loc) · 3.08 KB

README.md

File metadata and controls

104 lines (82 loc) · 3.08 KB

Introduction

This is a simple matrix bot that transcribes your voice to text message using faster-whisper, a reimplementation of OpenAI's Whisper model using CTranslate2.

Feature

  1. Liberate your hands: support automatically speech to text transcribtion
  2. Support E2EE Room
  3. Self host your service without privacy problem

Installation and Setup

  1. Edit config.json or .env with proper values
  2. Edit compose.yaml
  3. Launch the container

Here is a guide to make bot works on E2E encrypted room.

For explainations and complete parameter list see: https://github.com/hibobmaster/matrix-stt-bot/wiki

  1. Create config.json

Tips: set a non-exist room_id at the first time to prevent bot handling historical message which may mess your room up.

{
    "homeserver": "https://matrix.org",
    "user_id": "@xxxx:matrix.org",
    "password": "xxxxxxxxxx",
    "device_id": "GMIAZSVFF",
    "room_id": "!xxxxxxxx:xxx.xxx.xxx",
    "model_size": "base",
    "import_keys_path": "element-keys.txt",
    "import_keys_password": "xxxxxxxxxxxx"
}
  1. Create compose.yaml
services:
  app:
    image: ghcr.io/hibobmaster/matrix-stt-bot:latest
    container_name: matrix-stt-bot
    restart: always
    # build:
    #   context: .
    #   dockerfile: ./Dockerfile
    # env_file:
    #   - .env
    volumes:
      # use env file or config.json
      - ./config.json:/app/config.json
      # use touch to create an empty file stt_db, for persist database only
      - ./stt_db:/app/db
      # import_keys path
      - ./element-keys.txt:/app/element-keys.txt
      # store whisper models that program will download
      - ./models:/app/models
    networks:
      - matrix_network

networks:
  matrix_network:

Get your E2E room keys here: e2e-room-keys Notice: If you deploy matrix_chatgpt_bot along with this project, remember do not use the same database name.

  1. Launch for the first time
docker compose up

You will get notice: INFO - start import_keys process

After INFO - import_keys success, please remove import_keys configuration!!!

Wait a second, to see if stt_db has finished syncing_progress (The space occupied is about 100kb and above?)

Then Ctrl+C stop the container

  1. Edit config.json again

Remove import_keys_path and import_keys_password options

Set a correct room_id or remove it if you hope the bot to work in the rooms it is in.

Tips: if bot exits because RuntimeError: Unable to open file 'model.bin' in model, try rm -r models then relaunch the container.

  1. Finally

Launch the container

docker compose up -d

Demo

demo1 demo2

Thanks

  1. https://github.com/guillaumekln/faster-whisper
  2. https://github.com/poljar/matrix-nio
  3. https://github.com/8go/matrix-commander
JetBrains Logo (Main) logo.