Skip to main content
CometChatAIAssistantChatHistory lists the past conversations a user has had with an AI agent. Each row is the first message of one conversation, grouped under “Today”, “Yesterday” or a date. The navigation bar carries an inline “Chat History” title, and a New Chat row sits under it as a bar the list scrolls beneath. Tapping a row hands you that conversation’s first message, so you can reopen it; swipe or long-press a row to delete it.
CometChatAIAssistantChatHistory showing past AI chats grouped by date

Where It Fits

The message header already shows the chat-history and new-chat buttons for an AI agent (onChatHistoryClick / onNewChatClick on CometChatMessageHeader); this screen is what the first one opens.

Quick Start

Present it with the agent, and reopen a conversation from a row.
Put it in a NavigationStack: it uses the system navigation bar with an inline title, which stays at every sheet detent.onItemClick receives the conversation’s first message as the SDK’s BaseMessage. Open the agent’s chat with it as the parent message to continue that conversation.The ✕ shows only when onCloseClick is set, and then replaces the back button — the screen has one way out. Pushed without onCloseClick, the system back button is the way out.

What It Shows

  • The agent’s top-level text messages — each the start of a conversation — 20 at a time, newest first. Replies and deleted messages are left out.
  • A row is the message’s text on up to two lines. A mention reads as @Name, and markdown markers are removed.
  • A header above each day’s rows — “Today”, “Yesterday”, then a date such as “Oct 12, 2026”. It stays pinned while that day’s rows scroll beneath it. A message with no send time sits under “Updating”.
  • The next page loads when you scroll to within two rows of the end. A list that fits on the screen does not load more by itself.

Deleting

Long-press a row, or swipe it left, and choose Delete. “Delete this conversation?” asks first; confirming deletes the message on the server and removes the row. If the server refuses, the row stays and “Unable to delete conversation” appears briefly.

Actions and Events

Callback Methods

Setting onItemLongClick replaces the menu and the swipe entirely — the long press is then yours:

SDK Events (Real-Time, Automatic)

A delete made elsewhere — in the chat, or on another device — removes the row. Conversations started while the screen is open do not appear until it is opened again.

States

The New Chat row stays in every state. A page that fails after rows have loaded replaces them with the error state. Deleting the last row loaded shows the empty state, even if older conversations are still on the server.

Functionality


Custom View Slots

Replace a state’s view, change its words, or hide it.
The loading, empty and error views are initialiser arguments (loadingView, emptyView, errorView):
The same through modifiers, for a whole subtree — .cometChatAIAssistantChatHistoryLoadingView, .cometChatAIAssistantChatHistoryEmptyView, .cometChatAIAssistantChatHistoryErrorView and .cometChatAIAssistantChatHistoryHidden:

Add your own options after Delete, or replace the list. The long-press menu and the swipe draw from the same list.
Add options with addOptions, or replace the list with options:

Common Patterns

Show a group’s history

Pass group instead of user for a group’s history. A group scope builds the request but does not fetch; set it on a store and ask for the first page yourself:

Change the day header words

The day headers cannot be reworded in this toolkit.

Advanced Methods

Store Access

AIAssistantChatHistoryStore holds the state the list draws. Pass one to keep the history across presentations, or to drive it yourself:
Keep one store per agent: the request is built the first time a scope is set, and a later agent reuses it.

Subclassing

CometChatAIAssistantChatHistory is a View struct. Customise it with its slots, modifiers and style.

Style

Every property is optional; anything unset keeps the default look.
On iOS 26 the bar is Liquid Glass and draws its own title, and the rows fade beneath the bar and the New Chat row as one surface; the header text and background properties apply on earlier systems and with Reduce Transparency on, where the New Chat row is flat. The long-press menu is the system’s, so the Delete text properties reach the swipe only.

Next Steps

Message Header

The chat-history and new-chat buttons that open this screen

Message List

Open a conversation at its parent message