pediatric-ai-scribe-v3/src/utils
Daniel 5614a436be
Some checks failed
Forgejo Android APK / Root app tests (push) Successful in 52s
Forgejo Docker Build / Root app tests (push) Successful in 52s
Forgejo Android APK / Build signed APK (push) Successful in 2m15s
Forgejo Docker Build / Build Docker image (push) Successful in 10s
Forgejo Docker Build / Deploy to the host (push) Failing after 0s
fix: a deck asked for a figure and never got one — three causes, one symptom
"Include a diagram" produced decks with no picture. Three separate faults, each
hiding the next, found by generating the same deck after fixing each one.

First, deck generation ran on the default 4000-token budget. A deck's JSON is
several times the size of the prose it holds, so a long deck came back truncated,
failed to parse, and fell back to markdown — which has no way to request a
figure, so the model described one instead and the slide rendered a literal
"![Placeholder: Flow diagram ...]" as its first bullet. Deck generation now gets
room, and the fallback says how the reply failed: empty, cut short at N
characters, or not a deck.

Second, the figure request sat inside the layout vocabulary, one line among
forty, and the model passed over it. It goes last now, after the author's own
instructions — the same placement lesson the image tool taught earlier.

Third, and the one that actually mattered: image_prompt is only read on the
figure and image types, so an image_prompt on a bullets slide was dropped in
silence. The instruction said "add image_prompt to N slides" without saying
which types carry one. It now names them, and a misplaced request is honoured
rather than discarded — a slide with words becomes a figure, one without becomes
a full-slide image.

Image markup is also stripped wherever text enters a slide, on both paths: a
described figure is not a figure, and a bullet of raw markdown is worse than no
bullet.

