Skip to main content

Overview

CometChatAIAssistantChat is the top-level orchestrator for the AI assistant chat experience. It wires together CometChatMessageHeader, CometChatMessageList, CometChatMessageComposer, and the CometChatAIAssistantChatHistory sidebar into a single cohesive interface. Key capabilities:
  • Real-time streaming — integrates with CometChatAIStreamingService to display live AI responses token-by-token
  • Tool call dispatch — registers CometChatAIAssistantTools handlers that the streaming service invokes automatically
  • Chat history sidebar — browse and resume past AI conversations without losing context
  • Suggestion pills — configurable quick-reply prompts sourced from explicit input or user metadata
  • Concurrent run support — multiple AI responses can stream simultaneously without state corruption
  • Keyboard accessible — full focus management including sidebar open/close focus trapping and restoration
Live Preview — default AI assistant chat preview. Open in Storybook ↗

Basic Usage

Inputs

Events

This component does not emit outputs directly — it manages all state internally and communicates with child components via signals and the CometChatAIStreamingService.

Advanced Usage

Registering Tool Handlers

Use CometChatAIAssistantTools to register client-side functions the AI can call during a conversation. The streaming service dispatches them automatically when a tool_call_end event is received.

Suggestion Pills

Provide quick-reply prompts to guide users. If suggestedMessages is empty, the component falls back to user.getMetadata().suggestedMessages.

Custom Greeting Template

Render a personalized greeting before the first message using the greetingTemplate input. The template context exposes the agent user as $implicit.

Concurrent Runs

The component supports multiple simultaneous AI responses. Each run streams independently — a slow tool call in one run does not block text streaming in another. This is handled automatically by CometChatAIStreamingService using per-run concatMap pipelines merged via mergeMap.

Controlling Streaming Speed

Adjust the per-token animation delay at runtime. The streamingSpeed input is synced to the service via an effect() — changes take effect immediately for all active and future runs.

Customization

CSS Variables

All visual properties are controlled via CSS variables. Override them in your global stylesheet or a scoped component style:

Localization Keys

Override any key via CometChatLocalize.updateKeys():