{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/ManageChatSessionsUseCase.php",
"limit": 120
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/ManageChatSessionsUseCase.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Chat;\n\n\/\/ @responsibility: Verwaltet Chat-Sessions (CRUD, Einstellungen, Collections)\n\nuse Domain\\Entity\\ChatMessage;\nuse Domain\\Entity\\ChatSession;\nuse Domain\\Repository\\ChatMessageRepositoryInterface;\nuse Domain\\Repository\\ChatSessionRepositoryInterface;\nuse Domain\\Repository\\CollectionRepositoryInterface;\nuse Infrastructure\\AI\\ModelConfig;\nuse Infrastructure\\Persistence\\ContentConfigRepository;\nuse Infrastructure\\Validation\\CollectionValidator;\n\nfinal class ManageChatSessionsUseCase\n{\n private ?array $collectionsCache = null;\n\n public function __construct(\n private ChatSessionRepositoryInterface $sessionRepo,\n private ChatMessageRepositoryInterface $messageRepo,\n private ContentConfigRepository $configRepo,\n private CollectionRepositoryInterface $collectionRepo,\n private CollectionValidator $collectionValidator,\n private \\PDO $pdoDev\n ) {\n }\n\n public function createSession(): string\n {\n $uuid = $this->sessionRepo->generateUuid();\n $this->sessionRepo->create($uuid, 'claude-opus-4-5-20251101', '[\"documents\"]', 5);\n\n return $uuid;\n }\n\n public function getSession(string $uuid): ?ChatSession\n {\n return $this->sessionRepo->findByUuid($uuid);\n }\n\n \/**\n * Get all sessions as entities.\n *\n * @return array<int, ChatSession>\n *\/\n public function getAllSessions(int $limit = 50): array\n {\n return $this->sessionRepo->findAll($limit);\n }\n\n \/**\n * Get all sessions with stats as arrays (for list views).\n *\n * @return array<int, array<string, mixed>>\n *\/\n public function getAllSessionsWithStats(int $limit = 50): array\n {\n return $this->sessionRepo->findAllWithStats($limit);\n }\n\n \/**\n * Get messages for a session.\n *\n * @return array<int, ChatMessage>\n *\/\n public function getMessages(int $sessionId): array\n {\n return $this->messageRepo->findBySessionId($sessionId);\n }\n\n public function updateTitle(int $sessionId, string $title): string\n {\n $title = trim($title);\n\n if ($title === '') {\n $title = 'Neuer Chat';\n }\n\n $title = mb_substr($title, 0, 100);\n $this->sessionRepo->updateTitle($sessionId, $title);\n\n return $title;\n }\n\n public function updateSettings(\n int $sessionId,\n string $model,\n array $collections,\n int $contextLimit,\n int $authorProfileId,\n float $temperature,\n int $maxTokens\n ): void {\n $model = ModelConfig::validate($model);\n $collections = $this->validateCollections($collections);\n $contextLimit = $this->validateContextLimit($contextLimit);\n $authorProfileId = $this->validateAuthorProfileId($authorProfileId);\n $temperature = $this->validateTemperature($temperature);\n $maxTokens = $this->validateMaxTokens($maxTokens);\n\n $this->sessionRepo->updateSettings(\n $sessionId,\n $model,\n $collections,\n $contextLimit,\n $authorProfileId > 0 ? $authorProfileId : null,\n $temperature,\n $maxTokens\n );\n }\n\n public function updateSystemPrompt(int $sessionId, string $systemPrompt): ChatSessionResult\n {\n $maxLength = 2000;\n $wasTruncated = mb_strlen($systemPrompt) > $maxLength;\n $systemPrompt = trim(mb_substr($systemPrompt, 0, $maxLength));",
"numLines": 120,
"startLine": 1,
"totalLines": 280
}
}
}