Let one gate decide every AI surface, so switching AI off actually removes all of it

The Tools card adopted the AI scripts on the host check alone, and api/ai.php only
tested AI_ENABLED in front of ask, so a disabled subsystem still had rows to run and
an endpoint that answered.
This commit is contained in:
Gmer4Lfe
2026-08-07 09:49:31 -04:00
parent bf7a2cc911
commit be306cf86c
5 changed files with 35 additions and 16 deletions
+6 -6
View File
@@ -319,12 +319,12 @@ function vv_tools_scripts(): array {
// chain. Moving the file to match the UI would break the grouping that explains it.
$ADOPTED = ['System_Essentials/server_reboot.sh'];
// The AI tools are adopted only where the index and the model actually live. Elsewhere they
// are two rows that can only ever fail — the retrieval index is not synced between hosts and
// Ollama runs on one of them. vv_is_ai_host() comes from include/ai.php, which the page loads
// but this file does not require; absent it, assume not, because showing a tool that cannot
// work is worse than omitting one that could.
if (function_exists('vv_is_ai_host') && vv_is_ai_host()) {
// The AI tools are adopted only where the index and the model actually live, and only while
// the subsystem is switched on. Elsewhere they are two rows that can only ever fail — the
// retrieval index is not synced between hosts, Ollama runs on one of them, and both scripts
// refuse on their own unless AI_ENABLED is true. vv_ai_ui_on() is the same gate the AI tab
// and the assistant dock use, so AI off means no AI anywhere in the UI, not most of it.
if (vv_ai_ui_on()) {
array_push($ADOPTED, 'AI/ai_index.sh', 'AI/ai_query.sh');
}