AI Analysis: add verbose logging for Gemini diagnostics
This commit is contained in:
@@ -198,15 +198,19 @@ class AIAnalysisService
|
||||
try {
|
||||
$response = Http::timeout(60)->post("https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=" . $apiKey, [
|
||||
'contents' => [['parts' => [['text' => $prompt]]]],
|
||||
'generationConfig' => ['responseMimeType' => 'application/json']
|
||||
'generationConfig' => [
|
||||
'responseMimeType' => 'application/json'
|
||||
]
|
||||
]);
|
||||
|
||||
if ($response->successful()) {
|
||||
$text = $response->json('candidates.0.content.parts.0.text');
|
||||
return json_decode($this->extractJson($text), true);
|
||||
} else {
|
||||
Log::error("Gemini API Error: " . $response->status() . " - " . $response->body());
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Gemini Analysis Failed: " . $e->getMessage());
|
||||
Log::error("Gemini Connection Failed: " . $e->getMessage());
|
||||
}
|
||||
|
||||
return $this->getSimulatedAnalysis();
|
||||
|
||||
Reference in New Issue
Block a user