TeleMikiya is a hybrid message search tool for Telegram that combines semantic similarity search with full-text search capabilities, providing more accurate and comprehensive search results.
- 🔄 Automatic Telegram message syncing and indexing
- 🔍 Hybrid search combining:
- Semantic similarity search using vector embeddings
- Full-text search powered by PGroonga
- 🤖 Multiple embedding providers support:
- 💬 Both CLI and Telegram Bot interfaces
- PostgreSQL 15+ with:
- pgvecto.rs extension for vector similarity search
- PGroonga extension for full-text search
- Either Ollama or OpenAI API access
- Create a configuration file:
# Copy example config to one of:
# - ./config.toml
# - $XDG_CONFIG_HOME/telemikiya/config.toml
# - /etc/telemikiya/config.toml
cp config.example.toml config.toml
- Edit the configuration file with required settings:
- Telegram API credentials (from https://my.telegram.org)
- Database connection details
- Text embedding service configuration
- Install required PostgreSQL extensions:
- Install pgvecto.rs following the official installation guide
- Install PGroonga following the official installation guide
- Create database and user:
-- Connect as postgres user
sudo -u postgres psql
-- Create user
CREATE USER telemikiya WITH PASSWORD 'your_password';
-- Create database
CREATE DATABASE telemikiya OWNER telemikiya;
-- Connect to the new database
\c telemikiya
-- Create extensions
CREATE EXTENSION IF NOT EXISTS vectors;
CREATE EXTENSION IF NOT EXISTS pgroonga;
-- Create schemas
CREATE SCHEMA user_session AUTHORIZATION telemikiya;
CREATE SCHEMA bot_session AUTHORIZATION telemikiya;
-- Grant permissions
GRANT ALL ON SCHEMA vectors TO telemikiya;
- Migrate database schema:
# First-time setup
telemikiya db migrate
# When embedding dimensions change, use --allow-clear-embedding flag
telemikiya db migrate --allow-clear-embedding
# Start all services (observer, embedding, and bot)
telemikiya run
# Start specific services only
telemikiya run --observer=false --embedding=true --bot=false
# Basic search
telemikiya search "how to use Docker"
# Specify result count
telemikiya search --count 20 "recommend a movie"
# Search in specific dialog
telemikiya search --dialog-id 123456789 "meeting notes"
# Search by time range
telemikiya search --start-time "2024-01-01 00:00:00" "happy new year"
Send /search
command to your bot:
/search how to use Docker
Enable debug logging with -D
or --debug
:
telemikiya -D run
Use -C
or --config
to specify config file path:
telemikiya -C /path/to/config.toml run