fix: the assistant page keeps its layout whatever the initialiser does, and its starters are whole questions

The page class that hides the app sidebar and gives the chat its full height
was added only after the initialiser returned, so any error there left the
app menu and the chat rail side by side with the panels at half height. The
class goes on first now. The starter chips show the question itself rather
than a two-word label, four of them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016fZGJNyDvERbMgS2Uc2msP
This commit is contained in:
Daniel 2026-09-14 23:42:32 +02:00
parent 15ec830038
commit 91a35a4b27

View file

@ -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 {
'<p>Ask a real clinical question. Citations stay linked to the source cards on the right.</p>' +
'<div class="assistant-examples">' + examples.map(function (item) {
var source = item.sourceTitle ? (' title="Available from: ' + escapeAttr(item.sourceTitle + (item.page ? ', page ' + item.page : '')) + '"') : '';
return '<button type="button" data-assistant-example="' + escapeAttr(item.prompt) + '"' + source + '>' + escapeHtml(item.label) + '</button>';
// The question itself, not a two-word label: "Status asthma escalation"
// says nothing about what will be asked; the question does.
return '<button type="button" data-assistant-example="' + escapeAttr(item.prompt) + '"' + source + '>' + escapeHtml(item.prompt || item.label) + '</button>';
}).join('') + '</div></div>';
}
@ -2634,7 +2640,7 @@ import {
examples[i] = examples[j];
examples[j] = tmp;
}
return examples.slice(0, 3);
return examples.slice(0, 4);
}
function bindExampleButtons(root) {