docs: Update TODO.md with completed implementation status

This commit is contained in:
2026-01-23 16:10:27 +01:00
parent 26f5a7370c
commit eb876bc267

107
TODO.md
View File

@@ -1,48 +1,71 @@
# n8n Workflow Import - Implementation Plan # n8n Customer Provisioning System
## Status: 🔄 In Progress ## Status: ✅ Phase 1-4 Complete
--- ---
## Problem ## Implementierte Features
Der n8n Workflow wird nicht automatisch importiert und aktiviert. Die bisherige Implementierung in Step 10 funktioniert nicht korrekt, weil:
1. Die `pct_exec` Ausgabe nicht korrekt für JSON-Parsing zurückgegeben wird
2. Credentials müssen zuerst erstellt werden, dann deren IDs im Workflow referenziert werden
3. Der Workflow muss nach dem Import aktiviert werden
--- ### Phase 1: n8n API Funktionen (libsupabase.sh)
## Lösung - [x] `n8n_api_login()` - Login mit `emailOrLdapLoginId` (nicht `email`)
### Phase 1: libsupabase.sh - Neue n8n API Funktionen
- [x] `n8n_api_login()` - Login und Cookie speichern
- [x] `n8n_api_create_postgres_credential()` - PostgreSQL Credential erstellen - [x] `n8n_api_create_postgres_credential()` - PostgreSQL Credential erstellen
- [x] `n8n_api_create_ollama_credential()` - Ollama Credential erstellen - [x] `n8n_api_create_ollama_credential()` - Ollama Credential erstellen
- [x] `n8n_api_import_workflow()` - Workflow importieren - [x] `n8n_api_import_workflow()` - Workflow importieren
- [x] `n8n_api_activate_workflow()` - Workflow aktivieren - [x] `n8n_api_activate_workflow()` - Workflow aktivieren mit `versionId`
- [x] `n8n_generate_workflow_json()` - Workflow JSON mit Credential-IDs generieren - [x] `n8n_generate_rag_workflow_json()` - Built-in Workflow Template
- [x] `n8n_setup_rag_workflow()` - Hauptfunktion für komplettes Setup
### Phase 2: install.sh - Step 10 überarbeiten ### Phase 2: install.sh - Workflow Import
- [x] Login durchführen - [x] Login durchführen
- [x] PostgreSQL Credential erstellen und ID speichern - [x] PostgreSQL Credential erstellen und ID speichern
- [x] Ollama Credential erstellen und ID speichern - [x] Ollama Credential erstellen und ID speichern
- [x] Workflow JSON mit korrekten Credential-IDs generieren - [x] Workflow JSON mit korrekten Credential-IDs generieren
- [x] Workflow importieren - [x] Workflow importieren
- [x] Workflow aktivieren - [x] Workflow aktivieren mit `POST /rest/workflows/{id}/activate` + `versionId`
### Phase 3: Testen ### Phase 3: Externe Workflow-Datei Support
- [ ] Neuen Container erstellen mit `bash install.sh --debug` - [x] `--workflow-file <path>` Option hinzugefügt (default: `RAGKI-BotPGVector.json`)
- [ ] Prüfen ob Workflow importiert wurde - [x] `--ollama-model <model>` Option hinzugefügt (default: `ministral-3:3b`)
- [ ] Prüfen ob Workflow aktiv ist - [x] `--embedding-model <model>` Option hinzugefügt (default: `nomic-embed-text:latest`)
- [ ] Prüfen ob Credentials korrekt verknüpft sind - [x] Python-Script für dynamische Credential-ID-Ersetzung
- [x] Entfernung von `id`, `versionId`, `meta`, `tags`, `active`, `pinData` beim Import
- [x] `RAGKI-BotPGVector.json` als Standard-Workflow-Template
### Phase 4: Git Push ### Phase 4: Tests & Git
- [ ] Änderungen committen - [x] Container sb-1769174647 - Workflow aktiviert ✅
- [ ] Push zu Repository - [x] Container sb-1769180683 - Externe Workflow-Datei ✅
- [x] Git Commits gepusht
---
## Verwendung
### Standard-Installation (mit Default-Workflow)
```bash
bash install.sh --debug
```
### Mit benutzerdefiniertem Workflow
```bash
bash install.sh --debug \
--workflow-file /path/to/custom-workflow.json \
--ollama-model "llama3.2:3b" \
--embedding-model "nomic-embed-text:v1.5"
```
### Verfügbare Optionen
| Option | Default | Beschreibung |
|--------|---------|--------------|
| `--workflow-file` | `RAGKI-BotPGVector.json` | Pfad zur n8n Workflow JSON-Datei |
| `--ollama-model` | `ministral-3:3b` | Ollama Chat-Modell |
| `--embedding-model` | `nomic-embed-text:latest` | Ollama Embedding-Modell |
--- ---
@@ -50,14 +73,40 @@ Der n8n Workflow wird nicht automatisch importiert und aktiviert. Die bisherige
### n8n REST API Endpoints ### n8n REST API Endpoints
- `POST /rest/login` - Login (setzt Session Cookie) | Endpoint | Methode | Beschreibung |
- `POST /rest/credentials` - Credential erstellen |----------|---------|--------------|
- `POST /rest/workflows` - Workflow importieren | `/rest/login` | POST | Login (Feld: `emailOrLdapLoginId`, nicht `email`) |
- `PATCH /rest/workflows/{id}` - Workflow aktivieren | `/rest/credentials` | POST | Credential erstellen |
| `/rest/workflows` | POST | Workflow importieren |
| `/rest/workflows/{id}/activate` | POST | Workflow aktivieren (benötigt `versionId`) |
### Credential Types ### Credential Types
- `postgres` - PostgreSQL Datenbank - `postgres` - PostgreSQL Datenbank
- `ollamaApi` - Ollama API - `ollamaApi` - Ollama API
### Workflow-Verarbeitung
Das Python-Script `/tmp/process_workflow.py` im Container:
1. Liest die Workflow-Template-Datei
2. Entfernt Felder: `id`, `versionId`, `meta`, `tags`, `active`, `pinData`
3. Ersetzt alle `postgres` Credential-IDs mit der neuen ID
4. Ersetzt alle `ollamaApi` Credential-IDs mit der neuen ID
5. Schreibt die verarbeitete Workflow-Datei
--- ---
## Git Commits
1. `ff1526c` - feat: Auto-import n8n RAG workflow with credentials
2. `f663708` - fix: Workflow activation with versionId
3. `26f5a73` - feat: External workflow file support with dynamic credential replacement
---
## Nächste Schritte (Optional)
- [ ] Workflow-Validierung vor Import
- [ ] Mehrere Workflows unterstützen
- [ ] Workflow-Update bei bestehenden Containern
- [ ] Backup/Export von Workflows