Files

112 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# apply4jobs RAG Stack
KI-basierter Chat-Assistent für apply4jobs.de beantwortet Recruiter-Fragen zu Sebastian Fröhlich auf Basis seiner Bewerbungsunterlagen.
## Architektur
\`\`\`
apply4jobs.de (Next.js)
└── ChatWidget → https://ai.apply4jobs.de/api/v1/chat/completions
└── FastAPI RAG-Bridge (Port 8000)
├── multilingual-e5-small (Embeddings)
├── pgvector / PostgreSQL (Vektordatenbank)
└── OpenAI GPT-4o-mini (Generierung)
\`\`\`
## Stack
| Service | Image | Port |
|---------|-------|------|
| PostgreSQL + pgvector | pgvector/pgvector:pg16 | 5432 |
| Ollama | ollama/ollama:latest | 11434 |
| Open WebUI | ghcr.io/open-webui/open-webui:main | 3000 |
| RAG API | python:3.11-slim (custom) | 8000 |
## Voraussetzungen
- Docker + Docker Compose v2
- Ubuntu 22.04 LTS
- Domain mit SSL (Let's Encrypt)
- OpenAI API Key (GPT-4o-mini)
## Setup
### 1. Repository klonen
\`\`\`bash
git clone <repo-url> /opt/apply4jobs
cd /opt/apply4jobs
\`\`\`
### 2. Umgebungsvariablen konfigurieren
\`\`\`bash
cp .env.example .env
nano .env
\`\`\`
\`\`\`env
OPENAI_API_KEY=sk-proj-...
POSTGRES_PASSWORD=dein-sicheres-passwort
\`\`\`
### 3. Stack starten
\`\`\`bash
docker compose up -d
\`\`\`
### 4. Ollama-Modelle pullen
\`\`\`bash
docker exec ollama ollama pull llama3.2:3b
docker exec ollama ollama pull nomic-embed-text
\`\`\`
### 5. Datenbank importieren
\`\`\`bash
docker exec -i postgres psql -U anythingllm -d anythingllm < backup.sql
\`\`\`
## RAG API Endpunkte
| Methode | Endpoint | Beschreibung |
|---------|----------|-------------|
| GET | /health | Health Check |
| GET | /v1/models | Verfügbare Modelle |
| POST | /retrieve | Kontext aus pgvector abrufen |
| POST | /v1/chat/completions | OpenAI-kompatibler Chat-Endpunkt |
## Kosten
| Posten | Kosten/Monat |
|--------|-------------|
| Hetzner CPX42 | ~22 € |
| OpenAI GPT-4o-mini | ~1-3 € |
| **Gesamt** | **~23-25 €** |
## Wartung
\`\`\`bash
# Logs anzeigen
docker compose logs -f rag-api
# Container neu starten
docker compose restart rag-api
# Nach Code-Änderungen neu bauen
docker compose up -d --build rag-api
# SSL-Zertifikat testen
certbot renew --dry-run
\`\`\`
## Sicherheitshinweise
- .env niemals ins Git-Repository committen
- DSGVO: Datenschutzhinweis auf apply4jobs.de erforderlich
- Chat-Logs werden nicht persistiert
- Hetzner Rechenzentrum Deutschland = DSGVO-konform