UNPKG

@promptbook/templates

Version:

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

76 lines (75 loc) 3.03 kB
import type { ChatMessage } from '../../types/ChatMessage'; import type { ChatParticipant } from '../../types/ChatParticipant'; import type { ParsedCitation } from '../../utils/parseCitationsFromContent'; /** * Minimal participant visuals needed by chat exports. * * @private internal utility of chat save format definitions */ export type ChatExportParticipantVisuals = { readonly displayName: string; readonly accentColor: string; }; /** * One numbered source collected from rendered chat message citations. * * @private internal utility of chat save format definitions */ export type ChatExportCitationFootnote = { readonly number: number; readonly citation: ParsedCitation; }; /** * Document-wide citation footnotes collected while rendering chat exports. * * @private internal utility of chat save format definitions */ export type ChatExportCitationFootnoteRegistry = { readonly footnotes: Array<ChatExportCitationFootnote>; readonly footnoteBySourceKey: Map<string, ChatExportCitationFootnote>; }; /** * Render-ready chat message citation payload using document-wide footnote numbers. * * @private internal utility of chat save format definitions */ export type ChatExportCitationRenderModel = { readonly content: ChatMessage['content']; readonly footnotes: ReadonlyArray<ChatExportCitationFootnote>; }; /** * Formats exported timestamps into a compact human-readable label. * * @private internal utility of chat save format definitions */ export declare function formatChatExportTimestamp(value?: string | Date): string; /** * Builds a participant lookup indexed by both raw and upper-cased names. * * @private internal utility of chat save format definitions */ export declare function buildChatExportParticipantMap(participants: ReadonlyArray<ChatParticipant>): ReadonlyMap<string, ChatParticipant>; /** * Resolves the display label and accent color for one message sender. * * @private internal utility of chat save format definitions */ export declare function resolveChatExportParticipantVisuals(participants: ReadonlyMap<string, ChatParticipant>, sender: string): ChatExportParticipantVisuals; /** * Creates an empty document-wide citation footnote registry. * * @private internal utility of chat save format definitions */ export declare function createChatExportCitationFootnoteRegistry(): ChatExportCitationFootnoteRegistry; /** * Converts one message to markdown content with document-wide numbered citation references. * * @private internal utility of chat save format definitions */ export declare function createChatExportCitationRenderModel(citationFootnotes: ChatExportCitationFootnoteRegistry, message: Pick<ChatMessage, 'content' | 'citations'>): ChatExportCitationRenderModel; /** * Creates a readable source label for one citation footnote. * * @private internal utility of chat save format definitions */ export declare function formatChatExportCitationFootnoteLabel(footnote: ChatExportCitationFootnote, href?: string): string;