Files
html/api/test-archive/test-ollama.php
2026-04-12 22:57:03 +02:00

10 lines
585 B
PHP

<?php
header("Content-Type: application/json");
set_time_limit(30);
$payload = json_encode(["model"=>"mistral","messages"=>[["role"=>"system","content"=>"Tu es WEDROID. Reponds en 1 phrase."],["role"=>"user","content"=>"hi"]],"stream"=>false,"options"=>["num_predict"=>200]]);
$start = microtime(true);
$raw = shell_exec("curl -s -m 25 http://localhost:11434/api/chat -d " . escapeshellarg($payload) . " 2>&1");
$t = round(microtime(true) - $start, 1);
$j = json_decode($raw, true);
echo json_encode(["time"=>$t."s","model"=>"mistral","response"=>$j["message"]["content"] ?? "FAIL"]);