Fix SQL string literals for PostgreSQL compatibility in AI logs query

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro
2026-07-14 19:21:39 +00:00
co-authored by Claude Sonnet 4.6
parent 44297aa0bb
commit fb92ebfb1c
+5 -5
View File
@@ -48,16 +48,16 @@ class ShowAiLogs extends Component
if ($this->filtroFechaDesde) $resumenQuery->whereDate('created_at', '>=', $this->filtroFechaDesde);
if ($this->filtroFechaHasta) $resumenQuery->whereDate('created_at', '<=', $this->filtroFechaHasta);
$resumen = $resumenQuery->selectRaw('
$resumen = $resumenQuery->selectRaw("
COUNT(*) as total_llamadas,
SUM(CASE WHEN resultado = "ok" THEN 1 ELSE 0 END) as total_ok,
SUM(CASE WHEN resultado = "error" THEN 1 ELSE 0 END) as total_errores,
SUM(CASE WHEN resultado = 'ok' THEN 1 ELSE 0 END) as total_ok,
SUM(CASE WHEN resultado = 'error' THEN 1 ELSE 0 END) as total_errores,
SUM(input_tokens) as total_input_tokens,
SUM(output_tokens) as total_output_tokens,
SUM(audio_segundos) as total_segundos_whisper,
SUM(CASE WHEN servicio = "whisper" THEN costo ELSE 0 END) as costo_whisper,
SUM(CASE WHEN servicio = 'whisper' THEN costo ELSE 0 END) as costo_whisper,
AVG(tiempo_ms) as avg_tiempo_ms
')->first();
")->first();
return view('livewire.chat.show-ai-logs', compact('logs', 'resumen'));
}