SiAiChatComponent documentation¶
import { SiAiChatComponent } from '@siemens/element-ng/chat-messages';A model-driven chat container component for displaying an AI chat interface with automatic scroll-to-bottom behavior.
This component provides an AI chat interface, managing scrolling behavior to keep the newest messages visible while respecting user scrolling actions. It automatically scrolls to the bottom when new content is added, unless the user has scrolled up to view older messages.
Required content projection:
• si-chat-input: Input controls for composing messages
See: ChatMessage for the chat message model
See: AiChatMessage for the AI chat message model
See: UserChatMessage for the user chat message model
See: TemplateChatMessage for the template chat message model
See: SiChatInputComponent for the chat input component
See: SiChatContainerComponent for the base chat container component
See: SiAiMessageComponent for the used AI message component
See: SiUserMessageComponent for the used user message component
See: SiChatMessageComponent for the base wrapper chat message component used by AI and user message components
Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| activityInputArgumentsLabel ¶ | TranslatableString | $localize`:@@SI_AI_CHAT_CONTAINER.INPUT_ARGUMENTS:Input arguments` | Label for activity input arguments. |
| activityOutputLabel ¶ | TranslatableString | $localize`:@@SI_AI_CHAT_CONTAINER.OUTPUT:Output` | Label for activity output. |
| activityReasoningLabel ¶ | TranslatableString | $localize`:@@SI_AI_CHAT_CONTAINER.REASONING:Reasoning` | Default name for reasoning activities. |
| aiIcon ¶ | string | 'element-ai' | Custom AI icon name, used for empty state |
| autoExpand ¶ | boolean | true | Whether the latest activity details are expanded automatically. |
| colorVariant ¶ | BackgroundColorVariant | 'base-0' | Color to use for component background. |
| disableInterrupt ¶ | boolean | false | Whether to disable the interrupt functionality |
| greeting ¶ | TranslatableString | $localize`:@@SI_AI_CHAT_CONTAINER.WELCOME_GREETING:Hello,` | The greeting text for the welcome screen |
| hideWelcomeScreen ¶ | boolean | false | Whether to hide the welcome screen when there are no messages and the chat is not loading. |
| interrupting ¶ | boolean | false | Whether the system is currently interrupting an operation. When true, forces interruptible mode and shows sending state on the input. |
| loading ¶ | boolean | false | Whether a pending loading AI message should be shown (e.g. while waiting for response). If you also want to prevent the user from sending new messages, set sending to true as well. |
| markdownOptions ¶ | SiMarkdownOptions | makeSiMarkdownOptions() | Options used to render chat message markdown. |
| messages ¶ | ChatMessage[] | undefined | List of chat messages to display. Messages can contain either content (string) or a template (TemplateRef) for custom rendering. When both content and template are provided, the template takes precedence. | |
| noAutoScroll ¶ | boolean | false | Disable auto-scroll to bottom when new messages are added |
| promptSuggestions ¶ | PromptSuggestion[] | Record<string, PromptSuggestion[]> | [] | The list of prompt suggestions for the welcome screen, either as an array or a record mapping category labels to suggestion arrays |
| secondaryActionsLabel ¶ | TranslatableString | $localize`:@@SI_AI_CHAT_CONTAINER.SECONDARY_ACTIONS:More actions` | More actions button aria label |
| sending ¶ | boolean | false | Whether a message is currently being sent, disables input and shows a loading state in the input area. If you want to show a loading state for the latest AI message, set loading to true instead. |
| show ¶ | ActivityDetailsDisplay | 'auto' | Which activity input and output parts are shown. |
| statusAction ¶ | { title: string; href: string; target?: string; } | undefined | Status notification action link | |
| statusHeading ¶ | string | undefined | Status notification heading | |
| statusMessage ¶ | string | undefined | Status notification message | |
| statusSeverity ¶ | "success" | "info" | "warning" | "danger" | "caution" | "critical" | undefined | Status notification severity | |
| welcomeMessage ¶ | TranslatableString | $localize`:@@SI_AI_CHAT_CONTAINER.WELCOME_MESSAGE:how can I help you today?` | The welcome message text for the welcome screen |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| messageSent ¶ | { content: string; attachments: ChatInputAttachment[]; } | Emitted when a new message is sent |
Attributes and Methods¶
| Name | Type | Default | Description |
|---|---|---|---|
| focus() ¶ | () => void | Focuses the chat input component if it exists. | |
| (readonly) inputInterruptible ¶ | Signal<boolean> | ... | Implements SiChatInputParent |
| (readonly) inputSending ¶ | Signal<boolean> | ... | Implements SiChatInputParent |
| onInputSend() ¶ | () => void | Implements SiChatInputParent | |
| scrollToBottom() ¶ | () => void | Scrolls to the bottom of the messages container immediately. This method forces a scroll even if the user has scrolled up. |
Types Documentation¶
import type { ActivityDetailsDisplay } from '@siemens/element-ng/chat-messages'; import type { BackgroundColorVariant } from '@siemens/element-ng/common';Use this type with filter components colorVariant to render component variants based on background of container
ChatMessage
| UserChatMessage | AiChatMessage | ActivityChatMessage | ActivityTraceChatMessage | TemplateChatMessage ¶import type { ChatMessage } from '@siemens/element-ng/chat-messages';Chat message type union of all supported message types in the AI chat container.
See: UserChatMessage for user messages
See: AiChatMessage for AI messages
See: ActivityChatMessage for individual activities
See: ActivityTraceChatMessage for grouped activities
See: TemplateChatMessage for template-based messages
See: BaseChatMessage for the base chat message interface
See: SiAiChatComponent for the AI chat container where this is used
import type { PromptSuggestion } from '@siemens/element-ng/chat-messages'; import { SiMarkdownOptions } from '@siemens/element-ng/markdown';Options for the markdown renderer. This holds all configuration and allows installing extensions. A number of extensions are already ready to use and shipped with Element.
Example:
import { siMarkdownMathKaTeX } from '@siemens/element-ng/markdown/extensions/math';
import remarkGemoji from 'remark-gemoji';
protected markdownOptions = new SiMarkdownOptions()
.installExtension(siMarkdownMathKaTeX())
.installUnifiedPlugin(remarkGemoji);
<si-markdown [markdown]="markdownText()" [options]="markdownOptions" />
-
() => SiMarkdownOptions¶
-
getCodeTypeHandlers
() => Map<string, TypeHandler>¶Returns: All code type handlers
-
getHighlighter
() => SiMarkdownHighlighter | undefined¶Returns: The highlighter
-
getTypeHandlers
() => TypeHandler[]¶Returns: All type handlers
-
installExtension
(extension: SiMarkdownExtension) => SiMarkdownOptions¶Installs a extension which can contain plugins, type handlers
Returns: self for chaining
Parameters-
• The extension definition
-
-
installUnifiedPlugin
(plugin: UnifiedPlugin, options?: any) => SiMarkdownOptions¶Installs a plugin into the
unifiedchainReturns: self for chaining
-
makeProcessor
(meta: SiMarkdownMetadata) => Processor<Root, Root, SiMarkdownRoot, undefined, undefined>¶Creates the
unifiedprocessor with all plugins and optionsReturns:
unifiedprocessorParameters -
registerDirective
(directives: TypeHandler | TypeHandler[]) => SiMarkdownOptions¶Registers a component used to render a named Markdown directive.
Returns: self for chaining
Parameters -
setCodeHighlighter
(highlighter?: SiMarkdownHighlighter) => SiMarkdownOptions¶Sets the code highlighter
Parameters-
• The highlighter
-
import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit. Equivalent to a normal string in usage and functionality.
import type { ChatInputAttachment } from '@siemens/element-ng/chat-messages';Attachment item interface for file attachments in chat messages, extension of Attachment for SiAttachmentListComponent to use within SiChatInputComponent. Adds the action file information. Can be used within SiChatContainerComponent.
See: Attachment for base attachment interface
See: SiAttachmentListComponent for the attachment list component
See: SiChatInputComponent for the chat input component
See: SiChatContainerComponent for the base chat container component where this can be used
See: SiAiChatComponent for the AI chat container where this needs to be used
-
File object
-
File name
name:
stringInherited from Attachment¶ -
Optionally show a preview of the attachment by providing a template that is shown in a modal when clicked (optional)
previewTemplate?:
TemplateRef<any> | (() => TemplateRef<any>)Inherited from Attachment¶ -
File size in bytes
-
MIME type
import type { SiChatInputParent } from '@siemens/element-ng/chat-messages';Parent contract used by SiChatInputComponent when it is projected into a chat container.
-
inputInterruptible:
readonlySignal<boolean>¶ -
inputSending:
readonlySignal<boolean>¶
-
onInputSend
() => void¶
import type { UserChatMessage } from '@siemens/element-ng/chat-messages';User chat message for AI chats
See: SiAiChatComponent for the AI chat container where this is used
-
Actions available for this message
-
Attachments (for user messages)
-
Message content, should be a string, empty string shows loading state
content:
stringInherited from BaseChatMessage¶ -
Whether the message is currently loading/being generated - can be a boolean or Signal<boolean>
loading?:
boolean | Signal<boolean>Inherited from BaseChatMessage¶ -
Type of message
type:
"user"Inherited from BaseChatMessage¶
import type { AiChatMessage } from '@siemens/element-ng/chat-messages';AI chat message
See: SiAiChatComponent for the AI chat container where this is used
-
Actions available for this message
-
Message content - can be a string or a Signal<string>, empty string shows loading state, set signal back to string to end "streaming" state
content:
string | Signal<string>Inherited from BaseChatMessage¶ -
Whether the message is currently loading/being generated - can be a boolean or Signal<boolean>
loading?:
boolean | Signal<boolean>Inherited from BaseChatMessage¶ -
Type of message
type:
"ai"Inherited from BaseChatMessage¶
import type { ActivityChatMessage } from '@siemens/element-ng/chat-messages';Progress or intermediate activity shown between chat messages.
-
Overrides automatic expansion for this activity.
-
Overrides automatic input expansion. Record keys can be selected individually.
autoExpandInputs?:
boolean | string[]¶ -
Overrides automatic output expansion.
-
Reasoning content rendered directly in the activity.
-
Alternative icon. Set to false to show the generic activity marker.
-
Activity inputs. Record entries are rendered as individual message parts.
-
Label for the input arguments section.
-
Whether the activity is still running.
-
Nested activities.
-
Activity name. Defaults to the reasoning label for content-only activities.
-
Output from the activity.
-
Label for the output section.
import type { ActivityTraceChatMessage } from '@siemens/element-ng/chat-messages';Related activities grouped under a shared collapsible heading. The latest trace stays expanded until a user message follows it.
-
Overrides automatic expansion for this trace.
-
Activities in execution order.
-
Activity trace name.
import type { TemplateChatMessage } from '@siemens/element-ng/chat-messages';Render custom chat message via template, consider using SiChatMessageComponent inside the template for consistent styling
See: SiAiChatComponent for the AI chat container where this is used
See: SiChatMessageComponent for the chat message wrapper component which can be used inside the template
-
Template to render the message
-
Context data to pass to the template
import type { UnifiedPlugin } from '@siemens/element-ng/markdown'; import type { TypeHandler } from '@siemens/element-ng/markdown';Type handler for a named type. This can be an AST node type, a code type, a directive name
-
The component used to render the node
component:
Type<SiMarkdownExtensionComponent>Inherited from ComponentWithOptions<SiMarkdownExtensionComponent>¶ -
Options passed to the component
options?:
anyInherited from ComponentWithOptions<SiMarkdownExtensionComponent>¶ -
Type name
import type { SiMarkdownExtension } from '@siemens/element-ng/markdown';An extension to the si-markdown component
-
Special code type handlers to install
-
Directives
-
unifiedplugins to install -
Type handlers to install
types?:
TypeHandler[]¶
import type { SiMarkdownHighlighter } from '@siemens/element-ng/markdown'; SiMarkdownRoot
Omit<Root, 'children'> & { children: ExtendedRootContent[]; references?: { footnoteDefinitions?: Map<string, FootnoteDefinition>; definitions?: Map<string, Definition>; }; } ¶import type { SiMarkdownRoot } from '@siemens/element-ng/markdown';Extended root with references
import type { SiMarkdownMetadata } from '@siemens/element-ng/markdown';Options passed to makeProcessor()
import type { Attachment } from '@siemens/element-ng/chat-messages';Attachment item interface for file attachments in chat messages, used by SiAttachmentListComponent and inside SiUserMessageComponent as well as SiChatInputComponent.
See: SiAttachmentListComponent for the attachment list component
See: SiUserMessageComponent for the user message
See: SiChatInputComponent for the chat input component
-
File name
-
Optionally show a preview of the attachment by providing a template that is shown in a modal when clicked (optional)
previewTemplate?:
TemplateRef<any> | (() => TemplateRef<any>)¶
import type { MenuItemAction } from '@siemens/element-ng/menu'; -
Action that called when the item is triggered. A function will be called, a string will be dispatched to the SiMenuActionService.
action:
string | ((actionParam: any, source: MenuItemAction) => void)¶ -
Badge that is rendered after the label.
badge?:
string | numberInherited from MenuItemBase¶ -
Color of the badge (not iconBadge).
badgeColor?:
stringInherited from MenuItemBase¶ -
Whether the menu item id disabled.
disabled?:
booleanInherited from MenuItemBase¶ -
Optional icon that will be rendered before the label.
icon?:
stringInherited from MenuItemBase¶ -
Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered.
iconBadge?:
string | number | booleanInherited from MenuItemBase¶ -
ID that will be attached to the DOM node.
id?:
stringInherited from MenuItemBase¶ -
Label that is shown to the user.
label:
TranslatableStringInherited from MenuItemBase¶
import type { BaseChatMessage } from '@siemens/element-ng/chat-messages';Base interface for all chat messages. Messages can be rendered either with content or with a custom template for advanced styling and functionality.
See: ChatMessage for the chat message type union
See: UserChatMessage for user messages
See: AiChatMessage for AI messages
See: TemplateChatMessage for template-based messages
import type { SiMarkdownExtensionComponent } from '@siemens/element-ng/markdown';Interface an extension component must implement
-
Node to be rendered
-
Options passed to the component
-
The parent node
import type { SiMarkdownHighlighterComponent } from '@siemens/element-ng/markdown';Interface a code highlighter component must implement
-
The code to be highlighted
-
The language
-
Options passed to the component
-
Function the highlighter can call to updated the displayed language
updateLanguage:
InputSignal<(lang?: string) => void>¶
import type { ExtendedRootContent } from '@siemens/element-ng/markdown'; import type { SiMarkdownCitation } from '@siemens/element-ng/markdown';Citation metadata associated with a markdown response.
-
Optional source description.
description?:
stringInherited from SourceReference¶ -
Identifier referenced by bracket notation, such as
[source-1]. -
Source name displayed to the user.
name:
stringInherited from SourceReference¶ -
Zero-based, end-exclusive source range of the citation reference in the markdown source.
-
Optional source quote. Takes precedence over description.
quote?:
stringInherited from SourceReference¶ -
Source URL.
url:
stringInherited from SourceReference¶
import type { MenuItemBase } from '@siemens/element-ng/menu'; -
Badge that is rendered after the label.
-
Color of the badge (not iconBadge).
-
Whether the menu item id disabled.
-
Optional icon that will be rendered before the label.
-
Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered.
-
ID that will be attached to the DOM node.
-
Label that is shown to the user.
import type { Footnotes } from '@siemens/element-ng/markdown';Extra node for collecting all footnotes
-
List of children.
children:
FootnoteDefinition[]Inherited from Parent¶ -
Info from the ecosystem.
-
Position of a node in a source document.
Nodes that are generated (not in the original source document) must not have a position.
-
Node type.
import type { Citations } from '@siemens/element-ng/markdown';Container for one or more adjacent citation nodes.
import type { DirectiveNode } from '@siemens/element-ng/markdown';AST node created by remark-directive.
-
Attributes declared on the directive.
attributes:
Record<string, string | undefined>¶ -
List of children.
children:
RootContent[]Inherited from Parent¶ -
Info from the ecosystem.
-
The directive name without its leading colons.
-
Position of a node in a source document.
Nodes that are generated (not in the original source document) must not have a position.
-
Node type.
type:
"containerDirective" | "leafDirective" | "textDirective"Inherited from Node¶
import type { SourceReference } from '@siemens/element-ng/source-chip';Definition of a single source
import type { Citation } from '@siemens/element-ng/markdown';Inline node that references an item in the source citation array.
-
Info from the ecosystem.
-
Position of a node in a source document.
Nodes that are generated (not in the original source document) must not have a position.
-
Text replaced by a position-based citation.
-
Node type.
Except where otherwise noted, content on this site is licensed under MIT License.