Backup #1416
| ID | 1416 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/Domain/Entity/ChatSession.php |
| Version | 16 |
| Typ |
modified |
| Größe | 5.7 KB |
| Hash | c41159c8dc164d4bb66f82920e8d3c86b36bdde1346d48b656876a47b047da9e |
| Datum | 2025-12-25 16:59:04 |
| Geändert von | claude-code-hook |
| Grund | Claude 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 SessionUuid $uuid,
private SessionMetadata $metadata,
private ?int $id = null,
private ?string $sessionToken = null,
private ?int $userId = null,
private ?int $personaId = null,
private ?string $title = null,
private ?int $authorProfileId = null,
private ?int $systemPromptId = null,
private ?\DateTimeImmutable $createdAt = null,
private ?\DateTimeImmutable $updatedAt = null,
private ?\DateTimeImmutable $lastActivity = null
) {
$this->createdAt ??= new \DateTimeImmutable();
$this->updatedAt ??= new \DateTimeImmutable();
$this->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: $model,
collections: $collections,
contextLimit: $contextLimit,
temperature: $temperature,
maxTokens: $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()
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'id' => $this->id,
'uuid' => $this->uuid->value(),
'session_token' => $this->sessionToken,
'user_id' => $this->userId,
'persona_id' => $this->personaId,
'title' => $this->title,
'model' => $this->metadata->getModel(),
'collections' => json_encode($this->metadata->getCollections()),
'context_limit' => $this->metadata->getContextLimit(),
'temperature' => $this->metadata->getTemperature(),
'max_tokens' => $this->metadata->getMaxTokens(),
'author_profile_id' => $this->authorProfileId,
'system_prompt_id' => $this->systemPromptId,
'created_at' => $this->createdAt->format('Y-m-d H:i:s'),
'updated_at' => $this->updatedAt->format('Y-m-d H:i:s'),
'last_activity' => $this->lastActivity->format('Y-m-d H:i:s'),
];
}
}
Vollständig herunterladen
Aktionen
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