UNPKG

@promptbook/remote-client

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

55 lines (54 loc) 1.88 kB
import type { ChatMessage } from '../types/ChatMessage'; import type { ParsedCitation } from './parseCitationsFromContent'; /** * Minimal message shape required to derive inline citation references and footnotes. * * @private utility of `<Chat/>` */ type CitationFootnoteMessage = Pick<ChatMessage, 'content' | 'citations'>; /** * One rendered citation footnote entry shown below the message body. * * @private utility of `<Chat/>` */ export type CitationFootnoteEntry = { /** * Visible footnote number assigned by first appearance in the message body. */ readonly number: number; /** * Citation metadata rendered for this footnote. */ readonly citation: ParsedCitation; }; /** * Render-ready message citation payload containing transformed content plus footnotes. * * @private utility of `<Chat/>` */ export type CitationFootnoteRenderModel = { /** * Markdown/HTML content with inline citation tokens replaced by numeric superscripts. */ readonly content: ChatMessage['content']; /** * Deduplicated footnotes ordered by first appearance in the message body. */ readonly footnotes: ReadonlyArray<CitationFootnoteEntry>; }; /** * Creates one render model that replaces raw citation tokens with numeric footnotes. * * Supported input markers: * - OpenAI-style full markers that already include the document source name. * - Bracketed id-only tokens, for example `[0:0]` or `[8:13]` * * Footnotes are deduplicated by document source while preserving the first-seen order. * * @param message - Message content plus optional structured citation metadata. * @returns Render-ready content and matching footnote entries. * * @private utility of `<Chat/>` */ export declare function createCitationFootnoteRenderModel(message: CitationFootnoteMessage): CitationFootnoteRenderModel; export {};