Protokoll #12862
| ID | 12862 |
|---|---|
| Zeitstempel | 2025-12-24 10:55:38.274371 |
| 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 | 2,399 (Input: 0, Output: 0) |
| Dauer | 84 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": "mcp__mcp-tasks__tasks_get",
"tool_input": {
"id": 298
}
}
Response
{
"tool_response": [
{
"type": "text",
"text": "{\n \"success\": true,\n \"task\": {\n \"id\": 298,\n \"uuid\": \"449ab513-f82c-486e-a7ee-7098221e9916\",\n \"title\": \"Query-Profile Konzept: Online-Abfrage für Chat\/Content Studio\",\n \"description\": \"# Auftrag\\n\\nEntwerfe und implementiere ein **Query-Profile System** für die Online-Abfrage (RAG Phase A0-A8), das unterschiedliche Abfragestrategien für Chat und Content Studio ermöglicht.\\n\\n## Kontext\\n\\n**Architektur-Grundlage:** RAG-Prozess-Dokument `docs_get(path=\\\"\/prozesse\/rag-prozess\\\")` (Doc-ID: 100)\\n\\n**Kernprinzip der Online-Pipeline:**\\n- Abfrage **erzeugt kein Wissen** - nur Kombination, Filterung, Formulierung\\n- Graph wird **nicht verändert**\\n- SQL bleibt **kanonisch**\\n- Vektor nur zur **Vorselektion**\\n\\n**Warum Query-Profile statt Pipeline?**\\n- Online = synchron, pro Request → kein Batch-Prozess\\n- Unterschiedliche Anwendungen brauchen unterschiedliche Strategien\\n- Profile sind konfigurierbar ohne Code-Änderung\\n\\n**Datenbank:** `ki_content` (Abfrage), `ki_dev` (Konfiguration)\\n\\n---\\n\\n## Online-Pipeline Phasen (A0-A8)\\n\\n```\\nA0: Query-Analyse → Anfrage verstehen, Intent erkennen\\nA1: Query-Embedding → Vektor für Ähnlichkeitssuche\\nA2: Vector-Search → Qdrant: Top-N Chunks nach Similarity\\nA3: SQL-Enrichment → Kanonische Daten aus SQL nachladen\\nA4: Context-Selection → Chunks filtern, sortieren, limitieren\\nA5: Prompt-Composition → System-Prompt + Context + User-Query\\nA6: LLM-Generation → Claude API \/ Ollama\\nA7: Source-Attribution → Quellennachweis hinzufügen\\nA8: Response-Return → Ausgabe an User\\n```\\n\\n---\\n\\n## Query-Profile Konzept\\n\\n### Neue Tabelle: `query_profiles` (ki_dev)\\n\\n```sql\\nCREATE TABLE query_profiles (\\n id INT AUTO_INCREMENT PRIMARY KEY,\\n name VARCHAR(100) UNIQUE NOT NULL,\\n description TEXT,\\n application ENUM('chat', 'content_studio', 'api', 'all') DEFAULT 'all',\\n is_default BOOLEAN DEFAULT FALSE,\\n \\n -- Phase A2: Vector Search\\n vector_collection VARCHAR(100) DEFAULT 'documents',\\n vector_top_k INT DEFAULT 20,\\n vector_min_score FLOAT DEFAULT 0.5,\\n \\n -- Phase A4: Context Selection\\n max_chunks INT DEFAULT 10,\\n max_tokens INT DEFAULT 4000,\\n scoring_weights JSON, -- {\\\"similarity\\\": 0.6, \\\"recency\\\": 0.2, \\\"authority\\\": 0.2}\\n \\n -- Phase A5: Prompt Composition\\n system_prompt_template TEXT,\\n include_metadata BOOLEAN DEFAULT TRUE,\\n include_sources BOOLEAN DEFAULT TRUE,\\n \\n -- Phase A6: LLM\\n llm_provider ENUM('claude', 'ollama') DEFAULT 'claude',\\n llm_model VARCHAR(100) DEFAULT 'claude-sonnet-4-20250514',\\n llm_temperature FLOAT DEFAULT 0.7,\\n llm_max_tokens INT DEFAULT 2000,\\n \\n -- Erweiterte Optionen\\n include_entities BOOLEAN DEFAULT FALSE,\\n include_relations BOOLEAN DEFAULT FALSE,\\n filter_by_taxonomy JSON, -- [\\\"Methoden\\\", \\\"Konzepte\\\"]\\n \\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP,\\n updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP\\n);\\n```\\n\\n### Vordefinierte Profile\\n\\n```sql\\n-- Profil 1: Chat (schnell, fokussiert)\\nINSERT INTO query_profiles (name, description, application, is_default,\\n vector_top_k, max_chunks, max_tokens, scoring_weights,\\n llm_provider, llm_model, llm_temperature)\\nVALUES (\\n 'Chat-Standard',\\n 'Schnelle, fokussierte Antworten für Chat-Interface',\\n 'chat',\\n TRUE,\\n 20,\\n 10,\\n 4000,\\n '{\\\"similarity\\\": 0.7, \\\"recency\\\": 0.2, \\\"authority\\\": 0.1}',\\n 'claude',\\n 'claude-sonnet-4-20250514',\\n 0.7\\n);\\n\\n-- Profil 2: Content Studio (umfassend, mit Entitäten)\\nINSERT INTO query_profiles (name, description, application, is_default,\\n vector_top_k, max_chunks, max_tokens, scoring_weights,\\n include_entities, include_relations,\\n llm_provider, llm_model, llm_temperature)\\nVALUES (\\n 'Content-Studio-Standard',\\n 'Umfassende Recherche mit Entitäten und Relationen',\\n 'content_studio',\\n TRUE,\\n 50,\\n 20,\\n 8000,\\n '{\\\"similarity\\\": 0.5, \\\"recency\\\": 0.1, \\\"authority\\\": 0.4}',\\n TRUE,\\n TRUE,\\n 'claude',\\n 'claude-sonnet-4-20250514',\\n 0.5\\n);\\n\\n-- Profil 3: API (minimal, schnell)\\nINSERT INTO query_profiles (name, description, application,\\n vector_top_k, max_chunks, max_tokens,\\n include_metadata, include_sources,\\n llm_provider, llm_model)\\nVALUES (\\n 'API-Minimal',\\n 'Minimaler Kontext für schnelle API-Antworten',\\n 'api',\\n 10,\\n 5,\\n 2000,\\n FALSE,\\n TRUE,\\n 'ollama',\\n 'mistral'\\n);\\n```\\n\\n---\\n\\n## Aufgaben\\n\\n### 1. Datenbank-Schema erstellen\\n\\n```bash\\n# Nutze MCP-DB\\ndb_execute(statement=\\\"CREATE TABLE query_profiles (...)\\\", database=\\\"ki_dev\\\")\\n```\\n\\n### 2. Profile-Repository implementieren\\n\\n**Datei:** `src\/Domain\/Repository\/QueryProfileRepositoryInterface.php`\\n\\n```php\\ninterface QueryProfileRepositoryInterface\\n{\\n public function findById(int $id): ?QueryProfile;\\n public function findByName(string $name): ?QueryProfile;\\n public function findDefaultForApplication(string $application): ?QueryProfile;\\n public function findAll(): array;\\n}\\n```\\n\\n**Datei:** `src\/Infrastructure\/Persistence\/QueryProfileRepository.php`\\n\\n### 3. Query-Service erweitern\\n\\n**Datei:** `src\/Infrastructure\/QueryService.php` (oder neu erstellen)\\n\\n```php\\nclass QueryService\\n{\\n public function executeQuery(string $query, QueryProfile $profile): QueryResult\\n {\\n \/\/ A0: Query analysieren\\n $intent = $this->analyzeQuery($query);\\n \\n \/\/ A1: Embedding erstellen\\n $embedding = $this->embedQuery($query);\\n \\n \/\/ A2: Vector Search\\n $candidates = $this->vectorSearch($embedding, $profile);\\n \\n \/\/ A3: SQL Enrichment\\n $enriched = $this->enrichFromSql($candidates);\\n \\n \/\/ A4: Context Selection\\n $context = $this->selectContext($enriched, $profile);\\n \\n \/\/ A5: Prompt Composition\\n $prompt = $this->composePrompt($query, $context, $profile);\\n \\n \/\/ A6: LLM Generation\\n $response = $this->generateResponse($prompt, $profile);\\n \\n \/\/ A7: Source Attribution\\n $attributed = $this->addSources($response, $context);\\n \\n \/\/ A8: Return\\n return new QueryResult($attributed, $context->getSources());\\n }\\n}\\n```\\n\\n### 4. Chat-Controller anpassen\\n\\n**Datei:** `src\/Controller\/ChatController.php`\\n\\n```php\\npublic function sendMessage(Request $request): Response\\n{\\n $profile = $this->queryProfileRepository->findDefaultForApplication('chat');\\n \/\/ ... Query mit Profil ausführen\\n}\\n```\\n\\n### 5. Content-Studio anpassen\\n\\n**Datei:** `src\/Controller\/ContentController.php`\\n\\n```php\\npublic function generate(Request $request): Response\\n{\\n $profile = $this->queryProfileRepository->findDefaultForApplication('content_studio');\\n \/\/ ... Query mit Profil ausführen\\n}\\n```\\n\\n### 6. Admin-UI für Profile (optional)\\n\\n**URL:** `\/config\/query-profiles`\\n- Liste aller Profile\\n- Erstellen\/Bearbeiten\/Löschen\\n- Default pro Application setzen\\n\\n---\\n\\n## Scoring-Algorithmus (Phase A4)\\n\\n```php\\nfunction calculateScore(Chunk $chunk, QueryProfile $profile, float $vectorScore): float\\n{\\n $weights = $profile->getScoringWeights();\\n \\n $similarity = $vectorScore * ($weights['similarity'] ?? 0.6);\\n \\n $recency = $this->calculateRecencyScore($chunk->getCreatedAt()) \\n * ($weights['recency'] ?? 0.2);\\n \\n $authority = $this->calculateAuthorityScore($chunk->getDocument())\\n * ($weights['authority'] ?? 0.2);\\n \\n return $similarity + $recency + $authority;\\n}\\n\\nfunction calculateRecencyScore(DateTime $date): float\\n{\\n $daysOld = (new DateTime())->diff($date)->days;\\n return max(0, 1 - ($daysOld \/ 365)); \/\/ Linear decay über 1 Jahr\\n}\\n\\nfunction calculateAuthorityScore(Document $doc): float\\n{\\n \/\/ Basierend auf Quelle, Typ, manuellem Ranking\\n return $doc->getAuthorityScore() ?? 0.5;\\n}\\n```\\n\\n---\\n\\n## Dokumentation\\n\\nNach Implementierung RAG-Prozess-Dokument erweitern:\\n\\n```bash\\ndocs_update(id=100, content=\\\"... + Query-Profile Sektion ...\\\")\\n```\\n\\nNeue Sektion:\\n```html\\n<section>\\n <h2>Query-Profile (Online-Abfrage)<\/h2>\\n <p>Die Online-Pipeline nutzt konfigurierbare Profile...<\/p>\\n <!-- Profil-Tabelle, Scoring-Erklärung, etc. -->\\n<\/section>\\n```\\n\\n---\\n\\n## Qualitätskriterien\\n\\n- [ ] Tabelle `query_profiles` in ki_dev erstellt\\n- [ ] 3 Standard-Profile angelegt (Chat, Content Studio, API)\\n- [ ] QueryProfileRepository implementiert\\n- [ ] QueryService nutzt Profile\\n- [ ] Chat verwendet Chat-Profil\\n- [ ] Content Studio verwendet Content-Studio-Profil\\n- [ ] Scoring-Algorithmus dokumentiert\\n- [ ] RAG-Prozess-Doku aktualisiert\",\n \"type\": \"ai_task\",\n \"status\": \"in_progress\",\n \"created_by\": \"mcp-tasks\",\n \"created_by_type\": \"ai\",\n \"parent_task_id\": null,\n \"due_date\": null,\n \"created_at\": \"2025-12-24T10:49:40.725500\",\n \"updated_at\": \"2025-12-24T10:52:00.968993\",\n \"completed_at\": null,\n \"metadata\": {}\n },\n \"assignments\": [],\n \"results\": []\n}"
}
]
}