Put the assistant on the dashboard, where the questions actually occur to you

This commit is contained in:
Gmer4Lfe
2026-08-08 22:01:13 -04:00
parent 4d00e37ca1
commit ea0c713c89
3 changed files with 179 additions and 2 deletions
+20
View File
@@ -64,6 +64,7 @@
// A flat object of the keys listed in the assembly below, plus _api_status and ts.
//
// DEPENDS ON
// include/ai.php AI residency and index figures, only when vv_ai_ui_on()
// include/config.php vv_cache_read()
// include/common.php raw hardware metrics — system, cpu, mem, net, gpu, disks,
// ups, parity, containers, transcodes, remote roll-ups
@@ -92,6 +93,24 @@ require_once dirname(__DIR__) . '/include/docker_folders.php';
// Pre-warm the API cache with one request (shared by all API-first functions below).
vv_api_data();
// AI residency, for the Monitor tab's AI row. Collected here rather than by that card polling
// api/ai.php on its own cycle: vv_ai_runtime_stats() calls out to Ollama and shells nvidia-smi,
// and this payload is written once a minute by the background writer — a card polling it
// directly would pay both costs every five seconds on every open tab.
//
// Null on any host that is not the AI host or has AI_ENABLED false, which is also what makes the
// row absent rather than empty there. Same shape as every other optional subsystem on this page.
$_vv_ai = null;
if (vv_ai_ui_on()) {
require_once dirname(__DIR__) . '/include/ai.php';
$_vv_ai = [
'model' => vv_ai_config()['model'],
'runtime' => vv_ai_runtime_stats(),
'index' => vv_ai_index_stats(),
'tokens' => vv_ai_token_stats()['today'] ?? null,
];
}
echo json_encode([
'system' => vv_system_info(),
'fallback' => vv_fallback_state(),
@@ -119,6 +138,7 @@ echo json_encode([
'vms' => vv_get_vms(),
'docker_folders' => vv_get_docker_folders(),
'remote_hosts' => vv_remote_hosts_stats(),
'ai' => $_vv_ai,
'_api_status' => vv_api_get_status(),
'ts' => time(),
]);