Files
larablog/app/Domain/Ai/StubLlmProvider.php
gouki 3cec4c5e18
CI / PHPUnit (PHP 8.3) (push) Failing after 4s
CI / PHPUnit (PHP 8.2) (push) Failing after 1m9s
CI / Deploy (manual gate) (push) Skipped
wip: article AI polish, category SEO fields, cover generator, membership plan seeder
2026-09-07 18:48:37 +00:00

36 lines
977 B
PHP

<?php
declare(strict_types=1);
namespace App\Domain\Ai;
use App\Contracts\LlmProvider;
class StubLlmProvider implements LlmProvider
{
public function complete(string $prompt, array $context = []): array
{
$title = trim((string) ($context['title'] ?? 'Untitled'));
return [
'summary' => 'Stub summary for «'.$title.'».',
'description' => 'Stub SEO description for '.$title.'.',
'polished_content' => trim($prompt)."\n\n<!-- stub polished -->",
'suggestions' => [
'Review headings for clarity.',
'Add a concise meta description.',
],
];
}
public function moderate(string $content): array
{
$blocked = str_contains(strtolower($content), 'spam');
return [
'status' => $blocked ? 'rejected' : 'approved',
'reason' => $blocked ? 'Detected spam keyword in stub provider.' : null,
];
}
}