Refactor: remove unused cogs and services, simplify architecture
- Remove admin.py and search.py cogs - Remove searxng.py service and rate_limiter.py utility - Update bot.py, ai_chat.py, config.py, and ai_service.py - Update documentation and docker-compose.yml
This commit is contained in:
13
CLAUDE.md
13
CLAUDE.md
@@ -20,7 +20,7 @@ python -m py_compile src/daemon_boyfriend/**/*.py
|
||||
|
||||
## Architecture
|
||||
|
||||
This is a Discord bot with AI chat (multi-provider) and SearXNG web search.
|
||||
This is a Discord bot that responds to @mentions with AI-generated responses (multi-provider support).
|
||||
|
||||
### Provider Pattern
|
||||
The AI system uses a provider abstraction pattern:
|
||||
@@ -30,10 +30,8 @@ The AI system uses a provider abstraction pattern:
|
||||
- OpenRouter uses OpenAI's client with a different base URL
|
||||
|
||||
### Cog System
|
||||
Discord commands are organized as cogs in `cogs/`:
|
||||
- `ai_chat.py` - `/chat` command and `@mention` handler (primary user interaction)
|
||||
- `search.py` - `/search` and `/image` commands using SearXNG
|
||||
- `admin.py` - `/status`, `/help`, `/ping`, `/provider` commands
|
||||
Discord functionality is in `cogs/`:
|
||||
- `ai_chat.py` - `@mention` handler (responds when bot is mentioned)
|
||||
|
||||
Cogs are auto-loaded by `bot.py` from the `cogs/` directory.
|
||||
|
||||
@@ -42,12 +40,9 @@ All config flows through `config.py` using pydantic-settings. The `settings` sin
|
||||
|
||||
### Key Design Decisions
|
||||
- `ConversationManager` stores per-user chat history in memory with configurable max length
|
||||
- `RateLimiter` tracks per-user rate limits using timestamps in a dict
|
||||
- Long AI responses are split via `split_message()` in `ai_chat.py` to respect Discord's 2000 char limit
|
||||
- The bot responds to @mentions via `on_message` listener, not just slash commands
|
||||
- The bot responds only to @mentions via `on_message` listener
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Required: `DISCORD_TOKEN`, plus one of `OPENAI_API_KEY`, `OPENROUTER_API_KEY`, or `ANTHROPIC_API_KEY` depending on `AI_PROVIDER` setting.
|
||||
|
||||
Set `DISCORD_GUILD_ID` for instant slash command sync during development (otherwise global sync takes up to 1 hour).
|
||||
|
||||
Reference in New Issue
Block a user