All agent prompts are now stored in app.prompt_templates (migration 20260519000000)
and editable by admins via the new AI Prompts CRUD page. If no DB entry exists
for a key the hardcoded default is used automatically as fallback.
PromptTemplateService renders templates with {{variable}} substitution.
All four agents (SpecsResearch, JsonCoding, EbayText, OllamaVision) use the service.
SpecsResearchAgent now receives the articleType name (e.g. "Laptop") so the
specs prompt is scoped to the correct device category instead of being generic.
SpecsResearchHandler loads the ArticleType from the repository for this purpose.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
65 lines
1.3 KiB
PHP
65 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Domain\AI;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Uid\Uuid;
|
|
|
|
#[ORM\Entity]
|
|
#[ORM\Table(name: 'prompt_templates', schema: 'app')]
|
|
class PromptTemplate
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\Column(type: 'uuid')]
|
|
private Uuid $id;
|
|
|
|
#[ORM\Column(type: 'string', length: 100, unique: true)]
|
|
private string $key;
|
|
|
|
#[ORM\Column(type: 'text')]
|
|
private string $body;
|
|
|
|
#[ORM\Column(type: 'datetime_immutable')]
|
|
private \DateTimeImmutable $updatedAt;
|
|
|
|
public function __construct(string $key, string $body)
|
|
{
|
|
$this->id = Uuid::v7();
|
|
$this->key = $key;
|
|
$this->body = $body;
|
|
$this->updatedAt = new \DateTimeImmutable();
|
|
}
|
|
|
|
public function getId(): Uuid
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getKey(): string
|
|
{
|
|
return $this->key;
|
|
}
|
|
|
|
public function getBody(): string
|
|
{
|
|
return $this->body;
|
|
}
|
|
|
|
public function getUpdatedAt(): \DateTimeImmutable
|
|
{
|
|
return $this->updatedAt;
|
|
}
|
|
|
|
public function setKey(string $key): void
|
|
{
|
|
$this->key = $key;
|
|
}
|
|
|
|
public function setBody(string $body): void
|
|
{
|
|
$this->body = $body;
|
|
$this->updatedAt = new \DateTimeImmutable();
|
|
}
|
|
}
|