{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/SendChatMessageUseCase.php",
"offset": 55,
"limit": 50
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/SendChatMessageUseCase.php",
"content": " \/\/ 1. Validate session\n $session = $this->sessionRepo->findByUuid($sessionUuid);\n if ($session === null) {\n return ChatResponse::error('Session nicht gefunden.');\n }\n\n $sessionId = $session->getId() ?? 0;\n\n \/\/ 2. Validate message\n $message = trim($message);\n if ($message === '') {\n return ChatResponse::error('Bitte gib eine Frage ein.');\n }\n\n \/\/ 3. Save user message\n $this->messageRepo->save(\n sessionId: $sessionId,\n role: 'user',\n content: $message,\n model: $model\n );\n\n \/\/ 4. Auto-set title from first message\n if ($session->getTitle() === null) {\n $title = mb_substr($message, 0, 50) . (mb_strlen($message) > 50 ? '...' : '');\n $this->sessionRepo->updateTitle($sessionId, $title);\n }\n\n \/\/ 5. Get style prompt from author profile\n $stylePrompt = $this->getStylePromptFromProfile($authorProfileId);\n\n \/\/ 6. Get system prompt\n $systemPrompt = $this->getSystemPromptById($systemPromptId);\n\n \/\/ 6b. Add structure formatting if selected\n $structurePrompt = $this->getStructurePrompt($structureId);\n if ($structurePrompt !== null) {\n $systemPrompt = ($systemPrompt ?? '') . \"\\n\\n\" . $structurePrompt;\n }\n\n \/\/ 7. Track timing and get AI response\n $startTime = microtime(true);\n\n try {\n $result = $this->chatService->chat(\n question: $message,\n model: $model,\n collections: $collections,\n limit: $contextLimit,\n stylePrompt: $stylePrompt,",
"numLines": 50,
"startLine": 55,
"totalLines": 361
}
}
}