fix(brainstorm): auto-queue and retry post-it generation with fallback starter cards

This commit is contained in:
2026-09-23 10:52:29 +02:00
parent 3dc09a11a7
commit a4824bb440
2 changed files with 33 additions and 10 deletions
+9 -4
View File
@@ -142,9 +142,14 @@ try {
// Fallback: reguliere generatie
$aiRes = fociz_ai_generate_ideas($session['title'], $session['theme'] ?? 'Algemeen', $count, $user['id'], $session['description'] ?? '');
if (!$aiRes['success']) {
echo json_encode(['error' => $aiRes['error']]);
exit;
$ideas = $aiRes['ideas'] ?? [];
if (empty($ideas)) {
$ideas = [
"Gebruikerservaring en flow optimaliseren voor " . $session['title'],
"Kernfunctionaliteit automatiseren om handmatig werk te reduceren",
"Koppelingen en integraties verkennen voor snellere afhandeling",
"Feedback- en validatielus inrichten met eindgebruikers",
];
}
$insertStmt = $db->prepare("
@@ -152,7 +157,7 @@ try {
VALUES (?, ?, 'Ideeën', 'amber', ?, 1)
");
foreach ($aiRes['ideas'] as $ideaText) {
foreach ($ideas as $ideaText) {
$ideaText = trim($ideaText);
if (!empty($ideaText)) {
$insertStmt->execute([$sessionId, $ideaText, $authorName]);