Update: 2026-06-27 04:23:48
This commit is contained in:
@@ -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);
|
$aiData = json_decode($response, true);
|
||||||
$textRaw = $aiData['candidates'][0]['content']['parts'][0]['text'] ?? '';
|
$textRaw = $aiData['candidates'][0]['content']['parts'][0]['text'] ?? '';
|
||||||
$textRaw = trim(preg_replace('/```json|```/', '', $textRaw));
|
$textRaw = trim(preg_replace('/```json|```/', '', $textRaw));
|
||||||
$aiRawText = $textRaw; // حفظ الـ JSON الخام من Gemini
|
|
||||||
$json = json_decode($textRaw, true);
|
$json = json_decode($textRaw, true);
|
||||||
|
$aiRawText = ($json !== null && $json !== false) ? $textRaw : null; // فقط إذا كان JSON صحيح
|
||||||
|
|
||||||
if ($json && isset($json['status']) && strtolower($json['status']) === 'failure') {
|
if ($json && isset($json['status']) && strtolower($json['status']) === 'failure') {
|
||||||
jsonError("AI Verification Failed: " . ($json['reason'] ?? 'Unknown reason'));
|
jsonError("AI Verification Failed: " . ($json['reason'] ?? 'Unknown reason'));
|
||||||
|
|||||||
Reference in New Issue
Block a user