Files
stack/tests/llm
kert 1b81aeac92
Some checks failed
CI / lint (push) Successful in 39s
CI / notebooks-smoke (push) Successful in 1m39s
Deploy / notebooks (push) Has been skipped
Deploy / zotero (push) Has been skipped
Deploy / docs (push) Has been skipped
CI / test (push) Failing after 2m29s
Deploy / api (push) Has been skipped
Deploy / llm (push) Has been skipped
Deploy / mc (push) Has been skipped
Infra CI / zotero (push) Successful in 15s
Infra CI / docs (push) Successful in 20s
Infra CI / notebooks (push) Successful in 52s
Infra CI / api (push) Successful in 1m2s
Infra CI / llm (push) Successful in 47s
Deploy / report (push) Successful in 14s
Infra CI / mc (push) Failing after 37s
feat(llm): in-page PDF viewer for comment and article attachments — /ui/pdf/<key>, /pdf/<key>[/file], self-hosted PDF.js, viewer links on chat sources and search hits
Rules keep their federalregister.gov links; this is for the files the
library holds itself: a regulations.gov comment's downloaded
attachments (.state/comments/<docket>/<id>/attachment_N.*), an item's
bib attachments (data/storage/<att>/<name>) and Zotero-only storage
PDFs (zotero.sqlite read immutable, one indexed lookup per request).

llm.pdfs lists an item's attachments from those three places (comment
first, de-duplicated by name) and resolves a file by *name* only,
refusing anything outside the storage roots. GET /pdf/<key> lists
them (name, size, source, renderable, media type); GET
/pdf/<key>/file?name= serves a PDF inline with range requests and
other formats as downloads. /ui/vendor/<name> serves the vendored
pdf.js 4.10.38 (same-origin worker; no CDN dependency).

/ui/pdf/<key>?file=&page=&q=: continuous scroll, pages rendered lazily
(IntersectionObserver, ~1.5 screens ahead) at device pixel ratio,
re-fit on resize/orientation (ResizeObserver, debounced), fit-to-width
and zoom, page input with hash tracking, a text layer for selection,
whole-document find with highlights (seeded from the cited snippet),
keyboard shortcuts, a file selector when an item has several, and a
download fallback when a file is not a PDF or cannot be rendered.

as_source carries attachment + page from the chunk metadata; the chat
sources and search hits show a 'PDF p.N' link into the viewer for
comment/corpus sources. compose: the llm service mounts
./.state/comments read-only.
2026-09-24 18:56:10 -04:00
..