diff --git a/Plugin/unraid/include/ai_chat.php b/Plugin/unraid/include/ai_chat.php index 9ee3886..7b58647 100644 --- a/Plugin/unraid/include/ai_chat.php +++ b/Plugin/unraid/include/ai_chat.php @@ -899,6 +899,9 @@ vv_ai_profiles_script(); } const SEE_THINK_KEY = 'vvAiSeeThink:' + P; + // Per instance, like the reasoning key beside it: the Monitor card and a tab's assistant are + // opened for different reasons and should not share one answer to "pick up where I left off". + const RESUME_KEY = 'vvAiResume:' + P; const seeThink = () => { const c = $('see-think'); return !!c && c.checked; }; // Paths ride in data attributes rather than an onclick. They come out of the index, and a @@ -2056,7 +2059,20 @@ vv_ai_profiles_script(); // // Silent on failure. Nothing here is worth an error message: the fallback is the empty box // the operator would otherwise have got, and an empty box is a working chat. - if (store && o.resume !== false) { + // The checkbox decides, and it defaults ON — an unset key means a first visit, not a refusal. + // Read here rather than from the element, because construction runs before the header is + // wired and an unchecked box must prevent the fetch, not undo it afterwards. + let _resumeWanted = true; + try { _resumeWanted = localStorage.getItem(RESUME_KEY) !== '0'; } catch (_) {} + const resumeEl = $('resume'); + if (resumeEl) { + resumeEl.checked = _resumeWanted; + resumeEl.addEventListener('change', () => { + try { localStorage.setItem(RESUME_KEY, resumeEl.checked ? '1' : '0'); } catch (_) {} + }); + } + + if (store && o.resume !== false && _resumeWanted) { fetch(API + '?action=chats').then(r => r.json()).then(d => { if (!d.ok || !(d.chats || []).length) return; // Do not clobber a conversation the operator has already started. The list arrives after @@ -2307,6 +2323,12 @@ function vv_ai_chat_markup(string $prefix, array $o = []): void { + +