SuperSeller3000/migrations/Version20260519010000.php

85 lines
2.7 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260519010000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Seed default AI prompt templates';
}
public function up(Schema $schema): void
{
$now = (new \DateTimeImmutable())->format('Y-m-d H:i:s');
$prompts = [
'specs_research' => <<<'BODY'
List all known technical specifications for the {{articleType}}: "{{subject}}".
Include: processor, RAM, storage variants, display size and resolution, GPU, battery capacity,
ports, connectivity, weight, dimensions, OS, and any other relevant specs.
If you know this device, be specific and complete. If it is unknown, say so explicitly.
BODY,
'ebay_title' => <<<'BODY'
Create a concise eBay listing title (max 80 characters) for this {{typeName}}.
Device: {{deviceLabel}}
Use the most important specifications. Include condition if not "new".
Condition: {{condition}}
{{specsSection}}
Return ONLY the title text, no quotes, no explanation.
BODY,
'ebay_description' => <<<'BODY'
Create a professional eBay listing description in German for this {{typeName}}.
Device: {{deviceLabel}}
Include all available specifications in a clear, structured format.
Mention the condition: {{condition}}.
{{conditionNotes}}
{{specsSection}}
Use HTML formatting (ul, li, strong tags). Max 2000 characters.
BODY,
'vision_analyze' => <<<'BODY'
Look at this nameplate/label photo of IT hardware.
Extract the manufacturer (brand), model number/designation, and serial number visible on the label.
Do not guess or add information not on the label.
Respond in exactly this format (use empty string if not visible):
MANUFACTURER: <brand name, e.g. Dell, HP, Lenovo, Medion>
MODEL: <model number or designation>
SERIAL: <serial number>
BODY,
'json_coding' => <<<'BODY'
Convert the following hardware specifications to a JSON object.
The JSON must use these exact keys (UUIDs) and follow the indicated value formats:
{{schema}}
{{missingHint}}
Specifications text:
{{specsText}}
Return ONLY valid JSON. No explanation. No markdown. No extra text.
JSON:
BODY,
];
foreach ($prompts as $key => $body) {
$this->addSql(
'INSERT INTO app.prompt_templates (id, key, body, updated_at) VALUES (gen_random_uuid(), :key, :body, :now)',
['key' => $key, 'body' => $body, 'now' => $now],
);
}
}
public function down(Schema $schema): void
{
$this->addSql("DELETE FROM app.prompt_templates WHERE key IN ('specs_research', 'ebay_title', 'ebay_description', 'vision_analyze', 'json_coding')");
}
}