Update: 2026-07-05 17:53:37

This commit is contained in:
Hamza-Ayed
2026-07-05 17:53:37 +03:00
parent 7ae953f6e3
commit 2a5cd2cfbc
+7 -4
View File
@@ -365,12 +365,15 @@ class SiroGeminiService {
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
$data = json_decode($response, true);
$text = $data['candidates'][0]['content']['parts'][0]['text'] ?? '';
return trim(preg_replace('/```html|```/', '', $text));
if ($httpCode !== 200) {
echo "\n[GEMINI API ERROR] HTTP Code: $httpCode\n";
echo "Response: $response\n\n";
return null;
}
$data = json_decode($response, true);
$text = $data['candidates'][0]['content']['parts'][0]['text'] ?? '';
return trim(preg_replace('/```html|```/', '', $text));
return null;
}
}