AI chatbot with semantic search (RAG), voice transcription, text-to-speech, user authentication, and a React frontend — powered by OpenAI and FastAPI.
- 💬 AI Chat — Powered by OpenAI GPT (gpt-3.5-turbo) with personality modes: Friendly, Professional, Sarcastic, Motivational
- 🔍 Semantic RAG — ChromaDB-backed knowledge base with semantic search using OpenAI embeddings
- 🎙️ Voice Input — Whisper-based audio transcription endpoint
- 🔊 Text-to-Speech — gTTS integration for audio responses
- 🔐 Authentication — JWT-based user login with SQLite storage
- 📊 Usage Tracking — Per-user token and cost accounting
- 🐳 Docker Ready — Full Docker Compose setup for local development
- ✅ CI/CD — GitHub Actions workflow with integration tests
| Layer | Technology |
|---|---|
| Frontend | React 18, Axios |
| Backend | Python, FastAPI, Uvicorn |
| AI | OpenAI GPT, Whisper, Embeddings |
| Vector DB | ChromaDB |
| Auth | JWT (PyJWT) |
| Database | SQLite |
| TTS | gTTS |
| Deployment | Docker, Render, Hugging Face |
ai-chatbot/
├── backend/
│ ├── app.py # FastAPI backend (chat, auth, RAG, TTS, Whisper)
│ ├── requirements.txt # Python dependencies
│ └── Dockerfile
├── frontend-react/
│ ├── src/
│ │ ├── App.js # React UI (chat, auth, KB upload, audio)
│ │ └── index.css
│ └── package.json
├── tests/
│ ├── integration_api_test.py
│ └── test_integration_endpoints.py
├── deploy/
│ ├── docker_deploy.md
│ ├── render.md
│ └── hf_instructions.md
├── docker-compose.yml
└── README.md
- Python 3.11+
- Node.js 18+
- OpenAI API Key
git clone https://github.com/nithu0035/AI-chatbot.git
cd AI-chatbot/ai-chatbotcd backend
pip install -r requirements.txtCreate a .env file:
OPENAI_API_KEY=your_openai_api_key_here
JWT_SECRET=your_secret_key_here
Start the backend:
uvicorn app:app --host 0.0.0.0 --port 8000cd frontend-react
npm install
npm startOpen your browser at http://localhost:3000
# From the ai-chatbot/ directory
OPENAI_API_KEY=your_key JWT_SECRET=your_secret docker-compose up --build| Service | URL |
|---|---|
| Frontend | http://localhost:3000 |
| Backend API | http://localhost:8000 |
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Health check |
| POST | /register |
Register a new user |
| POST | /login |
Login and get JWT token |
| POST | /chat |
Send a message and get AI reply |
| POST | /transcribe |
Upload audio for Whisper transcription |
| POST | /tts |
Convert text to speech |
| POST | /upload-kb |
Upload document to knowledge base |
cd tests
pip install pytest httpx
pytest integration_api_test.pySee the deploy/ folder for step-by-step guides:
- Docker →
deploy/docker_deploy.md - Render →
deploy/render.md - Hugging Face Spaces →
deploy/hf_instructions.md
Gudipatoju Nitesh
GitHub: @nithu0035