$session Session data from database * @param array> $messages Messages for this session */ public function __construct( private array $session, private array $messages = [], ) { } public function getId(): int { return (int) ($this->session['id'] ?? 0); } public function getUuid(): string { return $this->session['uuid'] ?? ''; } public function getTitle(): ?string { return $this->session['title'] ?? null; } public function getModel(): string { return $this->session['model'] ?? 'claude-opus-4-5-20251101'; } /** * @return array */ public function getCollections(): array { $collections = $this->session['collections'] ?? '["documents"]'; $decoded = json_decode($collections, true); return is_array($decoded) ? $decoded : ['documents']; } public function getContextLimit(): int { return (int) ($this->session['context_limit'] ?? 5); } public function getAuthorProfileId(): int { return (int) ($this->session['author_profile_id'] ?? 0); } public function getSystemPromptId(): int { return (int) ($this->session['system_prompt_id'] ?? 1); } public function getTemperature(): float { return (float) ($this->session['temperature'] ?? 0.7); } public function getMaxTokens(): int { return (int) ($this->session['max_tokens'] ?? 4096); } public function getSystemPrompt(): ?string { return $this->session['system_prompt'] ?? null; } /** * @return array> */ public function getMessages(): array { return $this->messages; } public function getMessageCount(): int { return count($this->messages); } /** * Get raw session array for backwards compatibility * * @return array */ public function toArray(): array { return $this->session; } /** * Check if session exists */ public function exists(): bool { return $this->getId() > 0; } }