@progress/kendo-angular-conversational-ui 14.4.0-develop.9 → 15.0.0-develop.1
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/NOTICE.txt +146 -593
- package/ai-prompt/aiprompt.component.d.ts +120 -0
- package/ai-prompt/aiprompt.module.d.ts +25 -0
- package/ai-prompt/common/aiprompt.service.d.ts +26 -0
- package/ai-prompt/common/output-card.component.d.ts +36 -0
- package/ai-prompt/common/toolbar-focusable.directive.d.ts +24 -0
- package/ai-prompt/common/toolbar-navigation.service.d.ts +24 -0
- package/ai-prompt/localization/custom-messages.component.d.ts +17 -0
- package/ai-prompt/localization/localized-messages.directive.d.ts +16 -0
- package/ai-prompt/localization/messages.d.ts +49 -0
- package/ai-prompt/models/command-execute-event.d.ts +23 -0
- package/ai-prompt/models/command.interface.d.ts +30 -0
- package/ai-prompt/models/index.d.ts +10 -0
- package/ai-prompt/models/output-rating-change-event.d.ts +18 -0
- package/ai-prompt/models/prompt-output.interface.d.ts +41 -0
- package/ai-prompt/models/prompt-request-event.d.ts +22 -0
- package/ai-prompt/models/view-type.d.ts +8 -0
- package/ai-prompt/templates/toolbar-actions.template.d.ts +18 -0
- package/ai-prompt/utils.d.ts +19 -0
- package/ai-prompt/views/base-view.d.ts +46 -0
- package/ai-prompt/views/command-view.component.d.ts +23 -0
- package/ai-prompt/views/custom-view.component.d.ts +20 -0
- package/ai-prompt/views/index.d.ts +8 -0
- package/ai-prompt/views/output-view.component.d.ts +22 -0
- package/ai-prompt/views/prompt-view.component.d.ts +47 -0
- package/{api → chat/api}/execute-action-event.d.ts +1 -1
- package/chat/attachment.component.d.ts +1 -1
- package/chat/builtin-actions.d.ts +1 -1
- package/chat/chat-view.d.ts +1 -1
- package/chat/chat.component.d.ts +2 -2
- package/chat/chat.module.d.ts +3 -3
- package/chat/message-attachments.component.d.ts +1 -1
- package/chat/message-box.component.d.ts +2 -2
- package/chat/message-list.component.d.ts +1 -1
- package/chat/message.component.d.ts +1 -1
- package/chat/suggested-actions.component.d.ts +1 -1
- package/conversational-ui.module.d.ts +43 -0
- package/esm2020/ai-prompt/aiprompt.component.mjs +348 -0
- package/esm2020/ai-prompt/aiprompt.module.mjs +79 -0
- package/esm2020/ai-prompt/common/aiprompt.service.mjs +38 -0
- package/esm2020/ai-prompt/common/output-card.component.mjs +199 -0
- package/esm2020/ai-prompt/common/toolbar-focusable.directive.mjs +67 -0
- package/esm2020/ai-prompt/common/toolbar-navigation.service.mjs +55 -0
- package/esm2020/ai-prompt/localization/custom-messages.component.mjs +41 -0
- package/esm2020/ai-prompt/localization/localized-messages.directive.mjs +37 -0
- package/esm2020/ai-prompt/localization/messages.mjs +35 -0
- package/esm2020/ai-prompt/models/prompt-output.interface.mjs +5 -0
- package/esm2020/ai-prompt/models/prompt-request-event.mjs +5 -0
- package/esm2020/ai-prompt/models/view-type.mjs +5 -0
- package/esm2020/ai-prompt/templates/toolbar-actions.template.mjs +27 -0
- package/esm2020/ai-prompt/utils.mjs +26 -0
- package/esm2020/ai-prompt/views/base-view.mjs +89 -0
- package/esm2020/ai-prompt/views/command-view.component.mjs +82 -0
- package/esm2020/ai-prompt/views/custom-view.component.mjs +35 -0
- package/esm2020/ai-prompt/views/index.mjs +8 -0
- package/esm2020/ai-prompt/views/output-view.component.mjs +66 -0
- package/esm2020/ai-prompt/views/prompt-view.component.mjs +146 -0
- package/esm2020/chat/api/attachment.interface.mjs +5 -0
- package/esm2020/chat/api/message.interface.mjs +5 -0
- package/esm2020/chat/api/user.interface.mjs +5 -0
- package/esm2020/chat/builtin-actions.mjs +1 -1
- package/esm2020/chat/chat.component.mjs +1 -1
- package/esm2020/chat/chat.module.mjs +3 -3
- package/esm2020/chat/common/models/message-box-options.mjs +5 -0
- package/esm2020/chat/message-box.component.mjs +2 -2
- package/esm2020/chat/message-list.component.mjs +2 -2
- package/esm2020/conversational-ui.module.mjs +50 -0
- package/esm2020/index.mjs +10 -2
- package/esm2020/package-metadata.mjs +2 -2
- package/fesm2015/progress-kendo-angular-conversational-ui.mjs +1411 -149
- package/fesm2020/progress-kendo-angular-conversational-ui.mjs +1299 -43
- package/index.d.ts +11 -3
- package/package.json +10 -7
- package/schematics/ngAdd/index.js +4 -2
- /package/{api → chat/api}/action.interface.d.ts +0 -0
- /package/{api → chat/api}/attachment.interface.d.ts +0 -0
- /package/{api → chat/api}/index.d.ts +0 -0
- /package/{api → chat/api}/message.interface.d.ts +0 -0
- /package/{api → chat/api}/post-message-event.d.ts +0 -0
- /package/{api → chat/api}/preventable-event.d.ts +0 -0
- /package/{api → chat/api}/user.interface.d.ts +0 -0
- /package/{cards → chat/cards}/hero-card.component.d.ts +0 -0
- /package/{common → chat/common}/focused-state.directive.d.ts +0 -0
- /package/{common → chat/common}/models/message-box-options.d.ts +0 -0
- /package/{common → chat/common}/scroll-anchor.directive.d.ts +0 -0
- /package/{common → chat/common}/utils.d.ts +0 -0
- /package/esm2020/{api/attachment.interface.mjs → ai-prompt/models/command-execute-event.mjs} +0 -0
- /package/esm2020/{api/message.interface.mjs → ai-prompt/models/command.interface.mjs} +0 -0
- /package/esm2020/{api/user.interface.mjs → ai-prompt/models/index.mjs} +0 -0
- /package/esm2020/{common/models/message-box-options.mjs → ai-prompt/models/output-rating-change-event.mjs} +0 -0
- /package/esm2020/{api → chat/api}/action.interface.mjs +0 -0
- /package/esm2020/{api → chat/api}/execute-action-event.mjs +0 -0
- /package/esm2020/{api → chat/api}/index.mjs +0 -0
- /package/esm2020/{api → chat/api}/post-message-event.mjs +0 -0
- /package/esm2020/{api → chat/api}/preventable-event.mjs +0 -0
- /package/esm2020/{cards → chat/cards}/hero-card.component.mjs +0 -0
- /package/esm2020/{common → chat/common}/focused-state.directive.mjs +0 -0
- /package/esm2020/{common → chat/common}/scroll-anchor.directive.mjs +0 -0
- /package/esm2020/{common → chat/common}/utils.mjs +0 -0
@@ -3,20 +3,25 @@
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
5
5
|
import * as i0 from '@angular/core';
|
6
|
-
import { Directive, Optional, isDevMode, EventEmitter, forwardRef, Component, Input, Output, HostBinding, ViewChildren, ElementRef, ViewChild, HostListener, ContentChild, NgModule } from '@angular/core';
|
6
|
+
import { Directive, Optional, isDevMode, EventEmitter, forwardRef, Component, Input, Output, HostBinding, ViewChildren, ElementRef, ViewChild, HostListener, ContentChild, InjectionToken, Inject, Injectable, ContentChildren, NgModule } from '@angular/core';
|
7
7
|
import * as i1$1 from '@progress/kendo-angular-l10n';
|
8
8
|
import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
9
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
10
10
|
import * as i6 from '@progress/kendo-angular-common';
|
11
|
-
import { Keys, ResizeSensorModule } from '@progress/kendo-angular-common';
|
12
|
-
import { fromEvent, Subscription } from 'rxjs';
|
11
|
+
import { Keys, isPresent, guid, focusableSelector, ResizeSensorModule } from '@progress/kendo-angular-common';
|
12
|
+
import { fromEvent, Subscription, Subject } from 'rxjs';
|
13
13
|
import * as i2 from '@angular/common';
|
14
14
|
import { CommonModule } from '@angular/common';
|
15
15
|
import * as i1 from '@progress/kendo-angular-intl';
|
16
16
|
import { debounceTime } from 'rxjs/operators';
|
17
|
-
import { chevronLeftIcon, chevronRightIcon, paperPlaneIcon } from '@progress/kendo-svg-icons';
|
18
|
-
import * as
|
19
|
-
import { ButtonModule } from '@progress/kendo-angular-buttons';
|
17
|
+
import { chevronLeftIcon, chevronRightIcon, paperPlaneIcon, sparklesIcon, commentIcon, moreHorizontalIcon, chevronUpIcon, chevronDownIcon, copyIcon, arrowRotateCwIcon, thumbUpOutlineIcon, thumbDownOutlineIcon, thumbUpIcon, thumbDownIcon } from '@progress/kendo-svg-icons';
|
18
|
+
import * as i4 from '@progress/kendo-angular-buttons';
|
19
|
+
import { ButtonsModule, ButtonModule } from '@progress/kendo-angular-buttons';
|
20
|
+
import { IconsModule } from '@progress/kendo-angular-icons';
|
21
|
+
import * as i3 from '@progress/kendo-angular-inputs';
|
22
|
+
import { InputsModule } from '@progress/kendo-angular-inputs';
|
23
|
+
import * as i3$1 from '@progress/kendo-angular-layout';
|
24
|
+
import { LayoutModule } from '@progress/kendo-angular-layout';
|
20
25
|
|
21
26
|
/**
|
22
27
|
* Defines a template that will be used for displaying message attachments. To define an attachment
|
@@ -119,8 +124,8 @@ const packageMetadata = {
|
|
119
124
|
name: '@progress/kendo-angular-conversational-ui',
|
120
125
|
productName: 'Kendo UI for Angular',
|
121
126
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
122
|
-
publishDate:
|
123
|
-
version: '
|
127
|
+
publishDate: 1706543943,
|
128
|
+
version: '15.0.0-develop.1',
|
124
129
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
125
130
|
};
|
126
131
|
|
@@ -735,7 +740,7 @@ MessageAttachmentsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.
|
|
735
740
|
icon="chevron-right"
|
736
741
|
>
|
737
742
|
</button>
|
738
|
-
`, isInline: true, components: [{ type:
|
743
|
+
`, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: AttachmentComponent, selector: "kendo-chat-attachment", inputs: ["attachment", "template"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
739
744
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageAttachmentsComponent, decorators: [{
|
740
745
|
type: Component,
|
741
746
|
args: [{
|
@@ -1278,7 +1283,7 @@ MessageBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
|
|
1278
1283
|
</ng-container>
|
1279
1284
|
|
1280
1285
|
<ng-template *ngIf="messageBoxTemplate" [ngTemplateOutlet]="messageBoxTemplate?.templateRef"></ng-template>
|
1281
|
-
`, isInline: true, components: [{ type:
|
1286
|
+
`, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: FocusedStateDirective, selector: "[kendoChatFocusedState]" }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
1282
1287
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageBoxComponent, decorators: [{
|
1283
1288
|
type: Component,
|
1284
1289
|
args: [{
|
@@ -1351,11 +1356,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
1351
1356
|
/**
|
1352
1357
|
* @hidden
|
1353
1358
|
*/
|
1354
|
-
class Messages extends ComponentMessages {
|
1359
|
+
class Messages$1 extends ComponentMessages {
|
1355
1360
|
}
|
1356
|
-
Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
1357
|
-
Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, selector: "kendoConversationalUIMessages", inputs: { messagePlaceholder: "messagePlaceholder", send: "send", messageListLabel: "messageListLabel", messageBoxInputLabel: "messageBoxInputLabel", messageAttachmentLeftArrow: "messageAttachmentLeftArrow", messageAttachmentRightArrow: "messageAttachmentRightArrow", messageAvatarAlt: "messageAvatarAlt" }, usesInheritance: true, ngImport: i0 });
|
1358
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, decorators: [{
|
1361
|
+
Messages$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages$1, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
1362
|
+
Messages$1.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages$1, selector: "kendoConversationalUIMessages", inputs: { messagePlaceholder: "messagePlaceholder", send: "send", messageListLabel: "messageListLabel", messageBoxInputLabel: "messageBoxInputLabel", messageAttachmentLeftArrow: "messageAttachmentLeftArrow", messageAttachmentRightArrow: "messageAttachmentRightArrow", messageAvatarAlt: "messageAvatarAlt" }, usesInheritance: true, ngImport: i0 });
|
1363
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages$1, decorators: [{
|
1359
1364
|
type: Directive,
|
1360
1365
|
args: [{
|
1361
1366
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
@@ -1381,26 +1386,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
1381
1386
|
/**
|
1382
1387
|
* @hidden
|
1383
1388
|
*/
|
1384
|
-
class LocalizedMessagesDirective extends Messages {
|
1389
|
+
class LocalizedMessagesDirective$1 extends Messages$1 {
|
1385
1390
|
constructor(service) {
|
1386
1391
|
super();
|
1387
1392
|
this.service = service;
|
1388
1393
|
}
|
1389
1394
|
}
|
1390
|
-
LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
1391
|
-
LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: LocalizedMessagesDirective, selector: "[kendoChatLocalizedMessages]", providers: [
|
1395
|
+
LocalizedMessagesDirective$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective$1, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
1396
|
+
LocalizedMessagesDirective$1.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: LocalizedMessagesDirective$1, selector: "[kendoChatLocalizedMessages]", providers: [
|
1392
1397
|
{
|
1393
|
-
provide: Messages,
|
1394
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
1398
|
+
provide: Messages$1,
|
1399
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective$1)
|
1395
1400
|
}
|
1396
1401
|
], usesInheritance: true, ngImport: i0 });
|
1397
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
1402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective$1, decorators: [{
|
1398
1403
|
type: Directive,
|
1399
1404
|
args: [{
|
1400
1405
|
providers: [
|
1401
1406
|
{
|
1402
|
-
provide: Messages,
|
1403
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
1407
|
+
provide: Messages$1,
|
1408
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective$1)
|
1404
1409
|
}
|
1405
1410
|
],
|
1406
1411
|
selector: '[kendoChatLocalizedMessages]'
|
@@ -1636,7 +1641,7 @@ ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version:
|
|
1636
1641
|
(sendMessage)="sendMessage.emit($event)"
|
1637
1642
|
>
|
1638
1643
|
</kendo-message-box>
|
1639
|
-
`, isInline: true, components: [{ type: MessageListComponent, selector: "kendo-chat-message-list", inputs: ["messages", "attachmentTemplate", "messageTemplate", "localization", "user"], outputs: ["executeAction", "navigate", "resize"] }, { type: MessageBoxComponent, selector: "kendo-message-box", inputs: ["user", "autoScroll", "type", "localization", "messageBoxTemplate"], outputs: ["sendMessage"] }], directives: [{ type: LocalizedMessagesDirective, selector: "[kendoChatLocalizedMessages]" }, { type: ScrollAnchorDirective, selector: "[kendoChatScrollAnchor]", inputs: ["autoScroll"], outputs: ["autoScrollChange"], exportAs: ["scrollAnchor"] }] });
|
1644
|
+
`, isInline: true, components: [{ type: MessageListComponent, selector: "kendo-chat-message-list", inputs: ["messages", "attachmentTemplate", "messageTemplate", "localization", "user"], outputs: ["executeAction", "navigate", "resize"] }, { type: MessageBoxComponent, selector: "kendo-message-box", inputs: ["user", "autoScroll", "type", "localization", "messageBoxTemplate"], outputs: ["sendMessage"] }], directives: [{ type: LocalizedMessagesDirective$1, selector: "[kendoChatLocalizedMessages]" }, { type: ScrollAnchorDirective, selector: "[kendoChatScrollAnchor]", inputs: ["autoScroll"], outputs: ["autoScrollChange"], exportAs: ["scrollAnchor"] }] });
|
1640
1645
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ChatComponent, decorators: [{
|
1641
1646
|
type: Component,
|
1642
1647
|
args: [{
|
@@ -1740,176 +1745,1390 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
1740
1745
|
args: ['messageList', { static: true }]
|
1741
1746
|
}] } });
|
1742
1747
|
|
1743
|
-
// eslint-disable no-forward-ref
|
1744
1748
|
/**
|
1745
|
-
*
|
1746
|
-
* ([see example]({% slug globalization_chat %}#toc-custom-messages)).
|
1749
|
+
* @hidden
|
1747
1750
|
*/
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
+
const MY_TOKEN = new InjectionToken('COMMAND_TOKEN');
|
1752
|
+
/**
|
1753
|
+
* @hidden
|
1754
|
+
*/
|
1755
|
+
const DEFAULT_SVG_ICONS = {
|
1756
|
+
prompt: sparklesIcon,
|
1757
|
+
output: commentIcon,
|
1758
|
+
command: moreHorizontalIcon
|
1759
|
+
};
|
1760
|
+
/**
|
1761
|
+
* @hidden
|
1762
|
+
*/
|
1763
|
+
const DEFAULT_ICONS = {
|
1764
|
+
prompt: 'sparkles',
|
1765
|
+
output: 'comment',
|
1766
|
+
command: 'more-horizontal'
|
1767
|
+
};
|
1768
|
+
|
1769
|
+
/**
|
1770
|
+
* @hidden
|
1771
|
+
*/
|
1772
|
+
class BaseView {
|
1773
|
+
constructor(viewType, localization) {
|
1774
|
+
this.viewType = viewType;
|
1775
|
+
this.localization = localization;
|
1776
|
+
this.hostClasses = true;
|
1777
|
+
if (this.viewType !== 'custom') {
|
1778
|
+
this.icon = DEFAULT_ICONS[this.viewType];
|
1779
|
+
this.svgIcon = DEFAULT_SVG_ICONS[this.viewType];
|
1780
|
+
}
|
1781
|
+
}
|
1782
|
+
/**
|
1783
|
+
* The text of the ToolBar button corresponding to the view.
|
1784
|
+
*/
|
1785
|
+
set buttonText(value) {
|
1786
|
+
this._buttonText = value;
|
1787
|
+
}
|
1788
|
+
get buttonText() {
|
1789
|
+
return isPresent(this._buttonText) ?
|
1790
|
+
this._buttonText :
|
1791
|
+
this.messageFor(`${this.viewType}View`);
|
1792
|
+
}
|
1793
|
+
/**
|
1794
|
+
* The font icon of the ToolBar button corresponding to the view.
|
1795
|
+
*/
|
1796
|
+
set icon(value) {
|
1797
|
+
if (isPresent(value)) {
|
1798
|
+
this._icon = value;
|
1799
|
+
}
|
1800
|
+
else {
|
1801
|
+
this.icon = DEFAULT_ICONS[this.viewType];
|
1802
|
+
}
|
1803
|
+
}
|
1804
|
+
get icon() {
|
1805
|
+
return this._icon;
|
1806
|
+
}
|
1807
|
+
/**
|
1808
|
+
* The SVG icon of the ToolBar button corresponding to the view.
|
1809
|
+
*/
|
1810
|
+
set svgIcon(value) {
|
1811
|
+
if (isPresent(value)) {
|
1812
|
+
this._svgIcon = value;
|
1813
|
+
}
|
1814
|
+
else {
|
1815
|
+
this.svgIcon = DEFAULT_SVG_ICONS[this.viewType];
|
1816
|
+
}
|
1817
|
+
}
|
1818
|
+
get svgIcon() {
|
1819
|
+
return this._svgIcon;
|
1820
|
+
}
|
1821
|
+
/**
|
1822
|
+
* @hidden
|
1823
|
+
*/
|
1824
|
+
messageFor(text) {
|
1825
|
+
return this.localization.get(text);
|
1826
|
+
}
|
1827
|
+
}
|
1828
|
+
BaseView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseView, deps: [{ token: MY_TOKEN }, { token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
1829
|
+
BaseView.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: BaseView, inputs: { buttonText: "buttonText", icon: "icon", svgIcon: "svgIcon" }, host: { properties: { "class.k-prompt-view": "this.hostClasses" } }, viewQueries: [{ propertyName: "template", first: true, predicate: ["content"], descendants: true, static: true }], ngImport: i0 });
|
1830
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseView, decorators: [{
|
1831
|
+
type: Directive
|
1832
|
+
}], ctorParameters: function () {
|
1833
|
+
return [{ type: undefined, decorators: [{
|
1834
|
+
type: Inject,
|
1835
|
+
args: [MY_TOKEN]
|
1836
|
+
}] }, { type: i1$1.LocalizationService }];
|
1837
|
+
}, propDecorators: { hostClasses: [{
|
1838
|
+
type: HostBinding,
|
1839
|
+
args: ['class.k-prompt-view']
|
1840
|
+
}], template: [{
|
1841
|
+
type: ViewChild,
|
1842
|
+
args: ['content', { static: true }]
|
1843
|
+
}], buttonText: [{
|
1844
|
+
type: Input
|
1845
|
+
}], icon: [{
|
1846
|
+
type: Input
|
1847
|
+
}], svgIcon: [{
|
1848
|
+
type: Input
|
1849
|
+
}] } });
|
1850
|
+
|
1851
|
+
/**
|
1852
|
+
* @hidden
|
1853
|
+
*/
|
1854
|
+
class AIPromptService {
|
1855
|
+
constructor() {
|
1856
|
+
this.promptValue = '';
|
1857
|
+
this.showOutputRating = false;
|
1858
|
+
this.requestEvent = new Subject();
|
1859
|
+
this.executeEvent = new Subject();
|
1860
|
+
this.outputCopyEvent = new Subject();
|
1861
|
+
this.outputRatingChangeEvent = new Subject();
|
1862
|
+
}
|
1863
|
+
getFlattenPromptCommands(commands = this.promptCommands) {
|
1864
|
+
let newArr = [];
|
1865
|
+
commands.forEach(c => {
|
1866
|
+
if (c.hasOwnProperty('children')) {
|
1867
|
+
const childrenArr = c.children;
|
1868
|
+
newArr = newArr.concat(childrenArr);
|
1869
|
+
if (childrenArr.length > 0) {
|
1870
|
+
this.getFlattenPromptCommands(childrenArr);
|
1871
|
+
}
|
1872
|
+
}
|
1873
|
+
});
|
1874
|
+
return newArr.concat(this.promptCommands);
|
1875
|
+
}
|
1876
|
+
}
|
1877
|
+
AIPromptService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1878
|
+
AIPromptService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptService });
|
1879
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptService, decorators: [{
|
1880
|
+
type: Injectable
|
1881
|
+
}] });
|
1882
|
+
|
1883
|
+
/**
|
1884
|
+
* The component for rendering the **Prompt** view.
|
1885
|
+
*/
|
1886
|
+
class PromptViewComponent extends BaseView {
|
1887
|
+
constructor(localization, service) {
|
1888
|
+
super('prompt', localization);
|
1751
1889
|
this.service = service;
|
1890
|
+
/**
|
1891
|
+
* @hidden
|
1892
|
+
*/
|
1893
|
+
this.showSuggestions = true;
|
1894
|
+
/**
|
1895
|
+
* @hidden
|
1896
|
+
*/
|
1897
|
+
this.contentId = `k-prompt-suggestions-${guid()}`;
|
1752
1898
|
}
|
1753
|
-
|
1754
|
-
|
1899
|
+
/**
|
1900
|
+
* @hidden
|
1901
|
+
*/
|
1902
|
+
get suggestionsIcons() {
|
1903
|
+
return this.showSuggestions ?
|
1904
|
+
{ font: 'chevron-up', svg: chevronUpIcon } :
|
1905
|
+
{ font: 'chevron-down', svg: chevronDownIcon };
|
1906
|
+
}
|
1907
|
+
/**
|
1908
|
+
* @hidden
|
1909
|
+
*/
|
1910
|
+
get promptSuggestions() {
|
1911
|
+
return this.service.promptSuggestions;
|
1912
|
+
}
|
1913
|
+
/**
|
1914
|
+
*
|
1915
|
+
* @hidden
|
1916
|
+
*/
|
1917
|
+
set textAreaValue(value) {
|
1918
|
+
this.service.promptValue = value;
|
1919
|
+
}
|
1920
|
+
;
|
1921
|
+
get textAreaValue() {
|
1922
|
+
return this.service.promptValue;
|
1923
|
+
}
|
1924
|
+
/**
|
1925
|
+
* @hidden
|
1926
|
+
*/
|
1927
|
+
suggestionClick(suggestion) {
|
1928
|
+
this.textAreaValue = this.service.promptValue = suggestion;
|
1755
1929
|
}
|
1756
1930
|
}
|
1757
|
-
|
1758
|
-
|
1931
|
+
PromptViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: PromptViewComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
1932
|
+
PromptViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: PromptViewComponent, selector: "kendo-aiprompt-prompt-view", providers: [
|
1759
1933
|
{
|
1760
|
-
provide:
|
1761
|
-
useExisting: forwardRef(() =>
|
1934
|
+
provide: BaseView,
|
1935
|
+
useExisting: forwardRef(() => PromptViewComponent)
|
1762
1936
|
}
|
1763
|
-
], usesInheritance: true, ngImport: i0, template:
|
1764
|
-
|
1937
|
+
], usesInheritance: true, ngImport: i0, template: `
|
1938
|
+
<ng-template #content>
|
1939
|
+
<kendo-textarea
|
1940
|
+
[placeholder]="messageFor('promptPlaceholder')"
|
1941
|
+
[rows]="1"
|
1942
|
+
[(value)]="textAreaValue">
|
1943
|
+
</kendo-textarea>
|
1944
|
+
<div class="k-prompt-expander">
|
1945
|
+
<button kendoButton
|
1946
|
+
[attr.aria-controls]="contentId"
|
1947
|
+
[attr.aria-expanded]="showSuggestions"
|
1948
|
+
fillMode="flat"
|
1949
|
+
[icon]="suggestionsIcons.font"
|
1950
|
+
[svgIcon]="suggestionsIcons.svg"
|
1951
|
+
type="button"
|
1952
|
+
(click)="showSuggestions = !showSuggestions">
|
1953
|
+
{{messageFor('promptSuggestions')}}
|
1954
|
+
</button>
|
1955
|
+
<div *ngIf="showSuggestions"
|
1956
|
+
class="k-prompt-expander-content"
|
1957
|
+
role="list"
|
1958
|
+
[attr.id]="contentId">
|
1959
|
+
<div *ngFor="let suggestion of promptSuggestions"
|
1960
|
+
class="k-prompt-suggestion"
|
1961
|
+
role="listitem"
|
1962
|
+
(click)="suggestionClick(suggestion)">
|
1963
|
+
{{suggestion}}
|
1964
|
+
</div>
|
1965
|
+
</div>
|
1966
|
+
</div>
|
1967
|
+
</ng-template>
|
1968
|
+
`, isInline: true, components: [{ type: i3.TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "adornmentsOrientation", "rows", "cols", "maxlength", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
1969
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: PromptViewComponent, decorators: [{
|
1765
1970
|
type: Component,
|
1766
1971
|
args: [{
|
1972
|
+
selector: 'kendo-aiprompt-prompt-view',
|
1767
1973
|
providers: [
|
1768
1974
|
{
|
1769
|
-
provide:
|
1770
|
-
useExisting: forwardRef(() =>
|
1975
|
+
provide: BaseView,
|
1976
|
+
useExisting: forwardRef(() => PromptViewComponent)
|
1771
1977
|
}
|
1772
1978
|
],
|
1773
|
-
|
1774
|
-
|
1979
|
+
template: `
|
1980
|
+
<ng-template #content>
|
1981
|
+
<kendo-textarea
|
1982
|
+
[placeholder]="messageFor('promptPlaceholder')"
|
1983
|
+
[rows]="1"
|
1984
|
+
[(value)]="textAreaValue">
|
1985
|
+
</kendo-textarea>
|
1986
|
+
<div class="k-prompt-expander">
|
1987
|
+
<button kendoButton
|
1988
|
+
[attr.aria-controls]="contentId"
|
1989
|
+
[attr.aria-expanded]="showSuggestions"
|
1990
|
+
fillMode="flat"
|
1991
|
+
[icon]="suggestionsIcons.font"
|
1992
|
+
[svgIcon]="suggestionsIcons.svg"
|
1993
|
+
type="button"
|
1994
|
+
(click)="showSuggestions = !showSuggestions">
|
1995
|
+
{{messageFor('promptSuggestions')}}
|
1996
|
+
</button>
|
1997
|
+
<div *ngIf="showSuggestions"
|
1998
|
+
class="k-prompt-expander-content"
|
1999
|
+
role="list"
|
2000
|
+
[attr.id]="contentId">
|
2001
|
+
<div *ngFor="let suggestion of promptSuggestions"
|
2002
|
+
class="k-prompt-suggestion"
|
2003
|
+
role="listitem"
|
2004
|
+
(click)="suggestionClick(suggestion)">
|
2005
|
+
{{suggestion}}
|
2006
|
+
</div>
|
2007
|
+
</div>
|
2008
|
+
</div>
|
2009
|
+
</ng-template>
|
2010
|
+
`
|
1775
2011
|
}]
|
1776
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
2012
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; } });
|
1777
2013
|
|
1778
2014
|
/**
|
1779
|
-
*
|
1780
|
-
* Hero cards host a single large image and action buttons with text content.
|
2015
|
+
* @hidden
|
1781
2016
|
*/
|
1782
|
-
class
|
1783
|
-
constructor() {
|
1784
|
-
this.
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
this.
|
2017
|
+
class AIPromptOutputCardComponent {
|
2018
|
+
constructor(localization, service) {
|
2019
|
+
this.localization = localization;
|
2020
|
+
this.service = service;
|
2021
|
+
this.hostClass = true;
|
2022
|
+
this.listItemRole = 'listitem';
|
2023
|
+
this.tabIndex = 0;
|
2024
|
+
this.ariaKeyShortcuts = 'Enter';
|
2025
|
+
this.copyIcon = copyIcon;
|
2026
|
+
this.retryIcon = arrowRotateCwIcon;
|
2027
|
+
this.positiveRatingIcon = thumbUpOutlineIcon;
|
2028
|
+
this.negativeRatingIcon = thumbDownOutlineIcon;
|
2029
|
+
this.titleId = `k-output-card-${guid()}`;
|
2030
|
+
}
|
2031
|
+
get ariaDescribedBy() {
|
2032
|
+
return this.titleId;
|
2033
|
+
}
|
2034
|
+
messageFor(text) {
|
2035
|
+
return this.localization.get(text);
|
2036
|
+
}
|
2037
|
+
get showRating() {
|
2038
|
+
return this.service.showOutputRating;
|
2039
|
+
}
|
2040
|
+
get outputTitle() {
|
2041
|
+
if (isPresent(this.promptOutput.title)) {
|
2042
|
+
return this.promptOutput.title;
|
2043
|
+
}
|
2044
|
+
else {
|
2045
|
+
const titleMessage = this.promptOutput.isRetry ? 'outputRetryTitle' : 'outputTitle';
|
2046
|
+
return this.messageFor(titleMessage);
|
2047
|
+
}
|
1789
2048
|
}
|
1790
|
-
|
1791
|
-
this.
|
2049
|
+
handleRetry() {
|
2050
|
+
if (this.promptOutput.commandId) {
|
2051
|
+
const eventArgs = {
|
2052
|
+
command: this.service.getFlattenPromptCommands().find(c => c.id === this.promptOutput.commandId),
|
2053
|
+
sender: this.service.aiPrompt,
|
2054
|
+
isRetry: true
|
2055
|
+
};
|
2056
|
+
this.service.executeEvent.next(eventArgs);
|
2057
|
+
}
|
2058
|
+
else {
|
2059
|
+
const eventArgs = {
|
2060
|
+
prompt: this.promptOutput.prompt,
|
2061
|
+
sender: this.service.aiPrompt,
|
2062
|
+
isRetry: true
|
2063
|
+
};
|
2064
|
+
this.service.requestEvent.next(eventArgs);
|
2065
|
+
}
|
2066
|
+
}
|
2067
|
+
handleCopy() {
|
2068
|
+
navigator.clipboard.writeText(this.promptOutput.output);
|
2069
|
+
this.service.outputCopyEvent.next(this.promptOutput);
|
2070
|
+
}
|
2071
|
+
handleRating(ratingType) {
|
2072
|
+
const eventArgs = {
|
2073
|
+
promptOutput: this.promptOutput,
|
2074
|
+
rating: ratingType
|
2075
|
+
};
|
2076
|
+
this.service.outputRatingChangeEvent.next(eventArgs);
|
2077
|
+
if (ratingType === 'positive') {
|
2078
|
+
this.positiveRatingIcon = thumbUpIcon;
|
2079
|
+
this.negativeRatingIcon = thumbDownOutlineIcon;
|
2080
|
+
}
|
2081
|
+
else {
|
2082
|
+
this.negativeRatingIcon = thumbDownIcon;
|
2083
|
+
this.positiveRatingIcon = thumbUpOutlineIcon;
|
2084
|
+
}
|
1792
2085
|
}
|
1793
2086
|
}
|
1794
|
-
|
1795
|
-
|
1796
|
-
<
|
2087
|
+
AIPromptOutputCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptOutputCardComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
2088
|
+
AIPromptOutputCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: { promptOutput: "promptOutput" }, host: { properties: { "class.k-card": "this.hostClass", "attr.role": "this.listItemRole", "attr.tabindex": "this.tabIndex", "attr.aria-describedby": "this.ariaDescribedBy", "attr.aria-keyshortcuts": "this.ariaKeyShortcuts" } }, ngImport: i0, template: `
|
2089
|
+
<div class="k-card-header">
|
2090
|
+
<div
|
2091
|
+
class="k-card-title"
|
2092
|
+
[attr.id]="titleId">{{outputTitle}}
|
2093
|
+
</div>
|
2094
|
+
<div class="k-card-subtitle">{{promptOutput.prompt}}</div>
|
2095
|
+
</div>
|
1797
2096
|
<div class="k-card-body">
|
1798
|
-
|
1799
|
-
{{ title }}
|
1800
|
-
</h5>
|
1801
|
-
<h6 class="k-card-subtitle" *ngIf="subtitle">
|
1802
|
-
{{ subtitle }}
|
1803
|
-
</h6>
|
2097
|
+
<p>{{promptOutput.output}}</p>
|
1804
2098
|
</div>
|
1805
|
-
<div class="k-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
2099
|
+
<div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
|
2100
|
+
<button kendoButton
|
2101
|
+
fillMode="flat"
|
2102
|
+
themeColor="primary"
|
2103
|
+
rounded="full"
|
2104
|
+
icon="copy"
|
2105
|
+
[svgIcon]="copyIcon"
|
2106
|
+
(click)="handleCopy()"
|
2107
|
+
>{{messageFor('copyOutput')}}</button>
|
2108
|
+
<button kendoButton
|
2109
|
+
fillMode="flat"
|
2110
|
+
rounded="full"
|
2111
|
+
icon="arrow-rotate-cw"
|
2112
|
+
[svgIcon]="retryIcon"
|
2113
|
+
(click)="handleRetry()"
|
2114
|
+
>{{messageFor('retryGeneration')}}</button>
|
2115
|
+
<ng-container *ngIf="showRating">
|
2116
|
+
<span class="k-spacer"></span>
|
2117
|
+
<button kendoButton
|
2118
|
+
fillMode="flat"
|
2119
|
+
icon="thumb-up-outline"
|
2120
|
+
[svgIcon]="positiveRatingIcon"
|
2121
|
+
(click)="handleRating('positive')">
|
2122
|
+
</button>
|
2123
|
+
<button kendoButton
|
2124
|
+
fillMode="flat"
|
2125
|
+
icon="thumb-down-outline"
|
2126
|
+
[svgIcon]="negativeRatingIcon"
|
2127
|
+
(click)="handleRating('negative')">
|
2128
|
+
</button>
|
2129
|
+
</ng-container>
|
1816
2130
|
</div>
|
1817
|
-
`, isInline: true, components: [{ type:
|
1818
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type:
|
2131
|
+
`, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
2132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptOutputCardComponent, decorators: [{
|
1819
2133
|
type: Component,
|
1820
2134
|
args: [{
|
1821
|
-
selector: '
|
2135
|
+
selector: '[kendoAIPromptOutputCard]',
|
1822
2136
|
template: `
|
1823
|
-
<
|
2137
|
+
<div class="k-card-header">
|
2138
|
+
<div
|
2139
|
+
class="k-card-title"
|
2140
|
+
[attr.id]="titleId">{{outputTitle}}
|
2141
|
+
</div>
|
2142
|
+
<div class="k-card-subtitle">{{promptOutput.prompt}}</div>
|
2143
|
+
</div>
|
1824
2144
|
<div class="k-card-body">
|
1825
|
-
|
1826
|
-
{{ title }}
|
1827
|
-
</h5>
|
1828
|
-
<h6 class="k-card-subtitle" *ngIf="subtitle">
|
1829
|
-
{{ subtitle }}
|
1830
|
-
</h6>
|
2145
|
+
<p>{{promptOutput.output}}</p>
|
1831
2146
|
</div>
|
1832
|
-
<div class="k-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
2147
|
+
<div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
|
2148
|
+
<button kendoButton
|
2149
|
+
fillMode="flat"
|
2150
|
+
themeColor="primary"
|
2151
|
+
rounded="full"
|
2152
|
+
icon="copy"
|
2153
|
+
[svgIcon]="copyIcon"
|
2154
|
+
(click)="handleCopy()"
|
2155
|
+
>{{messageFor('copyOutput')}}</button>
|
2156
|
+
<button kendoButton
|
2157
|
+
fillMode="flat"
|
2158
|
+
rounded="full"
|
2159
|
+
icon="arrow-rotate-cw"
|
2160
|
+
[svgIcon]="retryIcon"
|
2161
|
+
(click)="handleRetry()"
|
2162
|
+
>{{messageFor('retryGeneration')}}</button>
|
2163
|
+
<ng-container *ngIf="showRating">
|
2164
|
+
<span class="k-spacer"></span>
|
2165
|
+
<button kendoButton
|
2166
|
+
fillMode="flat"
|
2167
|
+
icon="thumb-up-outline"
|
2168
|
+
[svgIcon]="positiveRatingIcon"
|
2169
|
+
(click)="handleRating('positive')">
|
2170
|
+
</button>
|
2171
|
+
<button kendoButton
|
2172
|
+
fillMode="flat"
|
2173
|
+
icon="thumb-down-outline"
|
2174
|
+
[svgIcon]="negativeRatingIcon"
|
2175
|
+
(click)="handleRating('negative')">
|
2176
|
+
</button>
|
2177
|
+
</ng-container>
|
1843
2178
|
</div>
|
1844
2179
|
`
|
1845
2180
|
}]
|
1846
|
-
}], propDecorators: {
|
1847
|
-
type: Input
|
1848
|
-
}], title: [{
|
1849
|
-
type: Input
|
1850
|
-
}], subtitle: [{
|
1851
|
-
type: Input
|
1852
|
-
}], actions: [{
|
1853
|
-
type: Input
|
1854
|
-
}], cssClass: [{
|
2181
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; }, propDecorators: { hostClass: [{
|
1855
2182
|
type: HostBinding,
|
1856
2183
|
args: ['class.k-card']
|
1857
|
-
}],
|
1858
|
-
type:
|
2184
|
+
}], listItemRole: [{
|
2185
|
+
type: HostBinding,
|
2186
|
+
args: ['attr.role']
|
2187
|
+
}], tabIndex: [{
|
2188
|
+
type: HostBinding,
|
2189
|
+
args: ['attr.tabindex']
|
2190
|
+
}], ariaDescribedBy: [{
|
2191
|
+
type: HostBinding,
|
2192
|
+
args: ['attr.aria-describedby']
|
2193
|
+
}], ariaKeyShortcuts: [{
|
2194
|
+
type: HostBinding,
|
2195
|
+
args: ['attr.aria-keyshortcuts']
|
2196
|
+
}], promptOutput: [{
|
2197
|
+
type: Input
|
1859
2198
|
}] } });
|
1860
2199
|
|
1861
|
-
const PUBLIC_DIRECTIVES = [
|
1862
|
-
ChatComponent,
|
1863
|
-
CustomMessagesComponent,
|
1864
|
-
AttachmentTemplateDirective,
|
1865
|
-
MessageTemplateDirective,
|
1866
|
-
HeroCardComponent,
|
1867
|
-
ChatMessageBoxTemplateDirective
|
1868
|
-
];
|
1869
|
-
const PRIVATE_DIRECTIVES = [
|
1870
|
-
AttachmentComponent,
|
1871
|
-
FocusedStateDirective,
|
1872
|
-
LocalizedMessagesDirective,
|
1873
|
-
MessageAttachmentsComponent,
|
1874
|
-
MessageComponent,
|
1875
|
-
MessageListComponent,
|
1876
|
-
MessageTemplateDirective,
|
1877
|
-
ScrollAnchorDirective,
|
1878
|
-
SuggestedActionsComponent,
|
1879
|
-
MessageBoxComponent
|
1880
|
-
];
|
1881
2200
|
/**
|
1882
|
-
* The
|
1883
|
-
*
|
1884
|
-
* @example
|
1885
|
-
* ```ts-no-run
|
1886
|
-
* import { NgModule } from '@angular/core';
|
1887
|
-
* import { Component } from '@angular/core';
|
1888
|
-
* import { BrowserModule } from '@angular/platform-browser';
|
1889
|
-
*
|
1890
|
-
* import { ChatModule } from '@progress/kendo-angular-conversational-ui';
|
1891
|
-
* import { AppComponent } from './app.component';
|
1892
|
-
*
|
1893
|
-
* _@NgModule({
|
1894
|
-
* imports: [ BrowserModule, ChatModule ],
|
1895
|
-
* declarations: [ AppComponent ],
|
1896
|
-
* bootstrap: [ AppComponent ]
|
1897
|
-
* })
|
1898
|
-
*
|
1899
|
-
* export class AppModule { }
|
1900
|
-
* ```
|
2201
|
+
* The component for rendering the **Output** view.
|
1901
2202
|
*/
|
1902
|
-
class
|
2203
|
+
class OutputViewComponent extends BaseView {
|
2204
|
+
constructor(localization, service) {
|
2205
|
+
super('output', localization);
|
2206
|
+
this.service = service;
|
2207
|
+
}
|
2208
|
+
/**
|
2209
|
+
* @hidden
|
2210
|
+
*/
|
2211
|
+
get promptOutputs() {
|
2212
|
+
return this.service.promptOutputs;
|
2213
|
+
}
|
1903
2214
|
}
|
1904
|
-
|
1905
|
-
|
2215
|
+
OutputViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: OutputViewComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
2216
|
+
OutputViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: OutputViewComponent, selector: "kendo-aiprompt-output-view", providers: [{
|
2217
|
+
provide: BaseView,
|
2218
|
+
useExisting: forwardRef(() => OutputViewComponent)
|
2219
|
+
}], usesInheritance: true, ngImport: i0, template: `
|
2220
|
+
<ng-template #content>
|
2221
|
+
<div
|
2222
|
+
class="k-card-list"
|
2223
|
+
role="list">
|
2224
|
+
<div *ngFor="let output of promptOutputs"
|
2225
|
+
kendoAIPromptOutputCard
|
2226
|
+
[promptOutput]="output">
|
2227
|
+
</div>
|
2228
|
+
</div>
|
2229
|
+
</ng-template>
|
2230
|
+
`, isInline: true, components: [{ type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: ["promptOutput"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
2231
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: OutputViewComponent, decorators: [{
|
2232
|
+
type: Component,
|
2233
|
+
args: [{
|
2234
|
+
selector: 'kendo-aiprompt-output-view',
|
2235
|
+
providers: [{
|
2236
|
+
provide: BaseView,
|
2237
|
+
useExisting: forwardRef(() => OutputViewComponent)
|
2238
|
+
}],
|
2239
|
+
template: `
|
2240
|
+
<ng-template #content>
|
2241
|
+
<div
|
2242
|
+
class="k-card-list"
|
2243
|
+
role="list">
|
2244
|
+
<div *ngFor="let output of promptOutputs"
|
2245
|
+
kendoAIPromptOutputCard
|
2246
|
+
[promptOutput]="output">
|
2247
|
+
</div>
|
2248
|
+
</div>
|
2249
|
+
</ng-template>
|
2250
|
+
`
|
2251
|
+
}]
|
2252
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; } });
|
2253
|
+
|
2254
|
+
/**
|
2255
|
+
* Represents a template that allows you to define additional ToolBar actions.
|
2256
|
+
* The actions will be rendered right after all views' ToolBar buttons.
|
2257
|
+
* To define the template, nest an `<ng-template>` tag
|
2258
|
+
* with the `kendoAIPromptToolbarActionsTemplate` directive inside the `<kendo-aiprompt>` tag.
|
2259
|
+
*/
|
2260
|
+
class AIPromptToolbarActionsDirective {
|
2261
|
+
constructor(templateRef) {
|
2262
|
+
this.templateRef = templateRef;
|
2263
|
+
}
|
2264
|
+
}
|
2265
|
+
AIPromptToolbarActionsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarActionsDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
2266
|
+
AIPromptToolbarActionsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptToolbarActionsDirective, selector: "[kendoAIPromptToolbarActionsTemplate]", ngImport: i0 });
|
2267
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarActionsDirective, decorators: [{
|
2268
|
+
type: Directive,
|
2269
|
+
args: [{
|
2270
|
+
selector: '[kendoAIPromptToolbarActionsTemplate]'
|
2271
|
+
}]
|
2272
|
+
}], ctorParameters: function () {
|
2273
|
+
return [{ type: i0.TemplateRef, decorators: [{
|
2274
|
+
type: Optional
|
2275
|
+
}] }];
|
2276
|
+
} });
|
2277
|
+
|
2278
|
+
/**
|
2279
|
+
* @hidden
|
2280
|
+
*/
|
2281
|
+
class ToolbarNavigationService {
|
2282
|
+
constructor(localizationService) {
|
2283
|
+
this.localizationService = localizationService;
|
2284
|
+
this.focusableElements = [];
|
2285
|
+
this.currentFocusedIndex = 0;
|
2286
|
+
}
|
2287
|
+
register(tool) {
|
2288
|
+
if (!this.focusableElements.some(el => el === tool)) {
|
2289
|
+
this.focusableElements.push(tool);
|
2290
|
+
}
|
2291
|
+
}
|
2292
|
+
unregister(tool) {
|
2293
|
+
this.currentFocusedIndex = 0;
|
2294
|
+
this.focusableElements = this.focusableElements.filter(el => el !== tool);
|
2295
|
+
}
|
2296
|
+
isActive(focusable) {
|
2297
|
+
return this.focusableElements[this.currentFocusedIndex] === focusable;
|
2298
|
+
}
|
2299
|
+
setActiveIndex(tool) {
|
2300
|
+
this.currentFocusedIndex = Math.max(this.focusableElements.indexOf(tool), 0);
|
2301
|
+
}
|
2302
|
+
move(direction) {
|
2303
|
+
let delta = direction === 'right' ? 1 : -1;
|
2304
|
+
if (this.localizationService.rtl) {
|
2305
|
+
delta = -delta;
|
2306
|
+
}
|
2307
|
+
this.currentFocusedIndex += delta;
|
2308
|
+
if (this.currentFocusedIndex < 0) {
|
2309
|
+
this.currentFocusedIndex = this.focusableElements.length - 1;
|
2310
|
+
}
|
2311
|
+
else if (this.currentFocusedIndex >= this.focusableElements.length) {
|
2312
|
+
this.currentFocusedIndex = 0;
|
2313
|
+
}
|
2314
|
+
this.focusableElements[this.currentFocusedIndex].activate();
|
2315
|
+
}
|
2316
|
+
focusFirst() {
|
2317
|
+
this.focusableElements[this.currentFocusedIndex].activate();
|
2318
|
+
}
|
2319
|
+
}
|
2320
|
+
ToolbarNavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ToolbarNavigationService, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2321
|
+
ToolbarNavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ToolbarNavigationService });
|
2322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ToolbarNavigationService, decorators: [{
|
2323
|
+
type: Injectable
|
2324
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
2325
|
+
|
2326
|
+
/**
|
2327
|
+
* @hidden
|
2328
|
+
*/
|
2329
|
+
class Messages extends ComponentMessages {
|
2330
|
+
}
|
2331
|
+
Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
2332
|
+
Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, inputs: { promptView: "promptView", outputView: "outputView", generateOutput: "generateOutput", promptPlaceholder: "promptPlaceholder", copyOutput: "copyOutput", retryGeneration: "retryGeneration", outputTitle: "outputTitle", outputRetryTitle: "outputRetryTitle", promptSuggestions: "promptSuggestions" }, usesInheritance: true, ngImport: i0 });
|
2333
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, decorators: [{
|
2334
|
+
type: Directive
|
2335
|
+
}], propDecorators: { promptView: [{
|
2336
|
+
type: Input
|
2337
|
+
}], outputView: [{
|
2338
|
+
type: Input
|
2339
|
+
}], generateOutput: [{
|
2340
|
+
type: Input
|
2341
|
+
}], promptPlaceholder: [{
|
2342
|
+
type: Input
|
2343
|
+
}], copyOutput: [{
|
2344
|
+
type: Input
|
2345
|
+
}], retryGeneration: [{
|
2346
|
+
type: Input
|
2347
|
+
}], outputTitle: [{
|
2348
|
+
type: Input
|
2349
|
+
}], outputRetryTitle: [{
|
2350
|
+
type: Input
|
2351
|
+
}], promptSuggestions: [{
|
2352
|
+
type: Input
|
2353
|
+
}] } });
|
2354
|
+
|
2355
|
+
/**
|
2356
|
+
* @hidden
|
2357
|
+
*/
|
2358
|
+
class LocalizedMessagesDirective extends Messages {
|
2359
|
+
constructor(service) {
|
2360
|
+
super();
|
2361
|
+
this.service = service;
|
2362
|
+
}
|
2363
|
+
}
|
2364
|
+
LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
2365
|
+
LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: LocalizedMessagesDirective, selector: "[kendoAIPromptLocalizedMessages]", providers: [
|
2366
|
+
{
|
2367
|
+
provide: Messages,
|
2368
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
2369
|
+
}
|
2370
|
+
], usesInheritance: true, ngImport: i0 });
|
2371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
2372
|
+
type: Directive,
|
2373
|
+
args: [{
|
2374
|
+
providers: [
|
2375
|
+
{
|
2376
|
+
provide: Messages,
|
2377
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
2378
|
+
}
|
2379
|
+
],
|
2380
|
+
selector: '[kendoAIPromptLocalizedMessages]'
|
2381
|
+
}]
|
2382
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
2383
|
+
|
2384
|
+
/**
|
2385
|
+
* @hidden
|
2386
|
+
*/
|
2387
|
+
class AIPromptToolbarFocusableDirective {
|
2388
|
+
constructor(host, navigationService, renderer) {
|
2389
|
+
this.host = host;
|
2390
|
+
this.navigationService = navigationService;
|
2391
|
+
this.renderer = renderer;
|
2392
|
+
this.keyDownHandler = (e) => {
|
2393
|
+
const targetsSelf = e.target === this.element;
|
2394
|
+
const isLeftArrow = e.keyCode === Keys.ArrowLeft;
|
2395
|
+
const isRightArrow = e.keyCode === Keys.ArrowRight;
|
2396
|
+
const isArrow = isLeftArrow || isRightArrow;
|
2397
|
+
if (!targetsSelf || !isArrow) {
|
2398
|
+
return;
|
2399
|
+
}
|
2400
|
+
this.renderer.setAttribute(this.element, 'tabindex', '-1');
|
2401
|
+
this.element.querySelectorAll(focusableSelector).forEach(el => {
|
2402
|
+
this.renderer.setAttribute(el, 'tabindex', '-1');
|
2403
|
+
});
|
2404
|
+
if (isRightArrow) {
|
2405
|
+
this.navigationService.move('right');
|
2406
|
+
}
|
2407
|
+
else if (isLeftArrow) {
|
2408
|
+
this.navigationService.move('left');
|
2409
|
+
}
|
2410
|
+
};
|
2411
|
+
this.clickHandler = () => {
|
2412
|
+
this.navigationService.setActiveIndex(this);
|
2413
|
+
};
|
2414
|
+
navigationService.register(this);
|
2415
|
+
}
|
2416
|
+
get element() {
|
2417
|
+
return this.host.nativeElement;
|
2418
|
+
}
|
2419
|
+
ngAfterViewInit() {
|
2420
|
+
this.renderer.setAttribute(this.element, 'tabindex', this.navigationService.isActive(this) ? '0' : '-1');
|
2421
|
+
this.element.addEventListener('keydown', this.keyDownHandler, { capture: true });
|
2422
|
+
this.element.addEventListener('click', this.clickHandler, { capture: true });
|
2423
|
+
}
|
2424
|
+
ngOnDestroy() {
|
2425
|
+
this.navigationService.unregister(this);
|
2426
|
+
this.element.removeEventListener('keydown', this.keyDownHandler, { capture: true });
|
2427
|
+
this.element.removeEventListener('click', this.clickHandler, { capture: true });
|
2428
|
+
}
|
2429
|
+
activate() {
|
2430
|
+
this.renderer.setAttribute(this.element, 'tabindex', '0');
|
2431
|
+
this.element.focus();
|
2432
|
+
}
|
2433
|
+
}
|
2434
|
+
AIPromptToolbarFocusableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarFocusableDirective, deps: [{ token: i0.ElementRef }, { token: ToolbarNavigationService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
2435
|
+
AIPromptToolbarFocusableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]", ngImport: i0 });
|
2436
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarFocusableDirective, decorators: [{
|
2437
|
+
type: Directive,
|
2438
|
+
args: [{
|
2439
|
+
selector: '[kendoAIPromptToolbarFocusable]'
|
2440
|
+
}]
|
2441
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ToolbarNavigationService }, { type: i0.Renderer2 }]; } });
|
2442
|
+
|
2443
|
+
/**
|
2444
|
+
* Represents the Kendo UI AIPrompt component for Angular
|
2445
|
+
*/
|
2446
|
+
class AIPromptComponent {
|
2447
|
+
constructor(localization, service, navigationService, ngZone) {
|
2448
|
+
this.localization = localization;
|
2449
|
+
this.service = service;
|
2450
|
+
this.navigationService = navigationService;
|
2451
|
+
this.ngZone = ngZone;
|
2452
|
+
this.hostClasses = true;
|
2453
|
+
/**
|
2454
|
+
* The active view index of the AIPrompt component.
|
2455
|
+
*/
|
2456
|
+
this.activeView = 0;
|
2457
|
+
/**
|
2458
|
+
* Fires when the `activeView` property of the component is updated.
|
2459
|
+
* Used to provide a two-way binding for the `activeView` property.
|
2460
|
+
*/
|
2461
|
+
this.activeViewChange = new EventEmitter();
|
2462
|
+
/**
|
2463
|
+
* Fires each time the user clicks the Prompt view Generate button or the Output view Retry button.
|
2464
|
+
* To distinguish the source element, use the event's `isRetry` field.
|
2465
|
+
*/
|
2466
|
+
this.promptRequest = new EventEmitter();
|
2467
|
+
/**
|
2468
|
+
* Fires each time the user clicks a Command view command. Exposes the selected command as event data.
|
2469
|
+
*/
|
2470
|
+
this.commandExecute = new EventEmitter();
|
2471
|
+
/**
|
2472
|
+
* Fires each time the user clicks any Output view Copy button.
|
2473
|
+
*/
|
2474
|
+
this.outputCopy = new EventEmitter();
|
2475
|
+
/**
|
2476
|
+
* Fires each time the user clicks a rating button in any Output view card.
|
2477
|
+
*/
|
2478
|
+
this.outputRatingChange = new EventEmitter();
|
2479
|
+
this.subs = new Subscription();
|
2480
|
+
/**
|
2481
|
+
* @hidden
|
2482
|
+
*/
|
2483
|
+
this.sparklesIcon = sparklesIcon;
|
2484
|
+
/**
|
2485
|
+
* @hidden
|
2486
|
+
*/
|
2487
|
+
this.outputIcon = commentIcon;
|
2488
|
+
validatePackage(packageMetadata);
|
2489
|
+
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
2490
|
+
this.subs.add(localization.changes.subscribe(({ rtl }) => {
|
2491
|
+
this.direction = rtl ? 'rtl' : 'ltr';
|
2492
|
+
}));
|
2493
|
+
}
|
2494
|
+
get dirAttr() {
|
2495
|
+
return this.direction;
|
2496
|
+
}
|
2497
|
+
/**
|
2498
|
+
* The collection of commands that will be rendered in the Command view.
|
2499
|
+
*/
|
2500
|
+
set promptCommands(value) {
|
2501
|
+
this.service.promptCommands = value;
|
2502
|
+
}
|
2503
|
+
/**
|
2504
|
+
* The collection of suggestions that will be rendered in the Prompt view.
|
2505
|
+
*/
|
2506
|
+
set promptSuggestions(value) {
|
2507
|
+
this.service.promptSuggestions = value;
|
2508
|
+
}
|
2509
|
+
/**
|
2510
|
+
* The collection of generated prompt outputs that will be rendered in the Output view.
|
2511
|
+
*/
|
2512
|
+
set promptOutputs(value) {
|
2513
|
+
this.service.promptOutputs = value;
|
2514
|
+
}
|
2515
|
+
/**
|
2516
|
+
* Specifies if the rating buttons in each Output view card will be rendered.
|
2517
|
+
* By default, rating buttons are not rendered.
|
2518
|
+
*
|
2519
|
+
* @default false
|
2520
|
+
*/
|
2521
|
+
set showOutputRating(value) {
|
2522
|
+
this.service.showOutputRating = value;
|
2523
|
+
}
|
2524
|
+
ngAfterViewInit() {
|
2525
|
+
this.ngZone.runOutsideAngular(() => {
|
2526
|
+
this.service.aiPrompt = this;
|
2527
|
+
this.subs.add(this.service.requestEvent.subscribe(ev => this.promptRequest.emit(ev)));
|
2528
|
+
this.subs.add(this.service.executeEvent.subscribe(ev => this.commandExecute.emit(ev)));
|
2529
|
+
this.subs.add(this.service.outputCopyEvent.subscribe(ev => this.outputCopy.emit(ev)));
|
2530
|
+
this.subs.add(this.service.outputRatingChangeEvent.subscribe(ev => this.outputRatingChange.emit(ev)));
|
2531
|
+
});
|
2532
|
+
}
|
2533
|
+
ngOnDestroy() {
|
2534
|
+
this.subs.unsubscribe();
|
2535
|
+
}
|
2536
|
+
/**
|
2537
|
+
* Focuses the first focusable element in the AI Prompt.
|
2538
|
+
*/
|
2539
|
+
focus() {
|
2540
|
+
this.navigationService.focusFirst();
|
2541
|
+
}
|
2542
|
+
/**
|
2543
|
+
* @hidden
|
2544
|
+
*/
|
2545
|
+
get selectedView() {
|
2546
|
+
return this.viewsArray[this.activeView];
|
2547
|
+
}
|
2548
|
+
/**
|
2549
|
+
* @hidden
|
2550
|
+
*/
|
2551
|
+
get viewsArray() {
|
2552
|
+
var _a;
|
2553
|
+
return (_a = this.views) === null || _a === void 0 ? void 0 : _a.toArray();
|
2554
|
+
}
|
2555
|
+
/**
|
2556
|
+
* @hidden
|
2557
|
+
*/
|
2558
|
+
viewChange(idx) {
|
2559
|
+
if (idx !== this.activeView) {
|
2560
|
+
this.activeView = idx;
|
2561
|
+
this.activeViewChange.emit(idx);
|
2562
|
+
}
|
2563
|
+
}
|
2564
|
+
/**
|
2565
|
+
* @hidden
|
2566
|
+
*/
|
2567
|
+
messageFor(text) {
|
2568
|
+
return this.localization.get(text);
|
2569
|
+
}
|
2570
|
+
/**
|
2571
|
+
* @hidden
|
2572
|
+
*/
|
2573
|
+
get viewTemplate() {
|
2574
|
+
var _a, _b;
|
2575
|
+
return this.selectedView.viewType === 'custom' ? (_a = this.selectedView) === null || _a === void 0 ? void 0 : _a.viewTemplate : (_b = this.selectedView) === null || _b === void 0 ? void 0 : _b.template;
|
2576
|
+
}
|
2577
|
+
/**
|
2578
|
+
* @hidden
|
2579
|
+
*/
|
2580
|
+
handleGenerateOutput() {
|
2581
|
+
const value = this.service.promptValue;
|
2582
|
+
const eventArgs = {
|
2583
|
+
prompt: value,
|
2584
|
+
sender: this,
|
2585
|
+
isRetry: false
|
2586
|
+
};
|
2587
|
+
this.promptRequest.emit(eventArgs);
|
2588
|
+
}
|
2589
|
+
}
|
2590
|
+
AIPromptComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }, { token: ToolbarNavigationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
2591
|
+
AIPromptComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptComponent, selector: "kendo-aiprompt", inputs: { activeView: "activeView", promptCommands: "promptCommands", promptSuggestions: "promptSuggestions", promptOutputs: "promptOutputs", showOutputRating: "showOutputRating" }, outputs: { activeViewChange: "activeViewChange", promptRequest: "promptRequest", commandExecute: "commandExecute", outputCopy: "outputCopy", outputRatingChange: "outputRatingChange" }, host: { properties: { "class.k-prompt": "this.hostClasses", "attr.dir": "this.dirAttr" } }, providers: [
|
2592
|
+
LocalizationService,
|
2593
|
+
AIPromptService,
|
2594
|
+
ToolbarNavigationService,
|
2595
|
+
{
|
2596
|
+
provide: L10N_PREFIX,
|
2597
|
+
useValue: 'kendo.aiprompt'
|
2598
|
+
}
|
2599
|
+
], queries: [{ propertyName: "toolbarActionsTemplate", first: true, predicate: AIPromptToolbarActionsDirective, descendants: true }, { propertyName: "views", predicate: BaseView }], exportAs: ["kendoAIPrompt"], ngImport: i0, template: `
|
2600
|
+
<ng-container kendoAIPromptLocalizedMessages
|
2601
|
+
i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
|
2602
|
+
promptView="Ask AI"
|
2603
|
+
i18n-outputView="kendo.aiprompt.outputView|The Toolbar button text for the Output view."
|
2604
|
+
outputView="Output"
|
2605
|
+
i18n-generateOutput="kendo.aiprompt.generateOutput|The text for the Generate button in the Prompt view."
|
2606
|
+
generateOutput="Generate"
|
2607
|
+
i18n-promptPlaceholder="kendo.aiprompt.promptPlaceholder|The placeholder text for the Prompt view textarea."
|
2608
|
+
promptPlaceholder="Ask or generate content with AI"
|
2609
|
+
i18n-copyOutput="kendo.aiprompt.copyOutput|The Copy button text in each Output view card."
|
2610
|
+
copyOutput="Copy"
|
2611
|
+
i18n-retryGeneration="kendo.aiprompt.retryGeneration|The Retry button text in each Output view card."
|
2612
|
+
retryGeneration="Retry"
|
2613
|
+
i18n-outputTitle="kendo.aiprompt.outputTitle|The title of each Output view card."
|
2614
|
+
outputTitle="Generated with AI"
|
2615
|
+
i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
|
2616
|
+
outputRetryTitle="Generated with AI"
|
2617
|
+
i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
|
2618
|
+
promptSuggestions="Prompt suggestions">
|
2619
|
+
</ng-container>
|
2620
|
+
<div class="k-prompt-header">
|
2621
|
+
<div class="k-toolbar-flat k-toolbar k-toolbar-md"
|
2622
|
+
role="toolbar">
|
2623
|
+
<button *ngFor="let view of viewsArray; let idx = index"
|
2624
|
+
kendoButton
|
2625
|
+
kendoAIPromptToolbarFocusable
|
2626
|
+
type="button"
|
2627
|
+
fillMode="flat"
|
2628
|
+
rounded="full"
|
2629
|
+
themeColor="primary"
|
2630
|
+
[svgIcon]="view.svgIcon"
|
2631
|
+
[icon]="view.icon"
|
2632
|
+
[selected]="idx === activeView"
|
2633
|
+
(click)="viewChange(idx)">
|
2634
|
+
{{view.buttonText}}
|
2635
|
+
</button>
|
2636
|
+
|
2637
|
+
<ng-template *ngIf="toolbarActionsTemplate"
|
2638
|
+
[ngTemplateOutlet]="toolbarActionsTemplate?.templateRef">
|
2639
|
+
</ng-template>
|
2640
|
+
</div>
|
2641
|
+
</div>
|
2642
|
+
<div class="k-prompt-content">
|
2643
|
+
<div class="k-prompt-view">
|
2644
|
+
<ng-container *ngTemplateOutlet="viewTemplate">
|
2645
|
+
</ng-container>
|
2646
|
+
</div>
|
2647
|
+
</div>
|
2648
|
+
<div class="k-prompt-footer" *ngIf="selectedView.viewType === 'prompt'">
|
2649
|
+
<div class="k-actions k-actions-start k-actions-horizontal k-prompt-actions">
|
2650
|
+
<button
|
2651
|
+
kendoButton
|
2652
|
+
type="button"
|
2653
|
+
themeColor="primary"
|
2654
|
+
rounded="full"
|
2655
|
+
[svgIcon]="sparklesIcon"
|
2656
|
+
icon="sparkles"
|
2657
|
+
(click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
|
2658
|
+
</div>
|
2659
|
+
</div>
|
2660
|
+
`, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: LocalizedMessagesDirective, selector: "[kendoAIPromptLocalizedMessages]" }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
2661
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptComponent, decorators: [{
|
2662
|
+
type: Component,
|
2663
|
+
args: [{
|
2664
|
+
exportAs: 'kendoAIPrompt',
|
2665
|
+
selector: 'kendo-aiprompt',
|
2666
|
+
providers: [
|
2667
|
+
LocalizationService,
|
2668
|
+
AIPromptService,
|
2669
|
+
ToolbarNavigationService,
|
2670
|
+
{
|
2671
|
+
provide: L10N_PREFIX,
|
2672
|
+
useValue: 'kendo.aiprompt'
|
2673
|
+
}
|
2674
|
+
],
|
2675
|
+
template: `
|
2676
|
+
<ng-container kendoAIPromptLocalizedMessages
|
2677
|
+
i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
|
2678
|
+
promptView="Ask AI"
|
2679
|
+
i18n-outputView="kendo.aiprompt.outputView|The Toolbar button text for the Output view."
|
2680
|
+
outputView="Output"
|
2681
|
+
i18n-generateOutput="kendo.aiprompt.generateOutput|The text for the Generate button in the Prompt view."
|
2682
|
+
generateOutput="Generate"
|
2683
|
+
i18n-promptPlaceholder="kendo.aiprompt.promptPlaceholder|The placeholder text for the Prompt view textarea."
|
2684
|
+
promptPlaceholder="Ask or generate content with AI"
|
2685
|
+
i18n-copyOutput="kendo.aiprompt.copyOutput|The Copy button text in each Output view card."
|
2686
|
+
copyOutput="Copy"
|
2687
|
+
i18n-retryGeneration="kendo.aiprompt.retryGeneration|The Retry button text in each Output view card."
|
2688
|
+
retryGeneration="Retry"
|
2689
|
+
i18n-outputTitle="kendo.aiprompt.outputTitle|The title of each Output view card."
|
2690
|
+
outputTitle="Generated with AI"
|
2691
|
+
i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
|
2692
|
+
outputRetryTitle="Generated with AI"
|
2693
|
+
i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
|
2694
|
+
promptSuggestions="Prompt suggestions">
|
2695
|
+
</ng-container>
|
2696
|
+
<div class="k-prompt-header">
|
2697
|
+
<div class="k-toolbar-flat k-toolbar k-toolbar-md"
|
2698
|
+
role="toolbar">
|
2699
|
+
<button *ngFor="let view of viewsArray; let idx = index"
|
2700
|
+
kendoButton
|
2701
|
+
kendoAIPromptToolbarFocusable
|
2702
|
+
type="button"
|
2703
|
+
fillMode="flat"
|
2704
|
+
rounded="full"
|
2705
|
+
themeColor="primary"
|
2706
|
+
[svgIcon]="view.svgIcon"
|
2707
|
+
[icon]="view.icon"
|
2708
|
+
[selected]="idx === activeView"
|
2709
|
+
(click)="viewChange(idx)">
|
2710
|
+
{{view.buttonText}}
|
2711
|
+
</button>
|
2712
|
+
|
2713
|
+
<ng-template *ngIf="toolbarActionsTemplate"
|
2714
|
+
[ngTemplateOutlet]="toolbarActionsTemplate?.templateRef">
|
2715
|
+
</ng-template>
|
2716
|
+
</div>
|
2717
|
+
</div>
|
2718
|
+
<div class="k-prompt-content">
|
2719
|
+
<div class="k-prompt-view">
|
2720
|
+
<ng-container *ngTemplateOutlet="viewTemplate">
|
2721
|
+
</ng-container>
|
2722
|
+
</div>
|
2723
|
+
</div>
|
2724
|
+
<div class="k-prompt-footer" *ngIf="selectedView.viewType === 'prompt'">
|
2725
|
+
<div class="k-actions k-actions-start k-actions-horizontal k-prompt-actions">
|
2726
|
+
<button
|
2727
|
+
kendoButton
|
2728
|
+
type="button"
|
2729
|
+
themeColor="primary"
|
2730
|
+
rounded="full"
|
2731
|
+
[svgIcon]="sparklesIcon"
|
2732
|
+
icon="sparkles"
|
2733
|
+
(click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
|
2734
|
+
</div>
|
2735
|
+
</div>
|
2736
|
+
`
|
2737
|
+
}]
|
2738
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }, { type: ToolbarNavigationService }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
|
2739
|
+
type: HostBinding,
|
2740
|
+
args: ['class.k-prompt']
|
2741
|
+
}], dirAttr: [{
|
2742
|
+
type: HostBinding,
|
2743
|
+
args: ['attr.dir']
|
2744
|
+
}], views: [{
|
2745
|
+
type: ContentChildren,
|
2746
|
+
args: [BaseView]
|
2747
|
+
}], toolbarActionsTemplate: [{
|
2748
|
+
type: ContentChild,
|
2749
|
+
args: [AIPromptToolbarActionsDirective]
|
2750
|
+
}], activeView: [{
|
2751
|
+
type: Input
|
2752
|
+
}], promptCommands: [{
|
2753
|
+
type: Input
|
2754
|
+
}], promptSuggestions: [{
|
2755
|
+
type: Input
|
2756
|
+
}], promptOutputs: [{
|
2757
|
+
type: Input
|
2758
|
+
}], showOutputRating: [{
|
2759
|
+
type: Input
|
2760
|
+
}], activeViewChange: [{
|
2761
|
+
type: Output
|
2762
|
+
}], promptRequest: [{
|
2763
|
+
type: Output
|
2764
|
+
}], commandExecute: [{
|
2765
|
+
type: Output
|
2766
|
+
}], outputCopy: [{
|
2767
|
+
type: Output
|
2768
|
+
}], outputRatingChange: [{
|
2769
|
+
type: Output
|
2770
|
+
}] } });
|
2771
|
+
|
2772
|
+
/**
|
2773
|
+
* The component for rendering the **Command** view.
|
2774
|
+
*/
|
2775
|
+
class CommandViewComponent extends BaseView {
|
2776
|
+
constructor(localization, service) {
|
2777
|
+
super('command', localization);
|
2778
|
+
this.service = service;
|
2779
|
+
this.panelBarItems = [];
|
2780
|
+
}
|
2781
|
+
ngOnInit() {
|
2782
|
+
this.panelBarItems = this.getPanelBarItems(this.service.promptCommands);
|
2783
|
+
}
|
2784
|
+
itemClickHandler(ev) {
|
2785
|
+
if (ev.item.children) {
|
2786
|
+
return;
|
2787
|
+
}
|
2788
|
+
const selectedCommand = this.service.getFlattenPromptCommands().find(c => c.id == ev.item.id);
|
2789
|
+
if (selectedCommand) {
|
2790
|
+
const eventArgs = {
|
2791
|
+
command: selectedCommand,
|
2792
|
+
sender: this.service.aiPrompt,
|
2793
|
+
isRetry: false
|
2794
|
+
};
|
2795
|
+
this.service.executeEvent.next(eventArgs);
|
2796
|
+
}
|
2797
|
+
}
|
2798
|
+
getPanelBarItems(commands) {
|
2799
|
+
return commands.map(c => ({
|
2800
|
+
title: c.text,
|
2801
|
+
id: c.id,
|
2802
|
+
icon: c.icon,
|
2803
|
+
svgIcon: c.svgIcon,
|
2804
|
+
children: c.children ? this.getPanelBarItems(c.children) : null
|
2805
|
+
}));
|
2806
|
+
}
|
2807
|
+
}
|
2808
|
+
CommandViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CommandViewComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
2809
|
+
CommandViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: CommandViewComponent, selector: "kendo-aiprompt-command-view", providers: [{
|
2810
|
+
provide: BaseView,
|
2811
|
+
useExisting: forwardRef(() => CommandViewComponent)
|
2812
|
+
}], usesInheritance: true, ngImport: i0, template: `
|
2813
|
+
<ng-template #content>
|
2814
|
+
<kendo-panelbar
|
2815
|
+
[items]="panelBarItems"
|
2816
|
+
[animate]="false"
|
2817
|
+
[selectable]="false"
|
2818
|
+
(itemClick)="itemClickHandler($event)"
|
2819
|
+
></kendo-panelbar>
|
2820
|
+
</ng-template>
|
2821
|
+
`, isInline: true, components: [{ type: i3$1.PanelBarComponent, selector: "kendo-panelbar", inputs: ["expandMode", "selectable", "animate", "height", "keepItemContent", "items"], outputs: ["stateChange", "select", "expand", "collapse", "itemClick"], exportAs: ["kendoPanelbar"] }] });
|
2822
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CommandViewComponent, decorators: [{
|
2823
|
+
type: Component,
|
2824
|
+
args: [{
|
2825
|
+
selector: 'kendo-aiprompt-command-view',
|
2826
|
+
providers: [{
|
2827
|
+
provide: BaseView,
|
2828
|
+
useExisting: forwardRef(() => CommandViewComponent)
|
2829
|
+
}],
|
2830
|
+
template: `
|
2831
|
+
<ng-template #content>
|
2832
|
+
<kendo-panelbar
|
2833
|
+
[items]="panelBarItems"
|
2834
|
+
[animate]="false"
|
2835
|
+
[selectable]="false"
|
2836
|
+
(itemClick)="itemClickHandler($event)"
|
2837
|
+
></kendo-panelbar>
|
2838
|
+
</ng-template>
|
2839
|
+
`
|
2840
|
+
}]
|
2841
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; } });
|
2842
|
+
|
2843
|
+
/**
|
2844
|
+
* Custom component messages override default component messages.
|
2845
|
+
*/
|
2846
|
+
class AIPromptCustomMessagesComponent extends Messages {
|
2847
|
+
constructor(service) {
|
2848
|
+
super();
|
2849
|
+
this.service = service;
|
2850
|
+
}
|
2851
|
+
get override() {
|
2852
|
+
return true;
|
2853
|
+
}
|
2854
|
+
}
|
2855
|
+
AIPromptCustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptCustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
2856
|
+
AIPromptCustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptCustomMessagesComponent, selector: "kendo-aiprompt-messages", providers: [
|
2857
|
+
{
|
2858
|
+
provide: Messages,
|
2859
|
+
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
2860
|
+
}
|
2861
|
+
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
2862
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptCustomMessagesComponent, decorators: [{
|
2863
|
+
type: Component,
|
2864
|
+
args: [{
|
2865
|
+
providers: [
|
2866
|
+
{
|
2867
|
+
provide: Messages,
|
2868
|
+
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
2869
|
+
}
|
2870
|
+
],
|
2871
|
+
selector: 'kendo-aiprompt-messages',
|
2872
|
+
template: ``
|
2873
|
+
}]
|
2874
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
2875
|
+
|
2876
|
+
/**
|
2877
|
+
* The component for rendering a **Custom** view.
|
2878
|
+
*/
|
2879
|
+
class CustomViewComponent extends BaseView {
|
2880
|
+
constructor(localization) {
|
2881
|
+
super('custom', localization);
|
2882
|
+
}
|
2883
|
+
}
|
2884
|
+
CustomViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CustomViewComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
2885
|
+
CustomViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: CustomViewComponent, selector: "kendo-aiprompt-custom-view", inputs: { viewTemplate: "viewTemplate" }, providers: [{
|
2886
|
+
provide: BaseView,
|
2887
|
+
useExisting: forwardRef(() => CustomViewComponent)
|
2888
|
+
}], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
2889
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CustomViewComponent, decorators: [{
|
2890
|
+
type: Component,
|
2891
|
+
args: [{
|
2892
|
+
selector: 'kendo-aiprompt-custom-view',
|
2893
|
+
providers: [{
|
2894
|
+
provide: BaseView,
|
2895
|
+
useExisting: forwardRef(() => CustomViewComponent)
|
2896
|
+
}],
|
2897
|
+
template: ``
|
2898
|
+
}]
|
2899
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; }, propDecorators: { viewTemplate: [{
|
2900
|
+
type: Input
|
2901
|
+
}] } });
|
2902
|
+
|
2903
|
+
const PUBLIC_DIRECTIVES$1 = [
|
2904
|
+
AIPromptComponent,
|
2905
|
+
PromptViewComponent,
|
2906
|
+
OutputViewComponent,
|
2907
|
+
CommandViewComponent,
|
2908
|
+
CustomViewComponent,
|
2909
|
+
AIPromptCustomMessagesComponent,
|
2910
|
+
AIPromptToolbarActionsDirective,
|
2911
|
+
AIPromptToolbarFocusableDirective
|
2912
|
+
];
|
2913
|
+
const PRIVATE_DIRECTIVES$1 = [
|
2914
|
+
LocalizedMessagesDirective,
|
2915
|
+
AIPromptOutputCardComponent
|
2916
|
+
];
|
2917
|
+
class AIPromptModule {
|
2918
|
+
}
|
2919
|
+
AIPromptModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
2920
|
+
AIPromptModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptModule, declarations: [AIPromptComponent,
|
2921
|
+
PromptViewComponent,
|
2922
|
+
OutputViewComponent,
|
2923
|
+
CommandViewComponent,
|
2924
|
+
CustomViewComponent,
|
2925
|
+
AIPromptCustomMessagesComponent,
|
2926
|
+
AIPromptToolbarActionsDirective,
|
2927
|
+
AIPromptToolbarFocusableDirective, LocalizedMessagesDirective,
|
2928
|
+
AIPromptOutputCardComponent], imports: [CommonModule,
|
2929
|
+
ButtonsModule,
|
2930
|
+
IconsModule,
|
2931
|
+
InputsModule,
|
2932
|
+
LayoutModule], exports: [AIPromptComponent,
|
2933
|
+
PromptViewComponent,
|
2934
|
+
OutputViewComponent,
|
2935
|
+
CommandViewComponent,
|
2936
|
+
CustomViewComponent,
|
2937
|
+
AIPromptCustomMessagesComponent,
|
2938
|
+
AIPromptToolbarActionsDirective,
|
2939
|
+
AIPromptToolbarFocusableDirective] });
|
2940
|
+
AIPromptModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptModule, imports: [[
|
2941
|
+
CommonModule,
|
2942
|
+
ButtonsModule,
|
2943
|
+
IconsModule,
|
2944
|
+
InputsModule,
|
2945
|
+
LayoutModule
|
2946
|
+
]] });
|
2947
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptModule, decorators: [{
|
2948
|
+
type: NgModule,
|
2949
|
+
args: [{
|
2950
|
+
declarations: [...PUBLIC_DIRECTIVES$1, ...PRIVATE_DIRECTIVES$1],
|
2951
|
+
exports: [...PUBLIC_DIRECTIVES$1],
|
2952
|
+
imports: [
|
2953
|
+
CommonModule,
|
2954
|
+
ButtonsModule,
|
2955
|
+
IconsModule,
|
2956
|
+
InputsModule,
|
2957
|
+
LayoutModule
|
2958
|
+
]
|
2959
|
+
}]
|
2960
|
+
}] });
|
2961
|
+
|
2962
|
+
// eslint-disable no-forward-ref
|
2963
|
+
/**
|
2964
|
+
* Custom component messages override default component messages
|
2965
|
+
* ([see example]({% slug globalization_chat %}#toc-custom-messages)).
|
2966
|
+
*/
|
2967
|
+
class CustomMessagesComponent extends Messages$1 {
|
2968
|
+
constructor(service) {
|
2969
|
+
super();
|
2970
|
+
this.service = service;
|
2971
|
+
}
|
2972
|
+
get override() {
|
2973
|
+
return true;
|
2974
|
+
}
|
2975
|
+
}
|
2976
|
+
CustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
2977
|
+
CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: CustomMessagesComponent, selector: "kendo-chat-messages", providers: [
|
2978
|
+
{
|
2979
|
+
provide: Messages$1,
|
2980
|
+
useExisting: forwardRef(() => CustomMessagesComponent)
|
2981
|
+
}
|
2982
|
+
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
2983
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CustomMessagesComponent, decorators: [{
|
2984
|
+
type: Component,
|
2985
|
+
args: [{
|
2986
|
+
providers: [
|
2987
|
+
{
|
2988
|
+
provide: Messages$1,
|
2989
|
+
useExisting: forwardRef(() => CustomMessagesComponent)
|
2990
|
+
}
|
2991
|
+
],
|
2992
|
+
selector: 'kendo-chat-messages',
|
2993
|
+
template: ``
|
2994
|
+
}]
|
2995
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
2996
|
+
|
2997
|
+
/**
|
2998
|
+
* Represents a Hero Card component ([see example]({% slug dialogflow_chat %})).
|
2999
|
+
* Hero cards host a single large image and action buttons with text content.
|
3000
|
+
*/
|
3001
|
+
class HeroCardComponent {
|
3002
|
+
constructor() {
|
3003
|
+
this.cssClass = true;
|
3004
|
+
/**
|
3005
|
+
* Fires when the user clicks a button.
|
3006
|
+
*/
|
3007
|
+
this.executeAction = new EventEmitter();
|
3008
|
+
}
|
3009
|
+
onClick(action) {
|
3010
|
+
this.executeAction.next(action);
|
3011
|
+
}
|
3012
|
+
}
|
3013
|
+
HeroCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HeroCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
3014
|
+
HeroCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: HeroCardComponent, selector: "kendo-chat-hero-card", inputs: { imageUrl: "imageUrl", title: "title", subtitle: "subtitle", actions: "actions" }, outputs: { executeAction: "executeAction" }, host: { properties: { "class.k-card": "this.cssClass" } }, ngImport: i0, template: `
|
3015
|
+
<img class="k-card-image" [src]="imageUrl" *ngIf="imageUrl" />
|
3016
|
+
<div class="k-card-body">
|
3017
|
+
<h5 class="k-card-title" *ngIf="title">
|
3018
|
+
{{ title }}
|
3019
|
+
</h5>
|
3020
|
+
<h6 class="k-card-subtitle" *ngIf="subtitle">
|
3021
|
+
{{ subtitle }}
|
3022
|
+
</h6>
|
3023
|
+
</div>
|
3024
|
+
<div class="k-card-actions k-card-actions-vertical">
|
3025
|
+
<span class="k-card-action"
|
3026
|
+
*ngFor="let act of actions"
|
3027
|
+
>
|
3028
|
+
<button
|
3029
|
+
kendoButton fillMode="flat"
|
3030
|
+
(click)="onClick(act)"
|
3031
|
+
>
|
3032
|
+
{{ act.title }}
|
3033
|
+
</button>
|
3034
|
+
</span>
|
3035
|
+
</div>
|
3036
|
+
`, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
3037
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HeroCardComponent, decorators: [{
|
3038
|
+
type: Component,
|
3039
|
+
args: [{
|
3040
|
+
selector: 'kendo-chat-hero-card',
|
3041
|
+
template: `
|
3042
|
+
<img class="k-card-image" [src]="imageUrl" *ngIf="imageUrl" />
|
3043
|
+
<div class="k-card-body">
|
3044
|
+
<h5 class="k-card-title" *ngIf="title">
|
3045
|
+
{{ title }}
|
3046
|
+
</h5>
|
3047
|
+
<h6 class="k-card-subtitle" *ngIf="subtitle">
|
3048
|
+
{{ subtitle }}
|
3049
|
+
</h6>
|
3050
|
+
</div>
|
3051
|
+
<div class="k-card-actions k-card-actions-vertical">
|
3052
|
+
<span class="k-card-action"
|
3053
|
+
*ngFor="let act of actions"
|
3054
|
+
>
|
3055
|
+
<button
|
3056
|
+
kendoButton fillMode="flat"
|
3057
|
+
(click)="onClick(act)"
|
3058
|
+
>
|
3059
|
+
{{ act.title }}
|
3060
|
+
</button>
|
3061
|
+
</span>
|
3062
|
+
</div>
|
3063
|
+
`
|
3064
|
+
}]
|
3065
|
+
}], propDecorators: { imageUrl: [{
|
3066
|
+
type: Input
|
3067
|
+
}], title: [{
|
3068
|
+
type: Input
|
3069
|
+
}], subtitle: [{
|
3070
|
+
type: Input
|
3071
|
+
}], actions: [{
|
3072
|
+
type: Input
|
3073
|
+
}], cssClass: [{
|
3074
|
+
type: HostBinding,
|
3075
|
+
args: ['class.k-card']
|
3076
|
+
}], executeAction: [{
|
3077
|
+
type: Output
|
3078
|
+
}] } });
|
3079
|
+
|
3080
|
+
const PUBLIC_DIRECTIVES = [
|
3081
|
+
ChatComponent,
|
3082
|
+
CustomMessagesComponent,
|
3083
|
+
AttachmentTemplateDirective,
|
3084
|
+
MessageTemplateDirective,
|
3085
|
+
HeroCardComponent,
|
3086
|
+
ChatMessageBoxTemplateDirective
|
3087
|
+
];
|
3088
|
+
const PRIVATE_DIRECTIVES = [
|
3089
|
+
AttachmentComponent,
|
3090
|
+
FocusedStateDirective,
|
3091
|
+
LocalizedMessagesDirective$1,
|
3092
|
+
MessageAttachmentsComponent,
|
3093
|
+
MessageComponent,
|
3094
|
+
MessageListComponent,
|
3095
|
+
MessageTemplateDirective,
|
3096
|
+
ScrollAnchorDirective,
|
3097
|
+
SuggestedActionsComponent,
|
3098
|
+
MessageBoxComponent
|
3099
|
+
];
|
3100
|
+
/**
|
3101
|
+
* The [NgModule](link:site.data.urls.angular['ngmodules']) for the Chat component.
|
3102
|
+
*
|
3103
|
+
* @example
|
3104
|
+
* ```ts-no-run
|
3105
|
+
* import { NgModule } from '@angular/core';
|
3106
|
+
* import { Component } from '@angular/core';
|
3107
|
+
* import { BrowserModule } from '@angular/platform-browser';
|
3108
|
+
*
|
3109
|
+
* import { ChatModule } from '@progress/kendo-angular-conversational-ui';
|
3110
|
+
* import { AppComponent } from './app.component';
|
3111
|
+
*
|
3112
|
+
* _@NgModule({
|
3113
|
+
* imports: [ BrowserModule, ChatModule ],
|
3114
|
+
* declarations: [ AppComponent ],
|
3115
|
+
* bootstrap: [ AppComponent ]
|
3116
|
+
* })
|
3117
|
+
*
|
3118
|
+
* export class AppModule { }
|
3119
|
+
* ```
|
3120
|
+
*/
|
3121
|
+
class ChatModule {
|
3122
|
+
}
|
3123
|
+
ChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
3124
|
+
ChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ChatModule, declarations: [ChatComponent,
|
1906
3125
|
CustomMessagesComponent,
|
1907
3126
|
AttachmentTemplateDirective,
|
1908
3127
|
MessageTemplateDirective,
|
1909
3128
|
HeroCardComponent,
|
1910
3129
|
ChatMessageBoxTemplateDirective, AttachmentComponent,
|
1911
3130
|
FocusedStateDirective,
|
1912
|
-
LocalizedMessagesDirective,
|
3131
|
+
LocalizedMessagesDirective$1,
|
1913
3132
|
MessageAttachmentsComponent,
|
1914
3133
|
MessageComponent,
|
1915
3134
|
MessageListComponent,
|
@@ -1945,9 +3164,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
1945
3164
|
}]
|
1946
3165
|
}] });
|
1947
3166
|
|
3167
|
+
/**
|
3168
|
+
* Represents the [NgModule](link:site.data.urls.angular['ngmodules'])
|
3169
|
+
* definition for the Conversational UI components.
|
3170
|
+
*
|
3171
|
+
* @example
|
3172
|
+
*
|
3173
|
+
* ```ts-no-run
|
3174
|
+
* // Import the Conversational UI module
|
3175
|
+
* import { ConversationalUIModule } from '@progress/kendo-angular-conversational-ui';
|
3176
|
+
*
|
3177
|
+
* // The browser platform with a compiler
|
3178
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
3179
|
+
*
|
3180
|
+
* import { NgModule } from '@angular/core';
|
3181
|
+
*
|
3182
|
+
* // Import the app component
|
3183
|
+
* import { AppComponent } from './app.component';
|
3184
|
+
*
|
3185
|
+
* // Define the app module
|
3186
|
+
* _@NgModule({
|
3187
|
+
* declarations: [AppComponent], // declare app component
|
3188
|
+
* imports: [BrowserModule, ConversationalUIModule], // import Conversational UI module
|
3189
|
+
* bootstrap: [AppComponent]
|
3190
|
+
* })
|
3191
|
+
* export class AppModule {}
|
3192
|
+
*
|
3193
|
+
* // Compile and launch the module
|
3194
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
3195
|
+
*
|
3196
|
+
* ```
|
3197
|
+
*/
|
3198
|
+
class ConversationalUIModule {
|
3199
|
+
}
|
3200
|
+
ConversationalUIModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ConversationalUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
3201
|
+
ConversationalUIModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ConversationalUIModule, exports: [AIPromptModule, ChatModule] });
|
3202
|
+
ConversationalUIModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ConversationalUIModule, imports: [AIPromptModule, ChatModule] });
|
3203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ConversationalUIModule, decorators: [{
|
3204
|
+
type: NgModule,
|
3205
|
+
args: [{
|
3206
|
+
exports: [AIPromptModule, ChatModule]
|
3207
|
+
}]
|
3208
|
+
}] });
|
3209
|
+
|
1948
3210
|
/**
|
1949
3211
|
* Generated bundle index. Do not edit.
|
1950
3212
|
*/
|
1951
3213
|
|
1952
|
-
export { AttachmentTemplateDirective, ChatComponent, ChatMessageBoxTemplateDirective, ChatModule, CustomMessagesComponent, ExecuteActionEvent, HeroCardComponent, MessageTemplateDirective, SendMessageEvent };
|
3214
|
+
export { AIPromptComponent, AIPromptCustomMessagesComponent, AIPromptModule, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AttachmentTemplateDirective, ChatComponent, ChatMessageBoxTemplateDirective, ChatModule, CommandViewComponent, ConversationalUIModule, CustomMessagesComponent, CustomViewComponent, ExecuteActionEvent, HeroCardComponent, MessageTemplateDirective, OutputViewComponent, PromptViewComponent, SendMessageEvent };
|
1953
3215
|
|