Compare commits
11
Commits
4431376ad5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65982bb636 | ||
|
|
d53835bb5f | ||
|
|
c0f0856501 | ||
|
|
495b7aaaba | ||
|
|
02267f0059 | ||
|
|
ae49591735 | ||
|
|
a596609d7a | ||
|
|
1a82ac19f6 | ||
|
|
2001c25bb6 | ||
|
|
82b9bbde73 | ||
|
|
f283fa5360 |
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY bot.py .
|
||||
COPY bot.py topics.txt ./
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
# DadBot
|
||||
|
||||
A Discord bot with a persistent personality, long-term memory, and a simulated inner life. Runs through LiteLLM so you can point it at any model.
|
||||
|
||||
## Features
|
||||
|
||||
- **Persistent personality** — DadBot can rewrite his own personality prompt via a tool call. Changes persist to `personality.txt` and are logged to `personality_changelog.txt`.
|
||||
- **User dossiers** — Automatically builds and maintains a per-user fact file (`dossiers.json`) from conversation history.
|
||||
- **Self-reflection** — When idle, DadBot runs a private reflection session: explores a topic from `topics.txt`, updates his reflection notes, and may refine his personality.
|
||||
- **Life simulation** — Alternates with reflection sessions to run scripted life events (`life_events.json`) as a two-LLM dialogue. Outcomes are summarised into `life_history.txt` and can influence personality.
|
||||
- **Web search** — Connected to a SearXNG MCP server for live web search during conversations and reflections.
|
||||
- **Image support** — Handles image attachments in messages (base64-encoded, passed to the model as vision input).
|
||||
- **Multi-message replies** — Use `[SPLIT]` in model output to send multiple Discord messages with natural word-count-based pacing.
|
||||
- **Rolling context** — Per-channel message history with a configurable window (`MAX_CONTEXT`).
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.11+
|
||||
- A running [LiteLLM](https://github.com/BerriAI/litellm) proxy
|
||||
- A running [SearXNG MCP](https://github.com/ihor-sokoliuk/mcp-searxng) instance (optional but expected)
|
||||
- A Discord bot token
|
||||
|
||||
## Setup
|
||||
|
||||
1. Copy `.env.example` to `.env` and fill in your values:
|
||||
|
||||
```env
|
||||
DISCORD_TOKEN=your_discord_bot_token
|
||||
LITELLM_BASE_URL=http://your-litellm-host:4000/v1
|
||||
LITELLM_API_KEY=your_key
|
||||
MODEL=your-chat-model
|
||||
BACKGROUND_MODEL=your-background-model # defaults to MODEL if unset
|
||||
SYSTEM_PROMPT=...
|
||||
MAX_CONTEXT=20
|
||||
MCP_URL=http://mcp-searxng:4001/mcp
|
||||
```
|
||||
|
||||
2. Install dependencies:
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
3. Run:
|
||||
|
||||
```bash
|
||||
python bot.py
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
The compose file expects an external Docker network named `aiplayground_litellm_internal` and mounts all persistent data files from the project directory.
|
||||
|
||||
## Configuration
|
||||
|
||||
| Variable | Default | Description |
|
||||
|---|---|---|
|
||||
| `MODEL` | `gpt-4` | Model for chat and reflection |
|
||||
| `BACKGROUND_MODEL` | `MODEL` | Model for background tasks (life sim, reflection) |
|
||||
| `MAX_CONTEXT` | `20` | Rolling message history per channel |
|
||||
| `SYSTEM_PROMPT` | `You are a helpful assistant.` | Base system prompt |
|
||||
| `MCP_URL` | `http://mcp-searxng:4001/mcp` | SearXNG MCP endpoint |
|
||||
| `REFLECTION_IDLE_MIN` | (see bot.py) | Minutes of inactivity before background task fires |
|
||||
| `REFLECTION_MAX_TURNS` | `5` | Max LLM turns per reflection session |
|
||||
| `LIFE_SIM_MAX_TURNS` | `6` | Max turns per life simulation event |
|
||||
|
||||
## Data Files
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `personality.txt` | DadBot's current personality prompt (editable by the bot) |
|
||||
| `dossiers.json` | Per-user and self fact store |
|
||||
| `reflection_notes.txt` | Notes DadBot saves for future reflection sessions |
|
||||
| `reflection_log.txt` | Full transcripts of past reflection sessions |
|
||||
| `personality_changelog.txt` | Log of every personality change with reasoning |
|
||||
| `topics.txt` | One topic per line — exploration pool for reflection sessions |
|
||||
| `used_topics.json` | Tracks which topics have been used |
|
||||
| `life_events.json` | Ordered list of life events to simulate |
|
||||
| `used_life_events.json` | Tracks which life events have been played |
|
||||
| `life_history.txt` | Summaries of completed life events |
|
||||
| `life_sim_log.txt` | Full transcripts of life simulation sessions |
|
||||
+16
-1
@@ -1,11 +1,26 @@
|
||||
services:
|
||||
discordbot:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
restart: on-failure
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
delay: 10s
|
||||
max_attempts: 5
|
||||
window: 120s
|
||||
env_file: .env
|
||||
volumes:
|
||||
- ./dossiers.json:/app/dossiers.json
|
||||
- ./personality.txt:/app/personality.txt
|
||||
- ./reflection_log.txt:/app/reflection_log.txt
|
||||
- ./personality_changelog.txt:/app/personality_changelog.txt
|
||||
- ./reflection_notes.txt:/app/reflection_notes.txt
|
||||
- ./used_topics.json:/app/used_topics.json
|
||||
- ./life_events.json:/app/life_events.json
|
||||
- ./used_life_events.json:/app/used_life_events.json
|
||||
- ./life_history.txt:/app/life_history.txt
|
||||
- ./life_sim_log.txt:/app/life_sim_log.txt
|
||||
- ./channel_history.json:/app/channel_history.json
|
||||
networks:
|
||||
- litellm_net
|
||||
|
||||
|
||||
@@ -2,3 +2,5 @@ discord.py>=2.3
|
||||
openai>=1.0
|
||||
python-dotenv>=1.0
|
||||
mcp>=1.0
|
||||
httpx>=0.27
|
||||
beautifulsoup4>=4.12
|
||||
Reference in new issue
Block a user