{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/GetChatSessionUseCase.php",
"old_string": " public function getDefaultSystemPrompt(): string\n {",
"new_string": " public function getSystemPromptById(?int $id): string\n {\n if ($id === null) {\n return $this->getDefaultSystemPrompt();\n }\n $prompts = $this->getSystemPrompts();\n foreach ($prompts as $prompt) {\n if (($prompt['id'] ?? null) === $id) {\n return $prompt['content'] ?? $this->getDefaultSystemPrompt();\n }\n }\n\n return $this->getDefaultSystemPrompt();\n }\n\n public function getDefaultSystemPrompt(): string\n {"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/GetChatSessionUseCase.php",
"oldString": " public function getDefaultSystemPrompt(): string\n {",
"newString": " public function getSystemPromptById(?int $id): string\n {\n if ($id === null) {\n return $this->getDefaultSystemPrompt();\n }\n $prompts = $this->getSystemPrompts();\n foreach ($prompts as $prompt) {\n if (($prompt['id'] ?? null) === $id) {\n return $prompt['content'] ?? $this->getDefaultSystemPrompt();\n }\n }\n\n return $this->getDefaultSystemPrompt();\n }\n\n public function getDefaultSystemPrompt(): string\n {",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Chat;\n\n\/\/ @responsibility: Retrieves chat session data\n\nuse Domain\\Entity\\ChatMessage;\nuse Domain\\Entity\\ChatSession;\nuse Domain\\Repository\\ChatMessageRepositoryInterface;\nuse Domain\\Repository\\ChatSessionRepositoryInterface;\nuse Domain\\Repository\\CollectionRepositoryInterface;\nuse Domain\\Repository\\ContentConfigRepositoryInterface;\n\nfinal class GetChatSessionUseCase implements GetChatSessionUseCaseInterface\n{\n private ?array $collectionsCache = null;\n\n public function __construct(\n private ChatSessionRepositoryInterface $sessionRepo,\n private ChatMessageRepositoryInterface $messageRepo,\n private ContentConfigRepositoryInterface $configRepo,\n private CollectionRepositoryInterface $collectionRepo\n ) {\n }\n\n public function getSession(string $uuid): ?ChatSession\n {\n return $this->sessionRepo->findByUuid($uuid);\n }\n\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 * @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 * @return array<int, ChatMessage>\n *\/\n public function getMessages(int $sessionId): array\n {\n return $this->messageRepo->findBySessionId($sessionId);\n }\n\n public function getAuthorProfiles(): array\n {\n return $this->configRepo->getAuthorProfiles();\n }\n\n public function getSystemPrompts(): array\n {\n return $this->configRepo->getSystemPrompts();\n }\n\n public function getOutputStructures(): array\n {\n return $this->configRepo->getStructures();\n }\n\n public function getStructure(int $id): ?array\n {\n return $this->configRepo->getStructure($id);\n }\n\n public function getAvailableCollections(): array\n {\n if ($this->collectionsCache === null) {\n $this->collectionsCache = $this->collectionRepo->getSearchable();\n\n if ($this->collectionsCache === []) {\n $this->collectionsCache = [\n ['collection_id' => 'documents', 'display_name' => 'Dokumente', 'points_count' => 0, 'vector_size' => 1024],\n ];\n }\n }\n\n return $this->collectionsCache;\n }\n\n public function getDefaultSystemPrompt(): string\n {\n return <<<'PROMPT'\n Du bist ein hilfreicher Assistent für Fragen zu systemischem Teamcoaching und Teamentwicklung.\n\n Beantworte die Frage des Nutzers basierend auf dem bereitgestellten Kontext.\n - Antworte auf Deutsch\n - Sei präzise und hilfreich\n - Wenn der Kontext die Frage nicht beantwortet, sage das ehrlich\n - Verweise auf die Quellen wenn passend\n PROMPT;\n }\n}\n",
"structuredPatch": [
{
"oldStart": 89,
"oldLines": 6,
"newStart": 89,
"newLines": 21,
"lines": [
" return $this->collectionsCache;",
" }",
" ",
"+ public function getSystemPromptById(?int $id): string",
"+ {",
"+ if ($id === null) {",
"+ return $this->getDefaultSystemPrompt();",
"+ }",
"+ $prompts = $this->getSystemPrompts();",
"+ foreach ($prompts as $prompt) {",
"+ if (($prompt['id'] ?? null) === $id) {",
"+ return $prompt['content'] ?? $this->getDefaultSystemPrompt();",
"+ }",
"+ }",
"+",
"+ return $this->getDefaultSystemPrompt();",
"+ }",
"+",
" public function getDefaultSystemPrompt(): string",
" {",
" return <<<'PROMPT'"
]
}
],
"userModified": false,
"replaceAll": false
}
}