Kagamicho/cs_chatbot
0
<!-- ⚠️ The YAML frontmatter above is REQUIRED by Hugging Face Spaces. Do NOT remove or reorder these keys — the Space will refuse to build. Reference: https://huggingface.co/docs/hub/spaces-config-reference -->
Remix Denki Chatbot
Japanese AI chatbot for Remix Denki (リミックスでんき) — Phase 1 MVP.
Bootstraps from public website + PDFs + manual FAQ, designed so real CS Q&A pairs can be added later without code changes or model retraining.
See docs/superpowers/specs/2026-04-28-remix-chatbot-design.md for the full design.
Setup
cp .env.example .env
# Edit .env — required vars listed below
uv sync
uv run uvicorn app.main:app --reloadRequired environment variables
Optional / rarely changed:
Stack
- LLM: Gemini 2.5 (Flash + Pro) via Google AI Studio API → Vertex AI for production
- Retrieval: Hybrid (BM25 + vector embeddings + reranker)
- Backend: FastAPI
- Vector DB: Chroma (local) → Vertex Vector Search (production)
- Crawler: Playwright
- Frontend: Static HTML/JS chat widget
Quickstart
# 1. Install deps
uv sync
# 2. Set API key
cp .env.example .env
# edit .env, add your GEMINI_API_KEY
# 3. Build the knowledge base from public sources
uv run python ingestion/run_ingest.py
# 4. Start the chat server
uv run uvicorn app.main:app --reload
# 5. Open the widget
# visit http://localhost:8000/Project layout
chatbot/
├── config/ # settings, prompts, LLM profiles
├── app/ # FastAPI service (the core)
├── ingestion/ # KB build pipeline (crawl → chunk → embed → index)
├── data/ # sources, processed chunks, indexes, logs
├── frontend/ # HTML/JS chat widget
├── eval/ # golden Q&A regression set
├── scripts/ # CSV → Q&A converters, review UI, exporters
├── tests/
└── docs/ # design specAdding real Q&A later
When CS hands you a CSV of real Q&A:
# convert (auto-detects encoding/columns first time, saves mapping)
uv run python scripts/csv_to_qa_jsonl.py --input data/sources/cs_inbox/<file>.csv --interactive
# (optional) review in browser
uv run python scripts/qa_review.py --file data/sources/qa_pairs/<batch>.jsonl
# re-index just the new Q&A (~30s, no downtime)
uv run python ingestion/run_ingest.py --source qa_pairsNo retraining. No code changes. The bot answers from the new data on the next request.
CS Dashboard Phase 1 (added 2026-05-08)
/escalatenow dual-writes to JSONL + Firestoreconversations/{id}POST /admin/conversations/{id}/{reply,status,assignee}— agent endpointsGET /admin/smtp-status— banner check- Stub-mode email: when
SMTP_PASSWORDempty, replies are saved withsentVia="stub"and not delivered
See docs/superpowers/specs/2026-05-08-cs-dashboard-design.md for full design.
