37676-vm/generate_content.php
2026-01-21 16:50:02 +00:00

21 lines
735 B
PHP

<?php
require_once __DIR__ . '/ai/LocalAIApi.php';
$prompt = "You are the 'Bro' editor for 'Real Bro Blog'. Generate 3 'Bro Tips of the Week' and 1 'Bro Manifesto' intro for the homepage. Keep it casual, high-energy, and related to beer, parties, and lifestyle. Output in JSON format with keys 'tips' (array of strings) and 'manifesto' (string).";
$resp = LocalAIApi::createResponse(
[
'input' => [
['role' => 'system', 'content' => 'You are a bro-culture content creator.'],
['role' => 'user', 'content' => $prompt],
],
]
);
if (!empty($resp['success'])) {
$text = LocalAIApi::extractText($resp);
echo $text;
} else {
echo "AI Error: " . ($resp['error'] ?? 'unknown');
}