internal/support-bot/CLAUDE.md
Support Bot (Maximilian)
Customer support automation for Studyflash using Gemini AI with KB-grounded responses.
Support Bot (Maximilian)
Customer support automation for Studyflash using Gemini AI with KB-grounded responses.
Quick Reference
# Local dev
uvicorn main:app --reload --port 8000
# Deploy
# Auto-deploys on push to `main` of studyflash-ai/studyflash via Dokploy's
# GitHub integration. No manual deploy step.
# Adopt / drift-check the Dokploy resources via Pulumi
pnpm preview # pulumi preview --diff
pnpm run pulumi:up # pulumi up
# Check logs
# Open the Customer Support project in Dokploy UI → Customer Support Bot →
# Logs tab. Same source-of-truth used by the Dokploy auto-deploy pipeline.
Architecture
- Context Stuffing: Entire KB (~10 pages) fed to AI per request, no vector DB
- Gemini 3 Flash: Used for classification and draft generation
- Chatwoot: Ticket management integration
- Dokploy: Deployed at https://dokploy.studyflash.ch (project: Customer Support). Public at https://support-bot.studyflash.dev.
Key Files
| File | Purpose |
|---|---|
main.py | FastAPI app, /ask endpoint |
services/draft_agent_service.py | Gemini draft generation |
services/category_classifier_service.py | Query classification |
services/kb_service.py | KB loading from kb/ directory |
models/draft.py | Response schemas (no defaults in DraftResponseSchema - Gemini limitation) |
kb/*.md | Knowledge base articles by category |
API Endpoints
POST /ask- Main support query endpointPOST /analyze- Weekly gap analyzerPOST /log-correction- Log human corrections
Secrets
Sourced from Infisical at /internal/support-bot/ (prod env), written to
Dokploy's native env at pulumi up time. Live keys (per application.one):
AUTOMATIONS_ADMIN_KEYAUTO_REPLY_ENABLEDCHATWOOT_ACCOUNT_IDCHATWOOT_API_TOKENCHATWOOT_API_URLGEMINI_API_KEYMETABASE_EMBEDDING_SECRET_KEYPORT
Deployment Notes
- KB files must be in
.dockerignorewhitelist (!kb/*.md). - Public URL: https://support-bot.studyflash.dev (port 8080 in-container, Let's Encrypt via Dokploy).
- Pulumi adoption stack lives next to the source —
index.ts,Pulumi.yaml,package.jsonin this directory.