Deploy: 2026-05-24 01:32:00
This commit is contained in:
25
backend/test_gemini.php
Normal file
25
backend/test_gemini.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
// Adjust path if needed
|
||||
require __DIR__ . '/app/Services/GeminiService.php';
|
||||
|
||||
$apiKey = getenv('GEMINI_API_KEY');
|
||||
if (empty($apiKey)) {
|
||||
// try to load from .env
|
||||
$env = parse_ini_file(__DIR__ . '/.env');
|
||||
$apiKey = $env['GEMINI_API_KEY'] ?? '';
|
||||
}
|
||||
|
||||
if (empty($apiKey)) {
|
||||
echo "NO API KEY FOUND\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
echo "Testing Gemini API...\n";
|
||||
$res = \App\Services\GeminiService::generateResponse($apiKey, "You are a helpful bot.", "hi");
|
||||
if ($res) {
|
||||
echo "SUCCESS: " . $res . "\n";
|
||||
} else {
|
||||
echo "FAILED.\n";
|
||||
}
|
||||
Reference in New Issue
Block a user