Skip to content

@sqlrooms/ai / ChatAttachmentsState

Type Alias: ChatAttachmentsState

ChatAttachmentsState = object

Transient files and actions shared by attachment UI under one chat root.

Properties

attachments

attachments: FileUIPart[]

Files waiting to be included in the next user message.


append

append: (attachments) => void

Adds already-serialized AI SDK file parts without asynchronous work.

Parameters

ParameterType
attachmentsFileUIPart[]

Returns

void


appendAsync

appendAsync: (prepare) => Promise<boolean>

Prepares files asynchronously and appends them only if the composer state has not been cleared while the work is pending.

Parameters

ParameterType
prepare() => Promise<FileUIPart[]>

Returns

Promise<boolean>

Whether the prepared attachments were still current and appended.


remove

remove: (attachment) => void

Removes one pending file part by identity.

Parameters

ParameterType
attachmentFileUIPart

Returns

void


clear

clear: () => void

Removes every pending attachment.

Returns

void