| title | Mini AI Chatbot |
|---|---|
| emoji | 🤖 |
| colorFrom | blue |
| colorTo | green |
| sdk | docker |
| sdk_version | latest |
| app_file | Dockerfile |
| pinned | false |
A web-based AI chatbot that answers professional questions using a knowledge base with fuzzy string matching. Built with React frontend and FastAPI backend.
- Hf Spaces Deployed Link: https://huggingface.co/spaces/lydiaavin/mini-ai-chatbot
- Frontend (React + Vite): Clean conversational UI with input field, send button, answer display, and chat history.
- Backend (FastAPI): REST API with
/askendpoint for question processing. - Knowledge Base: 56 professional Q&A pairs covering productivity, leadership, finance, marketing, HR, and more.
- Matching: Fuzzy string matching using
fuzzywuzzylibrary with 50% similarity threshold. - History: Persists chat history in
history.jsonfor context in responses. - Fallback: Provides a professional fallback message for unmatched questions.
- Python 3.8+ (for backend)
- Node.js 14+ (for frontend)
-
Backend:
cd backend pip install -r requirements.txt uvicorn app:app --reload --host 0.0.0.0 --port 8000 -
Frontend (in a new terminal):
cd frontend npm install npm run dev -
Open
http://localhost:5173in your browser to access the chatbot UI.
- Endpoint:
POST /ask - Request Body:
{"question": "Your question here"} - Response:
{"answer": "Answer text"}
curl -X POST http://localhost:8000/ask \
-H "Content-Type: application/json" \
-d '{"question": "How to manage time effectively?"}'Response: {"answer": "Set SMART goals, use calendars, and avoid multitasking."}
- Backend: FastAPI, Uvicorn, Pydantic, fuzzywuzzy
- Frontend: React, Axios, Vite
mini-ai-chatbot/
├── backend/
│ ├── app.py
│ ├── knowledge_base.json # ~50 Q&A pairs
│ ├── history.json
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── App.jsx
│ │ ├── App.css
│ │ └── main.jsx
│ ├── package.json
│ └── vite.config.js
├── .gitignore
└── README.md
- Knowledge base covers common professional topics; unmatched questions receive a fallback response.
- Fuzzy matching threshold of 50% balances accuracy and coverage.