{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/SemanticExplorerController.php",
"offset": 170,
"limit": 100
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/SemanticExplorerController.php",
"content": " ]);\n }\n\n \/**\n * Vektor-Suche in documents Collection\n *\/\n private function vectorSearch(string $query, int $limit): array\n {\n \/\/ Embedding generieren\n $embedding = $this->getEmbedding($query);\n if (empty($embedding)) {\n return [];\n }\n\n \/\/ Qdrant suchen\n $response = $this->qdrantSearch($embedding, $limit);\n if (empty($response)) {\n return [];\n }\n\n \/\/ Chunk-Details aus DB laden\n $results = [];\n foreach ($response as $point) {\n $chunkId = $point['payload']['chunk_id'] ?? null;\n if ($chunkId === null) {\n continue;\n }\n\n $chunk = $this->repository->getChunkById($chunkId);\n\n if ($chunk !== null) {\n $chunk['score'] = $point['score'];\n $chunk['heading_path_decoded'] = json_decode($chunk['heading_path'] ?? '[]', true) ?: [];\n $results[] = $chunk;\n }\n }\n\n return $results;\n }\n\n \/**\n * Embedding via Ollama\n *\/\n private function getEmbedding(string $text): array\n {\n $ch = curl_init('http:\/\/localhost:11434\/api\/embeddings');\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => ['Content-Type: application\/json'],\n CURLOPT_POSTFIELDS => json_encode([\n 'model' => 'mxbai-embed-large',\n 'prompt' => $text,\n ]),\n ]);\n\n $response = curl_exec($ch);\n curl_close($ch);\n\n $data = json_decode($response, true);\n\n return $data['embedding'] ?? [];\n }\n\n \/**\n * Qdrant-Suche\n *\/\n private function qdrantSearch(array $embedding, int $limit): array\n {\n $ch = curl_init('http:\/\/localhost:6333\/collections\/documents\/points\/search');\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => ['Content-Type: application\/json'],\n CURLOPT_POSTFIELDS => json_encode([\n 'vector' => $embedding,\n 'limit' => $limit,\n 'with_payload' => true,\n ]),\n ]);\n\n $response = curl_exec($ch);\n curl_close($ch);\n\n $data = json_decode($response, true);\n\n return $data['result'] ?? [];\n }\n\n \/**\n * GET \/semantic-explorer\/semantik\n * Semantische Analyse pro Chunk\n *\/\n public function semantik(): void\n {\n $sentiment = $_GET['sentiment'] ?? '';\n $page = max(1, (int) ($_GET['page'] ?? 1));\n $limit = 50;\n $offset = ($page - 1) * $limit;\n",
"numLines": 100,
"startLine": 170,
"totalLines": 292
}
}
}