{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/ChatService.php",
"offset": 225,
"limit": 50
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/ChatService.php",
"content": " * @param array<int, array{id: int|string, score: float, payload: array<string, mixed>}> $searchResults Vector search results\n * @param int $maxTokens Maximum tokens to include (default: 3000)\n *\n * @return string The built context string\n *\/\n private function buildContext(array $searchResults, int $maxTokens = 3000): string\n {\n $contextParts = [];\n $totalChars = 0;\n $maxChars = $maxTokens * 4; \/\/ Approximate: 1 token ~ 4 characters\n\n foreach ($searchResults as $index => $result) {\n $payload = $result['payload'];\n $content = (string) ($payload['content'] ?? '');\n $docTitle = (string) ($payload['document_title'] ?? 'Unbekannt');\n\n \/\/ Check if adding this chunk would exceed the limit\n if ($totalChars + strlen($content) > $maxChars) {\n break;\n }\n\n $contextParts[] = sprintf('[Quelle %d: %s]%s%s', $index + 1, $docTitle, \"\\n\", $content);\n $totalChars += strlen($content);\n }\n\n return implode(\"\\n\\n---\\n\\n\", $contextParts);\n }\n\n \/**\n * Searches across multiple Qdrant collections and merges results.\n *\n * Queries each collection with the same embedding vector, then merges\n * and sorts results by score. Returns the top N results across all collections.\n *\n * @param array<int, float> $embedding The query embedding vector\n * @param array<string> $collections Collections to search\n * @param int $limit Maximum total results to return\n *\n * @return array<int, array{id: int|string, score: float, payload: array<string, mixed>}> Merged search results\n *\/\n private function searchMultipleCollections(array $embedding, array $collections, int $limit): array\n {\n $allResults = [];\n\n foreach ($collections as $collection) {\n try {\n $results = $this->qdrant->search($embedding, $collection, $limit);\n\n \/\/ Add collection name to each result's payload for reference\n foreach ($results as &$result) {",
"numLines": 50,
"startLine": 225,
"totalLines": 356
}
}
}