Files
denshooter a34d406375 feat: complete memorial website features
- Add user contribution system (memories, timeline entries)
- Add AI content moderation with Ollama (bad word detection + qwen3:4b)
- Add family photo/video upload with admin approval
- Add candle lighting feature
- Add timeline and recipe sections
- Add QR code page and OG image
- Add site authentication (password-protected access)
- Add proxy middleware for auth routing
- Add admin dashboard for content management
- Remove email fields, make name optional (default: Anonym)
- Add CI/CD pipeline for Gitea Actions
- Add Docker deployment configuration
- Optimize Ollama RAM usage (42GB → 2.9GB)
- Fix API routes accessibility through proxy middleware

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 12:20:33 +01:00

142 lines
2.9 KiB
Markdown

# 🤖 Ollama Content-Moderation Setup
## Automatische KI-Prüfung von Beiträgen
Die Website kann Beiträge automatisch mit einer lokalen KI (Ollama) prüfen und verdächtige Inhalte flaggen.
---
## 📥 Installation
### 1. Ollama installieren (einmalig)
**Mac:**
```bash
brew install ollama
```
**Linux:**
```bash
curl -fsSL https://ollama.com/install.sh | sh
```
**Windows:**
Download von https://ollama.com/download
---
### 2. Modell herunterladen (einmalig)
```bash
ollama pull llama3.2:1b
```
**Info:** Das Modell ist ~700MB groß und läuft sehr schnell auf deinem Mac.
---
### 3. Ollama starten
**Option A: Automatisch (macOS Service)**
```bash
brew services start ollama
```
**Option B: Manuell (im Terminal lassen)**
```bash
ollama serve
```
---
## 🚀 Wie es funktioniert
### Automatische Prüfung:
- Wenn jemand einen Beitrag einreicht (Erinnerung, Zeitstrahl, etc.)
- Wird automatisch die KI gefragt: "Ist das angemessen?"
- **Falls unangemessen:** Status wird auf `flagged` 🚩 gesetzt
- **Falls angemessen:** Status bleibt auf `pending`
### Im Admin-Panel:
- **Geflaggte Beiträge** erscheinen mit **rotem Hintergrund** 🔴
- **KI-Warnung** wird angezeigt (z.B. "Spam erkannt")
- Du kannst dann entscheiden:
- ✅ Freigeben (trotzdem ok)
- ❌ Ablehnen (KI hatte recht)
---
## 🎯 Was wird erkannt?
Die KI prüft auf:
-**Spam & Werbung**
-**Beleidigungen**
-**Off-Topic** (völlig irrelevant)
-**Unseriöse Inhalte**
-**Grammatik/Rechtschreibung** wird NICHT bemängelt!
---
## 🔧 Troubleshooting
### "Ollama not available"
- Prüfe ob Ollama läuft: `ollama list`
- Falls nicht: `ollama serve` im Terminal
### Moderation funktioniert nicht
- Prüfe: `curl http://localhost:11434/api/version`
- Sollte JSON zurückgeben
### KI flaggt zu viel / zu wenig
- Prompt anpassen in: `src/app/api/moderate/route.ts`
- Zeilen 20-40: Die KI-Instruktionen
---
## ⚙️ Deaktivieren
Falls du die Auto-Moderation nicht willst:
**Option 1:** Ollama einfach nicht starten
- Dann werden alle Beiträge als `pending` markiert
- Keine KI-Prüfung, aber auch keine Fehler
**Option 2:** Code entfernen
- Lösche die Auto-Moderation in `src/app/api/contributions/route.ts` (Zeilen 35-48)
---
## 📊 Performance
- **Ollama läuft lokal** → keine API-Kosten!
- **llama3.2:1b** → sehr schnell (~1-3 Sekunden)
- **RAM-Nutzung:** ~1GB wenn aktiv
- **CPU:** Minimal (außer während Moderation)
---
## 🎨 Anpassungen
### Andere Modelle verwenden:
```bash
# Kleineres Modell (schneller, weniger genau)
ollama pull llama3.2:1b
# Größeres Modell (langsamer, genauer)
ollama pull llama3.2:3b
```
Dann in `src/app/api/moderate/route.ts` ändern:
```typescript
model: 'llama3.2:3b' // statt :1b
```
---
## ✨ Fazit
-**Kostenlos** & **privat**
-**Automatisch** & **optional**
-**Du behältst Kontrolle** (finale Entscheidung)
-**Kein Setup nötig** in Production (läuft nur lokal)