diff --git a/public/js/clinicalAssistant.js b/public/js/clinicalAssistant.js index bff24633..144c86db 100644 --- a/public/js/clinicalAssistant.js +++ b/public/js/clinicalAssistant.js @@ -96,10 +96,13 @@ import { document.addEventListener('tabChanged', function (e) { if (e.detail && e.detail.tab === 'assistant') { - initIfNeeded(); // Open WebUI-style: the assistant workspace replaces the main menu; // saved chats become the left navigation and Go back restores the app. + // The class goes on first: it is the layout, and it must not depend on + // the initialiser finishing — an error in there once left the app + // sidebar and the chat rail side by side with the panels half height. document.body.classList.add('assistant-workspace'); + try { initIfNeeded(); } catch (err) { console.error('[assistant] init failed', err); } } if (e.detail && e.detail.tab && e.detail.tab !== 'assistant' && e.detail.tab !== 'learning') { lastNonAssistantTab = e.detail.tab; @@ -145,6 +148,7 @@ import { var id = null; try { id = localStorage.getItem(modelStorageKey(OPEN_CHAT_KEY)); } catch (e) {} if (!id || !document.getElementById('assistant-messages')) return; + if (typeof fetchSavedAssistantChat !== 'function') return; // Quietly: a chat that was deleted from another device is simply gone, // and the page opens on a new chat as it always did. return fetchSavedAssistantChat(id) @@ -2622,7 +2626,9 @@ import { '
Ask a real clinical question. Citations stay linked to the source cards on the right.
' + '