pediatric-ai-scribe-v3/src/utils/clinicalPrompts.js
Daniel 022869f01d fix: mobile layout regression, workspace menu in the assistant rail, prompt as principles
Mobile
body.assistant-workspace .assistant-layout is both later in the file and more
specific than the .assistant-layout rule inside @media (max-width:640px), so
phones were inheriting height: calc(100vh - 64px) — an offset for the app header
that workspace mode already hides — plus grid rules on a flex container. The
topbar then overlapped the content. Added a matching-specificity mobile override
restoring 100dvh and the flex layout.

Workspace menu in the rail
The saved-chats rail gains a collapsible Workspace section listing the app's own
tabs, so the assistant sidebar carries both its chats and the workspace
navigation. It is built from the real .tab-btn elements rather than a second copy
of the menu, so tabs added, renamed or hidden in index.html follow automatically
and admin-only tabs stay hidden.

Prompt
Rewritten as principles instead of an enumerated rulebook: "respond to the user's
latest message, not to an earlier one", "if it carries no question, ask what they
would like you to look up", "never repeat a previous answer", and for the tool
"use it when the latest message asks for a picture, or for a change to one you
just made, and not otherwise". No example words in any language remain — the
model reads the message as written. 1032 -> 788 characters.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BkfrkQwA4YGrGw9LZSpeAq
2026-09-09 22:24:10 +02:00

18 lines
2.8 KiB
JavaScript

// Global Clinical Assistant instructions, separate from the Scribe catalogue.
const DEFAULT_BEHAVIOR = 'You are a concise pediatric clinical assistant. Use retrieved context only for factual claims; do not answer from your own knowledge. Respond to the user\'s latest message, not to an earlier one. If it carries no question, say so briefly and ask what they would like you to look up. Never repeat a previous answer. Synthesize across sources and cite factual claims with the exact provided source numbers like [1]. Do not invent, renumber, merge, or move citations. You have a generate_image tool. Use it when the latest message asks for a picture, or for a change to one you just made, and not otherwise. Call it with a self-contained prompt built from the clinical context and briefly say you are preparing the image; it appears automatically. Do not write an image prompt as your answer.';
const DEFAULT_IMAGE_BEHAVIOR = ' Compose as a single complete medical teaching poster. Build the image from the full clinical answer: include every key fact, figure, threshold, unit, age group and pathway step with rich, complete descriptions and detailed labels. Keep every element fully inside the canvas with a 10% safe margin on all sides. Do not crop boxes, arrows, labels, legends, or body parts. Use fewer words per box, large readable type, and generous spacing. Never include citations, reference numbers, footnote markers, source lists, or organization logos in the image.';
function imagePromptForCanvas(prompt, behavior = DEFAULT_IMAGE_BEHAVIOR) {
var text = String(prompt || '');
var guidance = /^\s/.test(behavior) ? behavior : ' ' + behavior;
if (/\b(flow\s*chart|flowchart|algorithm|pathway|timeline|vertical|stepwise|decision\s*tree|age\s*group|0-21|22-28|29-60)\b/i.test(text)) {
guidance += ' Use a tall portrait layout with top-to-bottom flow, no more than 6-8 main nodes, and ample spacing between decision nodes.';
}
if (/\b(table|matrix|comparison|wide|landscape|side-by-side)\b/i.test(text)) {
guidance += ' Use a wide landscape layout with compact columns, ample horizontal spacing, and no text near the edges.';
}
return text + guidance;
}
const PATIENT_TAKEHOME_BEHAVIOR = 'Rewrite the clinical answer below as a short patient take-home sheet in simple, plain language a parent or caregiver can understand. Keep every medical fact, number, unit, dose and timeframe exactly as in the answer; explain medical terms in everyday words. Use short sentences and a simple bullet list with a clear "What to do" part. Never include citations, reference numbers, footnote markers, source lists, or organization logos. Never add new medical advice, never invent facts, and never guess what the clinician would say.';
module.exports = { DEFAULT_BEHAVIOR, DEFAULT_IMAGE_BEHAVIOR, PATIENT_TAKEHOME_BEHAVIOR, imagePromptForCanvas };