Interface ChatInstanceMessaging

Messaging actions for a chat instance.

interface ChatInstanceMessaging {
    addMessage: (message: MessageResponse) => Promise<void>;
    addMessageChunk: (chunk: StreamChunk) => Promise<void>;
    clearConversation: () => Promise<void>;
    insertHistory: (messages: HistoryItem[]) => Promise<void>;
    removeMessages: (messageIDs: string[]) => Promise<void>;
}

Properties

addMessage: (message: MessageResponse) => Promise<void>

Instructs the widget to process the given message as an incoming message received from the assistant. This will fire a "pre:receive" event immediately and a "receive" event after the event has been processed by the widget.

Type declaration

addMessageChunk: (chunk: StreamChunk) => Promise<void>

Adds a streaming message chunk to the chat widget.

clearConversation: () => Promise<void>

Clears the current conversation. This will trigger a restart of the conversation but will not start a new conversation (hydration).

insertHistory: (messages: HistoryItem[]) => Promise<void>

Inserts the given messages into the chat window as part of the chat history. This will fire the history:begin and history:end events.

removeMessages: (messageIDs: string[]) => Promise<void>

Removes the messages with the given IDs from the chat view.

MMNEPVFCICPMFPCPTTAAATR