logoassistant-ui
API ReferenceRuntime Hooks

ContentPartRuntime

useContentPart

Access the content part state:

import { useContentPart } from "@assistant-ui/react";
 
const part = useContentPart();
const partState = useContentPart.getState();
 
const status = useContentPart((m) => m.status);
const statusAgain = useContentPart.getState().status;

ContentPartState

part:

Readonly<ContentPartState>

The current content part.

status:

MessageStatus

The current content 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'.

On this page

Edit on Github