No description
  • Python 87%
  • Shell 8.2%
  • Dockerfile 2.6%
  • Makefile 2.2%
Find a file
narndtse b8cd4eb9d6
All checks were successful
/ deploy-api (push) Successful in 21s
Add license
2026-05-09 20:04:08 +02:00
.forgejo/workflows Change workflow 2026-05-09 17:41:30 +02:00
app First version 2026-05-03 11:21:51 +02:00
ollama Add initial RAG ingest pipeline (ollama + qdrant) 2026-04-26 23:54:26 +02:00
scripts First version 2026-05-03 11:21:51 +02:00
.env.example First version 2026-05-03 11:21:51 +02:00
.gitignore Add initial RAG ingest pipeline (ollama + qdrant) 2026-04-26 23:54:26 +02:00
docker-compose.yml First version 2026-05-03 11:21:51 +02:00
Dockerfile First version 2026-05-03 11:21:51 +02:00
LICENSE Add license 2026-05-09 20:04:08 +02:00
Makefile First version 2026-05-03 11:21:51 +02:00
README.md Add license 2026-05-09 20:04:08 +02:00
requirements.txt Add turnstile 2026-04-27 23:01:09 +02:00

Portfolio Chatbot (RAG)

License

Simple RAG setup using Ollama embeddings, Qdrant and Redis rate limiting.

Reverse Proxy Requirement (Important)

This API is designed to run behind a reverse proxy (e.g. Nginx) in production.

The rate limiting mechanism relies on the client IP address. Without a trusted proxy, headers such as X-Forwarded-For can be spoofed by clients, allowing them to bypass rate limits or causing incorrect behavior.

location / {
    proxy_pass http://app:8000;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Backend behavior

The backend reads the client IP from the X-Real-IP header:

return request.headers.get("x-real-ip") or request.client.host

Without a reverse proxy

  • All requests may appear to originate from the same IP (e.g. 127.0.0.1)
  • Rate limiting will not work correctly
  • IP-based protections can be bypassed

Development note

When running locally without Nginx, the application falls back to request.client.host. This usually resolves to 127.0.0.1, meaning all requests share the same rate limit.

For realistic testing, run the full stack (including Nginx).

Setup

make setup
make up
make ingest

Usage

API

curl -N -X POST http://localhost:8000/chat \
  -H "Content-Type: application/json" \
  -d '{"query": "Hast du Erfahrung mit Docker?"}'
# Only works if ENABLE_TURNSTILE is set to False

Retrieval (debug)

make search q="Hast du Erfahrung mit Docker?"

Generation

make generate q="Hast du Erfahrung mit Docker?"

Rate limit CLI

make rate-limit

Available commands:

  • list
  • delete
  • delete-all
  • exit

The CLI can be used to inspect current rate limit keys, delete a single key or reset all rate limits.

Stop

make down

Notes

  • Example data: data/cv.dummy.md
  • Real data is not included in this repository
  • Retrieval and generation are implemented separately for easier debugging
  • Redis is used for API rate limiting