AI Analysis: increase timeout to 120s and add logging
This commit is contained in:
@@ -95,8 +95,8 @@ class AIAnalysisService
|
|||||||
$ollamaUrl = config('services.ollama.url', 'http://localhost:11434/api/generate');
|
$ollamaUrl = config('services.ollama.url', 'http://localhost:11434/api/generate');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = Http::timeout(60)->post($ollamaUrl, [
|
$response = Http::timeout(120)->post($ollamaUrl, [
|
||||||
'model' => 'mistral', // or llama3
|
'model' => 'mistral',
|
||||||
'prompt' => $prompt,
|
'prompt' => $prompt,
|
||||||
'stream' => false,
|
'stream' => false,
|
||||||
'format' => 'json'
|
'format' => 'json'
|
||||||
@@ -104,9 +104,11 @@ class AIAnalysisService
|
|||||||
|
|
||||||
if ($response->successful()) {
|
if ($response->successful()) {
|
||||||
return json_decode($response->json('response'), true);
|
return json_decode($response->json('response'), true);
|
||||||
|
} else {
|
||||||
|
Log::warning("AI Provider Error: HTTP " . $response->status() . " - " . $response->body());
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("AI Analysis Call Failed: " . $e->getMessage());
|
Log::error("AI Connection Failed (Ollama): " . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback for demo if Ollama is not running
|
// Fallback for demo if Ollama is not running
|
||||||
|
|||||||
Reference in New Issue
Block a user