Share one AI across the mesh instead of confining it to the owner
Curated state copied to every node is state that can disagree, so the index, the model and the shared memory stay on the owner and each node reaches them over the SSH trust onboarding already builds. Chats stay on the node that had them; memory and bug reports stay the owner's to write.
This commit is contained in:
@@ -9,11 +9,13 @@
|
||||
// api/ai.php, receives a token, and polls until the job reaches done or error. That keeps
|
||||
// the api layer on one response convention; see api/ai.php for why SSE was declined.
|
||||
//
|
||||
// The tab is only reachable on HOST1, and only when AI_ENABLED is true. Varaverk.page omits
|
||||
// it from the tab list and rejects it server-side, and api/ai.php refuses every action on
|
||||
// the same two conditions independently — hiding a link is not access control. HOST1 is the
|
||||
// node with the GPU, the Ollama process and the index; include/ai.php reads only the local
|
||||
// {HOST}_OLLAMA_URL, so the tab could not function anywhere else regardless.
|
||||
// The tab is only reachable on the AI owner, and only when AI_ENABLED is true. Varaverk.page
|
||||
// omits it from the tab list and rejects it server-side, and api/ai.php refuses the owner-only
|
||||
// actions independently — hiding a link is not access control.
|
||||
//
|
||||
// That is a split of surfaces, not of capability. The mesh shares one AI and every node has an
|
||||
// assistant, served from here over include/ai_rpc.php; what stays on this node is the machinery
|
||||
// this page exposes — the index, the model configuration and the bug reports.
|
||||
//
|
||||
// DESIGN PRINCIPLES
|
||||
// The banner leads with offload, not with size.
|
||||
|
||||
@@ -42,12 +42,20 @@ $_enableLogging = ($_vars['ENABLE_LOGGING'] ?? 'false') === 'true';
|
||||
$_discordKey = $_myId . '_DISCORD_WEBHOOK';
|
||||
$_discordHook = $_vars[$_discordKey] ?? '';
|
||||
|
||||
// AI. The card is drawn only on the host that can actually run it — elsewhere AI_ENABLED is a
|
||||
// switch with nothing behind it, since the model and the index are HOST1's. vv_ai_ui_on() is
|
||||
// not the test here: it folds the switch into the host check, and this card is how the switch
|
||||
// gets turned back on. Fail-closed on anything but "true", matching the gate it feeds.
|
||||
// AI. Drawn on every node. AI_ENABLED is a per-node switch — master.conf is gitignored, so each
|
||||
// host carries its own — and every node has an assistant behind it, served by the AI owner's
|
||||
// model over the mesh.
|
||||
//
|
||||
// It used to be gated on vv_is_ai_host(), from when AI was genuinely owner-only and the switch
|
||||
// had nothing behind it anywhere else. That left the only surface that can turn AI on missing
|
||||
// from exactly the nodes that needed it.
|
||||
//
|
||||
// vv_ai_ui_on() is not the test: it folds the switch into the check, and this card is how the
|
||||
// switch gets turned back on. Fail-closed on anything but "true", matching the gate it feeds.
|
||||
$_aiHost = vv_is_ai_host();
|
||||
$_aiEnabled = strtolower(trim($_vars['AI_ENABLED'] ?? 'false')) === 'true';
|
||||
$_aiOwner = vv_ai_owner_host();
|
||||
$_aiOwnerNm = trim((string)($_vars[strtoupper($_aiOwner)] ?? $_aiOwner));
|
||||
|
||||
// The shared settings renderer, for the All-settings card at the foot of the page.
|
||||
require_once dirname(__DIR__) . '/include/confui.php';
|
||||
@@ -171,7 +179,6 @@ vv_conf_ui_assets();
|
||||
<span id="vv-ntf-fb" style="font-size:11px;"></span>
|
||||
</div>
|
||||
|
||||
<?php if ($_aiHost): ?>
|
||||
<!-- AI card -->
|
||||
<div class="vv-set-card">
|
||||
<div class="vv-set-hdr">AI</div>
|
||||
@@ -181,24 +188,45 @@ vv_conf_ui_assets();
|
||||
onclick="vvSetAiToggle(this)"></div>
|
||||
<div>
|
||||
<div class="vv-set-tog-lbl">AI features</div>
|
||||
<div class="vv-set-tog-sub">Master switch — the AI tab, the Scheduler assistant, and the AI tools on the Tools card</div>
|
||||
<div class="vv-set-tog-sub">Master switch —
|
||||
<?= $_aiHost ? 'the AI tab, the assistant dock, and the AI tools on the Tools card'
|
||||
: 'the assistant dock and the AI tools on the Tools card' ?></div>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<!-- Where the model lives. On a mirror this is the only place that says so — the AI tab,
|
||||
which reports it in full, is owner-only. -->
|
||||
<div class="vv-set-row" style="margin-bottom:10px;">
|
||||
<span style="color:#666;font-size:11px;">Model</span>
|
||||
<span style="font-size:11px;color:#4a7a4a;">
|
||||
<?= $_aiHost ? 'runs on this node' : 'shared from ' . vvEscHtml($_aiOwnerNm) ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="vv-set-info">
|
||||
Varaverk works exactly as well with this off. Every feature that can lean on AI has a
|
||||
complete non-AI path, so turning it off removes the AI surfaces from the WebGUI and
|
||||
nothing else — no script changes behaviour, no schedule changes.
|
||||
<br>
|
||||
Off is total: with it off the AI tab is not in the tab bar, the Scheduler's assistant dock
|
||||
Off is total: with it off
|
||||
<?= $_aiHost ? 'the AI tab is not in the tab bar, the assistant dock' : 'the assistant dock' ?>
|
||||
is not drawn, the AI tools are not listed, and
|
||||
<code style="font-size:10px;color:#4a7a4a;background:#080808;padding:1px 4px;border-radius:2px;">api/ai.php</code>
|
||||
refuses every request. This card is the way back on.
|
||||
<br>
|
||||
<?php if ($_aiHost): ?>
|
||||
<strong style="color:#a05a2c;">This node owns the model.</strong> The switch is still
|
||||
per-node, but every other node is served from here — turning it off here takes AI off the
|
||||
whole mesh, not just this box.
|
||||
<?php else: ?>
|
||||
The model, the index and the shared memory live on
|
||||
<?= vvEscHtml($_aiOwnerNm) ?>, which answers for this node too. This switch is this node's
|
||||
own: it controls whether the surfaces are drawn here, not whether they work anywhere else.
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<span id="vv-set-ai-fb" style="font-size:11px;color:#444;"></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Unraid API Key card -->
|
||||
<div class="vv-set-card">
|
||||
|
||||
Reference in New Issue
Block a user