Runtimes

AttachmentRuntime

AttachmentRuntime state and actions for reading attachment data and controlling files inside assistant-ui messages and composers.

API Reference

AttachmentRuntime

AttachmentRuntime
pathAttachmentRuntimePath & { attachmentSource: TSource }

AttachmentRuntime["path"]
refstring

threadSelectorAttachmentRuntime["path"]["threadSelector"]

AttachmentRuntime["path"]["threadSelector"]
type"main"

attachmentSource"message" | "edit-composer"

attachmentSelectorAttachmentRuntime["path"]["attachmentSelector"]

AttachmentRuntime["path"]["attachmentSelector"]
type"index"

indexnumber

sourceTSource

getState() => AttachmentState & { source: TSource; }

remove() => Promise<void>

subscribe(callback: () => void) => Unsubscribe

AttachmentState

AttachmentState
idstring

type"image" | "document" | "file" | (string & {})

namestring

contentType?string | undefined

file?File

File
lastModifiednumber

The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date. MDN Reference

namestring

The **`name`** read-only property of the File interface returns the name of the file represented by a File object. For security reasons, the path is excluded from this property. MDN Reference

webkitRelativePathstring

The **`webkitRelativePath`** read-only property of the File interface contains a string which specifies the file's path relative to the directory selected by the user in an <input> element with its webkitdirectory attribute set. MDN Reference

sizenumber

typestring

arrayBuffer() => Promise<ArrayBuffer>

bytes() => Promise<Uint8Array<ArrayBuffer>>

slice(start?: number, end?: number, contentType?: string) => Blob

stream() => ReadableStream<Uint8Array<ArrayBuffer>>

text() => Promise<string>

content?ThreadUserMessagePart[]

statusCompleteAttachmentStatus

AttachmentState["status"]
type"complete"

source"thread-composer"