| title | demo/telegram-ollama-chat/readme |
|---|---|
| group | demo/telegram-ollama-chat |
Telegram bot with pharmaceutical sales system, multiple interface support and local Ollama AI.
Demonstrates capabilities:
- Telegram Bot API integration with agent-swarm-kit
- Multi-interface support (Telegram, REPL, Web)
- Local AI with Ollama for privacy and cost efficiency
- Pharmaceutical sales system with product database
- Telegram Integration: Full-featured Telegram bot
- Multi-Interface: Telegram, REPL, Web interface
- Local AI: Ollama for privacy and offline work
- Pharma Sales: Specialized sales system
- Product Database: Pharmaceutical products database
- TensorFlow Embeddings: Semantic product search
- Runtime: Bun
- Language: TypeScript
- AI Framework: agent-swarm-kit
- Bot Framework: Telegraf
- Web Framework: Hono
- AI Provider: Ollama (local)
- ML: TensorFlow.js for embeddings
├── data/
│ └── products.json # Pharmaceutical products
├── src/
│ ├── config/
│ │ ├── hono.ts # Hono web config
│ │ ├── logger.ts # Logging setup
│ │ ├── swarm.ts # Swarm config
│ │ └── tf.ts # TensorFlow config
│ ├── logic/
│ │ ├── agent/ # Sales and triage agents
│ │ ├── completion/ # Ollama completion
│ │ ├── embedding/ # Ollama embeddings
│ │ ├── storage/ # Pharma storage
│ │ └── swarm/ # Root swarm
│ ├── main/
│ │ ├── hono.ts # Web server
│ │ ├── repl.ts # REPL interface
│ │ └── telegram.ts # Telegram bot
│ └── utils/
│ └── getChatData.ts # Chat utilities
├── public/
│ └── index.html # Web interface
└── logs/ # Application logs
# Install Ollama
curl https://ollama.ai/install.sh | sh
# Download model
ollama pull llama2
# Install dependencies
bun install
# Start Telegram bot
bun run src/main/telegram.ts
# Start Web server (optional)
bun run src/main/hono.ts
# Start REPL (optional)
bun run src/main/repl.tsCreate a .env file:
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
OLLAMA_API_URL=http://localhost:11434
OLLAMA_MODEL=llama2
WEB_PORT=3000- Find @BotFather in Telegram
- Send
/newbot - Choose name and username for bot
- Get API token
- Add token to
.env
- "Hello! What do you have for headaches?"
- "Show all vitamins"
- "Add aspirin to cart"
- "What helps with cold?"
Open http://localhost:3000 for web version
Interactive command line for testing
{
"name": "Аспирин",
"category": "Обезболивающие",
"price": 25.50,
"description": "От головной боли и температуры",
"contraindications": ["Язва желудка", "Беременность"],
"dosage": "1-2 таблетки 3 раза в день"
}- Privacy: Data doesn't leave your server
- Cost Efficiency: No API costs
- Offline Work: Works without internet
- Customization: Fine-tuning capability
- Performance: Optimized for local usage
Telegram Bot ←→ Agent Swarm ←→ Ollama
Web Interface ←→ ↑ ←→ Storage
REPL Console ←→ ↓ ←→ Embeddings
Ideal for:
- Pharmaceutical businesses
- Healthcare consultations
- E-commerce bots
- Customer service automation
- Privacy-sensitive applications
Can be extended with:
- Prescription management
- Doctor consultations
- Inventory tracking
- Order processing
- Payment integration