AI Agent Component Spec
AI Agent Component Spec
Where It Fits
CometChatAIAssistantChatHistory is a pre-built user interface widget designed to display the conversation history between users and an AI assistant within a chat application. It provides a structured and visually appealing way to present past interactions, making it easy for users to review previous messages and context.
Minimal Render
The simplest way to render CometChatAIAssistantChatHistory:- Dart
- Dart
- Dart
Filtering
You can adjust theMessagesRequestBuilder to customize the message list. Numerous options are available to alter the builder to meet your specific needs.
- Dart
The following parameters in messageRequestBuilder will always be altered inside the list:
- UID
- GUID
- types
- categories
MessagesRequestBuilder, please visit MessagesRequestBuilder.
Actions and Events
Callback Props
Component-level callbacks that fire on specific user interactions:| Callback | Signature | Fires When |
|---|---|---|
onMessageClicked | void Function(BaseMessage? message)? | User clicks a message |
onNewChatButtonClicked | VoidCallback? | User clicks the new chat button |
onError | OnError? | An error occurs while fetching messages |
onLoad | OnLoad<BaseMessage>? | List is successfully loaded |
onEmpty | OnEmpty? | List is empty |
onClose | VoidCallback? | User clicks the back/close button |
- Dart
Global UI Events
The CometChatAIAssistantChatHistory component does not produce any global UI events.Custom View Slots
Customize the appearance of CometChatAIAssistantChatHistory by replacing default views with your own widgets.| Slot | Signature | Replaces |
|---|---|---|
loadingStateView | WidgetBuilder? | Loading spinner |
emptyStateView | WidgetBuilder? | Empty state display |
errorStateView | WidgetBuilder? | Error state display |
backButton | Widget? | Back/close button |
Example: Custom Back Button
- Dart
Example: Custom Loading State
- Dart
Example: Custom Empty State
- Dart
Date Separator Pattern
You can modify the date pattern of the chat history date separator usingdateSeparatorPattern:
- Dart
Styling
Customize the appearance of CometChatAIAssistantChatHistory usingCometChatAIAssistantChatHistoryStyle.
- Dart

Style Properties
| Property | Type | Description |
|---|---|---|
backgroundColor | Color? | Background color of the message list |
border | BoxBorder? | Border of the message list |
borderRadius | BorderRadiusGeometry? | Border radius of the message list |
emptyStateTextStyle | TextStyle? | Style of empty state text |
emptyStateTextColor | Color? | Color of empty state text |
emptyStateSubtitleStyle | TextStyle? | Style of empty state subtitle |
emptyStateSubtitleColor | Color? | Color of empty state subtitle |
errorStateTextStyle | TextStyle? | Style of error state text |
errorStateTextColor | Color? | Color of error state text |
errorStateSubtitleStyle | TextStyle? | Style of error state subtitle |
errorStateSubtitleColor | Color? | Color of error state subtitle |
dateSeparatorStyle | CometChatDateStyle? | Style for date separator |
newChatIconColor | Color? | Color of new chat icon |
newChaTitleStyle | TextStyle? | Style of new chat title |
newChatTextColor | Color? | Color of new chat text |
itemTextStyle | TextStyle? | Style of item text |
itemTextColor | Color? | Color of item text |
headerBackgroundColor | Color? | Background color of header |
headerTitleTextStyle | TextStyle? | Style of header title text |
headerTitleTextColor | Color? | Color of header title text |
closeIconColor | Color? | Color of close icon |
separatorHeight | double? | Height of separator |
separatorColor | Color? | Color of separator |
deleteChatHistoryDialogStyle | CometChatConfirmDialogStyle? | Style for delete dialog |
Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
user | User? | null | User object for user message list |
group | Group? | null | Group object for group message list |
messagesRequestBuilder | MessagesRequestBuilder? | null | Custom request builder |
loadingStateView | WidgetBuilder? | null | Custom loading view |
emptyStateView | WidgetBuilder? | null | Custom empty view |
errorStateView | WidgetBuilder? | null | Custom error view |
onMessageClicked | void Function(BaseMessage?)? | null | Message click callback |
onError | OnError? | null | Error callback |
onLoad | OnLoad<BaseMessage>? | null | Load callback |
onEmpty | OnEmpty? | null | Empty callback |
onNewChatButtonClicked | VoidCallback? | null | New chat button callback |
style | CometChatAIAssistantChatHistoryStyle? | null | Style configuration |
dateSeparatorPattern | String Function(DateTime)? | null | Date separator pattern |
dateTimeFormatterCallback | DateTimeFormatterCallback? | null | Date/time formatter |
emptyStateText | String? | null | Empty state text |
emptyStateSubtitleText | String? | null | Empty state subtitle |
errorStateText | String? | null | Error state text |
errorStateSubtitleText | String? | null | Error state subtitle |
onClose | VoidCallback? | null | Close callback |
backButton | Widget? | null | Custom back button |
width | double? | null | Widget width |
height | double? | null | Widget height |
hideStickyDate | bool? | null | Hide sticky date separator |
hideDateSeparator | bool? | null | Hide date separator |
Message List
Display messages in a conversation
Message Composer
Compose and send messages
Theming
Learn how to customize the look and feel
Localization
Support multiple languages in your app