Protokoll #2165
| ID | 2165 |
|---|---|
| Zeitstempel | 2025-12-21 10:34:41.765944 |
| Client | root |
| IP | Warning: Undefined array key "request_ip" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 |
| Modell | claude-sonnet-4-20250514 |
| Status | completed |
| Tokens | 7,841 (Input: 0, Output: 0) |
| Dauer | 94 ms |
| Request-Zeit | Warning: Undefined array key "request_timestamp" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 18 |
| Response-Zeit | - |
Warning: Undefined array key "error_message" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 22
Request
{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/docs\/plan-form-components-refactoring.md",
"old_string": "---\n\n## 7. Migrations-Schritte\n\n### Phase 1: Infrastruktur\n1. [ ] Verzeichnis `\/src\/View\/partials\/form\/` erstellen\n2. [ ] `CollectionConfig.php` erstellen (Label-Mapping)\n3. [ ] CSS-Klassen vereinheitlichen in `styles.css`\n\n### Phase 2: Partials erstellen\n4. [ ] `model-select.php` - mit Optgroup-Support\n5. [ ] `collections.php` - mit Varianten (multi\/single\/checkbox)\n6. [ ] `context-limit.php`\n7. [ ] `author-profile.php`\n8. [ ] `system-prompt.php`\n9. [ ] `temperature.php`\n10. [ ] `max-tokens.php`\n11. [ ] `contract.php`\n12. [ ] `structure.php`\n\n### Phase 3: Views migrieren\n13. [ ] `chat\/index.php` auf Partials umstellen\n14. [ ] `content\/new.php` auf Partials umstellen\n15. [ ] `content\/show.php` auf Partials umstellen\n\n### Phase 4: Controller anpassen\n16. [ ] Variablennamen vereinheitlichen\n17. [ ] Redundante Logik entfernen\n\n### Phase 5: Testing\n18. [ ] Chat funktioniert wie vorher\n19. [ ] Content Studio funktioniert wie vorher\n20. [ ] Visuelle Konsistenz prüfen",
"new_string": "---\n\n## 7. Konsolidierte Migrations-Schritte\n\n### Phase 1: Datenbank-Schema (ki_dev)\n\n```sql\n-- 1.1 LLM-Modelle\nCREATE TABLE llm_models (...);\n\n-- 1.2 LLM-Presets\nCREATE TABLE llm_presets (...);\nINSERT INTO llm_presets (...) VALUES (...);\n\n-- 1.3 RAG-Collections\nCREATE TABLE rag_collections (...);\n\n-- 1.4 User-Präferenzen\nCREATE TABLE user_preferences (...);\nINSERT INTO user_preferences (user_id) VALUES (1);\n```\n\n| # | Task | Status |\n|---|------|--------|\n| 1.1 | Tabelle `llm_models` erstellen | [ ] |\n| 1.2 | Tabelle `llm_presets` erstellen + Initial-Daten | [ ] |\n| 1.3 | Tabelle `rag_collections` erstellen | [ ] |\n| 1.4 | Tabelle `user_preferences` erstellen + Initial-Eintrag | [ ] |\n\n### Phase 2: Repositories & Services\n\n| # | Task | Datei | Status |\n|---|------|-------|--------|\n| 2.1 | `LlmModelRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |\n| 2.2 | `LlmPresetRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |\n| 2.3 | `CollectionRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |\n| 2.4 | `UserPreferencesRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |\n| 2.5 | `UserPreferencesService` | `\/src\/Infrastructure\/` | [ ] |\n| 2.6 | `LlmSyncService` (Anthropic + Ollama) | `\/src\/Infrastructure\/AI\/` | [ ] |\n\n### Phase 3: Admin-Seiten\n\n| # | Task | URL | Status |\n|---|------|-----|--------|\n| 3.1 | Route `\/ressourcen\/llm` anlegen | Router.php | [ ] |\n| 3.2 | `RessourcenController::llmIndex()` | Controller | [ ] |\n| 3.3 | View `ressourcen\/llm\/index.php` (Tabs: Modelle, Presets) | View | [ ] |\n| 3.4 | Sync-Buttons (Anthropic, Ollama) | View + Controller | [ ] |\n| 3.5 | Route `\/ressourcen\/collections` anlegen | Router.php | [ ] |\n| 3.6 | `RessourcenController::collectionsIndex()` | Controller | [ ] |\n| 3.7 | View `ressourcen\/collections\/index.php` | View | [ ] |\n| 3.8 | Qdrant-Sync implementieren | QdrantService | [ ] |\n| 3.9 | Route `\/ressourcen\/profil` anlegen | Router.php | [ ] |\n| 3.10 | `RessourcenController::profilIndex()` | Controller | [ ] |\n| 3.11 | View `ressourcen\/profil\/index.php` | View | [ ] |\n\n### Phase 4: Partials-Verzeichnis & CSS\n\n| # | Task | Status |\n|---|------|--------|\n| 4.1 | Verzeichnis `\/src\/View\/partials\/form\/` erstellen | [ ] |\n| 4.2 | `\/public\/css\/llm-settings.css` erstellen | [ ] |\n| 4.3 | `\/public\/js\/llm-settings.js` erstellen | [ ] |\n| 4.4 | CSS\/JS in Layout einbinden | [ ] |\n\n### Phase 5: Partials erstellen\n\n| # | Partial | Quelle | Status |\n|---|---------|--------|--------|\n| 5.1 | `model-select.php` | `llm_models` | [ ] |\n| 5.2 | `collections-select.php` | `rag_collections` | [ ] |\n| 5.3 | `context-limit.php` | Hardcoded + UserPrefs | [ ] |\n| 5.4 | `temperature-tokens.php` | `llm_presets` + Model-Max | [ ] |\n| 5.5 | `author-profile.php` | `content_config` | [ ] |\n| 5.6 | `system-prompt.php` | `content_config` | [ ] |\n| 5.7 | `contract.php` | `content_config` | [ ] |\n| 5.8 | `structure.php` | `content_config` | [ ] |\n\n### Phase 6: Base Controller erweitern\n\n| # | Task | Status |\n|---|------|--------|\n| 6.1 | `Controller.php` um `$userPrefs` erweitern | [ ] |\n| 6.2 | Automatische Weitergabe an alle Views | [ ] |\n\n### Phase 7: API-Endpoints\n\n| # | Task | Route | Status |\n|---|------|-------|--------|\n| 7.1 | Modell-Info | `GET \/api\/v1\/llm\/{modelId}` | [ ] |\n\n### Phase 8: Initial-Sync & Datenmigration\n\n| # | Task | Status |\n|---|------|--------|\n| 8.1 | Anthropic-Modelle synchronisieren | [ ] |\n| 8.2 | Ollama-Modelle synchronisieren | [ ] |\n| 8.3 | Qdrant-Collections synchronisieren | [ ] |\n| 8.4 | `ModelConfig.php` durch Repository ersetzen | [ ] |\n\n### Phase 9: Chat-Integration\n\n| # | Task | Status |\n|---|------|--------|\n| 9.1 | `ChatController` auf Repositories umstellen | [ ] |\n| 9.2 | `ChatController::createSession()` mit UserPrefs | [ ] |\n| 9.3 | `chat\/index.php` auf Partials umstellen | [ ] |\n\n### Phase 10: Content-Studio-Integration\n\n| # | Task | Status |\n|---|------|--------|\n| 10.1 | `ContentController` auf Repositories umstellen | [ ] |\n| 10.2 | `ContentController::contentNew()` mit UserPrefs | [ ] |\n| 10.3 | `content\/new.php` auf Partials umstellen | [ ] |\n| 10.4 | `content\/show.php` auf Partials umstellen | [ ] |\n| 10.5 | `content\/edit.php` auf Partials umstellen | [ ] |\n\n### Phase 11: Python-Pipeline-Integration\n\n| # | Task | Status |\n|---|------|--------|\n| 11.1 | Pipeline auf DB-Query für Collections umstellen | [ ] |\n| 11.2 | Pipeline auf DB-Query für Modelle umstellen | [ ] |\n\n### Phase 12: Testing\n\n| # | Test | Status |\n|---|------|--------|\n| 12.1 | Admin: LLM-Verwaltung funktioniert | [ ] |\n| 12.2 | Admin: Collections-Verwaltung funktioniert | [ ] |\n| 12.3 | Admin: Profil-Seite speichert korrekt | [ ] |\n| 12.4 | Chat: Neue Session übernimmt Defaults | [ ] |\n| 12.5 | Chat: Bestehende Session behält Werte | [ ] |\n| 12.6 | Chat: Modell-Wechsel aktualisiert Token-Optionen | [ ] |\n| 12.7 | Chat: Preset-Buttons funktionieren | [ ] |\n| 12.8 | Content New: Formular mit allen Defaults | [ ] |\n| 12.9 | Content Show: Inline-Dropdowns funktionieren | [ ] |\n| 12.10 | Content: Generierung funktioniert | [ ] |\n| 12.11 | Visuelle Konsistenz Chat ↔ Content | [ ] |\n\n---\n\n## 7b. Alte Migrations-Schritte (Referenz)\n\n### Phase 1: Infrastruktur\n1. [ ] Verzeichnis `\/src\/View\/partials\/form\/` erstellen\n2. [ ] `CollectionConfig.php` erstellen (Label-Mapping)\n3. [ ] CSS-Klassen vereinheitlichen in `styles.css`\n\n### Phase 2: Partials erstellen\n4. [ ] `model-select.php` - mit Optgroup-Support\n5. [ ] `collections.php` - mit Varianten (multi\/single\/checkbox)\n6. [ ] `context-limit.php`\n7. [ ] `author-profile.php`\n8. [ ] `system-prompt.php`\n9. [ ] `temperature.php`\n10. [ ] `max-tokens.php`\n11. [ ] `contract.php`\n12. [ ] `structure.php`\n\n### Phase 3: Views migrieren\n13. [ ] `chat\/index.php` auf Partials umstellen\n14. [ ] `content\/new.php` auf Partials umstellen\n15. [ ] `content\/show.php` auf Partials umstellen\n\n### Phase 4: Controller anpassen\n16. [ ] Variablennamen vereinheitlichen\n17. [ ] Redundante Logik entfernen\n\n### Phase 5: Testing\n18. [ ] Chat funktioniert wie vorher\n19. [ ] Content Studio funktioniert wie vorher\n20. [ ] Visuelle Konsistenz prüfen"
}
}
Response
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/docs\/plan-form-components-refactoring.md",
"oldString": "---\n\n## 7. Migrations-Schritte\n\n### Phase 1: Infrastruktur\n1. [ ] Verzeichnis `\/src\/View\/partials\/form\/` erstellen\n2. [ ] `CollectionConfig.php` erstellen (Label-Mapping)\n3. [ ] CSS-Klassen vereinheitlichen in `styles.css`\n\n### Phase 2: Partials erstellen\n4. [ ] `model-select.php` - mit Optgroup-Support\n5. [ ] `collections.php` - mit Varianten (multi\/single\/checkbox)\n6. [ ] `context-limit.php`\n7. [ ] `author-profile.php`\n8. [ ] `system-prompt.php`\n9. [ ] `temperature.php`\n10. [ ] `max-tokens.php`\n11. [ ] `contract.php`\n12. [ ] `structure.php`\n\n### Phase 3: Views migrieren\n13. [ ] `chat\/index.php` auf Partials umstellen\n14. [ ] `content\/new.php` auf Partials umstellen\n15. [ ] `content\/show.php` auf Partials umstellen\n\n### Phase 4: Controller anpassen\n16. [ ] Variablennamen vereinheitlichen\n17. [ ] Redundante Logik entfernen\n\n### Phase 5: Testing\n18. [ ] Chat funktioniert wie vorher\n19. [ ] Content Studio funktioniert wie vorher\n20. [ ] Visuelle Konsistenz prüfen",
"newString": "---\n\n## 7. Konsolidierte Migrations-Schritte\n\n### Phase 1: Datenbank-Schema (ki_dev)\n\n```sql\n-- 1.1 LLM-Modelle\nCREATE TABLE llm_models (...);\n\n-- 1.2 LLM-Presets\nCREATE TABLE llm_presets (...);\nINSERT INTO llm_presets (...) VALUES (...);\n\n-- 1.3 RAG-Collections\nCREATE TABLE rag_collections (...);\n\n-- 1.4 User-Präferenzen\nCREATE TABLE user_preferences (...);\nINSERT INTO user_preferences (user_id) VALUES (1);\n```\n\n| # | Task | Status |\n|---|------|--------|\n| 1.1 | Tabelle `llm_models` erstellen | [ ] |\n| 1.2 | Tabelle `llm_presets` erstellen + Initial-Daten | [ ] |\n| 1.3 | Tabelle `rag_collections` erstellen | [ ] |\n| 1.4 | Tabelle `user_preferences` erstellen + Initial-Eintrag | [ ] |\n\n### Phase 2: Repositories & Services\n\n| # | Task | Datei | Status |\n|---|------|-------|--------|\n| 2.1 | `LlmModelRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |\n| 2.2 | `LlmPresetRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |\n| 2.3 | `CollectionRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |\n| 2.4 | `UserPreferencesRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |\n| 2.5 | `UserPreferencesService` | `\/src\/Infrastructure\/` | [ ] |\n| 2.6 | `LlmSyncService` (Anthropic + Ollama) | `\/src\/Infrastructure\/AI\/` | [ ] |\n\n### Phase 3: Admin-Seiten\n\n| # | Task | URL | Status |\n|---|------|-----|--------|\n| 3.1 | Route `\/ressourcen\/llm` anlegen | Router.php | [ ] |\n| 3.2 | `RessourcenController::llmIndex()` | Controller | [ ] |\n| 3.3 | View `ressourcen\/llm\/index.php` (Tabs: Modelle, Presets) | View | [ ] |\n| 3.4 | Sync-Buttons (Anthropic, Ollama) | View + Controller | [ ] |\n| 3.5 | Route `\/ressourcen\/collections` anlegen | Router.php | [ ] |\n| 3.6 | `RessourcenController::collectionsIndex()` | Controller | [ ] |\n| 3.7 | View `ressourcen\/collections\/index.php` | View | [ ] |\n| 3.8 | Qdrant-Sync implementieren | QdrantService | [ ] |\n| 3.9 | Route `\/ressourcen\/profil` anlegen | Router.php | [ ] |\n| 3.10 | `RessourcenController::profilIndex()` | Controller | [ ] |\n| 3.11 | View `ressourcen\/profil\/index.php` | View | [ ] |\n\n### Phase 4: Partials-Verzeichnis & CSS\n\n| # | Task | Status |\n|---|------|--------|\n| 4.1 | Verzeichnis `\/src\/View\/partials\/form\/` erstellen | [ ] |\n| 4.2 | `\/public\/css\/llm-settings.css` erstellen | [ ] |\n| 4.3 | `\/public\/js\/llm-settings.js` erstellen | [ ] |\n| 4.4 | CSS\/JS in Layout einbinden | [ ] |\n\n### Phase 5: Partials erstellen\n\n| # | Partial | Quelle | Status |\n|---|---------|--------|--------|\n| 5.1 | `model-select.php` | `llm_models` | [ ] |\n| 5.2 | `collections-select.php` | `rag_collections` | [ ] |\n| 5.3 | `context-limit.php` | Hardcoded + UserPrefs | [ ] |\n| 5.4 | `temperature-tokens.php` | `llm_presets` + Model-Max | [ ] |\n| 5.5 | `author-profile.php` | `content_config` | [ ] |\n| 5.6 | `system-prompt.php` | `content_config` | [ ] |\n| 5.7 | `contract.php` | `content_config` | [ ] |\n| 5.8 | `structure.php` | `content_config` | [ ] |\n\n### Phase 6: Base Controller erweitern\n\n| # | Task | Status |\n|---|------|--------|\n| 6.1 | `Controller.php` um `$userPrefs` erweitern | [ ] |\n| 6.2 | Automatische Weitergabe an alle Views | [ ] |\n\n### Phase 7: API-Endpoints\n\n| # | Task | Route | Status |\n|---|------|-------|--------|\n| 7.1 | Modell-Info | `GET \/api\/v1\/llm\/{modelId}` | [ ] |\n\n### Phase 8: Initial-Sync & Datenmigration\n\n| # | Task | Status |\n|---|------|--------|\n| 8.1 | Anthropic-Modelle synchronisieren | [ ] |\n| 8.2 | Ollama-Modelle synchronisieren | [ ] |\n| 8.3 | Qdrant-Collections synchronisieren | [ ] |\n| 8.4 | `ModelConfig.php` durch Repository ersetzen | [ ] |\n\n### Phase 9: Chat-Integration\n\n| # | Task | Status |\n|---|------|--------|\n| 9.1 | `ChatController` auf Repositories umstellen | [ ] |\n| 9.2 | `ChatController::createSession()` mit UserPrefs | [ ] |\n| 9.3 | `chat\/index.php` auf Partials umstellen | [ ] |\n\n### Phase 10: Content-Studio-Integration\n\n| # | Task | Status |\n|---|------|--------|\n| 10.1 | `ContentController` auf Repositories umstellen | [ ] |\n| 10.2 | `ContentController::contentNew()` mit UserPrefs | [ ] |\n| 10.3 | `content\/new.php` auf Partials umstellen | [ ] |\n| 10.4 | `content\/show.php` auf Partials umstellen | [ ] |\n| 10.5 | `content\/edit.php` auf Partials umstellen | [ ] |\n\n### Phase 11: Python-Pipeline-Integration\n\n| # | Task | Status |\n|---|------|--------|\n| 11.1 | Pipeline auf DB-Query für Collections umstellen | [ ] |\n| 11.2 | Pipeline auf DB-Query für Modelle umstellen | [ ] |\n\n### Phase 12: Testing\n\n| # | Test | Status |\n|---|------|--------|\n| 12.1 | Admin: LLM-Verwaltung funktioniert | [ ] |\n| 12.2 | Admin: Collections-Verwaltung funktioniert | [ ] |\n| 12.3 | Admin: Profil-Seite speichert korrekt | [ ] |\n| 12.4 | Chat: Neue Session übernimmt Defaults | [ ] |\n| 12.5 | Chat: Bestehende Session behält Werte | [ ] |\n| 12.6 | Chat: Modell-Wechsel aktualisiert Token-Optionen | [ ] |\n| 12.7 | Chat: Preset-Buttons funktionieren | [ ] |\n| 12.8 | Content New: Formular mit allen Defaults | [ ] |\n| 12.9 | Content Show: Inline-Dropdowns funktionieren | [ ] |\n| 12.10 | Content: Generierung funktioniert | [ ] |\n| 12.11 | Visuelle Konsistenz Chat ↔ Content | [ ] |\n\n---\n\n## 7b. Alte Migrations-Schritte (Referenz)\n\n### Phase 1: Infrastruktur\n1. [ ] Verzeichnis `\/src\/View\/partials\/form\/` erstellen\n2. [ ] `CollectionConfig.php` erstellen (Label-Mapping)\n3. [ ] CSS-Klassen vereinheitlichen in `styles.css`\n\n### Phase 2: Partials erstellen\n4. [ ] `model-select.php` - mit Optgroup-Support\n5. [ ] `collections.php` - mit Varianten (multi\/single\/checkbox)\n6. [ ] `context-limit.php`\n7. [ ] `author-profile.php`\n8. [ ] `system-prompt.php`\n9. [ ] `temperature.php`\n10. [ ] `max-tokens.php`\n11. [ ] `contract.php`\n12. [ ] `structure.php`\n\n### Phase 3: Views migrieren\n13. [ ] `chat\/index.php` auf Partials umstellen\n14. [ ] `content\/new.php` auf Partials umstellen\n15. [ ] `content\/show.php` auf Partials umstellen\n\n### Phase 4: Controller anpassen\n16. [ ] Variablennamen vereinheitlichen\n17. [ ] Redundante Logik entfernen\n\n### Phase 5: Testing\n18. [ ] Chat funktioniert wie vorher\n19. [ ] Content Studio funktioniert wie vorher\n20. [ ] Visuelle Konsistenz prüfen",
"originalFile": "# Plan: Einheitliche Form-Komponenten (Chat & Content Studio)\n\n## Status: PLANUNG\n**Erstellt:** 2025-12-21\n**Ziel:** DRY, KISS, SRP - Shared Partials für alle wiederverwendbaren Form-Elemente\n\n---\n\n## 0. LLM-Verwaltung (Grundlage für Modell-Dropdown)\n\n### 0.1 Architektur-Entscheidung\n\n**Gewählt: Variante B - Dedizierte LLM-Verwaltung**\n\nStatt dynamischer API-Abfrage bei jedem Seitenaufruf:\n- Zentrale Admin-Seite `\/ressourcen\/llm`\n- Datenbank-Tabelle als Single Source of Truth\n- Sync-Buttons für Provider (Anthropic, Ollama, weitere)\n- Sprechende Namen und Zusatzmetadaten\n\n### 0.2 Datenbank-Tabelle `llm_models`\n\n```sql\nCREATE TABLE llm_models (\n id INT AUTO_INCREMENT PRIMARY KEY,\n provider ENUM('anthropic', 'ollama', 'openai', 'google', 'mistral', 'custom') NOT NULL,\n model_id VARCHAR(100) NOT NULL, -- API-ID: \"claude-opus-4-5-20251101\"\n display_name VARCHAR(100) NOT NULL, -- Anzeige: \"Claude Opus 4.5\"\n description TEXT, -- Kurzbeschreibung\n context_window INT, -- Max. Tokens Input: 200000\n max_output_tokens INT, -- Max. Tokens Output: 8192\n input_price_per_mtok DECIMAL(10,4), -- Preis Input $\/MTok\n output_price_per_mtok DECIMAL(10,4), -- Preis Output $\/MTok\n capabilities JSON, -- {\"vision\": true, \"function_calling\": true}\n is_local BOOLEAN DEFAULT FALSE, -- Lokal (Ollama) vs. Cloud\n is_active BOOLEAN DEFAULT TRUE, -- In Dropdowns anzeigen?\n sort_order INT DEFAULT 0, -- Reihenfolge in Dropdowns\n last_synced_at DATETIME, -- Letzte Synchronisation\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n UNIQUE KEY unique_provider_model (provider, model_id)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\n```\n\n### 0.3 Admin-Seite `\/ressourcen\/llm`\n\n**URL:** `\/ressourcen\/llm`\n**Controller:** `RessourcenController::llmIndex()`\n\n**Funktionen:**\n\n| Button | Aktion |\n|--------|--------|\n| \"Anthropic synchronisieren\" | `GET api.anthropic.com\/v1\/models` → DB aktualisieren |\n| \"Ollama synchronisieren\" | `ollama list` → DB aktualisieren |\n| \"Neuer Provider\" | Manuell weiteren Provider hinzufügen |\n\n**Tabellen-Ansicht:**\n\n| Provider | Model-ID | Display-Name | Context | Preis In\/Out | Lokal | Aktiv | Aktionen |\n|----------|----------|--------------|---------|--------------|-------|-------|----------|\n| Anthropic | claude-opus-4-5-20251101 | Claude Opus 4.5 | 200k | $15\/$75 | - | ✓ | Bearbeiten |\n| Ollama | mistral:latest | Mistral 7B | 32k | - | ✓ | ✓ | Bearbeiten |\n\n**Bearbeiten-Dialog:**\n- Display-Name ändern\n- Beschreibung hinzufügen\n- Context-Window \/ Max-Output korrigieren\n- Preise eintragen (für Kostenberechnung)\n- Aktivieren\/Deaktivieren\n- Sortierung ändern\n\n### 0.4 Sync-Logik\n\n**Anthropic Sync:**\n```php\n\/\/ GET https:\/\/api.anthropic.com\/v1\/models\n\/\/ Response: {\"data\": [{\"id\": \"claude-opus-4-5-20251101\", ...}]}\n\nforeach ($apiModels as $model) {\n \/\/ INSERT ... ON DUPLICATE KEY UPDATE\n \/\/ Neue Modelle: is_active = true, display_name = model_id (initial)\n \/\/ Existierende: last_synced_at aktualisieren\n \/\/ Fehlende: NICHT löschen, nur last_synced_at bleibt alt\n}\n```\n\n**Ollama Sync:**\n```php\n\/\/ $ ollama list\n\/\/ NAME ID SIZE MODIFIED\n\/\/ mistral:latest abc123... 4.1 GB 2 days ago\n\n$output = shell_exec('ollama list');\n\/\/ Parsen und in DB einfügen\n```\n\n### 0.5 Dropdown-Query\n\n```php\n\/\/ ModelService::getActiveModels()\npublic function getActiveModels(): array\n{\n return $this->db->query(\"\n SELECT model_id, display_name, provider, is_local, context_window\n FROM llm_models\n WHERE is_active = 1\n ORDER BY is_local ASC, sort_order ASC, display_name ASC\n \")->fetchAll();\n}\n```\n\n### 0.6 Partial nutzt DB-Daten\n\n```php\n\/\/ \/src\/View\/partials\/form\/model-select.php\n<?php\n$models = $models ?? [];\n$selected = $selected ?? '';\n$variant = $variant ?? 'default';\n$class = $variant === 'inline' ? 'form-select--inline' : 'form-select';\n?>\n<select name=\"model\" id=\"model\" class=\"<?= $class ?>\">\n <optgroup label=\"Cloud\">\n <?php foreach ($models as $m): ?>\n <?php if (!$m['is_local']): ?>\n <option value=\"<?= $m['model_id'] ?>\" <?= $selected === $m['model_id'] ? 'selected' : '' ?>>\n <?= htmlspecialchars($m['display_name']) ?>\n <\/option>\n <?php endif; ?>\n <?php endforeach; ?>\n <\/optgroup>\n <optgroup label=\"Lokal\">\n <?php foreach ($models as $m): ?>\n <?php if ($m['is_local']): ?>\n <option value=\"<?= $m['model_id'] ?>\" <?= $selected === $m['model_id'] ? 'selected' : '' ?>>\n <?= htmlspecialchars($m['display_name']) ?>\n <\/option>\n <?php endif; ?>\n <?php endforeach; ?>\n <\/optgroup>\n<\/select>\n```\n\n### 0.7 Migrations-Schritte (LLM-Verwaltung)\n\n1. [ ] Tabelle `llm_models` in `ki_dev` erstellen\n2. [ ] `LlmModelRepository` erstellen\n3. [ ] `LlmSyncService` erstellen (Anthropic + Ollama)\n4. [ ] Route `\/ressourcen\/llm` anlegen\n5. [ ] `RessourcenController::llmIndex()` implementieren\n6. [ ] View `\/ressourcen\/llm\/index.php` erstellen\n7. [ ] Sync-Buttons implementieren\n8. [ ] Bearbeiten-Funktionalität\n9. [ ] Initial-Sync durchführen (bestehende Modelle importieren)\n10. [ ] `ModelConfig.php` durch `LlmModelRepository` ersetzen\n11. [ ] Partial `model-select.php` erstellen\n12. [ ] Chat und Content auf Partial umstellen\n\n---\n\n## 0b. Collection-Verwaltung (Grundlage für Collection-Dropdown)\n\n### 0b.1 Architektur-Entscheidung\n\n**Gewählt: DB-Tabelle analog zu LLMs**\n\n- Zentrale Admin-Seite `\/ressourcen\/collections`\n- Datenbank-Tabelle als Single Source of Truth\n- Sync mit Qdrant (Metadaten abrufen)\n- Sprechende Namen und Beschreibungen\n- **Multi-Select** als einheitliche Darstellung\n\n### 0b.2 Datenbank-Tabelle `rag_collections`\n\n```sql\nCREATE TABLE rag_collections (\n id INT AUTO_INCREMENT PRIMARY KEY,\n collection_id VARCHAR(100) NOT NULL UNIQUE, -- Qdrant-Name: \"documents\"\n display_name VARCHAR(100) NOT NULL, -- Anzeige: \"Dokumente\"\n description TEXT, -- \"PDF-Dokumente aus Nextcloud\"\n\n -- Qdrant-Metadaten (via Sync)\n vector_size INT, -- 1024\n distance_metric VARCHAR(20), -- \"Cosine\"\n points_count INT DEFAULT 0, -- Anzahl Vektoren\n\n -- Konfiguration\n embedding_model VARCHAR(100), -- \"mxbai-embed-large\"\n chunk_size INT, -- 2000\n chunk_overlap INT, -- 200\n\n -- Verwaltung\n source_type ENUM('nextcloud', 'mail', 'manual', 'system') DEFAULT 'manual',\n source_path VARCHAR(500), -- \"\/var\/www\/nextcloud\/data\/...\"\n is_active BOOLEAN DEFAULT TRUE, -- In Dropdowns anzeigen?\n is_searchable BOOLEAN DEFAULT TRUE, -- Für RAG verfügbar?\n sort_order INT DEFAULT 0,\n\n -- Timestamps\n last_synced_at DATETIME,\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\n```\n\n### 0b.3 Impact-Analyse: Wer nutzt Collections?\n\n| System\/Seite | Aktueller Zugriff | Neuer Zugriff | Änderung |\n|--------------|-------------------|---------------|----------|\n| **Chat** | `$qdrantService->listCollections()` | `CollectionRepository::getActive()` | Query aus DB |\n| **Content Studio** | `$qdrantService->listCollections()` | `CollectionRepository::getActive()` | Query aus DB |\n| **Content Show** | `$qdrantService->listCollections()` | `CollectionRepository::getActive()` | Query aus DB |\n| **Pipeline (Python)** | `config.py QDRANT_COLLECTIONS` | DB-Query oder Config-Sync | Python liest DB |\n| **Semantic Explorer** | Direkt Qdrant | `CollectionRepository` + Qdrant | Metadaten aus DB |\n| **System Explorer** | - | Statistiken aus DB | Neu |\n| **API \/api\/v1\/search** | Qdrant direkt | Validierung gegen DB | Nur aktive Collections |\n| **Embedding-Service** | `config.py` | DB oder Sync | Konsistenz |\n\n### 0b.4 Admin-Seite `\/ressourcen\/collections`\n\n**URL:** `\/ressourcen\/collections`\n**Controller:** `RessourcenController::collectionsIndex()`\n\n**Funktionen:**\n\n| Button | Aktion |\n|--------|--------|\n| \"Qdrant synchronisieren\" | Collections + Metadaten von Qdrant abrufen |\n| \"Neue Collection\" | Manuell Collection registrieren |\n\n**Tabellen-Ansicht:**\n\n| Collection-ID | Display-Name | Vektoren | Größe | Quelle | Aktiv | Suchbar | Aktionen |\n|---------------|--------------|----------|-------|--------|-------|---------|----------|\n| documents | Dokumente | 1.247 | 1024d | Nextcloud | ✓ | ✓ | Bearbeiten |\n| dokumentation_chunks | Doku-Chunks | 892 | 1024d | System | ✓ | ✓ | Bearbeiten |\n| mail | E-Mails | 3.421 | 1024d | Mail | ✓ | ✓ | Bearbeiten |\n| entities | Entitäten | 156 | 1024d | System | ✓ | - | Bearbeiten |\n\n**Bearbeiten-Dialog:**\n- Display-Name ändern\n- Beschreibung hinzufügen\n- Quelle\/Pfad dokumentieren\n- Aktivieren\/Deaktivieren (Dropdown)\n- Suchbar ja\/nein (RAG-Verfügbarkeit)\n- Sortierung ändern\n\n### 0b.5 Sync-Logik\n\n**Qdrant Sync:**\n```php\n\/\/ QdrantService::getCollectionsInfo()\npublic function syncCollections(): array\n{\n $qdrantCollections = $this->client->getCollections();\n\n foreach ($qdrantCollections as $col) {\n $info = $this->client->getCollectionInfo($col['name']);\n\n \/\/ INSERT ... ON DUPLICATE KEY UPDATE\n $this->repository->upsert([\n 'collection_id' => $col['name'],\n 'display_name' => $col['name'], \/\/ Initial = ID\n 'vector_size' => $info['config']['params']['size'],\n 'distance_metric' => $info['config']['params']['distance'],\n 'points_count' => $info['points_count'],\n 'last_synced_at' => now(),\n ]);\n }\n}\n```\n\n### 0b.6 Repository-Interface\n\n```php\n\/\/ CollectionRepository.php\ninterface CollectionRepositoryInterfac... [TRUNCATED-51135e03986e4a45]",
"structuredPatch": [
{
"oldStart": 2012,
"oldLines": 8,
"newStart": 2012,
"newLines": 149,
"lines": [
" ",
" ---",
" ",
"-## 7. Migrations-Schritte",
"+## 7. Konsolidierte Migrations-Schritte",
" ",
"+### Phase 1: Datenbank-Schema (ki_dev)",
"+",
"+```sql",
"+-- 1.1 LLM-Modelle",
"+CREATE TABLE llm_models (...);",
"+",
"+-- 1.2 LLM-Presets",
"+CREATE TABLE llm_presets (...);",
"+INSERT INTO llm_presets (...) VALUES (...);",
"+",
"+-- 1.3 RAG-Collections",
"+CREATE TABLE rag_collections (...);",
"+",
"+-- 1.4 User-Präferenzen",
"+CREATE TABLE user_preferences (...);",
"+INSERT INTO user_preferences (user_id) VALUES (1);",
"+```",
"+",
"+| # | Task | Status |",
"+|---|------|--------|",
"+| 1.1 | Tabelle `llm_models` erstellen | [ ] |",
"+| 1.2 | Tabelle `llm_presets` erstellen + Initial-Daten | [ ] |",
"+| 1.3 | Tabelle `rag_collections` erstellen | [ ] |",
"+| 1.4 | Tabelle `user_preferences` erstellen + Initial-Eintrag | [ ] |",
"+",
"+### Phase 2: Repositories & Services",
"+",
"+| # | Task | Datei | Status |",
"+|---|------|-------|--------|",
"+| 2.1 | `LlmModelRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |",
"+| 2.2 | `LlmPresetRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |",
"+| 2.3 | `CollectionRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |",
"+| 2.4 | `UserPreferencesRepository` | `\/src\/Infrastructure\/Persistence\/` | [ ] |",
"+| 2.5 | `UserPreferencesService` | `\/src\/Infrastructure\/` | [ ] |",
"+| 2.6 | `LlmSyncService` (Anthropic + Ollama) | `\/src\/Infrastructure\/AI\/` | [ ] |",
"+",
"+### Phase 3: Admin-Seiten",
"+",
"+| # | Task | URL | Status |",
"+|---|------|-----|--------|",
"+| 3.1 | Route `\/ressourcen\/llm` anlegen | Router.php | [ ] |",
"+| 3.2 | `RessourcenController::llmIndex()` | Controller | [ ] |",
"+| 3.3 | View `ressourcen\/llm\/index.php` (Tabs: Modelle, Presets) | View | [ ] |",
"+| 3.4 | Sync-Buttons (Anthropic, Ollama) | View + Controller | [ ] |",
"+| 3.5 | Route `\/ressourcen\/collections` anlegen | Router.php | [ ] |",
"+| 3.6 | `RessourcenController::collectionsIndex()` | Controller | [ ] |",
"+| 3.7 | View `ressourcen\/collections\/index.php` | View | [ ] |",
"+| 3.8 | Qdrant-Sync implementieren | QdrantService | [ ] |",
"+| 3.9 | Route `\/ressourcen\/profil` anlegen | Router.php | [ ] |",
"+| 3.10 | `RessourcenController::profilIndex()` | Controller | [ ] |",
"+| 3.11 | View `ressourcen\/profil\/index.php` | View | [ ] |",
"+",
"+### Phase 4: Partials-Verzeichnis & CSS",
"+",
"+| # | Task | Status |",
"+|---|------|--------|",
"+| 4.1 | Verzeichnis `\/src\/View\/partials\/form\/` erstellen | [ ] |",
"+| 4.2 | `\/public\/css\/llm-settings.css` erstellen | [ ] |",
"+| 4.3 | `\/public\/js\/llm-settings.js` erstellen | [ ] |",
"+| 4.4 | CSS\/JS in Layout einbinden | [ ] |",
"+",
"+### Phase 5: Partials erstellen",
"+",
"+| # | Partial | Quelle | Status |",
"+|---|---------|--------|--------|",
"+| 5.1 | `model-select.php` | `llm_models` | [ ] |",
"+| 5.2 | `collections-select.php` | `rag_collections` | [ ] |",
"+| 5.3 | `context-limit.php` | Hardcoded + UserPrefs | [ ] |",
"+| 5.4 | `temperature-tokens.php` | `llm_presets` + Model-Max | [ ] |",
"+| 5.5 | `author-profile.php` | `content_config` | [ ] |",
"+| 5.6 | `system-prompt.php` | `content_config` | [ ] |",
"+| 5.7 | `contract.php` | `content_config` | [ ] |",
"+| 5.8 | `structure.php` | `content_config` | [ ] |",
"+",
"+### Phase 6: Base Controller erweitern",
"+",
"+| # | Task | Status |",
"+|---|------|--------|",
"+| 6.1 | `Controller.php` um `$userPrefs` erweitern | [ ] |",
"+| 6.2 | Automatische Weitergabe an alle Views | [ ] |",
"+",
"+### Phase 7: API-Endpoints",
"+",
"+| # | Task | Route | Status |",
"+|---|------|-------|--------|",
"+| 7.1 | Modell-Info | `GET \/api\/v1\/llm\/{modelId}` | [ ] |",
"+",
"+### Phase 8: Initial-Sync & Datenmigration",
"+",
"+| # | Task | Status |",
"+|---|------|--------|",
"+| 8.1 | Anthropic-Modelle synchronisieren | [ ] |",
"+| 8.2 | Ollama-Modelle synchronisieren | [ ] |",
"+| 8.3 | Qdrant-Collections synchronisieren | [ ] |",
"+| 8.4 | `ModelConfig.php` durch Repository ersetzen | [ ] |",
"+",
"+### Phase 9: Chat-Integration",
"+",
"+| # | Task | Status |",
"+|---|------|--------|",
"+| 9.1 | `ChatController` auf Repositories umstellen | [ ] |",
"+| 9.2 | `ChatController::createSession()` mit UserPrefs | [ ] |",
"+| 9.3 | `chat\/index.php` auf Partials umstellen | [ ] |",
"+",
"+### Phase 10: Content-Studio-Integration",
"+",
"+| # | Task | Status |",
"+|---|------|--------|",
"+| 10.1 | `ContentController` auf Repositories umstellen | [ ] |",
"+| 10.2 | `ContentController::contentNew()` mit UserPrefs | [ ] |",
"+| 10.3 | `content\/new.php` auf Partials umstellen | [ ] |",
"+| 10.4 | `content\/show.php` auf Partials umstellen | [ ] |",
"+| 10.5 | `content\/edit.php` auf Partials umstellen | [ ] |",
"+",
"+### Phase 11: Python-Pipeline-Integration",
"+",
"+| # | Task | Status |",
"+|---|------|--------|",
"+| 11.1 | Pipeline auf DB-Query für Collections umstellen | [ ] |",
"+| 11.2 | Pipeline auf DB-Query für Modelle umstellen | [ ] |",
"+",
"+### Phase 12: Testing",
"+",
"+| # | Test | Status |",
"+|---|------|--------|",
"+| 12.1 | Admin: LLM-Verwaltung funktioniert | [ ] |",
"+| 12.2 | Admin: Collections-Verwaltung funktioniert | [ ] |",
"+| 12.3 | Admin: Profil-Seite speichert korrekt | [ ] |",
"+| 12.4 | Chat: Neue Session übernimmt Defaults | [ ] |",
"+| 12.5 | Chat: Bestehende Session behält Werte | [ ] |",
"+| 12.6 | Chat: Modell-Wechsel aktualisiert Token-Optionen | [ ] |",
"+| 12.7 | Chat: Preset-Buttons funktionieren | [ ] |",
"+| 12.8 | Content New: Formular mit allen Defaults | [ ] |",
"+| 12.9 | Content Show: Inline-Dropdowns funktionieren | [ ] |",
"+| 12.10 | Content: Generierung funktioniert | [ ] |",
"+| 12.11 | Visuelle Konsistenz Chat ↔ Content | [ ] |",
"+",
"+---",
"+",
"+## 7b. Alte Migrations-Schritte (Referenz)",
"+",
" ### Phase 1: Infrastruktur",
" 1. [ ] Verzeichnis `\/src\/View\/partials\/form\/` erstellen",
" 2. [ ] `CollectionConfig.php` erstellen (Label-Mapping)"
]
}
],
"userModified": false,
"replaceAll": false
}
}