wip: article AI polish, category SEO fields, cover generator, membership plan seeder
This commit is contained in:
@@ -34,15 +34,27 @@ class OptimizeArticleContentJob implements ShouldQueue
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $llm->complete($article->content, [
|
||||
$result = $llm->complete((string) $article->content, [
|
||||
'title' => $article->title,
|
||||
'article_id' => $article->id,
|
||||
'content_format' => $article->content_format,
|
||||
]);
|
||||
|
||||
$article->forceFill([
|
||||
'ai_summary' => $result['summary'] ?? null,
|
||||
'ai_suggestions' => $result['suggestions'] ?? [],
|
||||
])->save();
|
||||
$updates = [
|
||||
'ai_summary' => filled($result['summary'] ?? null) ? (string) $result['summary'] : $article->ai_summary,
|
||||
'ai_suggestions' => array_values($result['suggestions'] ?? []),
|
||||
];
|
||||
|
||||
if (filled($result['polished_content'] ?? null)) {
|
||||
$updates['ai_polished_content'] = (string) $result['polished_content'];
|
||||
}
|
||||
|
||||
// Fill empty SEO description from the model when the author left it blank.
|
||||
if (blank($article->description) && filled($result['description'] ?? null)) {
|
||||
$updates['description'] = (string) $result['description'];
|
||||
}
|
||||
|
||||
$article->forceFill($updates)->save();
|
||||
} catch (\Throwable $exception) {
|
||||
Log::warning('Article content optimization failed.', [
|
||||
'article_id' => $this->articleId,
|
||||
|
||||
Reference in New Issue
Block a user