Backup #1430

ID1430
Dateipfad/var/www/dev.campus.systemische-tools.de/src/Domain/Entity/ChatSession.php
Version18
Typ modified
Größe4.5 KB
Hashc7fd29e0cce59f333e8b1d8c88405ecebc1fdec786354edf4cd56f5ee87e5124
Datum2025-12-25 16:59:35
Geändert vonclaude-code-hook
GrundClaude Code Pre-Hook Backup vor Write-Operation
Datei existiert Ja

Dateiinhalt

<?php

declare(strict_types=1);

namespace Domain\Entity;

// @responsibility: Repräsentiert eine Chat-Session mit ihren Metadaten

use Domain\ValueObject\SessionMetadata;
use Domain\ValueObject\SessionUuid;

class ChatSession
{
    public function __construct(
        private readonly SessionUuid $uuid,
        private readonly SessionMetadata $metadata,
        private readonly ?int $id = null,
        private readonly ?string $sessionToken = null,
        private readonly ?int $userId = null,
        private readonly ?int $personaId = null,
        private readonly ?string $title = null,
        private readonly ?int $authorProfileId = null,
        private readonly ?int $systemPromptId = null,
        private readonly \DateTimeImmutable $createdAt = new \DateTimeImmutable(),
        private readonly \DateTimeImmutable $updatedAt = new \DateTimeImmutable(),
        private readonly \DateTimeImmutable $lastActivity = new \DateTimeImmutable()
    ) {
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getUuid(): string
    {
        return $this->uuid->value();
    }

    public function getUuidObject(): SessionUuid
    {
        return $this->uuid;
    }

    public function getSessionToken(): ?string
    {
        return $this->sessionToken;
    }

    public function getUserId(): ?int
    {
        return $this->userId;
    }

    public function getPersonaId(): ?int
    {
        return $this->personaId;
    }

    public function getTitle(): ?string
    {
        return $this->title;
    }

    public function getModel(): string
    {
        return $this->metadata->getModel();
    }

    /**
     * @return array<string>
     */
    public function getCollections(): array
    {
        return $this->metadata->getCollections();
    }

    public function getContextLimit(): int
    {
        return $this->metadata->getContextLimit();
    }

    public function getTemperature(): float
    {
        return $this->metadata->getTemperature();
    }

    public function getMaxTokens(): int
    {
        return $this->metadata->getMaxTokens();
    }

    public function getAuthorProfileId(): ?int
    {
        return $this->authorProfileId;
    }

    public function getSystemPromptId(): ?int
    {
        return $this->systemPromptId;
    }

    public function getCreatedAt(): \DateTimeImmutable
    {
        return $this->createdAt;
    }

    public function getUpdatedAt(): \DateTimeImmutable
    {
        return $this->updatedAt;
    }

    public function getLastActivity(): \DateTimeImmutable
    {
        return $this->lastActivity;
    }

    public function withId(int $id): self
    {
        return new self(
            uuid: $this->uuid,
            metadata: $this->metadata,
            id: $id,
            sessionToken: $this->sessionToken,
            userId: $this->userId,
            personaId: $this->personaId,
            title: $this->title,
            authorProfileId: $this->authorProfileId,
            systemPromptId: $this->systemPromptId,
            createdAt: $this->createdAt,
            updatedAt: $this->updatedAt,
            lastActivity: $this->lastActivity
        );
    }

    public function withTitle(string $title): self
    {
        return new self(
            uuid: $this->uuid,
            metadata: $this->metadata,
            id: $this->id,
            sessionToken: $this->sessionToken,
            userId: $this->userId,
            personaId: $this->personaId,
            title: $title,
            authorProfileId: $this->authorProfileId,
            systemPromptId: $this->systemPromptId,
            createdAt: $this->createdAt,
            updatedAt: new \DateTimeImmutable(),
            lastActivity: new \DateTimeImmutable()
        );
    }

    public function updateSettings(
        string $model,
        array $collections,
        int $contextLimit,
        ?int $authorProfileId,
        float $temperature,
        int $maxTokens
    ): self {
        $newMetadata = SessionMetadata::create($model, $collections, $contextLimit, $temperature, $maxTokens);
        return new self(
            uuid: $this->uuid,
            metadata: $newMetadata,
            id: $this->id,
            sessionToken: $this->sessionToken,
            userId: $this->userId,
            personaId: $this->personaId,
            title: $this->title,
            authorProfileId: $authorProfileId,
            systemPromptId: $this->systemPromptId,
            createdAt: $this->createdAt,
            updatedAt: new \DateTimeImmutable(),
            lastActivity: new \DateTimeImmutable()
        );
    }

}

Vollständig herunterladen

Aktionen

Herunterladen

Andere Versionen dieser Datei

ID Version Typ Größe Datum
1430 18 modified 4.5 KB 2025-12-25 16:59
1422 17 modified 5.6 KB 2025-12-25 16:59
1416 16 modified 5.7 KB 2025-12-25 16:59
1407 15 modified 7.9 KB 2025-12-25 16:58
1398 14 modified 9.8 KB 2025-12-25 16:58
1394 13 modified 9.9 KB 2025-12-25 16:58
1392 12 modified 10.0 KB 2025-12-25 16:57
1151 11 modified 10.0 KB 2025-12-25 09:53
1150 10 modified 9.9 KB 2025-12-25 09:53
1149 9 modified 9.8 KB 2025-12-25 09:53
1148 8 modified 9.8 KB 2025-12-25 09:53
1147 7 modified 10.0 KB 2025-12-25 09:53
1146 6 modified 10.0 KB 2025-12-25 09:53
1138 5 modified 9.8 KB 2025-12-25 09:43
1129 4 modified 9.8 KB 2025-12-25 09:40
1128 3 modified 9.8 KB 2025-12-25 09:40
1127 2 modified 9.8 KB 2025-12-25 09:40
1126 1 modified 9.1 KB 2025-12-25 09:40

← Zurück zur Übersicht