Restrict the AI tab to HOST1 — the only node with the GPU, Ollama and the index
This commit is contained in:
@@ -74,10 +74,17 @@ unset($_master, $_h1m, $_host1_blank, $_my_hostid, $_conf_missing);
|
||||
$tab = $_GET['tab'] ?? 'monitor';
|
||||
$validTabs = ['monitor', 'scheduler', 'docker', 'watchdog', 'partnership', 'fallback', 'arrs', 'rsync', 'auth', 'settings'];
|
||||
|
||||
// The AI tab exists only while AI_ENABLED is true. Appended to $validTabs rather than filtered
|
||||
// out of it, so the check below rejects ?tab=ai server-side as well — omitting the link is
|
||||
// presentation, not access control, and api/ai.php refuses `ask` on the same flag independently.
|
||||
$_vv_ai = strtolower(trim(vv_conf_vars()['AI_ENABLED'] ?? 'false')) === 'true';
|
||||
// The AI tab exists only on HOST1, and only while AI_ENABLED is true. Appended to $validTabs
|
||||
// rather than filtered out of it, so the check below rejects ?tab=ai server-side as well —
|
||||
// omitting the link is presentation, not access control, and api/ai.php refuses every action
|
||||
// on the same two conditions independently.
|
||||
//
|
||||
// The host half is not a preference: HOST1 owns the GPU, the Ollama process and the index, and
|
||||
// include/ai.php only ever reads the *local* {HOST}_OLLAMA_URL — there is no Tailscale resolver
|
||||
// in the PHP layer the way there is in the shell. On any other host the tab could only render
|
||||
// and then fail its own health check.
|
||||
$_vv_ai = vv_is_ai_host()
|
||||
&& strtolower(trim(vv_conf_vars()['AI_ENABLED'] ?? 'false')) === 'true';
|
||||
if ($_vv_ai) $validTabs[] = 'ai';
|
||||
|
||||
if (!in_array($tab, $validTabs)) $tab = 'monitor';
|
||||
|
||||
Reference in New Issue
Block a user