Chat

The Chat component is an interface element designed for messaging and communication within an application. It provides users with the ability to exchange messages with chatbots in real time.

Methods & Properties

MethodDescription

setMessages(Array[]: {role: user|assistant, content: string, created_at: Date, id?: string, avatar?: string})

Set messages

addMessage(role: user|assistant, content: string, id?: string, avatar?: string)

Add message

upsertLastMessage(role: user|assistant, content: string, id?: string, avatar?: string)

Insert or update last message

startReceiving()

Start receiving message

stopReceiving()

Stop receiving message

messages

Get an array of messages

briefMessages

Get an array of simplified messages (role and content properties only) ☝🏻Useful for integration with ChatGPT and similar APIs

Triggers

Triggers allow you to launch certain actions based on different events.

TriggerDescription

On Init

Calls for an action on component initialization, e.g., page refresh

On Message Sent

Calls for action on message sent by user

On Stop Receiving

Calls for action by clicking the "Stop" button

Last updated

© 2024 UI Bakery