An offline, self-contained FAQ chatbot for Rentelo that gives correct answers to your policy/FAQ questions using semantic search (TF‑IDF cosine similarity)—no external APIs or keys required.
- backend/: FastAPI app with a local FAQ knowledge base and semantic search.
- frontend/: Vite + React + Tailwind chat UI (clean, responsive).
- docker-compose.yml: One command to run both services.
cd backend
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
# source .venv/bin/activate
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 8000Backend will be on http://localhost:8000
Open a second terminal:
cd frontend
npm install
npm run devFrontend will be on http://localhost:5173 (Vite default). It calls the backend at http://localhost:8000.
docker compose up --build- Frontend: http://localhost:3000
- Backend: http://localhost:8000
POST /ask— Body:{ "question": "Your text" }→ returns best matching answer and metadata.GET /faqs— List all FAQ entries (title, tags).
- The backend loads FAQ data from
data/faqs.json(Q/A + tags). - Builds a TF‑IDF vector space using both questions and answers to improve recall.
- Computes cosine similarity between your query and the knowledge base.
- Returns the top answer. (Optional: supports
top_k.)
- Update
backend/data/faqs.jsonwith new entries (fields:id,title,question,answer,tagslist). - Restart the backend to reindex.
Made for the requirements you shared (refund policy, documents, KYC, timings, etc.).