Rag_Chat with doc/pdf that support amharic and english language
# DocChat — Bilingual RAG Web App 🇪🇹
### አማርኛ / English Document Intelligence
A modern, minimal, production-ready document QA platform.
**Stack:** FastAPI · Gemini 1.5 Flash · ChromaDB · Vanilla JS (no framework)
---
## Features
| Feature | Detail |
|---------|--------|
| 📄 Multi-format | PDF, DOCX, TXT, PPTX |
| 🌍 Bilingual | Amharic (አማርኛ) + English auto-detection |
| ⚡ Streaming | Token-by-token streaming like ChatGPT |
| 🧠 RAG Pipeline | Chunk → Embed → Vector Store → Retrieve → Generate |
| 🔍 Semantic Search | Gemini text-embedding-004 |
| 🗃 Vector DB | ChromaDB (in-memory / persistent) |
| 🐳 Docker | One-command deployment |
---
## Architecture
```
Browser (HTML/CSS/JS)
│ Upload files │ SSE stream
▼ ▼
┌─────────────────────────────────────────┐
│ FastAPI Backend │
│ │
│ /upload /chat/stream │
│ │ │ │
│ Extract text Embed query │
│ Chunk (800 chars) ChromaDB search │
│ Embed (Gemini) Top-5 chunks │
│ ChromaDB.add() Gemini generate │
│ SSE yield │
└─────────────────────────────────────────┘
```
---
## Quick Start
### 1. Clone & Configure
```bash
git clone
github.com
cd doc-chat
```
Set your Gemini API key:
```bash
export GEMINI_API_KEY="your-key-here"
```
Or create `.env`:
```
GEMINI_API_KEY=your-key-here
```
### 2a. Docker (Recommended)
```bash
docker-compose up --build
```
- Frontend:
localhost
- Backend API:
localhost
- API Docs:
localhost
### 2b. Local Dev
**Backend:**
```bash
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000
```
**Frontend:**
```bash
# Any static server works
cd frontend
npx serve . -p 3000
# or: python -m http.server 3000
```
---
## API Endpoints
| Method | Path | Description |
|--------|------|-- …