Lightweight local RAG web app for private document Q&A.
The app is designed for local or intranet deployment:
- Upload
.txt,.md,.pdf,.docx - Store documents and chunks in local SQLite
- Search locally with deterministic embeddings
- Answer with cited source chunks
- Use DeepSeek Flash or Ollama when configured, with an extractive local fallback
.\start.batOpen http://localhost:8000.
docker compose up --buildOpen http://localhost:8000.
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000The app works without Ollama by returning answers from retrieved passages. To use a local model:
ollama pull qwen2.5:7b
$env:OLLAMA_BASE_URL="http://localhost:11434"
$env:OLLAMA_MODEL="qwen2.5:7b"
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000For Docker Compose, add these environment variables under the service when you want the container to call a host Ollama instance:
OLLAMA_BASE_URL: http://host.docker.internal:11434
OLLAMA_MODEL: qwen2.5:7bCopy .env.example to .env, then fill your key:
Copy-Item .env.example .env
notepad .envUse these values:
DEEPSEEK_API_KEY=sk-...
DEEPSEEK_BASE_URL=https://api.deepseek.com
DEEPSEEK_MODEL=deepseek-v4-flashRestart the app after changing .env. DeepSeek takes priority over Ollama when
DEEPSEEK_API_KEY is set.
Runtime data is stored under data/:
data/rag.db: documents, chunks, and local embeddings
Delete data/rag.db to reset the knowledge base.
By default the app does not call cloud APIs.
When DEEPSEEK_API_KEY is configured, the user's question and retrieved
document chunks are sent to DeepSeek for generation. Do not enable DeepSeek for
deployments that require strict "documents never leave the local network"
guarantees.
When OLLAMA_BASE_URL is configured, it should point to a local or private
Ollama endpoint.