{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/ChatSessionDTO.php",
"oldString": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Chat;\n\n\/\/ @responsibility: Datenübertragungsobjekt für Chat-Sessions\n\nfinal class ChatSessionDTO\n{\n \/**\n * @param array<string,mixed> $session Session data from database\n * @param array<int,array<string,mixed>> $messages Messages for this session\n *\/\n public function __construct(\n private array $session,\n private array $messages = [],\n ) {\n }\n\n public function getId(): int\n {\n return (int) ($this->session['id'] ?? 0);\n }\n\n public function getUuid(): string\n {\n return $this->session['uuid'] ?? '';\n }\n\n public function getTitle(): ?string\n {\n return $this->session['title'] ?? null;\n }\n\n public function getModel(): string\n {\n return $this->session['model'] ?? 'claude-opus-4-5-20251101';\n }\n\n \/**\n * @return array<string>\n *\/\n public function getCollections(): array\n {\n $collections = $this->session['collections'] ?? '[\"documents\"]';\n $decoded = json_decode($collections, true);\n\n return is_array($decoded) ? $decoded : ['documents'];\n }\n\n public function getContextLimit(): int\n {\n return (int) ($this->session['context_limit'] ?? 5);\n }\n\n public function getAuthorProfileId(): int\n {\n return (int) ($this->session['author_profile_id'] ?? 0);\n }\n\n public function getSystemPromptId(): int\n {\n return (int) ($this->session['system_prompt_id'] ?? 1);\n }\n\n public function getTemperature(): float\n {\n return (float) ($this->session['temperature'] ?? 0.7);\n }\n\n public function getMaxTokens(): int\n {\n return (int) ($this->session['max_tokens'] ?? 4096);\n }\n\n public function getSystemPrompt(): ?string\n {\n return $this->session['system_prompt'] ?? null;\n }\n\n \/**\n * @return array<int,array<string,mixed>>\n *\/\n public function getMessages(): array\n {\n return $this->messages;\n }\n\n public function getMessageCount(): int\n {\n return count($this->messages);\n }\n\n \/**\n * Get raw session array for backwards compatibility\n *\n * @return array<string,mixed>\n *\/\n public function toArray(): array\n {\n return $this->session;\n }\n\n \/**\n * Check if session exists\n *\/\n public function exists(): bool\n {\n return $this->getId() > 0;\n }\n}",
"newString": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Chat;\n\n\/\/ @responsibility: Datenübertragungsobjekt für Chat-Sessions\n\nuse Domain\\Entity\\ChatMessage;\nuse Domain\\Entity\\ChatSession;\n\nfinal class ChatSessionDTO\n{\n private ChatSession $session;\n \/** @var array<int, ChatMessage> *\/\n private array $messages;\n\n \/**\n * @param ChatSession $session Session entity\n * @param array<int, ChatMessage> $messages Messages for this session\n *\/\n public function __construct(\n ChatSession $session,\n array $messages = [],\n ) {\n $this->session = $session;\n $this->messages = $messages;\n }\n\n public function getSession(): ChatSession\n {\n return $this->session;\n }\n\n public function getId(): int\n {\n return $this->session->getId() ?? 0;\n }\n\n public function getUuid(): string\n {\n return $this->session->getUuid();\n }\n\n public function getTitle(): ?string\n {\n return $this->session->getTitle();\n }\n\n public function getModel(): string\n {\n return $this->session->getModel();\n }\n\n \/**\n * @return array<string>\n *\/\n public function getCollections(): array\n {\n return $this->session->getCollections();\n }\n\n public function getContextLimit(): int\n {\n return $this->session->getContextLimit();\n }\n\n public function getAuthorProfileId(): int\n {\n return $this->session->getAuthorProfileId() ?? 0;\n }\n\n public function getSystemPromptId(): int\n {\n return $this->session->getSystemPromptId() ?? 1;\n }\n\n public function getTemperature(): float\n {\n return $this->session->getTemperature();\n }\n\n public function getMaxTokens(): int\n {\n return $this->session->getMaxTokens();\n }\n\n \/**\n * @return array<int, ChatMessage>\n *\/\n public function getMessages(): array\n {\n return $this->messages;\n }\n\n \/**\n * Get messages as arrays for views.\n *\n * @return array<int, array<string, mixed>>\n *\/\n public function getMessagesAsArrays(): array\n {\n return array_map(fn (ChatMessage $m) => $m->toArray(), $this->messages);\n }\n\n public function getMessageCount(): int\n {\n return count($this->messages);\n }\n\n \/**\n * Get session as array for views.\n *\n * @return array<string, mixed>\n *\/\n public function toArray(): array\n {\n return $this->session->toArray();\n }\n\n \/**\n * Check if session exists\n *\/\n public function exists(): bool\n {\n return $this->getId() > 0;\n }\n}",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Chat;\n\n\/\/ @responsibility: Datenübertragungsobjekt für Chat-Sessions\n\nfinal class ChatSessionDTO\n{\n \/**\n * @param array<string,mixed> $session Session data from database\n * @param array<int,array<string,mixed>> $messages Messages for this session\n *\/\n public function __construct(\n private array $session,\n private array $messages = [],\n ) {\n }\n\n public function getId(): int\n {\n return (int) ($this->session['id'] ?? 0);\n }\n\n public function getUuid(): string\n {\n return $this->session['uuid'] ?? '';\n }\n\n public function getTitle(): ?string\n {\n return $this->session['title'] ?? null;\n }\n\n public function getModel(): string\n {\n return $this->session['model'] ?? 'claude-opus-4-5-20251101';\n }\n\n \/**\n * @return array<string>\n *\/\n public function getCollections(): array\n {\n $collections = $this->session['collections'] ?? '[\"documents\"]';\n $decoded = json_decode($collections, true);\n\n return is_array($decoded) ? $decoded : ['documents'];\n }\n\n public function getContextLimit(): int\n {\n return (int) ($this->session['context_limit'] ?? 5);\n }\n\n public function getAuthorProfileId(): int\n {\n return (int) ($this->session['author_profile_id'] ?? 0);\n }\n\n public function getSystemPromptId(): int\n {\n return (int) ($this->session['system_prompt_id'] ?? 1);\n }\n\n public function getTemperature(): float\n {\n return (float) ($this->session['temperature'] ?? 0.7);\n }\n\n public function getMaxTokens(): int\n {\n return (int) ($this->session['max_tokens'] ?? 4096);\n }\n\n public function getSystemPrompt(): ?string\n {\n return $this->session['system_prompt'] ?? null;\n }\n\n \/**\n * @return array<int,array<string,mixed>>\n *\/\n public function getMessages(): array\n {\n return $this->messages;\n }\n\n public function getMessageCount(): int\n {\n return count($this->messages);\n }\n\n \/**\n * Get raw session array for backwards compatibility\n *\n * @return array<string,mixed>\n *\/\n public function toArray(): array\n {\n return $this->session;\n }\n\n \/**\n * Check if session exists\n *\/\n public function exists(): bool\n {\n return $this->getId() > 0;\n }\n}\n",
"structuredPatch": [
{
"oldStart": 6,
"oldLines": 36,
"newStart": 6,
"newLines": 50,
"lines": [
" ",
" \/\/ @responsibility: Datenübertragungsobjekt für Chat-Sessions",
" ",
"+use Domain\\Entity\\ChatMessage;",
"+use Domain\\Entity\\ChatSession;",
"+",
" final class ChatSessionDTO",
" {",
"+ private ChatSession $session;",
"+ \/** @var array<int, ChatMessage> *\/",
"+ private array $messages;",
"+",
" \/**",
"- * @param array<string,mixed> $session Session data from database",
"- * @param array<int,array<string,mixed>> $messages Messages for this session",
"+ * @param ChatSession $session Session entity",
"+ * @param array<int, ChatMessage> $messages Messages for this session",
" *\/",
" public function __construct(",
"- private array $session,",
"- private array $messages = [],",
"+ ChatSession $session,",
"+ array $messages = [],",
" ) {",
"+ $this->session = $session;",
"+ $this->messages = $messages;",
" }",
" ",
"+ public function getSession(): ChatSession",
"+ {",
"+ return $this->session;",
"+ }",
"+",
" public function getId(): int",
" {",
"- return (int) ($this->session['id'] ?? 0);",
"+ return $this->session->getId() ?? 0;",
" }",
" ",
" public function getUuid(): string",
" {",
"- return $this->session['uuid'] ?? '';",
"+ return $this->session->getUuid();",
" }",
" ",
" public function getTitle(): ?string",
" {",
"- return $this->session['title'] ?? null;",
"+ return $this->session->getTitle();",
" }",
" ",
" public function getModel(): string",
" {",
"- return $this->session['model'] ?? 'claude-opus-4-5-20251101';",
"+ return $this->session->getModel();",
" }",
" ",
" \/**"
]
},
{
"oldStart": 43,
"oldLines": 48,
"newStart": 57,
"newLines": 50,
"lines": [
" *\/",
" public function getCollections(): array",
" {",
"- $collections = $this->session['collections'] ?? '[\"documents\"]';",
"- $decoded = json_decode($collections, true);",
"-",
"- return is_array($decoded) ? $decoded : ['documents'];",
"+ return $this->session->getCollections();",
" }",
" ",
" public function getContextLimit(): int",
" {",
"- return (int) ($this->session['context_limit'] ?? 5);",
"+ return $this->session->getContextLimit();",
" }",
" ",
" public function getAuthorProfileId(): int",
" {",
"- return (int) ($this->session['author_profile_id'] ?? 0);",
"+ return $this->session->getAuthorProfileId() ?? 0;",
" }",
" ",
" public function getSystemPromptId(): int",
" {",
"- return (int) ($this->session['system_prompt_id'] ?? 1);",
"+ return $this->session->getSystemPromptId() ?? 1;",
" }",
" ",
" public function getTemperature(): float",
" {",
"- return (float) ($this->session['temperature'] ?? 0.7);",
"+ return $this->session->getTemperature();",
" }",
" ",
" public function getMaxTokens(): int",
" {",
"- return (int) ($this->session['max_tokens'] ?? 4096);",
"+ return $this->session->getMaxTokens();",
" }",
" ",
"- public function getSystemPrompt(): ?string",
"+ \/**",
"+ * @return array<int, ChatMessage>",
"+ *\/",
"+ public function getMessages(): array",
" {",
"- return $this->session['system_prompt'] ?? null;",
"+ return $this->messages;",
" }",
" ",
" \/**",
"- * @return array<int,array<string,mixed>>",
"+ * Get messages as arrays for views.",
"+ *",
"+ * @return array<int, array<string, mixed>>",
" *\/",
"- public function getMessages(): array",
"+ public function getMessagesAsArrays(): array",
" {",
"- return $this->messages;",
"+ return array_map(fn (ChatMessage $m) => $m->toArray(), $this->messages);",
" }",
" ",
" public function getMessageCount(): int"
]
},
{
"oldStart": 93,
"oldLines": 13,
"newStart": 109,
"newLines": 13,
"lines": [
" }",
" ",
" \/**",
"- * Get raw session array for backwards compatibility",
"+ * Get session as array for views.",
" *",
"- * @return array<string,mixed>",
"+ * @return array<string, mixed>",
" *\/",
" public function toArray(): array",
" {",
"- return $this->session;",
"+ return $this->session->toArray();",
" }",
" ",
" \/**"
]
}
],
"userModified": false,
"replaceAll": false
}
}