Message

Message

Explore the following sections to learn more about Message features:

Overview

Content of correspondence within a Thread. May contain text, images, videos, and other files.

Structure

type AttachmentType = 'file' | 'image' | 'video';

type Attachment = {
  type: AttachmentType,
  id: number | string,
  url: string,
  file?: File,
  poster?: string,
};

type TextContent = {
  type: 'text',
  text: string,
};

type MessageUserContent = string | (Attachment | TextContent)[];

type MessageAssistantContent = string | TextContent[];

type Message = {
  id: number | string;
  parentId?: number | string;
  time?: number;
  rating?: 'like' | 'dislike';
  reasoning?: {
    title?: string;
    text?: string;
    timeSec?: number;
  };
} & ({
  role: 'user';
  content: MessageUserContent;
} | {
  role: 'assistant';
  content: MessageAssistantContent;
});