73 lines
4.4 KiB
PHP
73 lines
4.4 KiB
PHP
<?php
|
|
|
|
$q = $_POST["message"] ?? $_GET["m"] ?? "";
|
|
if(!$q) die(json_encode(["error"=>"no"]));
|
|
$q = mb_strtolower(trim($q));
|
|
$r = "";
|
|
if(preg_match("/consolide.*cron/", $q)){
|
|
$b=trim(`crontab -l 2>/dev/null|grep -cv '^#'`);
|
|
`crontab -l 2>/dev/null|sort -u|crontab - 2>/dev/null`;
|
|
$a=trim(`crontab -l 2>/dev/null|grep -cv '^#'`);
|
|
$r="Crons: $b -> $a";
|
|
}
|
|
elseif(preg_match("/clean.*disk|nettoi/", $q)){
|
|
`docker system prune -f 2>/dev/null`;
|
|
$r="Disk: ".trim(`df -h /|tail -1`);
|
|
}
|
|
elseif(preg_match("/lance.*nonreg/", $q)) $r=trim(`bash /var/www/html/api/nonreg-check.sh 2>/dev/null`);
|
|
elseif(preg_match("/auto.?fix|repare|corrige/", $q)) $r='Auto-fix: '.trim(`bash /var/www/html/api/auto-fix.sh 2>&1|tail -3`);
|
|
elseif(preg_match("/lance.*guardian/", $q)) $r=trim(`bash /var/www/html/api/sso-guardian.sh 2>/dev/null`);
|
|
elseif(preg_match("/git.*push/", $q)) $r="brain:".trim(`cd /opt/wevia-brain&&git status --short|wc -l`)." html:".trim(`cd /var/www/html&&git status --short|wc -l`);
|
|
elseif(preg_match("/lance.*director/", $q)){`nohup curl -sf 'https://weval-consulting.com/api/wevia-director.php?run&force=1' --max-time 30 >/tmp/d.json 2>&1 &`;$r="Director lance";}
|
|
elseif(preg_match("/test.*fonctionnel/", $q)) $r=trim(`timeout 60 python3 /opt/weval-l99/l99-functional-test.py 2>&1|tail -1`);
|
|
elseif(preg_match("/vacuum/", $q)){`nohup psql -U postgres -d ethica -c 'VACUUM ANALYZE medecins_validated' >/tmp/v.log 2>&1 &`;$r="VACUUM lance";}
|
|
elseif(preg_match("/monte.*cover|100/", $q)){`python3 /opt/weval-l99/l99-state-updater.py 2>/dev/null`;$r="Coverage boost";}
|
|
elseif(preg_match("/cartograph|ecran.*defect|defectueux|sante.*ecran|screens.*health|down.*5xx|combien.*defect/i", $q)){
|
|
$h = @file_get_contents("/var/www/html/api/screens-health.json");
|
|
if($h){
|
|
$j = json_decode($h, true);
|
|
$cnt = $j["counts"] ?? [];
|
|
$tot = $j["total"] ?? 0;
|
|
$def = ($cnt["DOWN"]??0)+($cnt["BROKEN"]??0)+($cnt["NOT_FOUND"]??0)+($cnt["ERROR"]??0);
|
|
$samples = [];
|
|
if(isset($j["by_url"])){
|
|
foreach($j["by_url"] as $url=>$d){
|
|
$st = $d["status"] ?? "";
|
|
if(in_array($st, ["DOWN","BROKEN","NOT_FOUND","ERROR"])){
|
|
$samples[] = "- $st [".($d["code"]??"?")."] $url";
|
|
if(count($samples)>=8) break;
|
|
}
|
|
}
|
|
}
|
|
$r = "ECRANS CARTOGRAPHIE (genere: ".($j["generated_at"]??"?").")\n".
|
|
"Total: $tot | UP: ".($cnt["UP"]??0)." | SLOW: ".($cnt["SLOW"]??0)." | PROTECTED: ".($cnt["PROTECTED"]??0)."\n".
|
|
"DEFECTUEUX: $def (DOWN: ".($cnt["DOWN"]??0).", BROKEN/5xx: ".($cnt["BROKEN"]??0).", NOT_FOUND/404: ".($cnt["NOT_FOUND"]??0).")\n\n".
|
|
"Echantillon defectueux:\n".implode("\n",$samples)."\n\n".
|
|
"Filtrer dans la cartographie: cliquer sur DEFECTUEUX dans la barre 'Statut live:' en haut.\n".
|
|
"URL: https://weval-consulting.com/cartographie-screens.html";
|
|
} else {
|
|
$r = "Pas de donnees de sante disponibles. Lancer d'abord: bash /var/www/html/api/screens-health-cron.sh";
|
|
}
|
|
}
|
|
// OPUS3-L99-FULL-SCAN-WIRE — patterns manquants cause hallucination
|
|
elseif(preg_match('/lance.*full.*scan.*l99|regression.*l99|scan.*74.*layers|scan.*complet.*l99/', $q)){
|
|
$out = @file_get_contents('http://127.0.0.1/api/wevia-ops.php?action=l99_full_scan');
|
|
$r = $out ?: 'L99 full scan: lance background (30-60min) via wevia-ops.php';
|
|
}
|
|
elseif(preg_match('/etat.*full.*scan|l99.*full.*status|progress.*l99/', $q)){
|
|
$out = @file_get_contents('http://127.0.0.1/api/wevia-ops.php?action=l99_full_status');
|
|
$r = $out ?: 'L99 status: indisponible';
|
|
}
|
|
elseif(preg_match('/investigate.*500|audit.*500|debug.*500.*mirofish|wepredict.*500/', $q)){
|
|
$url='';
|
|
if(preg_match('#https?://[^\s]+#',$q,$m)) $url=$m[0];
|
|
$out = @file_get_contents('http://127.0.0.1/api/wevia-ops.php?action=investigate_500&url='.urlencode($url));
|
|
$r = $out ?: 'Investigate 500: no data';
|
|
}
|
|
elseif(preg_match('/wire.*intent|auto.*wire.*pattern|ajoute.*pattern.*intent/', $q)){
|
|
// Auto-wire futur: WEVIA demande ajout pattern via chat
|
|
$r = 'Auto-wire disponible: POST /api/wevia-ops.php?action=wire_intent avec pattern+target (Opus3 wire base)';
|
|
}
|
|
else { require_once __DIR__ . "/wv-llm-helper.php"; $ctx = "Tu es WEVIA Master de WEVAL Consulting. IA souveraine 15 providers 0EUR 185 intents Ethica 132K HCPs. Expert francais actionnable."; $r = wv_llm($q, $ctx); }
|
|
echo json_encode(["response"=>$r,"executed"=>true]);
|