UNPKG

jodit-pro

Version:

PRO Version of Jodit Editor

53 lines (52 loc) 1.54 kB
import type { IDictionary } from "jodit/esm/types/index"; import type { IAIArtifact } from "./artifacts"; import type { IToolCall, IToolResult } from "./tools"; import type { MessageRole } from "./types"; /** * Represents a single message in a conversation */ export interface IAIMessage { /** Unique message identifier */ readonly id: string; /** Role of the message sender */ readonly role: MessageRole; /** Message content */ readonly content: string; /** Timestamp when message was created */ readonly timestamp: number; /** Optional tool calls requested by assistant */ readonly toolCalls?: Readonly<IToolCall[]>; readonly toolResults?: Readonly<IToolResult[]>; /** Optional artifacts generated by AI: image, audio etc. */ readonly artifacts?: IAIArtifact[]; } /** * Response from AI API */ export interface IAIResponse { /** Unique message ID for the response */ responseId: string; /** Response content */ content: string; /** Optional tool calls requested by AI */ toolCalls?: IToolCall[]; /** Whether the response is complete */ finished: boolean; /** Optional metadata from API */ metadata?: IDictionary; /** Optional artifacts generated by AI: image, audio etc. */ artifacts?: IAIArtifact[]; } export type AIStreamEvent = { type: 'created'; response: IAIResponse; } | { type: 'text-delta'; delta: string; } | { type: 'completed'; response: IAIResponse; } | { type: 'error'; error: Error; };