From b7df54e4f365fa787d47fd9f3a210dbc192537d7 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Thu, 13 Aug 2026 17:03:45 -0400 Subject: [PATCH] Resume the dashboard chat from its own profile It reopened whatever was touched last anywhere, so the card could land in a Scheduler troubleshooting thread with no picker to get back. --- Plugin/unraid/include/ai_chat.php | 13 ++++++++++++- Plugin/unraid/pages/monitor.php | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Plugin/unraid/include/ai_chat.php b/Plugin/unraid/include/ai_chat.php index 8023899..755aef9 100644 --- a/Plugin/unraid/include/ai_chat.php +++ b/Plugin/unraid/include/ai_chat.php @@ -2045,7 +2045,18 @@ vv_ai_profiles_script(); // Do not clobber a conversation the operator has already started. The list arrives after // construction, so by the time it lands they may have typed and sent something. if (messages.length || busy) return; - const last = d.chats.slice().sort((a, b) => (b.updated || 0) - (a.updated || 0))[0]; + + // A placement whose profile never moves should not resume a thread from one that does. + // The store is shared on purpose — a conversation started on the dashboard is the one you + // carry on in the tab — but reopening restores the saved profile too, so the Monitor + // card would quietly turn into whatever the Scheduler was last troubleshooting. Filtered + // where the page says its profile is fixed; unfiltered on the AI tab, where moving + // between profiles is the point and the newest thread is genuinely the one you left. + const want = o.resumeProfile || ''; + const pool = want ? d.chats.filter(c => (c.profile || 'chat') === want) : d.chats; + if (!pool.length) return; + + const last = pool.slice().sort((a, b) => (b.updated || 0) - (a.updated || 0))[0]; if (last) loadChat(last.id); }).catch(() => {}); } diff --git a/Plugin/unraid/pages/monitor.php b/Plugin/unraid/pages/monitor.php index b83d661..871661c 100644 --- a/Plugin/unraid/pages/monitor.php +++ b/Plugin/unraid/pages/monitor.php @@ -2851,6 +2851,11 @@ if (document.getElementById('vv-mon-ai-chat')) { const vvMonChat = VvAiChat({ prefix: 'vv-mon-ai', profile: 'chat', + // This card is General Chat and stays General Chat — there is no picker on it. Without this + // it resumed whatever was most recently touched anywhere, so opening the dashboard could land + // it in the middle of a Scheduler troubleshooting thread, retitled and rescoped, on a card + // with no obvious way back. + resumeProfile: 'chat', empty: 'Ask anything. Questions about this installation are handed to the Varaverk ' + 'assistant automatically.', onChats: id => { if (vvMonChatList) vvMonChatList.setActive(id); },