Update: 2026-05-07 02:01:59
This commit is contained in:
@@ -30,7 +30,7 @@ class AI
|
||||
"contents" => [
|
||||
[
|
||||
"parts" => [
|
||||
["text" => $prompt],
|
||||
["text" => $prompt . " If the image is not an invoice, is blank, or is completely unreadable, return ONLY: {\"error\": \"invalid_invoice\"}. DO NOT guess or invent data."],
|
||||
[
|
||||
"inline_data" => [
|
||||
"mime_type" => $mimeType,
|
||||
@@ -65,6 +65,11 @@ class AI
|
||||
|
||||
if (!$textResponse) return null;
|
||||
|
||||
return json_decode($textResponse, true);
|
||||
$data = json_decode($textResponse, true);
|
||||
if (isset($data['error']) && $data['error'] === 'invalid_invoice') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user