feat: source citations with footnotes in the transcript (#21)

This commit was merged in pull request #21.
This commit is contained in:
2026-10-07 08:12:48 +00:00
parent 72a63e69e6
commit fcc6d26c9d
16 changed files with 2716 additions and 205 deletions
+27
View File
@@ -84,12 +84,39 @@ export interface PendingAttachment extends Attachment {
/** Base64 of the image, with no `data:` URL prefix. Ollama wants it bare. */
base64: string;
}
/**
* One numbered source, as a web tool found it.
*
* The number is the whole point: it is assigned once per turn, printed to the
* model in the tool result, and rendered as the marker the reader clicks. The
* model and the reader therefore agree on what `[3]` means without either of them
* being asked to remember a URL.
*/
export interface Source {
/** The number the model cites. One-based, and never reused for a different page. */
index: number;
/** Page title, or the URL when the page had none. */
title: string;
url: string;
}
/** What a tool actually returned during a turn, kept for display and debugging. */
export interface ToolCallRecord {
name: string;
arguments: Record<string, unknown>;
result: string;
isError: boolean;
/**
* The sources this call added to the turn, if it consulted any.
*
* Only what this call found, never the turn's running total: the whole list is
* the flattening of a turn's records, so storing the total here would write
* the same page once per later call.
*
* Absent on turns stored before sources were numbered, which is honest rather
* than empty: those answers never cited a number, so there is nothing to draw.
*/
sources?: Source[];
/**
* Set when the call was refused because the turn had already made it twice.
*