mirror of
https://github.com/temetro/temetro.git
synced 2026-08-30 12:19:07 +00:00
feat(ai): inline source citations in the AI chat
Retrieval tools now register a PHI-free sourceId per record/list and stream a data-source part with the real clinician-facing title; the system prompt asks the model to cite facts inline as [[src:id]]. The chat renders those markers as numbered inline citation chips (PreviewCard hover) via a Streamdown link override, with a Sources footer fallback when the model omits markers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -163,6 +163,13 @@ function systemPrompt(
|
||||
"instructions. Never invent clinical values; only state what the tools return.",
|
||||
"The record cards are rendered to the clinician automatically when you call a",
|
||||
"tool, so keep your prose a brief summary rather than re-listing every field.",
|
||||
"",
|
||||
"Citations: every retrieval tool result includes a `sourceId` (e.g. \"s1\").",
|
||||
"When you state a fact drawn from a tool result, append an inline citation",
|
||||
"marker immediately after that statement, in the exact form [[src:ID]] using",
|
||||
"the matching sourceId — e.g. \"BP is well controlled [[src:s1]].\" Cite only",
|
||||
"facts grounded in tool results, place the marker right after the relevant",
|
||||
"sentence, and never invent or guess a sourceId.",
|
||||
veilActive
|
||||
? `Privacy: this conversation runs on an external provider (${providerLabel}). Patient identifiers are de-identified as tokens like [PATIENT_1] / [MRN_1]; refer to patients generically ("this patient") rather than repeating tokens.`
|
||||
: "",
|
||||
|
||||
Reference in New Issue
Block a user