InputMessage
InputMessage is the message shape you pass into initialMessages and useChatStore().addMessage(...).
Fields
id?type: 'self' | 'other'parts: readonly MessagePart[]rawContent?timestamp?isLoading?loadingLabel?userResponseCallback?buttons?
Usage
tsx
import { createTextPart, type InputMessage } from 'react-actions-chat';
const initialMessages: readonly InputMessage[] = [
{
type: 'other',
parts: [createTextPart('Hello! How can I help you today?')],
},
];Notes
partsis the primary content surface for every message- built-in parts can now render text, inline images, and downloadable files
rawContentis useful when the visible transcript content is transformed, such as password maskingbuttonsattaches actions under the messageuserResponseCallbacklets the message react to the next user submission