diff --git a/Plugin/unraid/include/ai_chat.php b/Plugin/unraid/include/ai_chat.php index 69199ea..4fda2fd 100644 --- a/Plugin/unraid/include/ai_chat.php +++ b/Plugin/unraid/include/ai_chat.php @@ -365,6 +365,9 @@ vv_ai_profiles_script(); // conversation, or the page retargeting. A page holding its own copy of "which profile" has // no other way to stay in step with a menu it does not own. const onProfile = o.onProfile || function () {}; + // Called with the new state when the operator expands or collapses, for a page that has to + // re-lay itself out around the new height. See the grow handler. + const onResize = o.onResize || function () {}; const store = o.chats !== false; const POLL_MS = 1200; const POLL_CEIL = 300000; // stop polling a worker that never wrote a terminal state @@ -872,7 +875,20 @@ vv_ai_profiles_script(); } } if (growBtn) { - growBtn.addEventListener('click', () => { big = !big; applyHeights(); scroll(); }); + // onResize fires only here, on the operator's own toggle — never from setHeights(). A page + // whose layout depends on this height calls setHeights() from inside its fit routine, so + // announcing it there would call that routine from within itself, forever. + // + // A placement that is not simply taller than its neighbours has to be told. The Scheduler + // panel is pinned at the bottom and the views above it are sized from what is left, so + // without this the chat grows downward off the end of the panel and takes its own composer + // with it — which is precisely what it did. + growBtn.addEventListener('click', () => { + big = !big; + applyHeights(); + scroll(); + onResize(big); + }); } // Surface any script error into the transcript. Without it a throw anywhere on the page is diff --git a/Plugin/unraid/pages/scheduler.php b/Plugin/unraid/pages/scheduler.php index bdde849..783a392 100644 --- a/Plugin/unraid/pages/scheduler.php +++ b/Plugin/unraid/pages/scheduler.php @@ -2400,6 +2400,9 @@ if (document.getElementById('vv-sched-ai-chat')) { return false; }, onTurn: () => { vvAiFixArm(); requestAnimationFrame(vvFitRight); }, + // Expanding changes how much of the panel is left for the views above it. Without this the + // chat grows downward past the end of the panel instead of upward into it. + onResize: () => requestAnimationFrame(vvFitRight), onOffer: (kind, yes) => { if (kind === 'fix') vvAiFixAnswer(yes); }, }); }