feat: link citation markers in the render pipeline

renderModelOutput now takes the turn's sources and reports back which numbers it
linked, so the list has one source of truth for what the answer actually cited.

Maths runs before citations, not after. A link label has to escape its brackets,
and that escaped form is exactly LaTeX's own display delimiter, so converting the
model's maths first is what stops the maths pass from eating a marker and handing
back a bare 1.
This commit is contained in:
2026-10-07 16:11:18 +08:00
parent 1a8e767fbe
commit 41de7e1cc6
3 changed files with 118 additions and 37 deletions
+1 -1
View File
@@ -154,7 +154,7 @@ function renderMessage(message: ThreadMessage, options: TranscriptOptions): stri
? // One pass, in one place: fences get their languages and links recovered,
// then TeX becomes something drawable and the HTML around it is filtered to
// the subset the renderer acts on. See `render.ts` for the order and why.
renderModelOutput(answered)
renderModelOutput(answered).text
: !message.isStreaming
? "_No response._"
: activityLine