implemeted step 13 by Gemini

- added configuracion .env
- added test script for DAI API client
This commit is contained in:
2026-06-14 13:00:26 +02:00
parent 2b9b62b0aa
commit ec698f3f34
7 changed files with 241 additions and 0 deletions

44
tests/debug_dai.php Normal file
View File

@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../vendor/autoload.php';
// Load configuration
\App\Utils\Config::load(__DIR__ . '/../.env');
use App\Services\DAIClient;
/**
* CLI Debug skript pre overenie konektivity k DAIAPI
*/
echo "--- DAIAPI Connectivity Test ---" . PHP_EOL;
$client = new DAIClient();
$testPrompt = "Ahoj, aký je dnes deň a napíš mi v jednej krátkej vete, čo si o sebe myslíš ako o AI?";
echo "Odosielam testovací prompt: \"$testPrompt\"" . PHP_EOL;
echo "Čakám na odpoveď (timeout 60s)..." . PHP_EOL;
$startTime = microtime(true);
$answer = $client->sendRequest($testPrompt);
$endTime = microtime(true);
$duration = round($endTime - $startTime, 2);
echo PHP_EOL;
if ($answer !== null) {
echo "[SUCCESS] Pripojenie je funkčné!" . PHP_EOL;
echo "[INFO] Čas odpovede: {$duration}s" . PHP_EOL;
echo "--- ODPOVEĎ OD AI ---" . PHP_EOL;
echo $answer . PHP_EOL;
echo "---------------------" . PHP_EOL;
} else {
echo "[ERROR] Nepodarilo sa získať odpoveď od DAIAPI." . PHP_EOL;
echo "[DEBUG] Skontrolujte, či:" . PHP_EOL;
echo "1. Ste pripojený k VPN/sieti, kde beží DAIAPI." . PHP_EOL;
echo "2. Adresa http://192.168.122.10:9001 je dostupná." . PHP_EOL;
echo "3. API server nie je preťažený." . PHP_EOL;
}