Improve Telegram formatting and web synthesis
This commit is contained in:
parent
605c135b08
commit
0675f9a441
8 changed files with 425 additions and 508 deletions
47
README.md
47
README.md
|
|
@ -1,6 +1,6 @@
|
|||
# Marvin Telegram Bot
|
||||
|
||||
Simple Telegram bot server that sends your Telegram messages to Gemini and replies back. OpenRouter can be configured as a fallback. Recent conversation memory is stored persistently in SQLite.
|
||||
Simple Telegram bot server that sends your Telegram messages and photos to OpenRouter and replies back. Recent conversation memory is stored persistently in SQLite.
|
||||
|
||||
## Setup
|
||||
|
||||
|
|
@ -14,16 +14,13 @@ cp .env.example .env
|
|||
|
||||
```env
|
||||
TELEGRAM_BOT_TOKEN=...
|
||||
GEMINI_API_KEY=...
|
||||
OPENROUTER_API_KEY=...
|
||||
SEARXNG_URL=http://192.168.0.225:8080
|
||||
```
|
||||
|
||||
Gemini is the primary provider. OpenRouter is optional, but useful as fallback.
|
||||
|
||||
Get keys from:
|
||||
Get your key from:
|
||||
|
||||
```text
|
||||
https://aistudio.google.com/app/apikey
|
||||
https://openrouter.ai/keys
|
||||
```
|
||||
|
||||
|
|
@ -38,8 +35,7 @@ You are Marvin, a funny, slightly sarcastic assistant. Keep replies short and pl
|
|||
Optional settings in `.env`:
|
||||
|
||||
```env
|
||||
GEMINI_MODEL=gemini-2.5-flash-lite
|
||||
OPENROUTER_MODEL=openrouter/free
|
||||
OPENROUTER_MODEL=openai/gpt-5.4-mini
|
||||
PERSONALITY_FILE=personality.md
|
||||
MEMORY_DB=marvin.sqlite
|
||||
MAX_HISTORY_MESSAGES=20
|
||||
|
|
@ -69,18 +65,51 @@ Long-term memory commands:
|
|||
/forget_memories
|
||||
```
|
||||
|
||||
## Web browsing
|
||||
|
||||
Marvin will automatically search the web when a message looks like it needs current or live information, and it will return a short sourced summary directly. It uses your self-hosted SearXNG instance.
|
||||
|
||||
It will also automatically generate an image when a message looks like an image-generation request.
|
||||
|
||||
Use `/web` if you want to force a web search.
|
||||
Use `/image` if you want to force image generation.
|
||||
|
||||
Example:
|
||||
|
||||
```text
|
||||
/web latest OpenRouter gpt-5.4-mini model ID
|
||||
```
|
||||
|
||||
## Images
|
||||
|
||||
Send the bot a photo with an optional caption/question and it will analyze it using the configured OpenRouter model.
|
||||
|
||||
Generate and send an image using Pollinations:
|
||||
|
||||
```text
|
||||
/image a sad robot drinking coffee in Zagreb, noir style
|
||||
```
|
||||
|
||||
4. Start the bot:
|
||||
4. Start the bot locally:
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
Then open Telegram and message your bot.
|
||||
|
||||
## Production setup
|
||||
|
||||
Recommended production setup:
|
||||
|
||||
1. Run Marvin as a **systemd** service
|
||||
2. Keep using **polling**
|
||||
3. Store config in `.env`
|
||||
4. Run it as a dedicated unprivileged user
|
||||
5. View logs with:
|
||||
|
||||
```bash
|
||||
journalctl -u marvin -f
|
||||
```
|
||||
|
||||
See `deploy/README.md` and `deploy/marvin.service` for an example service configuration.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue