fix: corregir pipeline de validación de pagos

- GeminiVisionService: eliminar thinkingConfig (rompe modelos flash),
  reducir maxOutputTokens 8192→512, timeout 20→40s, default gemini-2.0-flash
- PublicChat: detectar correctamente errores de Gemini (__error/__parse_error)
  que antes pasaban el guard if(!$datosPago) por ser arrays truthy
- PagoValidadorService: tolerancia de hora 0→3 min, remitente >=2→>=1 palabra
- CorreoImapService: break→continue en correos fuera de ventana (IMAP no
  garantiza orden cronológico), fetchSize *4→*2 para evitar timeout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro
2026-07-31 05:00:23 +00:00
co-authored by Claude Sonnet 4.6
parent fc17e57624
commit d88f67ab5b
4 changed files with 13 additions and 11 deletions
+3 -4
View File
@@ -15,7 +15,7 @@ class GeminiVisionService
public function __construct()
{
$this->apiKey = ChatConfig::get('gemini_api_key', '');
$this->model = ChatConfig::get('gemini_model', 'gemini-3.5-flash');
$this->model = ChatConfig::get('gemini_model', 'gemini-2.0-flash');
}
public function extraerPago(string $base64, string $mimeType, ?int $usuarioId = null, string $canal = 'telegram'): ?array
@@ -36,8 +36,7 @@ class GeminiVisionService
'contents' => $contents,
'generationConfig' => [
'temperature' => 0.1,
'maxOutputTokens' => 8192,
'thinkingConfig' => ['thinkingBudget' => 0],
'maxOutputTokens' => 512,
],
];
@@ -49,7 +48,7 @@ class GeminiVisionService
$url = "https://generativelanguage.googleapis.com/{$ver}/models/{$this->model}:generateContent";
try {
$resp = Http::withHeaders(['Content-Type' => 'application/json'])
->timeout(20)
->timeout(40)
->post("{$url}?key={$this->apiKey}", $body);
if ($resp->successful()) {