project-nomad/admin/app/services
John Cortright 9fde7f7747 feat: show source document and date as citations under RAG chat answers
Closes #1179.

Surfaces the documents an answer was drawn from as a "Sources" list under the
assistant message, with the archive date where one is known, and persists it so
reopening a past conversation still shows what backed each answer.

Offline there is no second opinion to check an answer against, so provenance is
the only signal the user has that a claim came from a real document rather than
from the model. This is the other half of retrieval being allowed to decline:
one says when nothing relevant was found, this says what was found.

Citations are built from the chunks actually injected into the prompt, not from
everything retrieval returned. A chunk dropped by the budget planner never
reached the model, so citing it would credit the answer to a document it was
not based on -- the exact failure the list exists to prevent.

The archive title and date have been written into the vector payload by the ZIM
ingestion path all along and were simply never read back, so this works on
already-embedded content with no re-embed.

Rebased onto the RagPipelineService refactor, which landed after this was
written: the citation list now comes off the pipeline trace rather than the
inline retrieval block that used to live in the controller. Entries with
neither a path nor a title are skipped rather than shown as "Unknown source" --
a row the user cannot act on makes an answer look sourced when it is not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F8Mgg1vd2eKSs8StZiuyMV
2026-09-29 15:54:41 -07:00
..
app_auto_update_service.ts feat(supply-depot): opt-in automatic updates for installed apps 2026-06-23 04:46:52 +00:00
auto_update_service.ts feat(supply-depot): opt-in automatic updates for installed apps 2026-06-23 04:46:52 +00:00
benchmark_service.ts fix(system): resolve a placeholder GPU name on the System page too 2026-09-29 15:54:41 -07:00
benchmark_telemetry.ts feat(benchmark): end-of-run score reveal + NVIDIA GPU-util overlay (#1087) 2026-08-04 03:37:40 +00:00
chat_service.ts feat: show source document and date as citations under RAG chat answers 2026-09-29 15:54:41 -07:00
collection_manifest_service.ts feat: support gated downloads for self-hosted curated content (#1172) 2026-08-04 03:39:55 +00:00
collection_update_service.ts fix(downloads): let interrupted content downloads resume (#1202) 2026-08-04 03:40:01 +00:00
condition_service.ts Add offline FDA drug reference (labels, interaction view, conditions, remedies) (#1040) 2026-08-04 03:38:33 +00:00
container_registry_service.ts fix(updates): resolve relative registry pagination URL so tag listing doesn't crash (#945) 2026-06-23 04:46:59 +00:00
content_auto_update_service.ts Add offline FDA drug reference (labels, interaction view, conditions, remedies) (#1040) 2026-08-04 03:38:33 +00:00
context_window_service.ts feat(AI): budget the prompt and actually set the context window (#1253) 2026-09-29 15:54:41 -07:00
countries_service.ts feat(Maps): regional map downloads via go-pmtiles extract (#780) 2026-05-20 10:16:00 -07:00
creator_pack_service.ts fix(downloads): let interrupted content downloads resume (#1202) 2026-08-04 03:40:01 +00:00
custom_app_guard.ts feat: supply depot 2026-06-23 04:46:45 +00:00
docker_service.ts fix(gpu): a missing /dev/kfd blocks the AI Assistant install entirely 2026-09-29 15:54:41 -07:00
docs_service.ts docs: add an in-app Drug Reference guide (#1161) 2026-08-04 03:39:58 +00:00
download_service.ts fix(queue): clear terminal jobs before re-dispatch so downloads aren't silently dropped 2026-09-29 15:54:41 -07:00
drug_reference_service.ts Add offline FDA drug reference (labels, interaction view, conditions, remedies) (#1040) 2026-08-04 03:38:33 +00:00
eval_corpus_service.ts feat(AI): budget the prompt and actually set the context window (#1253) 2026-09-29 15:54:41 -07:00
eval_generation_service.ts feat(AI): let retrieval decline instead of making the prompt paper over it 2026-09-29 15:54:41 -07:00
eval_report_service.ts feat(AI): budget the prompt and actually set the context window (#1253) 2026-09-29 15:54:41 -07:00
eval_retrieval_service.ts feat(AI): let retrieval decline instead of making the prompt paper over it 2026-09-29 15:54:41 -07:00
kiwix_catalog_service.ts fix(zim): extract Kiwix catalog URL into system-wide constant 2026-09-02 09:40:38 -07:00
kiwix_library_service.ts fix(kiwix): self-heal a missing or corrupt library XML on startup 2026-06-23 04:46:56 +00:00
map_service.ts fix(maps): warn when world basemap missing instead of silent grey map (#1104) 2026-08-04 03:38:29 +00:00
nomad_md_service.ts feat(AI): nomad.md for custom instructions (#1127) 2026-08-04 03:38:33 +00:00
ollama_service.ts fix(ai): don't probe the native embed endpoint on a non-Ollama backend 2026-09-29 15:54:41 -07:00
queue_service.ts fix(queue): share one ioredis connection across BullMQ queues and workers (#1009) 2026-06-23 04:47:08 +00:00
rag_pipeline_service.ts feat(AI): let retrieval decline instead of making the prompt paper over it 2026-09-29 15:54:41 -07:00
rag_service.ts feat: show source document and date as citations under RAG chat answers 2026-09-29 15:54:41 -07:00
system_service.ts fix(system): resolve a placeholder GPU name on the System page too 2026-09-29 15:54:41 -07:00
system_update_service.ts feat(system): add opt-in automatic updates for the core NOMAD app 2026-06-23 04:46:51 +00:00
token_calibration_service.ts feat(AI): budget the prompt and actually set the context window (#1253) 2026-09-29 15:54:41 -07:00
zim_extraction_service.ts fix(rag): don't abandon a ZIM after one sparse batch 2026-09-29 15:54:41 -07:00
zim_service.ts fix(zim): extract Kiwix catalog URL into system-wide constant 2026-09-02 09:40:38 -07:00