Update: 2026-06-27 04:23:48

This commit is contained in:
Hamza-Ayed
2026-06-27 04:23:49 +03:00
parent 8993aa0a6b
commit a6738079a2

View File

@@ -276,8 +276,8 @@ Therefore, do NOT assume a specific field is on the front or the back of a card.
$aiData = json_decode($response, true);
$textRaw = $aiData['candidates'][0]['content']['parts'][0]['text'] ?? '';
$textRaw = trim(preg_replace('/```json|```/', '', $textRaw));
$aiRawText = $textRaw; // حفظ الـ JSON الخام من Gemini
$json = json_decode($textRaw, true);
$aiRawText = ($json !== null && $json !== false) ? $textRaw : null; // فقط إذا كان JSON صحيح
if ($json && isset($json['status']) && strtolower($json['status']) === 'failure') {
jsonError("AI Verification Failed: " . ($json['reason'] ?? 'Unknown reason'));