{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/ChatController.php",
"limit": 80
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/ChatController.php",
"content": "<?php\n\nnamespace Controller;\n\nuse Framework\\Controller;\nuse Infrastructure\\AI\\ModelConfig;\nuse Infrastructure\\Formatting\\ChatMessageFormatter;\nuse UseCases\\Chat\\ExportChatSessionUseCase;\nuse UseCases\\Chat\\ManageChatSessionsUseCase;\nuse UseCases\\Chat\\SendChatMessageUseCase;\n\nclass ChatController extends Controller\n{\n private ManageChatSessionsUseCase $sessionsUseCase;\n private SendChatMessageUseCase $messageUseCase;\n private ChatMessageFormatter $formatter;\n private ExportChatSessionUseCase $exportUseCase;\n\n public function __construct(\n ManageChatSessionsUseCase $sessionsUseCase,\n SendChatMessageUseCase $messageUseCase,\n ChatMessageFormatter $formatter,\n ExportChatSessionUseCase $exportUseCase\n ) {\n $this->sessionsUseCase = $sessionsUseCase;\n $this->messageUseCase = $messageUseCase;\n $this->formatter = $formatter;\n $this->exportUseCase = $exportUseCase;\n }\n\n public function index(): void\n {\n $uuid = $this->sessionsUseCase->createSession();\n header('Location: \/chat\/' . $uuid);\n exit;\n }\n\n public function show(string $uuid): void\n {\n $session = $this->sessionsUseCase->getSession($uuid);\n\n if ($session === null) {\n header('Location: \/chat');\n exit;\n }\n\n $this->view('chat.index', [\n 'title' => $session['title'] ?? 'KI-Chat',\n 'session' => $session,\n 'messages' => $this->sessionsUseCase->getMessages($session['id']),\n 'sessions' => $this->sessionsUseCase->getAllSessions(),\n 'authorProfiles' => $this->sessionsUseCase->getAuthorProfiles(),\n 'systemPrompts' => $this->sessionsUseCase->getSystemPrompts(),\n 'outputStructures' => $this->sessionsUseCase->getOutputStructures(),\n 'collections' => $this->sessionsUseCase->getAvailableCollections(),\n 'models' => ModelConfig::getAll(),\n 'defaultModel' => ModelConfig::DEFAULT_MODEL,\n ]);\n }\n\n public function sessionList(): void\n {\n $this->view('chat.partials.session-list', [\n 'sessions' => $this->sessionsUseCase->getAllSessions(),\n 'currentUuid' => $this->getString('current') ?: null,\n ]);\n }\n\n public function message(string $uuid): void\n {\n $session = $this->sessionsUseCase->getSession($uuid);\n\n if ($session === null) {\n $this->view('chat.partials.error', ['error' => 'Session nicht gefunden.']);\n\n return;\n }\n\n $question = trim($_POST['message'] ?? '');\n $model = ModelConfig::validate($_POST['model'] ?? $session['model']);",
"numLines": 80,
"startLine": 1,
"totalLines": 218
}
}
}