From db83255c5860a93e6f001d8ae5ed0fdad18ac85b Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 10 Sep 2026 04:12:36 +0200 Subject: [PATCH] feat: display-only sources toggle, signed-out preview, and a composer that carries the toolbar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sources (correcting what I built earlier) The previous toggle branched the SYSTEM PROMPT, so the same question could get a different answer depending on a display setting — the bias this was meant to avoid. The prompt is now unconditional: buildSystemPrompt takes no display argument and is byte-identical either way. Hiding sources happens on the way out — the server omits them and strips the now-orphaned [n] markers from the copy it sends. The answer is generated, stored and exported with citations intact, so turning the setting back on restores them without re-asking anything. Renamed to clinical_assistant.show_sources; the old key is still honoured. Signed-out preview (admin opt-in, default off) A visitor may try the assistant; reaching for the workspace asks them to sign in. Deliberately narrow: - Reachable paths are an exact allow-list, not a pattern, so a new endpoint is private unless someone adds it on purpose. - A preview visitor gets no identity at all (id: null), so nothing can be owned, saved, billed or addressed to them. - The image tool is withheld rather than left to fail on a null owner, and no audit rows are written. - A caller presenting a token is authenticated normally, so preview can never downgrade a real session; if the setting cannot be read, authentication is required. - Actions needing an account are hidden rather than offered and refused. Composer The bar above the transcript is gone. Patient take home, Export PDF, Download transcript and Attach images moved into a + menu in the composer, and the model selector moved beside send — shown only when there is more than one model, as before. Both views now start at the same top edge, so switching modes cannot nudge the page up or down. On an empty transcript the tiled ground runs behind and below the composer, which floats on it above centre. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01GmpYHPSLGmXGZMyLpn2Lbe --- public/components/admin.html | 13 ++- public/components/assistant.html | 42 +++++---- public/css/assistant.css | 61 +++++++++--- public/css/styles.css | 15 ++- public/js/admin/clinicalAssistant.js | 16 +++- public/js/app.js | 7 ++ public/js/auth.js | 25 ++++- public/js/clinicalAssistant.js | 76 ++++++++++----- src/routes/adminConfig.js | 7 +- src/routes/clinicalAssistant.js | 97 +++++++++++++++----- src/utils/clinicalAnswer.js | 24 ++--- test/admin-clinical-assistant-wiring.test.js | 4 +- test/assistant-citations.test.js | 64 ++++++------- test/assistant-preview.test.js | 93 +++++++++++++++++++ test/assistant-workspace-layout.test.js | 63 +++++++++++-- test/clinical-release-integration.test.js | 2 +- test/frontend-prompt-env.test.js | 2 +- 17 files changed, 461 insertions(+), 150 deletions(-) create mode 100644 test/assistant-preview.test.js diff --git a/public/components/admin.html b/public/components/admin.html index 68c3dae8..385d984d 100644 --- a/public/components/admin.html +++ b/public/components/admin.html @@ -328,13 +328,18 @@
- Citations + Sources
-

Retrieval and grounding are unchanged when this is off — answers are still built only from retrieved sources, but the [1] markers and the Sources panel are hidden.

+ +

Preview is read-only: visitors can try the assistant, and anything else asks them to sign in or create an account.

+

Display only. The AI prompt, retrieval and the stored answer are byte-for-byte identical either way, so turning this off cannot change what the model says. Citations are hidden, not removed — turning it back on restores them.

diff --git a/public/components/assistant.html b/public/components/assistant.html index 1c6f9c48..43c903e9 100644 --- a/public/components/assistant.html +++ b/public/components/assistant.html @@ -13,6 +13,7 @@