Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Classes/Domain/Repository/Llm/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@ protected function getPrompt(array $languageCodes): string
$prompt .= 'Required languages: ' . implode(', ', $languageCodes) . '. ';
$prompt .= 'Each language must have keys: ' . $this->getFieldKeys() . '. ';
$prompt .= 'Return ONLY a valid JSON object, no markdown, no code blocks, no explanation. ';
$prompt .= 'Format: {"en": {"title": "...", "description": "...", "alternativeText": "..."}, "de": {...}}';
$prompt .= 'Format: ' . $this->getFormat($languageCodes, array_keys($this->getFields()));
return $prompt;
}

protected function getFormat(array $languageCodes, array $fields): string
{
$format = [];
foreach ($languageCodes as $languageCode) {
foreach ($fields as $field) {
$format[$languageCode][$field] = '...';
}
}
return json_encode($format, JSON_UNESCAPED_UNICODE);
}

protected function getPromptPrefix(): string
{
$content = '';
Expand Down