Skip to main content

Overview

CometChatAIAssistantChat is a composite component that assembles the message header, message list, and message composer to provide an AI agent chat experience. It supports streaming responses, quick starter suggestions, “New Chat” to reset context, and a chat history sidebar.
A CometChat.User (the AI agent) is required to start the assistant chat.

Actions

Actions control how a component behaves. You can hook into the following callbacks:
1. onBackButtonClicked
Called when the header back button is clicked (visible when showBackButton is true).
2. onCloseButtonClicked
Called when the header close button is clicked (visible when showCloseButton is true).
3. onSendButtonClick
Called when the composer send button is clicked.
4. onError
Listen to errors from the underlying header, list, or composer.

Customization

To fit your app’s design requirements, you can customize the appearance of the Assistant Chat component. We provide exposed properties that allow you to modify the experience and behavior according to your specific needs.

Style

You can set the css of the Assistant Chat Component to customize the styling.

Functionality

These props tailor the experience. Most message options (copy/edit/delete/react, receipts, date separators, etc.) are disabled by default for assistant chats.

Advanced

Header Views

Customize header sections using the following props: headerItemView, headerTitleView, headerSubtitleView, headerLeadingView, headerTrailingView, and headerAuxiliaryButtonView. These customizations are done in the similar way as the Message Header component.
The header’s “New Chat” and “History” buttons are built-in. You can override them by providing a custom headerAuxiliaryButtonView.

Assistant Tools

Pass an instance of CometChatAIAssistantTools to enable tool/function calls during assistant replies.

Empty Chat Image View

Provide a custom image for the empty state using emptyChatImageView.

Empty Chat Greeting View

Override the empty state greeting message view using the emptyChatGreetingView prop.

Empty Chat Intro Message View

You can override the empty chat intro message view using the emptyChatIntroMessageView prop.

Templates

CometChatMessageTemplate is a pre-defined structure for creating message views that can be used as a starting point or blueprint for creating message views often known as message bubbles. For more information, you can refer to CometChatMessageTemplate. You can set message Templates to AIAssistantChat by using the following code snippet.