logoassistant-ui
API Reference/Runtime Hooks

MessagePartRuntime

useMessagePart

Access the message part state:

import { useMessagePart } from "@assistant-ui/react";

const part = useMessagePart();
const partState = useMessagePart.getState();

const status = useMessagePart((m) => m.status);
const statusAgain = useMessagePart.getState().status;

MessagePartState

part:

Readonly<MessagePartState>

The current message part.

status:

MessageStatus

The current message part status.

MessageStatus

type:

'running' | 'requires-action' | 'complete' | 'incomplete'

The status.

finish-reason?:

'stop' | 'cancelled' | 'length' | 'content-filter' | 'tool-calls' | 'other' | 'unknown'

The finish reason if the status is 'incomplete'.

error?:

unknown

The error object if the status is 'error'.