add system prompt and chunks index views and edit
This commit is contained in:
111
src/Entity/SystemPrompt.php
Normal file
111
src/Entity/SystemPrompt.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
// src/Entity/SystemPrompt.php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'system_prompt')]
|
||||
class SystemPrompt
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: 'uuid', unique: true)]
|
||||
private Uuid $id;
|
||||
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private int $version;
|
||||
|
||||
#[ORM\Column(type: 'text')]
|
||||
private string $content;
|
||||
|
||||
// 📝 Neuer Kommentar
|
||||
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
||||
private ?string $comment = null;
|
||||
|
||||
#[ORM\Column(type: 'boolean')]
|
||||
private bool $active = false;
|
||||
|
||||
#[ORM\Column(type: 'datetime_immutable')]
|
||||
private \DateTimeImmutable $createdAt;
|
||||
|
||||
// Optional für Governance / spätere Audit-Erweiterung
|
||||
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
|
||||
private ?\DateTimeImmutable $updatedAt = null;
|
||||
|
||||
public function __construct(
|
||||
int $version,
|
||||
string $content,
|
||||
?string $comment = null,
|
||||
bool $active = false
|
||||
) {
|
||||
$this->id = Uuid::v4();
|
||||
$this->version = $version;
|
||||
$this->content = $content;
|
||||
$this->comment = $comment;
|
||||
$this->active = $active;
|
||||
$this->createdAt = new \DateTimeImmutable();
|
||||
}
|
||||
|
||||
public function getId(): Uuid
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getVersion(): int
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
public function getContent(): string
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
public function getComment(): ?string
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): \DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
public function getUpdatedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
public function activate(): void
|
||||
{
|
||||
$this->active = true;
|
||||
$this->touch();
|
||||
}
|
||||
|
||||
public function deactivate(): void
|
||||
{
|
||||
$this->active = false;
|
||||
$this->touch();
|
||||
}
|
||||
|
||||
public function updateContent(string $content, ?string $comment = null): void
|
||||
{
|
||||
$this->content = $content;
|
||||
$this->comment = $comment;
|
||||
$this->touch();
|
||||
}
|
||||
|
||||
private function touch(): void
|
||||
{
|
||||
$this->updatedAt = new \DateTimeImmutable();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user