@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
146 lines (140 loc) • 6.32 kB
TypeScript
import * as i0 from '@angular/core';
import { EventEmitter, QueryList } from '@angular/core';
import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';
import { AIMessage, ChatConfig } from '@c8y/ngx-components/ai';
/**
* An action button that can be added to chat messages.
* Typically used for actions like copying, regenerating, or providing feedback on messages.
*/
declare class AiChatMessageActionComponent {
/**
* Disables the action button when true.
*/
disabled: boolean;
/**
* Tooltip text displayed when hovering over the action button.
*/
tooltip: string;
/**
* Icon to display in the action button.
*/
icon: SupportedIconsSuggestions;
/**
* Emitted when the action button is clicked.
*/
click: EventEmitter<void>;
static ɵfac: i0.ɵɵFactoryDeclaration<AiChatMessageActionComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AiChatMessageActionComponent, "c8y-ai-chat-message-action", never, { "disabled": { "alias": "disabled"; "required": false; }; "tooltip": { "alias": "tooltip"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; }, { "click": "click"; }, never, never, true, never>;
}
declare class AiChatMessageComponent {
readonly role: i0.InputSignal<"user" | "assistant">;
readonly message: i0.InputSignal<AIMessage>;
private readonly translateService;
private readonly roleResolved;
/**
* Generates an accessible label for the message container.
* Includes the role (user or assistant) and timestamp if available.
* @returns The aria-label string for screen readers
*/
readonly ariaLabel: i0.Signal<any>;
/**
* Generates an accessible label for the message content.
* Prefixes the content with contextual information about who sent it.
* @returns The aria-label string with prefixed role information
*/
readonly messageContentAriaLabel: i0.Signal<any>;
static ɵfac: i0.ɵɵFactoryDeclaration<AiChatMessageComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AiChatMessageComponent, "c8y-ai-chat-message", never, { "role": { "alias": "role"; "required": false; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; }, {}, never, [":not(c8y-ai-chat-message-action)", "c8y-ai-chat-message-action"], true, never>;
}
/**
* A suggestion chip that can be displayed in the chat interface.
* When clicked, it automatically populates and sends a predefined prompt.
*/
declare class AiChatSuggestionComponent {
/**
* The visible label text displayed on the suggestion chip.
*/
label: string;
/**
* The prompt text that will be sent when the suggestion is clicked.
*/
prompt: string;
/**
* Icon to display alongside the suggestion label.
*/
icon: SupportedIconsSuggestions;
/**
* When true, uses AI-styled buttons instead of default styling.
*/
useAiButtons: boolean;
/**
* Disables the suggestion chip when true.
*/
disabled: boolean;
/**
* Emitted when the suggestion is clicked, providing the prompt as an AIMessage.
*/
suggestionClicked: EventEmitter<AIMessage>;
/**
* Handles suggestion click and emits the prompt as a user message.
*/
suggest(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<AiChatSuggestionComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AiChatSuggestionComponent, "c8y-ai-chat-suggestion", never, { "label": { "alias": "label"; "required": false; }; "prompt": { "alias": "prompt"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "useAiButtons": { "alias": "useAiButtons"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "suggestionClicked": "suggestionClicked"; }, never, never, true, never>;
}
/**
* An interactive chat interface component for AI-powered conversations.
* Displays messages in a conversation format with support for loading states,
* custom configuration, and markdown formatting.
*/
declare class AiChatComponent {
/**
* Indicates whether the chat is currently processing a request.
* When true, displays a cancel button instead of send button and disables the input.
*/
isLoading: boolean;
/**
* Disables the chat input and send button when true.
*/
disabled: boolean;
/**
* The current text in the chat input field. Supports two-way binding.
*/
prompt: string;
/**
* Emitted when the user sends a message.
* Provides an AIMessage object with role, content, and timestamp.
*/
onMessage: EventEmitter<AIMessage>;
/**
* Emitted when the user cancels an ongoing operation during loading state.
*/
onCancel: EventEmitter<void>;
/**
* Child message components displayed in the chat.
*/
messages: QueryList<AiChatMessageComponent>;
readonly componentId: string;
private _config;
/**
* Configuration object for customizing labels, placeholders, and icons.
* Accepts partial configuration to override defaults.
*/
set config(value: Partial<ChatConfig>);
get config(): Partial<ChatConfig>;
/**
* Handles message submission when the user sends a message.
* Emits the onMessage event and clears the input.
* @param $event - The event object from the form submission
*/
sendMessage($event: Event): void;
/**
* Handles cancellation of ongoing operations during loading state.
* Emits the onCancel event.
*/
cancel(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<AiChatComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AiChatComponent, "c8y-ai-chat", never, { "isLoading": { "alias": "isLoading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "prompt": { "alias": "prompt"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, { "onMessage": "onMessage"; "onCancel": "onCancel"; }, ["messages"], ["c8y-ai-chat-message", "*", "c8y-ai-chat-suggestion"], true, never>;
}
export { AiChatComponent, AiChatMessageActionComponent, AiChatMessageComponent, AiChatSuggestionComponent };
//# sourceMappingURL=index.d.ts.map