Give the AI subsystem one profile table and one collection, read everywhere

This commit is contained in:
Gmer4Lfe
2026-08-08 22:35:37 -04:00
parent 0f4d381ac0
commit 0f92609425
10 changed files with 355 additions and 103 deletions
+7 -3
View File
@@ -425,8 +425,12 @@ vv_ai_chat_markup('vv-ai', [
});
box.innerHTML = html;
}
function loadBanner() {
fetch(API + '?action=stats').then(r => r.json())
// The 30-second tick reads the shared cache; a completed turn does not. Finishing a turn is
// precisely the event that changes what this banner reports — a cold model becomes resident,
// VRAM moves, context is now allocated — so re-rendering it from a payload written before the
// turn would show the operator the state they had just watched themselves leave.
function loadBanner(live) {
fetch(API + '?action=stats' + (live ? '&live=1' : '')).then(r => r.json())
.then(d => { if (d.ok) renderBanner(d.stats); })
.catch(() => {});
}
@@ -673,7 +677,7 @@ vv_ai_chat_markup('vv-ai', [
thinkEl: 'vv-ai-think',
empty: "Ask Varaverk about itself. Answers come only from this installation's own "
+ 'documentation, with sources.',
onTurn: () => { loadBanner(); loadTokens(); },
onTurn: () => { loadBanner(true); loadTokens(); },
onChats: id => { if (chatList) chatList.setActive(id); },
});
+3 -3
View File
@@ -317,7 +317,7 @@ if (vv_ai_ui_on()) vv_ai_chat_assets();
Conversations
</span>
</h3>
<?php vv_ai_chat_list_markup('vv-mon-ai'); ?>
<?php vv_ai_chat_list_markup('vv-mon-ai', true); ?>
</div>
<!-- Named for what it is, not "dock" — the Scheduler tab's vv-ai-dock is a different
@@ -1909,12 +1909,12 @@ function vvRenderAi(ai) {
h += line('Ollama', 'unreachable', 'color:#e57;');
} else if (!rt.loaded) {
h += line('Model', 'not loaded', 'color:#ffb74d;');
h += `<div style="font-size:10px;color:#444;margin:-2px 0 7px;">loads on first question</div>`;
h += `<div style="font-size:10px;color:#666;margin:-2px 0 7px;">loads on first question</div>`;
} else {
const p = rt.offload_pct;
const full = p === 100;
h += line('GPU offload', p === null ? '—' : p + '%', full ? 'color:#6fcf97;' : 'color:#ffb74d;');
h += `<div style="font-size:10px;color:#444;margin:-2px 0 7px;">`
h += `<div style="font-size:10px;color:#666;margin:-2px 0 7px;">`
+ (full ? 'all on GPU' : 'layers on CPU — slow') + `</div>`;
if (rt.context) h += line('Context', rt.context.toLocaleString());
}
+7 -1
View File
@@ -64,6 +64,7 @@
// api/rsync_standalone.php
require_once dirname(__DIR__) . '/include/scheduler.php';
require_once dirname(__DIR__) . '/include/docs.php';
require_once dirname(__DIR__) . '/include/ai_profiles.php';
// Live values for the `$VAR` markers in pages/readme/*.md. Conf variables, plus the derived
// path constants — those are not conf keys, but they are exactly what a reader needs resolved
@@ -1059,6 +1060,7 @@ Still the same two servers, two households, the same media stack running itself.
At rest it is one input row. Answers expand it upward and the views above shrink to
suit, which is why vvFitRight() subtracts its height. It pushes rather than overlays
so the thing you are asking about stays on screen. Collapsing keeps the conversation. -->
<?php vv_ai_profiles_script(); ?>
<div id="vv-ai-dock">
<div id="vv-ai-dock-body" style="display:none"></div>
<div id="vv-ai-dock-bar">
@@ -2367,8 +2369,12 @@ function vvAiDockScope(profile, label, target) {
const had = vvAiHist.length > 0;
vvAiProfile = profile;
vvAiScope = target;
// Short label from the registry, not a literal map. The map that used to be here was the
// fifth place a profile got defined, and it silently fell back to "Assistant" for any id it
// had not been told about — so a new profile would have shown up in the chip as the strict one.
const _p = (window.VvAiProfiles || {})[profile];
document.getElementById('vv-ai-dock-chip').textContent =
({ code: 'Code', troubleshoot: 'Troubleshoot' }[profile] || 'Assistant') + ' · ' + label;
(_p ? _p.short : profile) + ' · ' + label;
// Transcript stays, history sent to the model resets — the same rule the AI tab's profile
// buttons already use. A troubleshooting thread carrying log excerpts must not bleed into a