Protokoll #16448

ID16448
Zeitstempel2025-12-25 17:04:38.156906
Clientroot
IP145.224.72.140
Modellclaude-sonnet-4-20250514
Statuspending
Tokens5,560 (Input: 5,560, Output: 0)
Dauer-
Request-Zeit2025-12-25 17:04:38.156906
Response-Zeit-

Request

{
    "event": "PostToolUse",
    "tool_name": "TaskOutput",
    "tool_response": {
        "retrieval_status": "success",
        "task": {
            "task_id": "aa73184",
            "task_type": "local_agent",
            "status": "completed",
            "description": "Refactor ChunkAnalysisService split",
            "output": "[Tool: Read] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/ChunkAnalysisService.php\"}\n[Tool: mcp__mcp-code__code_class] {\"fqcn\":\"Infrastructure\\\\Docs\\\\ChunkAnalysisService\"}\n[Tool: mcp__mcp-code__code_dependents] {\"fqcn\":\"Infrastructure\\\\Docs\\\\ChunkAnalysisService\"}\n[Tool: Glob] {\"pattern\":\"src\/Infrastructure\/Docs\/*.php\"}\n[Tool: Bash] {\"command\":\"find \/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs -type f -name \\\"*.php\\\" | head -20\",\"description\":\"Find PHP files in Infrastructure\/Docs directory\"}\n[Tool: Bash] {\"command\":\"find \/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs -type f -name \\\"*.php\\\" | head -20\",\"description\":\"Find PHP files in Infrastructure\/Docs directory\"}\n[Tool: Read] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/Doc2VectorPipeline.php\"}\n[Tool: Read] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/services.php\",\"offset\":0,\"limit\":100}\n[Tool: Read] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/services.php\",\"offset\":0,\"limit\":100}\n[Tool: TodoWrite] {\"todos\":[{\"content\":\"Erstelle ChunkProcessorInterface mit Basis-Methoden\",\"activeForm\":\"Erstelle ChunkProcessorInterface\",\"status\":\"in_progress\"},{\"content\":\"Erstelle ChunkAnalyzer.php für LLM-Analyse (Taxonomie, Entities, Keywords)\",\"activeForm\":\"Erstelle ChunkAnalyzer.php\",\"status\":\"pending\"},{\"content\":\"Erstelle ChunkRepository.php für DB-Operationen (getChunk, updateStatus, etc.)\",\"activeForm\":\"Erstelle ChunkRepository.php\",\"status\":\"pending\"},{\"content\":\"Refaktoriere ChunkAnalysisService.php um neue Services zu nutzen\",\"activeForm\":\"Refaktoriere ChunkAnalysisService.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere Doc2VectorPipeline.php wenn nötig\",\"activeForm\":\"Aktualisiere Doc2VectorPipeline.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere services.php für neue Services\",\"activeForm\":\"Aktualisiere services.php\",\"status\":\"pending\"},{\"content\":\"Führe \/var\/www\/scripts\/php-check.sh aus\",\"activeForm\":\"Führe php-check.sh aus\",\"status\":\"pending\"}]}\n[Tool: TodoWrite] {\"todos\":[{\"content\":\"Erstelle ChunkProcessorInterface mit Basis-Methoden\",\"activeForm\":\"Erstelle ChunkProcessorInterface\",\"status\":\"in_progress\"},{\"content\":\"Erstelle ChunkAnalyzer.php für LLM-Analyse (Taxonomie, Entities, Keywords)\",\"activeForm\":\"Erstelle ChunkAnalyzer.php\",\"status\":\"pending\"},{\"content\":\"Erstelle ChunkRepository.php für DB-Operationen (getChunk, updateStatus, etc.)\",\"activeForm\":\"Erstelle ChunkRepository.php\",\"status\":\"pending\"},{\"content\":\"Refaktoriere ChunkAnalysisService.php um neue Services zu nutzen\",\"activeForm\":\"Refaktoriere ChunkAnalysisService.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere Doc2VectorPipeline.php wenn nötig\",\"activeForm\":\"Aktualisiere Doc2VectorPipeline.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere services.php für neue Services\",\"activeForm\":\"Aktualisiere services.php\",\"status\":\"pending\"},{\"content\":\"Führe \/var\/www\/scripts\/php-check.sh aus\",\"activeForm\":\"Führe php-check.sh aus\",\"status\":\"pending\"}]}\n[Tool: Write] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/ChunkProcessorInterface.php\",\"content\":\"<?php\\n\\ndeclare(strict_types=1);\\n\\nnamespace Infrastructure\\\\Docs;\\n\\n\/\/ @responsibility: Interface für Chunk-Verarbeitungsservices\\n\\ninterface ChunkProcessorInterface\\n{\\n    \/**\\n     * Processes a single chunk.\\n     *\\n     * @return array<string, mixed>\\n     *\/\\n    public function process(int $chunkId): array;\\n\\n    \/**\\n     * Processes multiple chunks in batch.\\n     *\\n     * @return array{processed: int, failed: int, errors: array<string>}\\n     *\/\\n    public function processBatch(int $limit): array;\\n\\n    \/**\\n     * Gets processing statistics.\\n     *\\n     * @return array<string, mixed>\\n     *\/\\n    public function getStats(): array;\\n}\\n\"}\n[Tool: TodoWrite] {\"todos\":[{\"content\":\"Erstelle ChunkProcessorInterface mit Basis-Methoden\",\"activeForm\":\"Erstelle ChunkProcessorInterface\",\"status\":\"completed\"},{\"content\":\"Erstelle ChunkAnalyzer.php für LLM-Analyse (Taxonomie, Entities, Keywords)\",\"activeForm\":\"Erstelle ChunkAnalyzer.php\",\"status\":\"in_progress\"},{\"content\":\"Erstelle ChunkRepository.php für DB-Operationen (getChunk, updateStatus, etc.)\",\"activeForm\":\"Erstelle ChunkRepository.php\",\"status\":\"pending\"},{\"content\":\"Refaktoriere ChunkAnalysisService.php um neue Services zu nutzen\",\"activeForm\":\"Refaktoriere ChunkAnalysisService.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere Doc2VectorPipeline.php wenn nötig\",\"activeForm\":\"Aktualisiere Doc2VectorPipeline.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere services.php für neue Services\",\"activeForm\":\"Aktualisiere services.php\",\"status\":\"pending\"},{\"content\":\"Führe \/var\/www\/scripts\/php-check.sh aus\",\"activeForm\":\"Führe php-check.sh aus\",\"status\":\"pending\"}]}\n[Tool: TodoWrite] {\"todos\":[{\"content\":\"Erstelle ChunkProcessorInterface mit Basis-Methoden\",\"activeForm\":\"Erstelle ChunkProcessorInterface\",\"status\":\"completed\"},{\"content\":\"Erstelle ChunkAnalyzer.php für LLM-Analyse (Taxonomie, Entities, Keywords)\",\"activeForm\":\"Erstelle ChunkAnalyzer.php\",\"status\":\"in_progress\"},{\"content\":\"Erstelle ChunkRepository.php für DB-Operationen (getChunk, updateStatus, etc.)\",\"activeForm\":\"Erstelle ChunkRepository.php\",\"status\":\"pending\"},{\"content\":\"Refaktoriere ChunkAnalysisService.php um neue Services zu nutzen\",\"activeForm\":\"Refaktoriere ChunkAnalysisService.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere Doc2VectorPipeline.php wenn nötig\",\"activeForm\":\"Aktualisiere Doc2VectorPipeline.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere services.php für neue Services\",\"activeForm\":\"Aktualisiere services.php\",\"status\":\"pending\"},{\"content\":\"Führe \/var\/www\/scripts\/php-check.sh aus\",\"activeForm\":\"Führe php-check.sh aus\",\"status\":\"pending\"}]}\n[Tool: Write] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/ChunkAnalyzer.php\",\"content\":\"<?php\\n\\ndeclare(strict_types=1);\\n\\nnamespace Infrastructure\\\\Docs;\\n\\n\/\/ @responsibility: Analysiert Chunks via LLM (Taxonomie, Entities, Keywords)\\n\\nuse Infrastructure\\\\AI\\\\OllamaService;\\nuse RuntimeException;\\n\\nfinal class ChunkAnalyzer\\n{\\n    private const string TAXONOMY_MODEL = 'gemma3:4b-it-qat';\\n    private const int MAX_RETRIES = 3;\\n\\n    public function __construct(\\n        private OllamaService $ollama\\n    ) {\\n    }\\n\\n    \/**\\n     * Performs LLM analysis on chunk content.\\n     *\\n     * @param array<string, mixed> $chunk\\n     * @param array{title: string, path: string} $docContext\\n     * @return array{taxonomy: array<string>, entities: array<array{name: string, type: string}>, keywords: array<string>}\\n     *\/\\n    public function analyze(array $chunk, array $docContext): array\\n    {\\n        $content = $chunk['content_clean'] ?? $chunk['content'];\\n        $headingPath = $this->decodeJsonArray($chunk['heading_path'] ?? null);\\n\\n        $context = sprintf(\\n            \\\"Dokument: %s\\\\nPfad: %s\\\\nAbschnitt: %s\\\\n\\\\nInhalt:\\\\n%s\\\",\\n            $docContext['title'],\\n            $docContext['path'],\\n            implode(' > ', $headingPath),\\n            $content\\n        );\\n\\n        $prompt = $this->buildAnalysisPrompt($context);\\n        $response = $this->callLlmWithRetry($prompt);\\n        $analysis = $this->parseAnalysisResponse($response);\\n\\n        \/\/ Fallback: If no taxonomy, derive from document path\\n        if (empty($analysis['taxonomy'])) {\\n            $analysis['taxonomy'] = $this->deriveTaxonomyFromPath($docContext['path']);\\n        }\\n\\n        return $analysis;\\n    }\\n\\n    \/**\\n     * Builds the analysis prompt.\\n     *\/\\n    private function buildAnalysisPrompt(string $context): string\\n    {\\n        return <<<PROMPT\\n            Analysiere den folgenden technischen Dokumentationsabschnitt und extrahiere strukturierte Informationen.\\n\\n            {$context}\\n\\n            Antworte NUR mit einem JSON-Objekt in diesem exakten Format (keine Erklärungen):\\n            {\\n              \\\"taxonomy\\\": [\\\"Hauptkategorie\\\", \\\"Unterkategorie\\\", \\\"Thema\\\"],\\n              \\\"entities\\\": [\\n                {\\\"name\\\": \\\"Entitätsname\\\", \\\"type\\\": \\\"TECHNOLOGY|CONCEPT|CONFIG|COMMAND|SERVICE\\\"}\\n              ],\\n              \\\"keywords\\\": [\\\"keyword1\\\", \\\"keyword2\\\", \\\"keyword3\\\"]\\n            }\\n\\n            Regeln:\\n            - taxonomy: Hierarchische Klassifikation (3 Ebenen: Bereich > Modul > Thema)\\n            - entities: Wichtige Technologien, Konzepte, Konfigurationen, Befehle, Dienste\\n            - keywords: 3-5 relevante Suchbegriffe\\n            - Antworte NUR mit dem JSON, keine anderen Texte\\n            PROMPT;\\n    }\\n\\n    \/**\\n     * Calls the LLM with retry logic.\\n     *\/\\n    private function callLlmWithRetry(string $prompt): string\\n    {\\n        $lastError = new RuntimeException('No attempts made');\\n\\n        for ($attempt = 1; $attempt <= self::MAX_RETRIES; $attempt++) {\\n            try {\\n                return $this->ollama->generate($prompt, self::TAXONOMY_MODEL);\\n            } catch (RuntimeException $e) {\\n                $lastError = $e;\\n                if ($attempt < self::MAX_RETRIES) {\\n                    usleep(500000 * $attempt); \/\/ Progressive backoff\\n                }\\n            }\\n        }\\n\\n        throw new RuntimeException(\\n            'LLM call failed after ' . self::MAX_RETRIES . ' attempts: ' . $lastError->getMessage()\\n        );\\n    }\\n\\n    \/**\\n     * Parses the LLM response into structured data.\\n     *\\n     * @return array{taxonomy: array<string>, entities: array<array{name: string, type: string}>, keywords: array<string>}\\n     *\/\\n    private function parseAnalysisResponse(string $response): array\\n    {\\n        $default = [\\n            'taxonomy' => [],\\n            'entities' => [],\\n            'keywords' => [],\\n        ];\\n\\n        \/\/ Extract JSON from response (handle markdown code blocks)\\n        $json = $response;\\n        if (preg_match('\/```(?:json)?\\\\s*... [TRUNCATED-ed3b44ce6eed6245]",
            "prompt": "Lese \/var\/www\/CLAUDE.md für Projektkontext.\n\n**Task #369: ChunkAnalysisService.php - Service aufteilen**\n\nArbeitsverzeichnis: \/var\/www\/dev.campus.systemische-tools.de\n\n1. Analysiere `src\/Infrastructure\/Docs\/ChunkAnalysisService.php` (401 LOC)\n2. Teile nach Verantwortung:\n   - `ChunkExtractor.php` - Text-Extraktion\n   - `ChunkEmbedder.php` - Embedding-Generierung\n   - `ChunkIndexer.php` - Qdrant-Indexierung\n3. Erstelle ChunkProcessorInterface\n4. Führe `\/var\/www\/scripts\/php-check.sh` aus\n\nMax 150 LOC pro Service. Single Responsibility pro Klasse.",
            "result": "[Tool: Read] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/ChunkAnalysisService.php\"}\n[Tool: mcp__mcp-code__code_class] {\"fqcn\":\"Infrastructure\\\\Docs\\\\ChunkAnalysisService\"}\n[Tool: mcp__mcp-code__code_dependents] {\"fqcn\":\"Infrastructure\\\\Docs\\\\ChunkAnalysisService\"}\n[Tool: Glob] {\"pattern\":\"src\/Infrastructure\/Docs\/*.php\"}\n[Tool: Bash] {\"command\":\"find \/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs -type f -name \\\"*.php\\\" | head -20\",\"description\":\"Find PHP files in Infrastructure\/Docs directory\"}\n[Tool: Bash] {\"command\":\"find \/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs -type f -name \\\"*.php\\\" | head -20\",\"description\":\"Find PHP files in Infrastructure\/Docs directory\"}\n[Tool: Read] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/Doc2VectorPipeline.php\"}\n[Tool: Read] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/services.php\",\"offset\":0,\"limit\":100}\n[Tool: Read] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/services.php\",\"offset\":0,\"limit\":100}\n[Tool: TodoWrite] {\"todos\":[{\"content\":\"Erstelle ChunkProcessorInterface mit Basis-Methoden\",\"activeForm\":\"Erstelle ChunkProcessorInterface\",\"status\":\"in_progress\"},{\"content\":\"Erstelle ChunkAnalyzer.php für LLM-Analyse (Taxonomie, Entities, Keywords)\",\"activeForm\":\"Erstelle ChunkAnalyzer.php\",\"status\":\"pending\"},{\"content\":\"Erstelle ChunkRepository.php für DB-Operationen (getChunk, updateStatus, etc.)\",\"activeForm\":\"Erstelle ChunkRepository.php\",\"status\":\"pending\"},{\"content\":\"Refaktoriere ChunkAnalysisService.php um neue Services zu nutzen\",\"activeForm\":\"Refaktoriere ChunkAnalysisService.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere Doc2VectorPipeline.php wenn nötig\",\"activeForm\":\"Aktualisiere Doc2VectorPipeline.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere services.php für neue Services\",\"activeForm\":\"Aktualisiere services.php\",\"status\":\"pending\"},{\"content\":\"Führe \/var\/www\/scripts\/php-check.sh aus\",\"activeForm\":\"Führe php-check.sh aus\",\"status\":\"pending\"}]}\n[Tool: TodoWrite] {\"todos\":[{\"content\":\"Erstelle ChunkProcessorInterface mit Basis-Methoden\",\"activeForm\":\"Erstelle ChunkProcessorInterface\",\"status\":\"in_progress\"},{\"content\":\"Erstelle ChunkAnalyzer.php für LLM-Analyse (Taxonomie, Entities, Keywords)\",\"activeForm\":\"Erstelle ChunkAnalyzer.php\",\"status\":\"pending\"},{\"content\":\"Erstelle ChunkRepository.php für DB-Operationen (getChunk, updateStatus, etc.)\",\"activeForm\":\"Erstelle ChunkRepository.php\",\"status\":\"pending\"},{\"content\":\"Refaktoriere ChunkAnalysisService.php um neue Services zu nutzen\",\"activeForm\":\"Refaktoriere ChunkAnalysisService.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere Doc2VectorPipeline.php wenn nötig\",\"activeForm\":\"Aktualisiere Doc2VectorPipeline.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere services.php für neue Services\",\"activeForm\":\"Aktualisiere services.php\",\"status\":\"pending\"},{\"content\":\"Führe \/var\/www\/scripts\/php-check.sh aus\",\"activeForm\":\"Führe php-check.sh aus\",\"status\":\"pending\"}]}\n[Tool: Write] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/ChunkProcessorInterface.php\",\"content\":\"<?php\\n\\ndeclare(strict_types=1);\\n\\nnamespace Infrastructure\\\\Docs;\\n\\n\/\/ @responsibility: Interface für Chunk-Verarbeitungsservices\\n\\ninterface ChunkProcessorInterface\\n{\\n    \/**\\n     * Processes a single chunk.\\n     *\\n     * @return array<string, mixed>\\n     *\/\\n    public function process(int $chunkId): array;\\n\\n    \/**\\n     * Processes multiple chunks in batch.\\n     *\\n     * @return array{processed: int, failed: int, errors: array<string>}\\n     *\/\\n    public function processBatch(int $limit): array;\\n\\n    \/**\\n     * Gets processing statistics.\\n     *\\n     * @return array<string, mixed>\\n     *\/\\n    public function getStats(): array;\\n}\\n\"}\n[Tool: TodoWrite] {\"todos\":[{\"content\":\"Erstelle ChunkProcessorInterface mit Basis-Methoden\",\"activeForm\":\"Erstelle ChunkProcessorInterface\",\"status\":\"completed\"},{\"content\":\"Erstelle ChunkAnalyzer.php für LLM-Analyse (Taxonomie, Entities, Keywords)\",\"activeForm\":\"Erstelle ChunkAnalyzer.php\",\"status\":\"in_progress\"},{\"content\":\"Erstelle ChunkRepository.php für DB-Operationen (getChunk, updateStatus, etc.)\",\"activeForm\":\"Erstelle ChunkRepository.php\",\"status\":\"pending\"},{\"content\":\"Refaktoriere ChunkAnalysisService.php um neue Services zu nutzen\",\"activeForm\":\"Refaktoriere ChunkAnalysisService.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere Doc2VectorPipeline.php wenn nötig\",\"activeForm\":\"Aktualisiere Doc2VectorPipeline.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere services.php für neue Services\",\"activeForm\":\"Aktualisiere services.php\",\"status\":\"pending\"},{\"content\":\"Führe \/var\/www\/scripts\/php-check.sh aus\",\"activeForm\":\"Führe php-check.sh aus\",\"status\":\"pending\"}]}\n[Tool: TodoWrite] {\"todos\":[{\"content\":\"Erstelle ChunkProcessorInterface mit Basis-Methoden\",\"activeForm\":\"Erstelle ChunkProcessorInterface\",\"status\":\"completed\"},{\"content\":\"Erstelle ChunkAnalyzer.php für LLM-Analyse (Taxonomie, Entities, Keywords)\",\"activeForm\":\"Erstelle ChunkAnalyzer.php\",\"status\":\"in_progress\"},{\"content\":\"Erstelle ChunkRepository.php für DB-Operationen (getChunk, updateStatus, etc.)\",\"activeForm\":\"Erstelle ChunkRepository.php\",\"status\":\"pending\"},{\"content\":\"Refaktoriere ChunkAnalysisService.php um neue Services zu nutzen\",\"activeForm\":\"Refaktoriere ChunkAnalysisService.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere Doc2VectorPipeline.php wenn nötig\",\"activeForm\":\"Aktualisiere Doc2VectorPipeline.php\",\"status\":\"pending\"},{\"content\":\"Aktualisiere services.php für neue Services\",\"activeForm\":\"Aktualisiere services.php\",\"status\":\"pending\"},{\"content\":\"Führe \/var\/www\/scripts\/php-check.sh aus\",\"activeForm\":\"Führe php-check.sh aus\",\"status\":\"pending\"}]}\n[Tool: Write] {\"file_path\":\"\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/ChunkAnalyzer.php\",\"content\":\"<?php\\n\\ndeclare(strict_types=1);\\n\\nnamespace Infrastructure\\\\Docs;\\n\\n\/\/ @responsibility: Analysiert Chunks via LLM (Taxonomie, Entities, Keywords)\\n\\nuse Infrastructure\\\\AI\\\\OllamaService;\\nuse RuntimeException;\\n\\nfinal class ChunkAnalyzer\\n{\\n    private const string TAXONOMY_MODEL = 'gemma3:4b-it-qat';\\n    private const int MAX_RETRIES = 3;\\n\\n    public function __construct(\\n        private OllamaService $ollama\\n    ) {\\n    }\\n\\n    \/**\\n     * Performs LLM analysis on chunk content.\\n     *\\n     * @param array<string, mixed> $chunk\\n     * @param array{title: string, path: string} $docContext\\n     * @return array{taxonomy: array<string>, entities: array<array{name: string, type: string}>, keywords: array<string>}\\n     *\/\\n    public function analyze(array $chunk, array $docContext): array\\n    {\\n        $content = $chunk['content_clean'] ?? $chunk['content'];\\n        $headingPath = $this->decodeJsonArray($chunk['heading_path'] ?? null);\\n\\n        $context = sprintf(\\n            \\\"Dokument: %s\\\\nPfad: %s\\\\nAbschnitt: %s\\\\n\\\\nInhalt:\\\\n%s\\\",\\n            $docContext['title'],\\n            $docContext['path'],\\n            implode(' > ', $headingPath),\\n            $content\\n        );\\n\\n        $prompt = $this->buildAnalysisPrompt($context);\\n        $response = $this->callLlmWithRetry($prompt);\\n        $analysis = $this->parseAnalysisResponse($response);\\n\\n        \/\/ Fallback: If no taxonomy, derive from document path\\n        if (empty($analysis['taxonomy'])) {\\n            $analysis['taxonomy'] = $this->deriveTaxonomyFromPath($docContext['path']);\\n        }\\n\\n        return $analysis;\\n    }\\n\\n    \/**\\n     * Builds the analysis prompt.\\n     *\/\\n    private function buildAnalysisPrompt(string $context): string\\n    {\\n        return <<<PROMPT\\n            Analysiere den folgenden technischen Dokumentationsabschnitt und extrahiere strukturierte Informationen.\\n\\n            {$context}\\n\\n            Antworte NUR mit einem JSON-Objekt in diesem exakten Format (keine Erklärungen):\\n            {\\n              \\\"taxonomy\\\": [\\\"Hauptkategorie\\\", \\\"Unterkategorie\\\", \\\"Thema\\\"],\\n              \\\"entities\\\": [\\n                {\\\"name\\\": \\\"Entitätsname\\\", \\\"type\\\": \\\"TECHNOLOGY|CONCEPT|CONFIG|COMMAND|SERVICE\\\"}\\n              ],\\n              \\\"keywords\\\": [\\\"keyword1\\\", \\\"keyword2\\\", \\\"keyword3\\\"]\\n            }\\n\\n            Regeln:\\n            - taxonomy: Hierarchische Klassifikation (3 Ebenen: Bereich > Modul > Thema)\\n            - entities: Wichtige Technologien, Konzepte, Konfigurationen, Befehle, Dienste\\n            - keywords: 3-5 relevante Suchbegriffe\\n            - Antworte NUR mit dem JSON, keine anderen Texte\\n            PROMPT;\\n    }\\n\\n    \/**\\n     * Calls the LLM with retry logic.\\n     *\/\\n    private function callLlmWithRetry(string $prompt): string\\n    {\\n        $lastError = new RuntimeException('No attempts made');\\n\\n        for ($attempt = 1; $attempt <= self::MAX_RETRIES; $attempt++) {\\n            try {\\n                return $this->ollama->generate($prompt, self::TAXONOMY_MODEL);\\n            } catch (RuntimeException $e) {\\n                $lastError = $e;\\n                if ($attempt < self::MAX_RETRIES) {\\n                    usleep(500000 * $attempt); \/\/ Progressive backoff\\n                }\\n            }\\n        }\\n\\n        throw new RuntimeException(\\n            'LLM call failed after ' . self::MAX_RETRIES . ' attempts: ' . $lastError->getMessage()\\n        );\\n    }\\n\\n    \/**\\n     * Parses the LLM response into structured data.\\n     *\\n     * @return array{taxonomy: array<string>, entities: array<array{name: string, type: string}>, keywords: array<string>}\\n     *\/\\n    private function parseAnalysisResponse(string $response): array\\n    {\\n        $default = [\\n            'taxonomy' => [],\\n            'entities' => [],\\n            'keywords' => [],\\n        ];\\n\\n        \/\/ Extract JSON from response (handle markdown code blocks)\\n        $json = $response;\\n        if (preg_match('\/```(?:json)?\\\\s*... [TRUNCATED-ed3b44ce6eed6245]"
        }
    }
}

Response

-
← Vorheriger Zur Liste Nächster →