hashbrown

UiChatResult

Chat state and commands with rendered UI messages.

UiChatResult
@typeTools
Chat.AnyTool
@typeState
components

The components offered to the model on the next request: the components option until setComponents replaces them.

lastAssistantMessage
UiAssistantMessage<Tools> | undefined

The most recent assistant response, including its rendered UI.

messages
UiChatMessage<Tools>[]

The messages with rendered UI attached to assistant responses.

setComponents
Dispatch<SetStateAction<UiKitInput<ExposedComponent<any>>[]>>

Replace the components offered to the model on the next request.

The chat keeps every component it has ever offered, one per name, with the newest definition of a name replacing older ones. Messages render with that set, so earlier answers still render after the list narrows, and new responses are parsed against it too: a provider that does not enforce the response schema strictly can still render a component that was removed.