@c8y/ngx-components 1023.68.7 → 1023.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/agent-chat/index.d.ts +235 -75
- package/ai/agent-chat/index.d.ts.map +1 -1
- package/ai/ai-chat/index.d.ts +176 -26
- package/ai/ai-chat/index.d.ts.map +1 -1
- package/ai/index.d.ts +309 -75
- package/ai/index.d.ts.map +1 -1
- package/asset-properties/index.d.ts.map +1 -1
- package/echart/index.d.ts +4 -0
- package/echart/index.d.ts.map +1 -1
- package/echart/models/index.d.ts +2 -0
- package/echart/models/index.d.ts.map +1 -1
- package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs +680 -242
- package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs +343 -44
- package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ai.mjs +187 -75
- package/fesm2022/c8y-ngx-components-ai.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-asset-properties.mjs +11 -5
- package/fesm2022/c8y-ngx-components-asset-properties.mjs.map +1 -1
- package/fesm2022/{c8y-ngx-components-computed-asset-properties-alarm-count-config.component-B2cy8gI7.mjs → c8y-ngx-components-computed-asset-properties-alarm-count-config.component-CPLDClTp.mjs} +3 -3
- package/fesm2022/{c8y-ngx-components-computed-asset-properties-alarm-count-config.component-B2cy8gI7.mjs.map → c8y-ngx-components-computed-asset-properties-alarm-count-config.component-CPLDClTp.mjs.map} +1 -1
- package/fesm2022/{c8y-ngx-components-computed-asset-properties-c8y-ngx-components-computed-asset-properties-BYHnA-5R.mjs → c8y-ngx-components-computed-asset-properties-c8y-ngx-components-computed-asset-properties-9be_iMQg.mjs} +30 -13
- package/fesm2022/c8y-ngx-components-computed-asset-properties-c8y-ngx-components-computed-asset-properties-9be_iMQg.mjs.map +1 -0
- package/fesm2022/{c8y-ngx-components-computed-asset-properties-configuration-snapshot-config.component-C4oL39m8.mjs → c8y-ngx-components-computed-asset-properties-configuration-snapshot-config.component-B2em01_W.mjs} +3 -3
- package/fesm2022/c8y-ngx-components-computed-asset-properties-configuration-snapshot-config.component-B2em01_W.mjs.map +1 -0
- package/fesm2022/{c8y-ngx-components-computed-asset-properties-event-count-config.component-DGwm6_C9.mjs → c8y-ngx-components-computed-asset-properties-event-count-config.component-CQuGa1RI.mjs} +3 -3
- package/fesm2022/c8y-ngx-components-computed-asset-properties-event-count-config.component-CQuGa1RI.mjs.map +1 -0
- package/fesm2022/{c8y-ngx-components-computed-asset-properties-fieldbus-item-status-config.component-BxfCjbYY.mjs → c8y-ngx-components-computed-asset-properties-fieldbus-item-status-config.component-CkmurxJv.mjs} +5 -5
- package/fesm2022/{c8y-ngx-components-computed-asset-properties-fieldbus-item-status-config.component-BxfCjbYY.mjs.map → c8y-ngx-components-computed-asset-properties-fieldbus-item-status-config.component-CkmurxJv.mjs.map} +1 -1
- package/fesm2022/c8y-ngx-components-computed-asset-properties-last-measurement-config.component-CTK9zNUh.mjs +86 -0
- package/fesm2022/c8y-ngx-components-computed-asset-properties-last-measurement-config.component-CTK9zNUh.mjs.map +1 -0
- package/fesm2022/c8y-ngx-components-computed-asset-properties.mjs +1 -1
- package/fesm2022/c8y-ngx-components-echart-models.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-echart.mjs +39 -18
- package/fesm2022/c8y-ngx-components-echart.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget-ai-config.mjs +106 -4
- package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget-ai-config.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-html-widget.mjs +14 -122
- package/fesm2022/c8y-ngx-components-widgets-implementations-html-widget.mjs.map +1 -1
- package/locales/locales.pot +83 -30
- package/package.json +1 -1
- package/widgets/implementations/html-widget/index.d.ts +11 -50
- package/widgets/implementations/html-widget/index.d.ts.map +1 -1
- package/fesm2022/c8y-ngx-components-computed-asset-properties-c8y-ngx-components-computed-asset-properties-BYHnA-5R.mjs.map +0 -1
- package/fesm2022/c8y-ngx-components-computed-asset-properties-configuration-snapshot-config.component-C4oL39m8.mjs.map +0 -1
- package/fesm2022/c8y-ngx-components-computed-asset-properties-event-count-config.component-DGwm6_C9.mjs.map +0 -1
- package/fesm2022/c8y-ngx-components-computed-asset-properties-last-measurement-config.component-C1cuxN3L.mjs +0 -92
- package/fesm2022/c8y-ngx-components-computed-asset-properties-last-measurement-config.component-C1cuxN3L.mjs.map +0 -1
package/ai/agent-chat/index.d.ts
CHANGED
|
@@ -1,85 +1,252 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { OnInit, OnDestroy,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnInit, OnDestroy, TemplateRef, Type, Injector } from '@angular/core';
|
|
3
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
+
import { ClientAgentDefinition, Suggestion, ChatConfig, AssistantMessageDisplayConfig, AIMessage, AIStreamResponse, ToolCallPart, ChatHistoryConfig, ChatHistory, WidgetAiChatSectionComponentConfig } from '@c8y/ngx-components/ai';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
5
6
|
|
|
6
7
|
declare class AgentChatComponent implements OnInit, OnDestroy {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
readonly translateService: TranslateService;
|
|
9
|
+
private readonly datePipe;
|
|
10
|
+
private readonly modalService;
|
|
11
|
+
/** Debug logging function for AI messages. Can be enabled at runtime with localStorage.setItem('c8y-debug-log.agent-chat', 'true'); */
|
|
12
|
+
readonly debugLog: (message: string, ...args: any[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Identifies which AI agent from the AI Agent Manager service will be used by this component.
|
|
15
|
+
*
|
|
16
|
+
* Where possible, provide a `ClientAgentDefinition` rather than just a name.
|
|
17
|
+
*
|
|
18
|
+
* It is recommended to define a `toolCallConfig` in the same place you define `ClientAgentDefinition`,
|
|
19
|
+
* and to use the keys from `assistantMessageDisplayConfig.toolCallConfig`
|
|
20
|
+
* in the `ClientAgentDefinition` tools list.
|
|
21
|
+
*/
|
|
22
|
+
readonly agent: _angular_core.InputSignal<string | ClientAgentDefinition>;
|
|
23
|
+
get agentName(): string;
|
|
24
|
+
get agentDefinition(): ClientAgentDefinition | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Clickable suggestions buttons to display just above the chat, for likely next user actions.
|
|
27
|
+
* These may be hardcoded or be set by the AI agent (e.g. in a tool call).
|
|
28
|
+
* This input should be `undefined` to indicate that there are no new suggestions yet, and that any restored from the chat history should be used instead.
|
|
29
|
+
* You can use the `isWelcoming` output to show different suggestions while the initial welcome message is displayed.
|
|
30
|
+
*/
|
|
31
|
+
readonly suggestions: _angular_core.InputSignal<Suggestion[]>;
|
|
32
|
+
/** ChatConfig to customize the ai-chat component's configuration if desired. */
|
|
33
|
+
readonly chatConfig: _angular_core.InputSignal<Partial<ChatConfig>>;
|
|
34
|
+
/** Template for customizing the welcome view using `ng-template`. */
|
|
35
|
+
readonly welcomeTemplate: _angular_core.InputSignal<TemplateRef<any>>;
|
|
36
|
+
/** Indicates whether the component has zero messages and is showing the welcome page. */
|
|
37
|
+
readonly isWelcoming: _angular_core.Signal<boolean>;
|
|
38
|
+
/** Configures whether this component should automatically create the provided `agent: ClientAgentDefinition`
|
|
39
|
+
* if an agent of that name doesn't already exist. This is an alternative to the usual mechanism of configuring
|
|
40
|
+
* agents using a `.agent.c8y.ts` file.
|
|
41
|
+
*/
|
|
42
|
+
readonly autoCreateAgents: _angular_core.InputSignal<boolean>;
|
|
43
|
+
/** Variables to pass to the AI agent for placeholders specified in the agent's system prompt. */
|
|
44
|
+
readonly variables: _angular_core.InputSignal<Record<string, any>>;
|
|
45
|
+
/**
|
|
46
|
+
* Allows overriding the component used to render messages from the AI assistant, if the default
|
|
47
|
+
* AiChatAssistantMessageComponent does not do what you need.
|
|
48
|
+
*
|
|
49
|
+
* The component must accept a single input `assistantMessageContext: AssistantMessageContext`.
|
|
50
|
+
* This object contains all data needed to render the assistant message and is forward-compatible with future additions.
|
|
51
|
+
*
|
|
52
|
+
* Example usage:
|
|
53
|
+
* <c8y-agent-chat [assistantMessageComponent]="MyCustomAssistantMessageComponent"></c8y-agent-chat>
|
|
54
|
+
*/
|
|
55
|
+
readonly assistantMessageComponent: _angular_core.InputSignal<Type<any>>;
|
|
56
|
+
/**
|
|
57
|
+
* Configuration passed to `AiChatAssistantMessageComponent` for controlling how messages from the assistant
|
|
58
|
+
* are rendered, including tool calls.
|
|
59
|
+
*
|
|
60
|
+
* If you are performing any tool calls it is recommended to configure the `toolCallConfig`
|
|
61
|
+
* to provide localized display names for the tools used in your `AgentDefinitionConfig`.
|
|
62
|
+
*/
|
|
63
|
+
readonly assistantMessageDisplayConfig: _angular_core.InputSignal<AssistantMessageDisplayConfig>;
|
|
64
|
+
/**
|
|
65
|
+
* Optional function to preprocess messages from the assistant before they are displayed, for example if you need to remove special
|
|
66
|
+
* tagged sections from the content to move into simulated tool calls.
|
|
67
|
+
*
|
|
68
|
+
* This function may be called many times for each message, as more steps, tool calls and content are streamed from the agent.
|
|
69
|
+
*
|
|
70
|
+
* If you modify any part of the message other than the `changedPart`, you should replace it with a new shallow copy of the object so
|
|
71
|
+
* that change detection works correctly. This is not necessary for changedPart.
|
|
72
|
+
*
|
|
73
|
+
* @param message The message from the AI assistant.
|
|
74
|
+
* @param changedPart The part of the message that has changed, which can be modified in-place if desired. Currently only tool calls are included here.
|
|
75
|
+
*/
|
|
76
|
+
readonly preprocessAgentMessage: _angular_core.InputSignal<(message: AIMessage, changedPart: AIStreamResponse["changedPart"]) => AIMessage>;
|
|
77
|
+
/** Optional function to override how the message history is prepared and compacted ready for sending with
|
|
78
|
+
* agent requests. This overrides the default behaviour from `defaultPruneMessagesForAgent`.
|
|
79
|
+
*
|
|
80
|
+
* For example this can be used to remove unnecessary information to minimize tokens, reduce the number of messages,
|
|
81
|
+
* or to make what is sent to the agent different from what is rendered in the UI.
|
|
82
|
+
*/
|
|
83
|
+
readonly pruneMessagesForAgent: _angular_core.InputSignal<(messages: AIMessage[]) => AIMessage[]>;
|
|
84
|
+
/** Input that provides a previously-saved chat history snapshot to restore. */
|
|
85
|
+
readonly initialChatHistory: _angular_core.InputSignal<string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | {
|
|
86
|
+
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
87
|
+
})[] | {
|
|
88
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any;
|
|
89
|
+
})[] | {
|
|
90
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
91
|
+
})[] | {
|
|
92
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
93
|
+
})[] | {
|
|
94
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
95
|
+
})[] | {
|
|
96
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
97
|
+
})[] | {
|
|
98
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
99
|
+
})[] | {
|
|
100
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
101
|
+
})[] | {
|
|
102
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
103
|
+
})[] | {
|
|
104
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
105
|
+
})[] | {
|
|
106
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
107
|
+
})[] | {
|
|
108
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
109
|
+
}>;
|
|
110
|
+
/** Suggestions that were restored from the initial chat history; used if `suggestions` input is not yet set. */
|
|
111
|
+
protected _restoredSuggestions: Suggestion[];
|
|
112
|
+
/**
|
|
113
|
+
* An optional function that returns a message sent in AI agent requests just before each new user message to provide context or "grounding" to
|
|
114
|
+
* anchor the AI's response - such as the current state of the document the AI is helping with.
|
|
115
|
+
*
|
|
116
|
+
* Typically this string would begin with a special prefix (e.g. "[STATE_SNAPSHOT]") that is described by the system prompt.
|
|
117
|
+
*
|
|
118
|
+
* This message does not form part of the chat history, to avoid confusing the AI agent with older grounding state.
|
|
119
|
+
* It is injected into the message history just before the latest user message as per standard recommendations,
|
|
120
|
+
* since AI gives more attention to the recent content.
|
|
121
|
+
*/
|
|
122
|
+
readonly groundingContextProvider: _angular_core.InputSignal<() => string>;
|
|
123
|
+
/**
|
|
124
|
+
* Provides application-defined fields to enrich the user feedback tracking data for this component.
|
|
125
|
+
*
|
|
126
|
+
* Do not include Intellectual Property or Personal Identifiable Information in this object, as it may
|
|
127
|
+
* be included in feedback data sent to third-party services.
|
|
128
|
+
*/
|
|
129
|
+
readonly userAnalyticsContext: _angular_core.InputSignal<Record<string, any>>;
|
|
130
|
+
readonly onMessageFinish: _angular_core.OutputEmitterRef<AIMessage>;
|
|
131
|
+
/**
|
|
132
|
+
* Notified when a tool result is received from the agent.
|
|
133
|
+
*
|
|
134
|
+
* This is called before it is added to the message displayed in the component.
|
|
135
|
+
*
|
|
136
|
+
* Tools with a client/UI implementation may provide `output` for the tool
|
|
137
|
+
* (e.g. data to render in the UI) by calling `addToolOutput`.
|
|
138
|
+
*/
|
|
139
|
+
readonly onToolResult: _angular_core.OutputEmitterRef<ToolCallPart<Record<string, unknown>, unknown>>;
|
|
140
|
+
/** Notified when the user presses the positive or negative feedback buttons for an assistant message.*/
|
|
141
|
+
readonly onFeedback: _angular_core.OutputEmitterRef<{
|
|
142
|
+
userMessage: AIMessage;
|
|
143
|
+
assistantMessage: AIMessage;
|
|
144
|
+
feedbackPositive: boolean;
|
|
145
|
+
}>;
|
|
146
|
+
/** The model name from the most recently received metadata while streaming a response, which is used by the analytics. */
|
|
147
|
+
protected model?: string;
|
|
148
|
+
/** The system prompt from the most recently received metadata while streaming a response, which is used by the analytics. */
|
|
149
|
+
protected systemPrompt?: Array<{
|
|
150
|
+
text: string;
|
|
151
|
+
type: string;
|
|
152
|
+
}>;
|
|
153
|
+
protected readonly _isLoading: _angular_core.WritableSignal<boolean>;
|
|
154
|
+
/** Is an AI agent request currently in progress. This can be used to disable UI elements while a reply (which might change the state) is being loaded. */
|
|
155
|
+
get isLoadingAiResponse(): _angular_core.Signal<boolean>;
|
|
156
|
+
private readonly aiAgentManagerApplicationName;
|
|
157
|
+
/** Stores any error with the agent or backend microservice. This error message is already translated. */
|
|
158
|
+
protected readonly _agentHealthError: _angular_core.WritableSignal<string>;
|
|
159
|
+
/** Stores the most recent agent health check response, or `undefined` while the initial check is in progress. */
|
|
160
|
+
private readonly _agentHealth;
|
|
161
|
+
/** Returns the most recent agent health check status such as `ready`, or an error. */
|
|
162
|
+
get agentHealthStatus(): "loading" | "missing-microservice" | "missing-permissions" | "missing-provider" | "missing-agent" | "ready";
|
|
163
|
+
/** Stores any detailed error messages from the backend. */
|
|
164
|
+
protected readonly agentHealthDetailedMessages: _angular_core.WritableSignal<string>;
|
|
165
|
+
/**
|
|
166
|
+
* Stores any error that occurred during streaming the current message from the agent.
|
|
167
|
+
*
|
|
168
|
+
* If possible this string is translated already or registered with `gettext`.
|
|
169
|
+
* In practice, this may not be translated if it comes from the backend.
|
|
170
|
+
*/
|
|
171
|
+
readonly agentStreamError: _angular_core.WritableSignal<string>;
|
|
172
|
+
readonly messages: _angular_core.WritableSignal<AIMessage[]>;
|
|
173
|
+
/** If the create agent button should be shown to the user. */
|
|
32
174
|
canCreate: boolean;
|
|
33
|
-
errorMsg: string;
|
|
34
175
|
prompt: string;
|
|
35
|
-
private aiService;
|
|
36
|
-
private
|
|
37
|
-
private alertService;
|
|
38
|
-
private
|
|
39
|
-
private appState;
|
|
176
|
+
private readonly aiService;
|
|
177
|
+
private readonly userAnalyticsService;
|
|
178
|
+
private readonly alertService;
|
|
179
|
+
private readonly chatHistoryService;
|
|
40
180
|
private abortController;
|
|
41
181
|
private assistantSubscription;
|
|
182
|
+
private pluginContextPath;
|
|
183
|
+
private appState;
|
|
184
|
+
private readonly assistantMessageComponents;
|
|
42
185
|
private get currentContextPath();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Stores client-supplied tool outputs to override tool results for a given toolCallId in the current assistant message.
|
|
188
|
+
* Cleared at the start of each new message.
|
|
189
|
+
*/
|
|
190
|
+
private _clientToolOutputs;
|
|
47
191
|
ngOnInit(): Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* Save the current chat history and suggestions to an opaque, versioned, JSON-serializable snapshot of the chat history for persistence.
|
|
194
|
+
*
|
|
195
|
+
* To save space, only recent tool results and reasoning are included.
|
|
196
|
+
* Additional options for compressing the history can be provided using the config parameters.
|
|
197
|
+
*
|
|
198
|
+
* @param config Optional configuration to limit what gets saved (e.g., filter out specific tools, limit total message count)
|
|
199
|
+
*/
|
|
200
|
+
saveChatHistory(config?: ChatHistoryConfig): ChatHistory;
|
|
201
|
+
/** Sends a message to the AI */
|
|
48
202
|
sendMessage(message: AIMessage): Promise<void>;
|
|
49
203
|
ngOnDestroy(): void;
|
|
50
|
-
reprompt(userMessage:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
204
|
+
reprompt(userMessage: AIMessage): Promise<void>;
|
|
205
|
+
/** Rates an AI message as positive/negative, sending the feedback to GainSight */
|
|
206
|
+
rate(assistantMessage: AIMessage, positive: boolean): Promise<void>;
|
|
207
|
+
reload(assistantMessage: AIMessage): void;
|
|
208
|
+
cancel(): void;
|
|
209
|
+
/**
|
|
210
|
+
* Overrides the output of a specific tool result (in the current assistant message), including optionally indicating that an error occurred.
|
|
211
|
+
*
|
|
212
|
+
* This can be used to provide output for tool calls that are implemented on the client,
|
|
213
|
+
* and is typically called from `onToolResult`.
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
216
|
+
addToolOutput(toolCallId: string, output: any, error?: boolean): void;
|
|
54
217
|
createAgent(): Promise<void>;
|
|
55
|
-
|
|
218
|
+
/** Restore chat history from a previously-saved snapshot. Does nothing if the component already has some messages. */
|
|
219
|
+
protected _restoreChatHistory(history: ChatHistory | undefined): void;
|
|
220
|
+
private getAnalyticsMetadataContext;
|
|
221
|
+
private handleAgentError;
|
|
222
|
+
private makeChangedPartNewInstance;
|
|
223
|
+
/**
|
|
224
|
+
* Called as responses are incrementally streamed from the agent.
|
|
225
|
+
* @param currentAssistantMsg The message already added to the messages array rendered by the UI,
|
|
226
|
+
* and dynamically updated by this function as more output comes from the agent.
|
|
227
|
+
* @param updatedAssistantMsg contains the latest data received from the agent
|
|
228
|
+
* @param changedPart if provided, indicates which part of the message was changed in this update
|
|
229
|
+
*/
|
|
56
230
|
private processAgentMessage;
|
|
57
|
-
|
|
58
|
-
static
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
declare class AgentStepFeedbackComponent implements OnInit, OnChanges {
|
|
62
|
-
step: AgentStep;
|
|
63
|
-
label: string;
|
|
64
|
-
loading: boolean;
|
|
65
|
-
collapsed: boolean;
|
|
66
|
-
canCollapse: boolean;
|
|
67
|
-
ngOnInit(): void;
|
|
68
|
-
ngOnChanges(changes: SimpleChanges): void;
|
|
69
|
-
parseDefaultAgentStep(step: AgentStep): void;
|
|
70
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AgentStepFeedbackComponent, never>;
|
|
71
|
-
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>;
|
|
231
|
+
private handleMessageFinish;
|
|
232
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AgentChatComponent, never>;
|
|
233
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgentChatComponent, "c8y-agent-chat", never, { "agent": { "alias": "agent"; "required": true; "isSignal": true; }; "suggestions": { "alias": "suggestions"; "required": false; "isSignal": true; }; "chatConfig": { "alias": "chatConfig"; "required": false; "isSignal": true; }; "welcomeTemplate": { "alias": "welcomeTemplate"; "required": false; "isSignal": true; }; "autoCreateAgents": { "alias": "autoCreateAgents"; "required": false; "isSignal": true; }; "variables": { "alias": "variables"; "required": false; "isSignal": true; }; "assistantMessageComponent": { "alias": "assistantMessageComponent"; "required": false; "isSignal": true; }; "assistantMessageDisplayConfig": { "alias": "assistantMessageDisplayConfig"; "required": false; "isSignal": true; }; "preprocessAgentMessage": { "alias": "preprocessAgentMessage"; "required": false; "isSignal": true; }; "pruneMessagesForAgent": { "alias": "pruneMessagesForAgent"; "required": false; "isSignal": true; }; "initialChatHistory": { "alias": "initialChatHistory"; "required": false; "isSignal": true; }; "groundingContextProvider": { "alias": "groundingContextProvider"; "required": false; "isSignal": true; }; "userAnalyticsContext": { "alias": "userAnalyticsContext"; "required": false; "isSignal": true; }; }, { "onMessageFinish": "onMessageFinish"; "onToolResult": "onToolResult"; "onFeedback": "onFeedback"; }, never, never, true, never>;
|
|
72
234
|
}
|
|
73
235
|
|
|
74
236
|
declare class WidgetAiChatSectionComponent implements OnInit {
|
|
237
|
+
/**
|
|
238
|
+
* Asynchronously return the parts of the config that may require dynamically importing other modules.
|
|
239
|
+
* @param componentInjector The function is provided a injector that can inject other services/components if needed.
|
|
240
|
+
*/
|
|
241
|
+
loadComponentConfig?: (componentInjector: Injector) => Promise<WidgetAiChatSectionComponentConfig>;
|
|
242
|
+
protected readonly _componentConfig: _angular_core.WritableSignal<WidgetAiChatSectionComponentConfig>;
|
|
75
243
|
suggestions: Array<{
|
|
76
244
|
label: string;
|
|
77
245
|
prompt: string;
|
|
78
246
|
}>;
|
|
79
247
|
agent: string | ClientAgentDefinition;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
welcomeText: any;
|
|
248
|
+
chatConfig?: Partial<ChatConfig>;
|
|
249
|
+
/** Provide the specified `contextVariableName` as a variable that can be used in the prompt. */
|
|
83
250
|
useContextAsVariable: boolean;
|
|
84
251
|
contextVariableName: string;
|
|
85
252
|
private variables$;
|
|
@@ -108,23 +275,16 @@ declare class WidgetAiChatSectionComponent implements OnInit {
|
|
|
108
275
|
get variables(): Observable<{
|
|
109
276
|
[key: string]: any;
|
|
110
277
|
}>;
|
|
111
|
-
|
|
278
|
+
private readonly injector;
|
|
112
279
|
private readonly widgetConfigService;
|
|
113
280
|
private readonly alertService;
|
|
114
281
|
private readonly contextRouteService;
|
|
115
|
-
/**
|
|
116
|
-
* A component that is used to render each step in the chat. By default, it uses the `AgentStepFeedbackComponent`.
|
|
117
|
-
* You can provide your own component by returning it from this callback.
|
|
118
|
-
*
|
|
119
|
-
* @returns A promise that resolves to a component type.
|
|
120
|
-
*/
|
|
121
|
-
loadRenderStepComponent: () => Promise<Type<any>>;
|
|
122
282
|
/**
|
|
123
283
|
* A callback that is invoked when a tool result is returned. The function can return either:
|
|
124
284
|
* - `undefined` or `void`: No action is taken.
|
|
125
285
|
* - an object which is stored to the widget configuration.
|
|
126
286
|
*/
|
|
127
|
-
onToolResult: (step:
|
|
287
|
+
onToolResult: (step: ToolCallPart) => undefined | any;
|
|
128
288
|
/**
|
|
129
289
|
* @ignore
|
|
130
290
|
*/
|
|
@@ -133,10 +293,10 @@ declare class WidgetAiChatSectionComponent implements OnInit {
|
|
|
133
293
|
* Handles the tool result returned from the AI agent.
|
|
134
294
|
* @param tool The tool result returned from the AI agent.
|
|
135
295
|
*/
|
|
136
|
-
toolResultHandler(tool:
|
|
137
|
-
static ɵfac:
|
|
138
|
-
static ɵcmp:
|
|
296
|
+
toolResultHandler(tool: ToolCallPart): void;
|
|
297
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetAiChatSectionComponent, never>;
|
|
298
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WidgetAiChatSectionComponent, "c8y-widget-ai-chat-section", never, { "loadComponentConfig": { "alias": "loadComponentConfig"; "required": false; }; "suggestions": { "alias": "suggestions"; "required": false; }; "agent": { "alias": "agent"; "required": false; }; "chatConfig": { "alias": "chatConfig"; "required": false; }; "useContextAsVariable": { "alias": "useContextAsVariable"; "required": false; }; "contextVariableName": { "alias": "contextVariableName"; "required": false; }; "variables": { "alias": "variables"; "required": false; }; "onToolResult": { "alias": "onToolResult"; "required": false; }; }, {}, never, never, true, never>;
|
|
139
299
|
}
|
|
140
300
|
|
|
141
|
-
export { AgentChatComponent,
|
|
301
|
+
export { AgentChatComponent, WidgetAiChatSectionComponent };
|
|
142
302
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sources":["../../../ai/agent-chat/agent-chat.component.ts","../../../ai/agent-chat/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../../ai/agent-chat/agent-chat.component.ts","../../../ai/agent-chat/widget-ai-chat-section.component.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;;;;AA0DA,cAAA,kBAAA,YAAA,MAAA,EAAA,SAAA;;AAuBE;AACA;;AAGA;AAMA;;;;;;;;AAQG;oBACW,aAAA,CAAA,WAAA,UAAA,qBAAA;;AAMd,2BAAA,qBAAA;AAKA;;;;;AAKG;0BACiB,aAAA,CAAA,WAAA,CAAA,UAAA;;yBAGD,aAAA,CAAA,WAAA,CAAA,OAAA,CAAA,UAAA;;8BAGK,aAAA,CAAA,WAAA,CAAA,WAAA;;0BAGJ,aAAA,CAAA,MAAA;AAEpB;;;AAGG;+BACsB,aAAA,CAAA,WAAA;;wBAGP,aAAA,CAAA,WAAA,CAAA,MAAA;AAElB;;;;;;;;;AASG;wCAC+B,aAAA,CAAA,WAAA,CAAA,IAAA;AAElC;;;;;;AAMG;4CACmC,aAAA,CAAA,WAAA,CAAA,6BAAA;AAEtC;;;;;;;;;;;AAWG;qCAC4B,aAAA,CAAA,WAAA,WAAA,SAAA,eAAA,gBAAA,oBAAA,SAAA;AAI/B;;;;;AAKG;oCAC2B,aAAA,CAAA,WAAA,YAAA,SAAA,OAAA,SAAA;;AAK9B,iCAA2B,aAAA,CAAA,WAAA;;;;;;;;;;;;;;;;;;;;;;;;AAAwB;;AAEnD,oCAAA,UAAA;AAEA;;;;;;;;;AASG;AACH,uCAAiC,aAAA,CAAA,WAAA;AAEjC;;;;;AAKG;mCAC0B,aAAA,CAAA,WAAA,CAAA,MAAA;8BAEL,aAAA,CAAA,gBAAA,CAAA,SAAA;AAExB;;;;;;;AAOG;2BACkB,aAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,MAAA;;AAGrB,yBAAmB,aAAA,CAAA,gBAAA;;;;AAId;;AAGL;;AAEA,6BAAA,KAAA;;;AAA6D;AAE7D,mCAA6B,aAAA,CAAA,cAAA;;AAE7B,+BAAuB,aAAA,CAAA,MAAA;AAIvB;;AAGA,0CAAoC,aAAA,CAAA,cAAA;;AAKpC;;AAEA;;AAKA,oDAA8C,aAAA,CAAA,cAAA;AAE9C;;;;;AAKG;+BACsB,aAAA,CAAA,cAAA;uBAKR,aAAA,CAAA,cAAA,CAAA,SAAA;;AAGjB;AACA;AAEA;AACA;AACA;AACA;;;;;AAMA;;AAMA;;;AAGG;;AAGG,gBAAA,OAAA;AAgCN;;;;;;;AAOG;AACH,6BAAA,iBAAA,GAAA,WAAA;;;AAuGA;;;AAqCM,2BAAA,SAAA,sBAAA,OAAA;;;AAsCN;;;;;;AAMG;AACH;;;;;AAuDA;AAyDA;AAsCA;;;;;;AAMG;;AA8DH;;;AAmCD;;ACnvBD,cAAA,4BAAA,YAAA,MAAA;AAOE;;;AAGG;;AAMH,yCAAmC,aAAA,CAAA,cAAA,CAAA,kCAAA;;;;AAGiB;AAEpD,oBAAA,qBAAA;AAEA,iBAAA,OAAA,CAAA,UAAA;;AAGA;AAEA;;AAGA;;;;;;;;;;;;;;;;AAgBG;AACH,uBAAA,UAAA;AACgC;AAAoB;AAAM;;;AAO5B;AAAoB;AAIlD;AACA;AACA;AACA;AAEA;;;;AAIG;;AAIH;;AAEG;AACG,gBAAA,OAAA;AAaN;;;AAGG;;;;AAoBJ;;;;"}
|