AI Analysis: switch to gemini-2.5-flash based on diagnostics
This commit is contained in:
@@ -196,7 +196,7 @@ class AIAnalysisService
|
|||||||
if (!$apiKey) return $this->getSimulatedAnalysis();
|
if (!$apiKey) return $this->getSimulatedAnalysis();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = Http::timeout(60)->post("https://generativelanguage.googleapis.com/v1/models/gemini-1.5-flash:generateContent?key=" . $apiKey, [
|
$response = Http::timeout(60)->post("https://generativelanguage.googleapis.com/v1/models/gemini-2.5-flash:generateContent?key=" . $apiKey, [
|
||||||
'contents' => [['parts' => [['text' => $prompt]]]]
|
'contents' => [['parts' => [['text' => $prompt]]]]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
27
test-gemini.php
Normal file
27
test-gemini.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
|
$kernel->bootstrap();
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
$apiKey = env('GEMINI_API_KEY');
|
||||||
|
if (!$apiKey) {
|
||||||
|
echo "API Key not found in .env\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Testing Gemini models with key: " . substr($apiKey, 0, 5) . "...\n";
|
||||||
|
|
||||||
|
$response = Http::get("https://generativelanguage.googleapis.com/v1/models?key=" . $apiKey);
|
||||||
|
|
||||||
|
if ($response->successful()) {
|
||||||
|
$models = $response->json('models');
|
||||||
|
foreach ($models as $model) {
|
||||||
|
echo "- " . $model['name'] . " (" . implode(", ", $model['supportedGenerationMethods']) . ")\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "Failed to list models: " . $response->status() . " - " . $response->body() . "\n";
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user