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
CometChatAIStreamingServiceto display live AI responses token-by-token - Tool call dispatch — registers
CometChatAIAssistantToolshandlers 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
| Input | Type | Default | Description |
|---|---|---|---|
user | CometChat.User | required | The AI agent user to chat with |
streamingSpeed | number | 30 | Per-token delay in milliseconds for the streaming animation |
aiAssistantTools | CometChatAIAssistantTools | undefined | Tool handlers the AI can invoke during a conversation |
loadLastAgentConversation | boolean | false | When true, automatically resumes the most recent conversation on load |
showSuggestedMessages | boolean | true | Whether to show suggestion pills above the composer |
suggestedMessages | string[] | [] | Explicit suggestion pill labels; falls back to user.getMetadata().suggestedMessages |
greetingTemplate | TemplateRef<{ $implicit: CometChat.User }> | undefined | Custom greeting template rendered before the first message |
Events
This component does not emit outputs directly — it manages all state internally and communicates with child components via signals and theCometChatAIStreamingService.
Advanced Usage
Registering Tool Handlers
UseCometChatAIAssistantTools 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. IfsuggestedMessages is empty, the component falls back to user.getMetadata().suggestedMessages.
Custom Greeting Template
Render a personalized greeting before the first message using thegreetingTemplate 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 byCometChatAIStreamingService using per-run concatMap pipelines merged via mergeMap.
Controlling Streaming Speed
Adjust the per-token animation delay at runtime. ThestreamingSpeed 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
| Key | Default (en-us) |
|---|---|
ai_assistant_chat_intro_message | ”How can I help you today?” |
ai_assistant_chat_composer_placeholder | ”Ask me anything…” |
ai_assistant_chat_new_chat | ”New Chat” |
ai_assistant_chat_history_title | ”AI Assistant” |
ai_assistant_chat_thinking | ”Thinking…” |
ai_assistant_chat_executing_tool | ”Executing…” |
ai_assistant_chat_no_internet | ”No internet connection” |
CometChatLocalize.updateKeys():