UNPKG

@kaifronsdal/transcript-viewer

Version:

A web-based viewer for AI conversation transcripts with rollback support

132 lines (116 loc) 2.94 kB
// Base types that match the Python Pydantic models export interface ToolCall { name: string; args: Record<string, any>; id: string; render?: string | Record<string, any>; } export interface Message { content: string | Array<string | Record<string, any>>; type: 'system' | 'assistant' | 'user' | 'tool' | 'api_failure'; name: string; id: string; metadata: Record<string, any>; tool_calls?: ToolCall[]; tool_call_id?: string; status?: 'success' | 'error'; error_category?: string; error_message?: string; recoverable?: boolean; // UI-specific properties isShared?: boolean; viewSource?: string | string[]; } export interface MessageWithUIProps extends Message { isShared: boolean; viewSource?: string | string[]; eventId?: string; // ID of the event that created this message } export interface Edit { operation: 'add' | 'rollback' | 'reset'; message?: Message; count?: number; to_id?: string; new_messages?: Message[]; } export interface TranscriptEvent { type: 'transcript_event'; id: string; metadata?: Record<string, any>; timestamp: string; view: string | string[]; edit: Edit; } export interface ToolDefinition { name: string; description: string; parameters: Record<string, ToolParameter>; required?: string[]; } export interface ToolParameter { type: string; description?: string; enum?: string[]; items?: Record<string, any>; properties?: Record<string, any>; required?: string[]; } export interface ToolCreationEvent { type: 'tool_creation_event'; id: string; metadata?: Record<string, any>; timestamp: string; model: string; tool: ToolDefinition; } export type Events = TranscriptEvent | ToolCreationEvent; export interface JudgeOutput { response: string; summary: string; justification: string; scores: Record<string, number>; } export interface TranscriptMetadata { transcript_id: string; auditor_model?: string; target_model?: string; created_at: string; updated_at: string; version: string; description?: string; short_name?: string; tags?: string[]; judge_output?: JudgeOutput; } export interface Transcript { metadata: TranscriptMetadata; events: (TranscriptEvent | ToolCreationEvent)[]; } export interface TranscriptDisplay { id: string; model: string; split: string; concerningScore: number; summary: string; scores: Record<string, number>; judgeSummary: string; justification: string; systemPrompt?: string; transcript: Transcript; _filePath?: string; // Optional file path for debugging } // Filter and view state types export interface FilterState { filterExpression: string; searchQuery: string; } export interface ViewSettings { viewMode: 'tree' | 'list'; } export interface TranscriptViewSettings { selectedView: string; showApiFailures: boolean; showSharedHistory: boolean; showSystemPrompt: boolean; availableViews: string[]; }