@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
115 lines (110 loc) • 5.8 kB
TypeScript
import * as i0 from '@angular/core';
import { OnInit, OnDestroy, Type, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
import { ClientAgentDefinition, ToolResult, AIMessageStreamSteps, AgentStep, AIMessage } from '@c8y/ngx-components/ai';
import { BehaviorSubject, OperatorFunction } from 'rxjs';
declare class AgentChatComponent implements OnInit, OnDestroy {
agent: string | ClientAgentDefinition;
suggestions: {
label: string;
prompt: string;
icon?: string;
}[];
title: string;
headline: string;
welcomeText: string;
autoInstallAgents: boolean;
variables: {};
stepRenderComponent: Type<any>;
onMessageDelta: EventEmitter<string>;
onMessageText: EventEmitter<string>;
onMessageFinish: EventEmitter<string>;
onToolResult: EventEmitter<ToolResult>;
isLoading: boolean;
/**
* A stream of AI messages representing the conversation.
*/
messages$: BehaviorSubject<AIMessageStreamSteps[]>;
agentName: string;
hasError: boolean;
canCreate: boolean;
errorMsg: string;
prompt: string;
private aiService;
private gainsightService;
private alertService;
private abortController;
private assistantSubscription;
defaultAgentStepRendererPipe: OperatorFunction<AgentStep[], {
content: Type<any> | string;
origin: AgentStep;
}[]>;
ngOnInit(): Promise<void>;
sendMessage(message: AIMessage): Promise<void>;
ngOnDestroy(): void;
reprompt(userMessage: AIMessageStreamSteps): void;
rate(assistantMessage: AIMessageStreamSteps, positive: any): void;
reload(assistantMessage: AIMessageStreamSteps): void;
cancel(): void;
createAgent(): Promise<void>;
private composeErrorMessage;
private processAgentMessage;
static ɵfac: i0.ɵɵFactoryDeclaration<AgentChatComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AgentChatComponent, "c8y-agent-chat", never, { "agent": { "alias": "agent"; "required": true; }; "suggestions": { "alias": "suggestions"; "required": false; }; "title": { "alias": "title"; "required": false; }; "headline": { "alias": "headline"; "required": false; }; "welcomeText": { "alias": "welcomeText"; "required": false; }; "autoInstallAgents": { "alias": "autoInstallAgents"; "required": false; }; "variables": { "alias": "variables"; "required": false; }; "stepRenderComponent": { "alias": "stepRenderComponent"; "required": false; }; }, { "onMessageDelta": "onMessageDelta"; "onMessageText": "onMessageText"; "onMessageFinish": "onMessageFinish"; "onToolResult": "onToolResult"; }, never, never, true, never>;
}
declare class AgentStepFeedbackComponent implements OnInit, OnChanges {
step: AgentStep;
label: string;
loading: boolean;
collapsed: boolean;
canCollapse: boolean;
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
parseDefaultAgentStep(step: AgentStep): void;
static ɵfac: i0.ɵɵFactoryDeclaration<AgentStepFeedbackComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AgentStepFeedbackComponent, "c8y-agent-step-feedback", never, { "step": { "alias": "step"; "required": true; }; "label": { "alias": "label"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "collapsed": { "alias": "collapsed"; "required": false; }; "canCollapse": { "alias": "canCollapse"; "required": false; }; }, {}, never, never, true, never>;
}
declare class WidgetAiChatSectionComponent implements OnInit {
suggestions: Array<{
label: string;
prompt: string;
}>;
agent: string | ClientAgentDefinition;
headline: "Welcome!";
title: string;
welcomeText: any;
variables: {
[key: string]: any;
};
useContextAsVariable: boolean;
contextVariableName: string;
_renderStepComponent: Type<any>;
private readonly widgetConfigService;
private readonly alertService;
private readonly contextRouteService;
/**
* A component that is used to render each step in the chat. By default, it uses the `AgentStepFeedbackComponent`.
* You can provide your own component by returning it from this callback.
*
* @returns A promise that resolves to a component type.
*/
loadRenderStepComponent: () => Promise<Type<any>>;
/**
* A callback that is invoked when a tool result is returned. The function can return either:
* - `undefined` or `void`: No action is taken.
* - an object which is stored to the widget configuration.
*/
onToolResult: (step: ToolResult) => undefined | any;
/**
* @ignore
*/
ngOnInit(): Promise<void>;
/**
* Handles the tool result returned from the AI agent.
* @param tool The tool result returned from the AI agent.
*/
toolResultHandler(tool: ToolResult): void;
static ɵfac: i0.ɵɵFactoryDeclaration<WidgetAiChatSectionComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<WidgetAiChatSectionComponent, "c8y-widget-ai-chat-section", never, { "suggestions": { "alias": "suggestions"; "required": false; }; "agent": { "alias": "agent"; "required": false; }; "headline": { "alias": "headline"; "required": false; }; "title": { "alias": "title"; "required": false; }; "welcomeText": { "alias": "welcomeText"; "required": false; }; "variables": { "alias": "variables"; "required": false; }; "useContextAsVariable": { "alias": "useContextAsVariable"; "required": false; }; "contextVariableName": { "alias": "contextVariableName"; "required": false; }; "loadRenderStepComponent": { "alias": "loadRenderStepComponent"; "required": false; }; }, {}, never, never, true, never>;
}
export { AgentChatComponent, AgentStepFeedbackComponent, WidgetAiChatSectionComponent };
//# sourceMappingURL=index.d.ts.map