Verified end to end after: the same request produced a deck with one figure, the
job completed, and the exported pptx carries one embedded image across 21 slides.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU
2026-09-12 04:28:30 +02:00
..
adminLockdown.js feat: admin lockdown, so several admins do not all get to change everything 2026-09-10 23:20:29 +02:00
ai.js refactor: Google models go through LiteLLM; the Vertex SDK is gone 2026-09-11 13:51:22 +02:00
audioBackupStore.js refactor: one place decides which bucket, on which S3, with which credentials 2026-09-10 17:09:13 +02:00
auditQueue.js Batch of security + scale fixes 2026-04-14 05:24:40 +02:00
buildId.js feat: ship reviewed prompt history, conversation limits and account protections 2026-09-07 04:01:01 +02:00
citationAudit.js fix: recordings that produced nothing, and the boxes that zoomed on iOS 2026-09-11 00:16:19 +02:00
clinicalAnswer.js feat: display-only sources toggle, signed-out preview, and a composer that carries the toolbar 2026-09-10 04:12:36 +02:00
clinicalConversation.js feat: Open WebUI-style assistant workspace — 3-column layout, markdown/math/code/tables, autosave with images, translation (LibreTranslate+DeepL), citation modal, Learning Hub moved in, handoff removed 2026-09-08 18:52:35 +02:00
clinicalMcpClient.js refactor: ped-ai calls clinical_semantic_search only 2026-09-10 17:22:40 +02:00
clinicalPromptPool.js feat: improve clinical assistant prompts 2026-06-06 00:01:07 +02:00
clinicalPrompts.js fix: mobile layout regression, workspace menu in the assistant rail, prompt as principles 2026-09-09 22:24:10 +02:00
clinicalRetrieval.js refactor: retrieval is text-only; admins can add model ids discovery never returns 2026-09-09 23:35:06 +02:00
clinicalTranslation.js fix: translated answers keep their source chips; the patient take home can be translated 2026-09-09 18:40:23 +02:00
config.js Feat: admin CMS, save/resume encounters, user templates, SSHADESS, well visit notes, sick visit, ROS/PE checklists, ICD-10 diagnoses 2026-03-22 16:43:39 -04:00
crypto.js Security hardening: PHI encryption, argon2, DOMPurify, SRI 2026-04-14 02:49:38 +02:00
deckBuild.js feat: record what a deck wanted and could not have 2026-09-11 22:51:15 +02:00
deckReview.js feat: a vision model looks at the rendered deck and fixes the layout 2026-09-11 21:38:18 +02:00
deckSchema.js fix: a deck asked for a figure and never got one — three causes, one symptom 2026-09-12 04:28:30 +02:00
docSpec.js feat: a slide can be drawn from primitives when the named layouts have no word for it 2026-09-11 22:12:26 +02:00
documentExport.js feat: a slide can be drawn from primitives when the named layouts have no word for it 2026-09-11 22:12:26 +02:00
embeddings.js simplify speech and embeddings through litellm 2026-05-09 05:09:02 +02:00
errors.js harden logging and observability 2026-05-08 19:08:19 +02:00
extensionTransfer.js feat: ship reviewed prompt history, conversation limits and account protections 2026-09-07 04:01:01 +02:00
fileType.js Security hardening: PHI encryption, argon2, DOMPurify, SRI 2026-04-14 02:49:38 +02:00
generatedImageLinks.js feat: integrate durable image jobs/private assets into current core 2026-09-07 16:53:42 +02:00
generatedImages.js feat: PubMed search for My Resources, and an image tool that actually fires 2026-09-11 16:47:08 +02:00
generatedImageStorage.js perf: store real image previews in MinIO, generated at creation and on demand 2026-09-10 06:39:30 +02:00
generationOptions.js Send reasoning options only to supported model 2026-08-27 21:25:38 +02:00
imageTool.js fix: mobile layout regression, workspace menu in the assistant rail, prompt as principles 2026-09-09 22:24:10 +02:00
learningRetrieval.js feat: Learning resources can be grounded in the clinical corpus 2026-09-11 14:03:05 +02:00
litellm.js fix litellm metadata discovery auth 2026-05-09 15:15:47 +02:00
logger.js fix: correct a false Settings claim; make every test child's stdout pure TAP 2026-09-10 15:41:44 +02:00
loginCodes.js feat: sign in with a code emailed to you, offered beside the password 2026-09-11 20:12:03 +02:00
metrics.js fix: generation stopped working whenever the slide reviewer was switched off 2026-09-12 00:57:30 +02:00
models.js refactor: Google models go through LiteLLM; the Vertex SDK is gone 2026-09-11 13:51:22 +02:00
notify.js Add biometric auth, ntfy push notifications, mobile improvements 2026-04-11 02:35:07 +02:00
objectStorage.js refactor: one place decides which bucket, on which S3, with which credentials 2026-09-10 17:09:13 +02:00
passwords.js Security hardening: PHI encryption, argon2, DOMPurify, SRI 2026-04-14 02:49:38 +02:00
patientTakehome.js feat: patient take home (copy/export/email), composer mic dictation, voice conversation mode, provider-aware translate languages 2026-09-08 20:01:46 +02:00
platform.js Sliding 24h idle timeout (web) + persistent mobile + 2FA backup codes 2026-04-14 04:24:54 +02:00
policy.js feat: ship reviewed prompt history, conversation limits and account protections 2026-09-07 04:01:01 +02:00
promptCatalog.js feat: integrate durable image jobs/private assets into current core 2026-09-07 16:53:42 +02:00
promptRevisions.js feat: ship reviewed prompt history, conversation limits and account protections 2026-09-07 04:01:01 +02:00
prompts.js feat: ship reviewed prompt history, conversation limits and account protections 2026-09-07 04:01:01 +02:00
promptSafe.js Batch of security + scale fixes 2026-04-14 05:24:40 +02:00
pubmedSearch.js feat: My Resources says what it is, offers its sources in one place, and Modify gets them too 2026-09-11 18:54:17 +02:00
redact.js harden logging and observability 2026-05-08 19:08:19 +02:00
redis.js feat: improve clinical assistant prompts 2026-06-06 00:01:07 +02:00
registrationInvites.js fix: expired invitations can be cleared too, revoked ones still cannot 2026-09-11 20:41:18 +02:00
resourceImages.js feat: a resource can have several illustrations, on its own path 2026-09-11 19:19:22 +02:00
sessions.js Add node-pg-migrate for versioned schema changes + better mobile UA labels 2026-04-14 05:06:19 +02:00
slideShapes.js feat: record what a deck wanted and could not have 2026-09-11 22:51:15 +02:00
slideSpec.js fix: decks were falling back to markdown, so no figure could ever be requested 2026-09-12 04:21:20 +02:00
sttProvider.js fix: patch nodemailer; Settings offers STT models the gateway really has 2026-09-10 15:54:57 +02:00
ttsProvider.js feat: ship reviewed prompt history, conversation limits and account protections 2026-09-07 04:01:01 +02:00
urlSafety.js feat: integrate durable image jobs/private assets into current core 2026-09-07 16:53:42 +02:00
webSearch.js feat: PubMed search for My Resources, and an image tool that actually fires 2026-09-11 16:47:08 +02:00