Runtime Hooks
Hooks for accessing attachment state in composer and messages.
useAuiState (Attachment State)
Access the current attachment state reactively:
import { useAuiState } from "@assistant-ui/react";
const name = useAuiState((s) => s.attachment.name);
const type = useAuiState((s) => s.attachment.type);For imperative access and actions, use useAui:
import { useAui } from "@assistant-ui/react";
const aui = useAui();
aui.attachment().remove();
const state = aui.attachment().getState();Attachment Runtime
AttachmentRuntimepath: AttachmentRuntimePath & { attachmentSource: TSource; }source: TSourcegetState: () => AttachmentState & { source: TSource; }remove: () => Promise<void>subscribe: (callback: () => void) => UnsubscribeAttachment State
AttachmentStateid: stringtype: "image" | "document" | "file" | (string & {})name: stringcontentType?: string | undefinedfile?: Filecontent?: ThreadUserMessagePart[]status: CompleteAttachmentStatus | PendingAttachmentStatussource: "message" | "thread-composer" | "edit-composer"