@progress/kendo-angular-grid 19.3.0-develop.20 → 19.3.0-develop.22
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/directives.d.ts +4 -3
- package/esm2022/common/toolbar-tool-base.directive.mjs +3 -2
- package/esm2022/directives.mjs +2 -0
- package/esm2022/grid.component.mjs +74 -5
- package/esm2022/grid.module.mjs +102 -101
- package/esm2022/index.mjs +2 -0
- package/esm2022/localization/messages.mjs +55 -1
- package/esm2022/navigation/toolbar-tool-name.mjs +2 -1
- package/esm2022/package-metadata.mjs +2 -2
- package/esm2022/rendering/toolbar/tools/ai-assistant/ai-assistant.component.mjs +286 -0
- package/esm2022/rendering/toolbar/tools/ai-assistant/ai-tool.directive.mjs +269 -0
- package/esm2022/rendering/toolbar/tools/ai-assistant/utils.mjs +47 -0
- package/fesm2022/progress-kendo-angular-grid.mjs +742 -50
- package/grid.component.d.ts +4 -1
- package/grid.module.d.ts +101 -100
- package/index.d.ts +2 -0
- package/localization/messages.d.ts +37 -1
- package/navigation/toolbar-tool-name.d.ts +1 -0
- package/package.json +21 -20
- package/rendering/toolbar/tools/ai-assistant/ai-assistant.component.d.ts +49 -0
- package/rendering/toolbar/tools/ai-assistant/ai-tool.directive.d.ts +119 -0
- package/rendering/toolbar/tools/ai-assistant/utils.d.ts +110 -0
- package/schematics/ngAdd/index.js +4 -4
package/esm2022/index.mjs
CHANGED
|
@@ -163,6 +163,7 @@ export { RemoveCommandDirective } from './editing/remove-command.directive';
|
|
|
163
163
|
export { AddCommandDirective } from './editing/add-command.directive';
|
|
164
164
|
export { AddCommandToolbarDirective } from './editing/add-command-tool.directive';
|
|
165
165
|
export { ColumnChooserToolbarDirective } from './rendering/toolbar/tools/column-chooser-tool.directive';
|
|
166
|
+
export { AIAssistantToolbarDirective } from './rendering/toolbar/tools/ai-assistant/ai-tool.directive';
|
|
166
167
|
export { SaveCommandToolbarDirective } from './editing/save-command-tool.directive';
|
|
167
168
|
export { EditCommandToolbarDirective } from './editing/edit-command-tool.directive';
|
|
168
169
|
export { RemoveCommandToolbarDirective } from './editing/remove-command-tool.directive';
|
|
@@ -214,3 +215,4 @@ export { SizingOptionsService } from './layout/sizing-options.service';
|
|
|
214
215
|
export { GridTableDirective } from './rendering/grid-table.directive';
|
|
215
216
|
// Needed as it is an optional injection of the FilterService
|
|
216
217
|
export { MenuTabbingService } from './filtering/menu/menu-tabbing.service';
|
|
218
|
+
export * from './rendering/toolbar/tools/ai-assistant/utils';
|
|
@@ -142,6 +142,42 @@ export class GridMessages extends ComponentMessages {
|
|
|
142
142
|
* [See example](slug:globalization_grid#toc-custom-messages).
|
|
143
143
|
*/
|
|
144
144
|
booleanFilterCellLabel;
|
|
145
|
+
/**
|
|
146
|
+
* The text of the AI Assistant Apply button.
|
|
147
|
+
*/
|
|
148
|
+
aiAssistantApplyButtonText;
|
|
149
|
+
/**
|
|
150
|
+
* The text of the AI Assistant toolbar tool.
|
|
151
|
+
*/
|
|
152
|
+
aiAssistantToolbarToolText;
|
|
153
|
+
/**
|
|
154
|
+
* The text of the AI Assistant Window title.
|
|
155
|
+
*/
|
|
156
|
+
aiAssistantWindowTitle;
|
|
157
|
+
/**
|
|
158
|
+
* The title of the AI Assistant Window close button.
|
|
159
|
+
*/
|
|
160
|
+
aiAssistantWindowCloseTitle;
|
|
161
|
+
/**
|
|
162
|
+
* The title of the AI Assistant Prompt Output Card.
|
|
163
|
+
*/
|
|
164
|
+
aiAssistantOutputCardTitle;
|
|
165
|
+
/**
|
|
166
|
+
* The success message dispayed in the AI Assistant Prompt Output Card's body.
|
|
167
|
+
*/
|
|
168
|
+
aiAssistantOutputCardBodyContent;
|
|
169
|
+
/**
|
|
170
|
+
* The title of the AI Assistant Window maximize button.
|
|
171
|
+
*/
|
|
172
|
+
aiAssistantWindowMaximizeTitle;
|
|
173
|
+
/**
|
|
174
|
+
* The title of the AI Assistant Window minimize button.
|
|
175
|
+
*/
|
|
176
|
+
aiAssistantWindowMinimizeTitle;
|
|
177
|
+
/**
|
|
178
|
+
* The title of the AI Assistant Window restore button.
|
|
179
|
+
*/
|
|
180
|
+
aiAssistantWindowRestoreTitle;
|
|
145
181
|
/**
|
|
146
182
|
* Sets the text for the `Equal` (**Is equal to**) filter operator.
|
|
147
183
|
*/
|
|
@@ -538,7 +574,7 @@ export class GridMessages extends ComponentMessages {
|
|
|
538
574
|
*/
|
|
539
575
|
externalEditingCancelText;
|
|
540
576
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GridMessages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
541
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: GridMessages, selector: "kendo-grid-messages-base", inputs: { groupPanelEmpty: "groupPanelEmpty", noRecords: "noRecords", pagerLabel: "pagerLabel", pagerFirstPage: "pagerFirstPage", pagerLastPage: "pagerLastPage", pagerPreviousPage: "pagerPreviousPage", pagerNextPage: "pagerNextPage", pagerPage: "pagerPage", pagerItemsPerPage: "pagerItemsPerPage", pagerOf: "pagerOf", pagerItems: "pagerItems", pagerPageNumberInputTitle: "pagerPageNumberInputTitle", pagerInputLabel: "pagerInputLabel", pagerSelectPage: "pagerSelectPage", filter: "filter", filterInputLabel: "filterInputLabel", filterMenuTitle: "filterMenuTitle", filterMenuOperatorsDropDownLabel: "filterMenuOperatorsDropDownLabel", filterMenuLogicDropDownLabel: "filterMenuLogicDropDownLabel", filterCellOperatorLabel: "filterCellOperatorLabel", booleanFilterCellLabel: "booleanFilterCellLabel", filterEqOperator: "filterEqOperator", filterNotEqOperator: "filterNotEqOperator", filterIsNullOperator: "filterIsNullOperator", filterIsNotNullOperator: "filterIsNotNullOperator", filterIsEmptyOperator: "filterIsEmptyOperator", filterIsNotEmptyOperator: "filterIsNotEmptyOperator", filterStartsWithOperator: "filterStartsWithOperator", filterContainsOperator: "filterContainsOperator", filterNotContainsOperator: "filterNotContainsOperator", filterEndsWithOperator: "filterEndsWithOperator", filterGteOperator: "filterGteOperator", filterGtOperator: "filterGtOperator", filterLteOperator: "filterLteOperator", filterLtOperator: "filterLtOperator", filterIsTrue: "filterIsTrue", filterIsFalse: "filterIsFalse", filterBooleanAll: "filterBooleanAll", adaptiveFilterOperatorsTitle: "adaptiveFilterOperatorsTitle", filterAfterOrEqualOperator: "filterAfterOrEqualOperator", filterAfterOperator: "filterAfterOperator", filterBeforeOperator: "filterBeforeOperator", filterBeforeOrEqualOperator: "filterBeforeOrEqualOperator", filterFilterButton: "filterFilterButton", filterClearButton: "filterClearButton", adaptiveCloseButtonTitle: "adaptiveCloseButtonTitle", adaptiveBackButtonTitle: "adaptiveBackButtonTitle", filterAndLogic: "filterAndLogic", filterOrLogic: "filterOrLogic", filterToolbarToolText: "filterToolbarToolText", loading: "loading", gridLabel: "gridLabel", columnMenu: "columnMenu", setColumnPosition: "setColumnPosition", columns: "columns", columnsSubtitle: "columnsSubtitle", adaptiveFilterTitle: "adaptiveFilterTitle", adaptiveSortTitle: "adaptiveSortTitle", adaptiveGroupTitle: "adaptiveGroupTitle", filterClearAllButton: "filterClearAllButton", groupClearButton: "groupClearButton", sortClearButton: "sortClearButton", sortDoneButton: "sortDoneButton", groupDoneButton: "groupDoneButton", lock: "lock", unlock: "unlock", stick: "stick", unstick: "unstick", sortable: "sortable", sortAscending: "sortAscending", sortDescending: "sortDescending", autosizeThisColumn: "autosizeThisColumn", autosizeAllColumns: "autosizeAllColumns", sortedAscending: "sortedAscending", sortedDescending: "sortedDescending", sortedDefault: "sortedDefault", sortToolbarToolText: "sortToolbarToolText", columnsApply: "columnsApply", columnsReset: "columnsReset", detailExpand: "detailExpand", detailCollapse: "detailCollapse", filterDateToday: "filterDateToday", filterDateToggle: "filterDateToggle", filterNumericDecrement: "filterNumericDecrement", filterNumericIncrement: "filterNumericIncrement", selectionCheckboxLabel: "selectionCheckboxLabel", selectAllCheckboxLabel: "selectAllCheckboxLabel", groupCollapse: "groupCollapse", groupExpand: "groupExpand", topToolbarLabel: "topToolbarLabel", bottomToolbarLabel: "bottomToolbarLabel", editToolbarToolText: "editToolbarToolText", saveToolbarToolText: "saveToolbarToolText", addToolbarToolText: "addToolbarToolText", cancelToolbarToolText: "cancelToolbarToolText", removeToolbarToolText: "removeToolbarToolText", excelExportToolbarToolText: "excelExportToolbarToolText", pdfExportToolbarToolText: "pdfExportToolbarToolText", groupPanelLabel: "groupPanelLabel", dragRowHandleLabel: "dragRowHandleLabel", columnMenuFilterTabTitle: "columnMenuFilterTabTitle", columnMenuGeneralTabTitle: "columnMenuGeneralTabTitle", columnMenuColumnsTabTitle: "columnMenuColumnsTabTitle", groupChipMenuPrevious: "groupChipMenuPrevious", groupChipMenuNext: "groupChipMenuNext", groupToolbarToolText: "groupToolbarToolText", formValidationErrorText: "formValidationErrorText", removeConfirmationDialogTitle: "removeConfirmationDialogTitle", removeConfirmationDialogContent: "removeConfirmationDialogContent", removeConfirmationDialogConfirmText: "removeConfirmationDialogConfirmText", removeConfirmationDialogRejectText: "removeConfirmationDialogRejectText", externalEditingTitle: "externalEditingTitle", externalEditingAddTitle: "externalEditingAddTitle", externalEditingSaveText: "externalEditingSaveText", externalEditingCancelText: "externalEditingCancelText" }, usesInheritance: true, ngImport: i0 });
|
|
577
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: GridMessages, selector: "kendo-grid-messages-base", inputs: { groupPanelEmpty: "groupPanelEmpty", noRecords: "noRecords", pagerLabel: "pagerLabel", pagerFirstPage: "pagerFirstPage", pagerLastPage: "pagerLastPage", pagerPreviousPage: "pagerPreviousPage", pagerNextPage: "pagerNextPage", pagerPage: "pagerPage", pagerItemsPerPage: "pagerItemsPerPage", pagerOf: "pagerOf", pagerItems: "pagerItems", pagerPageNumberInputTitle: "pagerPageNumberInputTitle", pagerInputLabel: "pagerInputLabel", pagerSelectPage: "pagerSelectPage", filter: "filter", filterInputLabel: "filterInputLabel", filterMenuTitle: "filterMenuTitle", filterMenuOperatorsDropDownLabel: "filterMenuOperatorsDropDownLabel", filterMenuLogicDropDownLabel: "filterMenuLogicDropDownLabel", filterCellOperatorLabel: "filterCellOperatorLabel", booleanFilterCellLabel: "booleanFilterCellLabel", aiAssistantApplyButtonText: "aiAssistantApplyButtonText", aiAssistantToolbarToolText: "aiAssistantToolbarToolText", aiAssistantWindowTitle: "aiAssistantWindowTitle", aiAssistantWindowCloseTitle: "aiAssistantWindowCloseTitle", aiAssistantOutputCardTitle: "aiAssistantOutputCardTitle", aiAssistantOutputCardBodyContent: "aiAssistantOutputCardBodyContent", aiAssistantWindowMaximizeTitle: "aiAssistantWindowMaximizeTitle", aiAssistantWindowMinimizeTitle: "aiAssistantWindowMinimizeTitle", aiAssistantWindowRestoreTitle: "aiAssistantWindowRestoreTitle", filterEqOperator: "filterEqOperator", filterNotEqOperator: "filterNotEqOperator", filterIsNullOperator: "filterIsNullOperator", filterIsNotNullOperator: "filterIsNotNullOperator", filterIsEmptyOperator: "filterIsEmptyOperator", filterIsNotEmptyOperator: "filterIsNotEmptyOperator", filterStartsWithOperator: "filterStartsWithOperator", filterContainsOperator: "filterContainsOperator", filterNotContainsOperator: "filterNotContainsOperator", filterEndsWithOperator: "filterEndsWithOperator", filterGteOperator: "filterGteOperator", filterGtOperator: "filterGtOperator", filterLteOperator: "filterLteOperator", filterLtOperator: "filterLtOperator", filterIsTrue: "filterIsTrue", filterIsFalse: "filterIsFalse", filterBooleanAll: "filterBooleanAll", adaptiveFilterOperatorsTitle: "adaptiveFilterOperatorsTitle", filterAfterOrEqualOperator: "filterAfterOrEqualOperator", filterAfterOperator: "filterAfterOperator", filterBeforeOperator: "filterBeforeOperator", filterBeforeOrEqualOperator: "filterBeforeOrEqualOperator", filterFilterButton: "filterFilterButton", filterClearButton: "filterClearButton", adaptiveCloseButtonTitle: "adaptiveCloseButtonTitle", adaptiveBackButtonTitle: "adaptiveBackButtonTitle", filterAndLogic: "filterAndLogic", filterOrLogic: "filterOrLogic", filterToolbarToolText: "filterToolbarToolText", loading: "loading", gridLabel: "gridLabel", columnMenu: "columnMenu", setColumnPosition: "setColumnPosition", columns: "columns", columnsSubtitle: "columnsSubtitle", adaptiveFilterTitle: "adaptiveFilterTitle", adaptiveSortTitle: "adaptiveSortTitle", adaptiveGroupTitle: "adaptiveGroupTitle", filterClearAllButton: "filterClearAllButton", groupClearButton: "groupClearButton", sortClearButton: "sortClearButton", sortDoneButton: "sortDoneButton", groupDoneButton: "groupDoneButton", lock: "lock", unlock: "unlock", stick: "stick", unstick: "unstick", sortable: "sortable", sortAscending: "sortAscending", sortDescending: "sortDescending", autosizeThisColumn: "autosizeThisColumn", autosizeAllColumns: "autosizeAllColumns", sortedAscending: "sortedAscending", sortedDescending: "sortedDescending", sortedDefault: "sortedDefault", sortToolbarToolText: "sortToolbarToolText", columnsApply: "columnsApply", columnsReset: "columnsReset", detailExpand: "detailExpand", detailCollapse: "detailCollapse", filterDateToday: "filterDateToday", filterDateToggle: "filterDateToggle", filterNumericDecrement: "filterNumericDecrement", filterNumericIncrement: "filterNumericIncrement", selectionCheckboxLabel: "selectionCheckboxLabel", selectAllCheckboxLabel: "selectAllCheckboxLabel", groupCollapse: "groupCollapse", groupExpand: "groupExpand", topToolbarLabel: "topToolbarLabel", bottomToolbarLabel: "bottomToolbarLabel", editToolbarToolText: "editToolbarToolText", saveToolbarToolText: "saveToolbarToolText", addToolbarToolText: "addToolbarToolText", cancelToolbarToolText: "cancelToolbarToolText", removeToolbarToolText: "removeToolbarToolText", excelExportToolbarToolText: "excelExportToolbarToolText", pdfExportToolbarToolText: "pdfExportToolbarToolText", groupPanelLabel: "groupPanelLabel", dragRowHandleLabel: "dragRowHandleLabel", columnMenuFilterTabTitle: "columnMenuFilterTabTitle", columnMenuGeneralTabTitle: "columnMenuGeneralTabTitle", columnMenuColumnsTabTitle: "columnMenuColumnsTabTitle", groupChipMenuPrevious: "groupChipMenuPrevious", groupChipMenuNext: "groupChipMenuNext", groupToolbarToolText: "groupToolbarToolText", formValidationErrorText: "formValidationErrorText", removeConfirmationDialogTitle: "removeConfirmationDialogTitle", removeConfirmationDialogContent: "removeConfirmationDialogContent", removeConfirmationDialogConfirmText: "removeConfirmationDialogConfirmText", removeConfirmationDialogRejectText: "removeConfirmationDialogRejectText", externalEditingTitle: "externalEditingTitle", externalEditingAddTitle: "externalEditingAddTitle", externalEditingSaveText: "externalEditingSaveText", externalEditingCancelText: "externalEditingCancelText" }, usesInheritance: true, ngImport: i0 });
|
|
542
578
|
}
|
|
543
579
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GridMessages, decorators: [{
|
|
544
580
|
type: Directive,
|
|
@@ -588,6 +624,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
588
624
|
type: Input
|
|
589
625
|
}], booleanFilterCellLabel: [{
|
|
590
626
|
type: Input
|
|
627
|
+
}], aiAssistantApplyButtonText: [{
|
|
628
|
+
type: Input
|
|
629
|
+
}], aiAssistantToolbarToolText: [{
|
|
630
|
+
type: Input
|
|
631
|
+
}], aiAssistantWindowTitle: [{
|
|
632
|
+
type: Input
|
|
633
|
+
}], aiAssistantWindowCloseTitle: [{
|
|
634
|
+
type: Input
|
|
635
|
+
}], aiAssistantOutputCardTitle: [{
|
|
636
|
+
type: Input
|
|
637
|
+
}], aiAssistantOutputCardBodyContent: [{
|
|
638
|
+
type: Input
|
|
639
|
+
}], aiAssistantWindowMaximizeTitle: [{
|
|
640
|
+
type: Input
|
|
641
|
+
}], aiAssistantWindowMinimizeTitle: [{
|
|
642
|
+
type: Input
|
|
643
|
+
}], aiAssistantWindowRestoreTitle: [{
|
|
644
|
+
type: Input
|
|
591
645
|
}], filterEqOperator: [{
|
|
592
646
|
type: Input
|
|
593
647
|
}], filterNotEqOperator: [{
|
|
@@ -10,7 +10,7 @@ export const packageMetadata = {
|
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCode: 'KENDOUIANGULAR',
|
|
12
12
|
productCodes: ['KENDOUIANGULAR'],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: '19.3.0-develop.
|
|
13
|
+
publishDate: 1754479136,
|
|
14
|
+
version: '19.3.0-develop.22',
|
|
15
15
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
16
16
|
};
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Component, ViewChild } from '@angular/core';
|
|
6
|
+
import { AIPromptComponent, OutputViewComponent, PromptViewComponent, AIPromptCustomMessagesComponent, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective } from '@progress/kendo-angular-conversational-ui';
|
|
7
|
+
import { HttpClient, HttpRequest } from '@angular/common/http';
|
|
8
|
+
import { ContextService } from './../../../../common/provider.service';
|
|
9
|
+
import { ColumnInfoService } from './../../../../common/column-info.service';
|
|
10
|
+
import { convertDateStringsInFilter } from './utils';
|
|
11
|
+
import { NgIf } from '@angular/common';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "@angular/common/http";
|
|
14
|
+
import * as i2 from "./../../../../common/provider.service";
|
|
15
|
+
import * as i3 from "./../../../../common/column-info.service";
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export class AiAssistantComponent {
|
|
20
|
+
http;
|
|
21
|
+
ctx;
|
|
22
|
+
columnInfoService;
|
|
23
|
+
aiPrompt;
|
|
24
|
+
activeView = 0;
|
|
25
|
+
promptOutputs = [];
|
|
26
|
+
requestUrl;
|
|
27
|
+
requestOptions;
|
|
28
|
+
aiPromptSettings;
|
|
29
|
+
aiToolDirective;
|
|
30
|
+
streaming = false;
|
|
31
|
+
disabledGenerateButton = false;
|
|
32
|
+
lastMessage;
|
|
33
|
+
requestData;
|
|
34
|
+
currentRequestSubscription = null;
|
|
35
|
+
//Remove this when the AI Assistant has a built-in loading indicator
|
|
36
|
+
loadingOutput = { id: 'k-loading-item', output: '', prompt: '' };
|
|
37
|
+
columns = [];
|
|
38
|
+
idCounter = 0;
|
|
39
|
+
constructor(http, ctx, columnInfoService) {
|
|
40
|
+
this.http = http;
|
|
41
|
+
this.ctx = ctx;
|
|
42
|
+
this.columnInfoService = columnInfoService;
|
|
43
|
+
}
|
|
44
|
+
ngAfterViewInit() {
|
|
45
|
+
this.columns = this.columnInfoService.leafNamedColumns.map((col) => ({
|
|
46
|
+
field: col.field,
|
|
47
|
+
title: col.title || col.field
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
ngOnDestroy() {
|
|
51
|
+
this.unsubscribeCurrentRequest();
|
|
52
|
+
}
|
|
53
|
+
message(message) {
|
|
54
|
+
return this.ctx.localization.get(message);
|
|
55
|
+
}
|
|
56
|
+
cancelRequest() {
|
|
57
|
+
this.aiToolDirective.cancelRequest.emit();
|
|
58
|
+
this.unsubscribeCurrentRequest();
|
|
59
|
+
this.streaming = false;
|
|
60
|
+
}
|
|
61
|
+
onPromptRequest(ev) {
|
|
62
|
+
if (this.promptOutputs.length === 0) {
|
|
63
|
+
this.promptOutputs.push(this.loadingOutput);
|
|
64
|
+
}
|
|
65
|
+
this.unsubscribeCurrentRequest();
|
|
66
|
+
this.streaming = true;
|
|
67
|
+
this.activeView = 1;
|
|
68
|
+
if (ev.prompt) {
|
|
69
|
+
this.lastMessage = ev.prompt;
|
|
70
|
+
}
|
|
71
|
+
this.requestData = {
|
|
72
|
+
columns: this.columns,
|
|
73
|
+
promptMessage: ev.prompt,
|
|
74
|
+
url: this.requestUrl,
|
|
75
|
+
requestOptions: {
|
|
76
|
+
...this.requestOptions
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
if (!this.requestOptions.body) {
|
|
80
|
+
const requestBody = {
|
|
81
|
+
role: this.requestData.requestOptions.role,
|
|
82
|
+
contents: [
|
|
83
|
+
{
|
|
84
|
+
text: this.requestData.promptMessage
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
columns: this.requestData.columns
|
|
88
|
+
};
|
|
89
|
+
this.requestData.requestOptions.body = requestBody;
|
|
90
|
+
}
|
|
91
|
+
this.aiToolDirective.promptRequest.emit({ requestData: this.requestData, isRetry: ev.isRetry });
|
|
92
|
+
if (!this.requestUrl) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.currentRequestSubscription = this.sendPromptRequest().subscribe((res) => {
|
|
96
|
+
if (res.body) {
|
|
97
|
+
this.processResponse(res);
|
|
98
|
+
this.streaming = false;
|
|
99
|
+
}
|
|
100
|
+
this.currentRequestSubscription = null;
|
|
101
|
+
}, (error) => {
|
|
102
|
+
this.handleError(error);
|
|
103
|
+
this.streaming = false;
|
|
104
|
+
this.currentRequestSubscription = null;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
sendPromptRequest() {
|
|
108
|
+
const request = new HttpRequest(this.requestData.requestOptions.method, this.requestData.url, this.requestData.requestOptions.body, this.requestData.requestOptions);
|
|
109
|
+
return this.http.request(request);
|
|
110
|
+
}
|
|
111
|
+
processResponse(response) {
|
|
112
|
+
const responseBody = response.body;
|
|
113
|
+
const isFilterable = Boolean(this.ctx.grid.filterable);
|
|
114
|
+
const isSortable = Boolean(this.ctx.grid.sortable);
|
|
115
|
+
const isGroupable = Boolean(this.ctx.grid.groupable);
|
|
116
|
+
if (isFilterable && responseBody.filter) {
|
|
117
|
+
this.processFilterResponse(responseBody.filter);
|
|
118
|
+
}
|
|
119
|
+
if (isSortable && responseBody.sort) {
|
|
120
|
+
this.processArrayResponse(responseBody.sort, this.ctx.grid.currentState.sort || [], (item) => item.field, (mergedArray) => this.ctx.grid.sortChange.next(mergedArray));
|
|
121
|
+
}
|
|
122
|
+
if (isGroupable && responseBody.group) {
|
|
123
|
+
this.processArrayResponse(responseBody.group, this.ctx.grid.currentState.group || [], (item) => item.field, (mergedArray) => this.ctx.grid.groupChange.next(mergedArray));
|
|
124
|
+
}
|
|
125
|
+
const responseContentStart = [`${this.ctx.localization.get('aiAssistantOutputCardBodyContent')} \n`];
|
|
126
|
+
const responseContentBody = responseBody.messages
|
|
127
|
+
.map((output, idx) => `${idx + 1} ${output}`)
|
|
128
|
+
.join('\n');
|
|
129
|
+
const output = {
|
|
130
|
+
id: this.idCounter++,
|
|
131
|
+
title: this.ctx.localization.get('aiAssistantOutputCardTitle'),
|
|
132
|
+
prompt: this.lastMessage,
|
|
133
|
+
output: responseContentStart.concat(responseContentBody).join(''),
|
|
134
|
+
};
|
|
135
|
+
if (this.promptOutputs[0].id === this.loadingOutput.id) {
|
|
136
|
+
this.promptOutputs.splice(0, 1);
|
|
137
|
+
}
|
|
138
|
+
this.promptOutputs.unshift(output);
|
|
139
|
+
this.aiToolDirective.responseSuccess.emit(response);
|
|
140
|
+
}
|
|
141
|
+
handleError(error) {
|
|
142
|
+
const output = {
|
|
143
|
+
id: this.idCounter++,
|
|
144
|
+
prompt: this.lastMessage,
|
|
145
|
+
output: error.message
|
|
146
|
+
};
|
|
147
|
+
this.promptOutputs.unshift(output);
|
|
148
|
+
this.aiToolDirective.responseError.emit(error);
|
|
149
|
+
}
|
|
150
|
+
unsubscribeCurrentRequest() {
|
|
151
|
+
if (this.currentRequestSubscription) {
|
|
152
|
+
this.currentRequestSubscription.unsubscribe();
|
|
153
|
+
this.currentRequestSubscription = null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
processArrayResponse(newItems, currentItems, getField, updateGrid) {
|
|
157
|
+
if (newItems?.length === 0) {
|
|
158
|
+
updateGrid([]);
|
|
159
|
+
}
|
|
160
|
+
else if (newItems?.length) {
|
|
161
|
+
let mergedArray = [...newItems];
|
|
162
|
+
const newFields = newItems.map(getField);
|
|
163
|
+
const existingItemsToKeep = currentItems.filter(item => !newFields.includes(getField(item)));
|
|
164
|
+
mergedArray = [...mergedArray, ...existingItemsToKeep];
|
|
165
|
+
updateGrid(mergedArray);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
processFilterResponse(filter) {
|
|
169
|
+
const processedFilter = convertDateStringsInFilter(filter, this.columnInfoService.leafNamedColumns);
|
|
170
|
+
const clearFilter = Object.keys(processedFilter).length === 0;
|
|
171
|
+
if (clearFilter) {
|
|
172
|
+
this.ctx.grid.filterChange.next(undefined);
|
|
173
|
+
}
|
|
174
|
+
else if (processedFilter?.filters.length) {
|
|
175
|
+
const currentFilter = this.ctx.grid.currentState.filter;
|
|
176
|
+
let mergedFilter = processedFilter;
|
|
177
|
+
if (currentFilter && currentFilter.filters?.length > 0) {
|
|
178
|
+
mergedFilter = {
|
|
179
|
+
logic: 'and',
|
|
180
|
+
filters: [
|
|
181
|
+
currentFilter,
|
|
182
|
+
processedFilter
|
|
183
|
+
]
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
this.ctx.grid.filterChange.next(mergedFilter);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AiAssistantComponent, deps: [{ token: i1.HttpClient }, { token: i2.ContextService }, { token: i3.ColumnInfoService }], target: i0.ɵɵFactoryTarget.Component });
|
|
190
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AiAssistantComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "aiPrompt", first: true, predicate: AIPromptComponent, descendants: true }], ngImport: i0, template: `
|
|
191
|
+
<kendo-aiprompt
|
|
192
|
+
#aiPrompt
|
|
193
|
+
[promptSuggestions]="aiPromptSettings?.promptSuggestions"
|
|
194
|
+
[showOutputRating]="aiPromptSettings?.showOutputRating"
|
|
195
|
+
[streaming]="streaming"
|
|
196
|
+
[speechToTextButton]="aiPromptSettings?.speechToTextButton"
|
|
197
|
+
[(activeView)]="activeView"
|
|
198
|
+
[generateButtonSVGIcon]="aiPromptSettings?.generateButtonSVGIcon"
|
|
199
|
+
[generateButtonIcon]="aiPromptSettings?.generateButtonIcon"
|
|
200
|
+
[disabledGenerateButton]="disabledGenerateButton || promptView.textAreaValue?.length === 0"
|
|
201
|
+
[promptOutputs]="aiPromptSettings?.promptOutputs || promptOutputs"
|
|
202
|
+
(promptRequest)="onPromptRequest($event)"
|
|
203
|
+
(promptRequestCancel)="cancelRequest()"
|
|
204
|
+
>
|
|
205
|
+
<kendo-aiprompt-prompt-view #promptView></kendo-aiprompt-prompt-view>
|
|
206
|
+
<kendo-aiprompt-output-view></kendo-aiprompt-output-view>
|
|
207
|
+
<ng-template *ngIf="streaming && aiPrompt.streaming" kendoAIPromptOutputTemplate let-output>
|
|
208
|
+
<div class="k-card">
|
|
209
|
+
<div class="k-card-header">
|
|
210
|
+
<div class="k-card-title">
|
|
211
|
+
<span class="k-skeleton k-skeleton-text k-skeleton-pulse" [style.width.px]="200"></span>
|
|
212
|
+
</div>
|
|
213
|
+
<div class="k-card-subtitle">
|
|
214
|
+
<span class="k-skeleton k-skeleton-text k-skeleton-pulse" style="width: 100%;"></span>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
<div class="k-card-body">
|
|
218
|
+
<span class="k-skeleton k-skeleton-rect k-skeleton-pulse" style="height: 80px;"></span>
|
|
219
|
+
</div>
|
|
220
|
+
<div class="k-card-actions">
|
|
221
|
+
<span class="k-skeleton k-skeleton-text k-skeleton-pulse" style="width: 100%;"></span>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
</ng-template>
|
|
225
|
+
<ng-template *ngIf="!(streaming && aiPrompt.streaming)" kendoAIPromptOutputBodyTemplate let-output>
|
|
226
|
+
<p>{{output.output}}</p>
|
|
227
|
+
</ng-template>
|
|
228
|
+
<kendo-aiprompt-messages
|
|
229
|
+
[generateOutput]="message('aiAssistantApplyButtonText')"
|
|
230
|
+
></kendo-aiprompt-messages>
|
|
231
|
+
</kendo-aiprompt>
|
|
232
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: AIPromptComponent, selector: "kendo-aiprompt", inputs: ["activeView", "promptCommands", "promptSuggestions", "promptOutputs", "showOutputRating", "streaming", "speechToTextButton", "textAreaSettings", "generateButtonSVGIcon", "generateButtonIcon", "disabledGenerateButton"], outputs: ["activeViewChange", "promptRequest", "commandExecute", "outputCopy", "outputRatingChange", "promptRequestCancel"], exportAs: ["kendoAIPrompt"] }, { kind: "component", type: AIPromptCustomMessagesComponent, selector: "kendo-aiprompt-messages" }, { kind: "component", type: PromptViewComponent, selector: "kendo-aiprompt-prompt-view" }, { kind: "component", type: OutputViewComponent, selector: "kendo-aiprompt-output-view" }, { kind: "directive", type: AIPromptOutputTemplateDirective, selector: "[kendoAIPromptOutputTemplate]" }, { kind: "directive", type: AIPromptOutputBodyTemplateDirective, selector: "[kendoAIPromptOutputBodyTemplate]" }] });
|
|
233
|
+
}
|
|
234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AiAssistantComponent, decorators: [{
|
|
235
|
+
type: Component,
|
|
236
|
+
args: [{
|
|
237
|
+
standalone: true,
|
|
238
|
+
imports: [NgIf, AIPromptComponent, AIPromptCustomMessagesComponent, PromptViewComponent, OutputViewComponent, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective],
|
|
239
|
+
template: `
|
|
240
|
+
<kendo-aiprompt
|
|
241
|
+
#aiPrompt
|
|
242
|
+
[promptSuggestions]="aiPromptSettings?.promptSuggestions"
|
|
243
|
+
[showOutputRating]="aiPromptSettings?.showOutputRating"
|
|
244
|
+
[streaming]="streaming"
|
|
245
|
+
[speechToTextButton]="aiPromptSettings?.speechToTextButton"
|
|
246
|
+
[(activeView)]="activeView"
|
|
247
|
+
[generateButtonSVGIcon]="aiPromptSettings?.generateButtonSVGIcon"
|
|
248
|
+
[generateButtonIcon]="aiPromptSettings?.generateButtonIcon"
|
|
249
|
+
[disabledGenerateButton]="disabledGenerateButton || promptView.textAreaValue?.length === 0"
|
|
250
|
+
[promptOutputs]="aiPromptSettings?.promptOutputs || promptOutputs"
|
|
251
|
+
(promptRequest)="onPromptRequest($event)"
|
|
252
|
+
(promptRequestCancel)="cancelRequest()"
|
|
253
|
+
>
|
|
254
|
+
<kendo-aiprompt-prompt-view #promptView></kendo-aiprompt-prompt-view>
|
|
255
|
+
<kendo-aiprompt-output-view></kendo-aiprompt-output-view>
|
|
256
|
+
<ng-template *ngIf="streaming && aiPrompt.streaming" kendoAIPromptOutputTemplate let-output>
|
|
257
|
+
<div class="k-card">
|
|
258
|
+
<div class="k-card-header">
|
|
259
|
+
<div class="k-card-title">
|
|
260
|
+
<span class="k-skeleton k-skeleton-text k-skeleton-pulse" [style.width.px]="200"></span>
|
|
261
|
+
</div>
|
|
262
|
+
<div class="k-card-subtitle">
|
|
263
|
+
<span class="k-skeleton k-skeleton-text k-skeleton-pulse" style="width: 100%;"></span>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
<div class="k-card-body">
|
|
267
|
+
<span class="k-skeleton k-skeleton-rect k-skeleton-pulse" style="height: 80px;"></span>
|
|
268
|
+
</div>
|
|
269
|
+
<div class="k-card-actions">
|
|
270
|
+
<span class="k-skeleton k-skeleton-text k-skeleton-pulse" style="width: 100%;"></span>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
</ng-template>
|
|
274
|
+
<ng-template *ngIf="!(streaming && aiPrompt.streaming)" kendoAIPromptOutputBodyTemplate let-output>
|
|
275
|
+
<p>{{output.output}}</p>
|
|
276
|
+
</ng-template>
|
|
277
|
+
<kendo-aiprompt-messages
|
|
278
|
+
[generateOutput]="message('aiAssistantApplyButtonText')"
|
|
279
|
+
></kendo-aiprompt-messages>
|
|
280
|
+
</kendo-aiprompt>
|
|
281
|
+
`
|
|
282
|
+
}]
|
|
283
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ContextService }, { type: i3.ColumnInfoService }]; }, propDecorators: { aiPrompt: [{
|
|
284
|
+
type: ViewChild,
|
|
285
|
+
args: [AIPromptComponent]
|
|
286
|
+
}] } });
|