@progress/kendo-angular-conversational-ui 19.3.0-develop.9 → 19.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai-prompt/aiprompt.component.d.ts +80 -13
- package/ai-prompt/aiprompt.module.d.ts +3 -1
- package/ai-prompt/common/aiprompt.service.d.ts +10 -0
- package/ai-prompt/common/output-card.component.d.ts +4 -0
- package/ai-prompt/localization/messages.d.ts +5 -1
- package/ai-prompt/models/ai-prompt-settings.d.ts +60 -0
- package/ai-prompt/models/index.d.ts +1 -0
- package/ai-prompt/templates/aiprompt-output-body-template.directive.d.ts +24 -0
- package/ai-prompt/templates/aiprompt-output-template.directive.d.ts +24 -0
- package/ai-prompt/views/output-view.component.d.ts +4 -0
- package/ai-prompt/views/prompt-view.component.d.ts +23 -1
- package/chat/message-attachments.component.d.ts +1 -1
- package/conversational-ui.module.d.ts +12 -7
- package/directives.d.ts +25 -2
- package/esm2022/ai-prompt/aiprompt.component.mjs +177 -25
- package/esm2022/ai-prompt/aiprompt.module.mjs +3 -1
- package/esm2022/ai-prompt/common/aiprompt.service.mjs +35 -0
- package/esm2022/ai-prompt/common/output-card.component.mjs +23 -5
- package/esm2022/ai-prompt/common/toolbar-focusable.directive.mjs +4 -3
- package/esm2022/ai-prompt/localization/messages.mjs +7 -1
- package/esm2022/ai-prompt/models/ai-prompt-settings.mjs +5 -0
- package/esm2022/ai-prompt/templates/aiprompt-output-body-template.directive.mjs +33 -0
- package/esm2022/ai-prompt/templates/aiprompt-output-template.directive.mjs +33 -0
- package/esm2022/ai-prompt/views/output-view.component.mjs +27 -11
- package/esm2022/ai-prompt/views/prompt-view.component.mjs +139 -21
- package/esm2022/chat/message-attachments.component.mjs +3 -2
- package/esm2022/chat/message-box.component.mjs +3 -3
- package/esm2022/chat/message-list.component.mjs +4 -2
- package/esm2022/chat/suggested-actions.component.mjs +2 -2
- package/esm2022/conversational-ui.module.mjs +13 -8
- package/esm2022/directives.mjs +32 -2
- package/esm2022/index.mjs +8 -0
- package/esm2022/inline-ai-prompt/inlineaiprompt-content.component.mjs +522 -0
- package/esm2022/inline-ai-prompt/inlineaiprompt.component.mjs +349 -0
- package/esm2022/inline-ai-prompt/inlineaiprompt.module.mjs +46 -0
- package/esm2022/inline-ai-prompt/inlineaiprompt.service.mjs +85 -0
- package/esm2022/inline-ai-prompt/localization/custom-messages.component.mjs +53 -0
- package/esm2022/inline-ai-prompt/localization/localized-messages.directive.mjs +39 -0
- package/esm2022/inline-ai-prompt/localization/messages.mjs +35 -0
- package/esm2022/inline-ai-prompt/models/command.interface.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/index.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/inlineaiprompt-popupsettings.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/inlineaiprompt-settings.mjs +59 -0
- package/esm2022/inline-ai-prompt/models/messages.mjs +8 -0
- package/esm2022/inline-ai-prompt/models/output-action-click-event.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/output-action.interface.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/prompt-output.interface.mjs +5 -0
- package/esm2022/inline-ai-prompt/models/prompt-request-event.mjs +5 -0
- package/esm2022/inline-ai-prompt/output-template.directive.mjs +38 -0
- package/esm2022/inline-ai-prompt/utils.mjs +57 -0
- package/esm2022/package-metadata.mjs +2 -2
- package/fesm2022/progress-kendo-angular-conversational-ui.mjs +1768 -147
- package/index.d.ts +8 -0
- package/inline-ai-prompt/inlineaiprompt-content.component.d.ts +82 -0
- package/inline-ai-prompt/inlineaiprompt.component.d.ts +157 -0
- package/inline-ai-prompt/inlineaiprompt.module.d.ts +31 -0
- package/inline-ai-prompt/inlineaiprompt.service.d.ts +41 -0
- package/inline-ai-prompt/localization/custom-messages.component.d.ts +27 -0
- package/inline-ai-prompt/localization/localized-messages.directive.d.ts +16 -0
- package/inline-ai-prompt/localization/messages.d.ts +25 -0
- package/inline-ai-prompt/models/command.interface.d.ts +38 -0
- package/inline-ai-prompt/models/index.d.ts +12 -0
- package/inline-ai-prompt/models/inlineaiprompt-popupsettings.d.ts +10 -0
- package/inline-ai-prompt/models/inlineaiprompt-settings.d.ts +66 -0
- package/inline-ai-prompt/models/messages.d.ts +21 -0
- package/inline-ai-prompt/models/output-action-click-event.d.ts +19 -0
- package/inline-ai-prompt/models/output-action.interface.d.ts +52 -0
- package/inline-ai-prompt/models/prompt-output.interface.d.ts +25 -0
- package/inline-ai-prompt/models/prompt-request-event.d.ts +17 -0
- package/inline-ai-prompt/output-template.directive.d.ts +27 -0
- package/inline-ai-prompt/utils.d.ts +17 -0
- package/package.json +13 -12
@@ -3,22 +3,28 @@
|
|
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, EventEmitter, Component, HostBinding, ViewChild, Input, Output, isDevMode, forwardRef, ViewChildren, ElementRef, ContentChild, InjectionToken, Inject, Injectable, ContentChildren, NgModule } from '@angular/core';
|
6
|
+
import { Directive, Optional, EventEmitter, Component, HostBinding, ViewChild, Input, Output, isDevMode, forwardRef, ViewChildren, ElementRef, ContentChild, InjectionToken, Inject, Injectable, ContentChildren, inject, SkipSelf, HostListener, ViewContainerRef, 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
|
-
import { NgIf, NgTemplateOutlet, NgFor, NgSwitch, NgSwitchCase } from '@angular/common';
|
11
|
-
import { Keys, ResizeSensorComponent, isPresent, focusableSelector, guid, ResizeBatchService } from '@progress/kendo-angular-common';
|
12
|
-
import { paperPlaneIcon, chevronLeftIcon, chevronRightIcon, sparklesIcon, commentIcon, moreHorizontalIcon, thumbUpIcon, thumbDownOutlineIcon, thumbDownIcon, thumbUpOutlineIcon, copyIcon, arrowRotateCwIcon, chevronUpIcon, chevronDownIcon } from '@progress/kendo-svg-icons';
|
13
|
-
import
|
14
|
-
import {
|
10
|
+
import { NgIf, NgTemplateOutlet, NgFor, NgSwitch, NgSwitchCase, NgClass } from '@angular/common';
|
11
|
+
import { Keys, normalizeNumpadKeys, ResizeSensorComponent, isPresent, focusableSelector, guid, isDocumentAvailable, ResizeBatchService } from '@progress/kendo-angular-common';
|
12
|
+
import { paperPlaneIcon, chevronLeftIcon, chevronRightIcon, sparklesIcon, commentIcon, moreHorizontalIcon, stopSmIcon, thumbUpIcon, thumbDownOutlineIcon, thumbDownIcon, thumbUpOutlineIcon, copyIcon, arrowRotateCwIcon, chevronUpIcon, chevronDownIcon, cancelOutlineIcon, menuIcon } from '@progress/kendo-svg-icons';
|
13
|
+
import * as i2 from '@progress/kendo-angular-buttons';
|
14
|
+
import { ButtonComponent, FloatingActionButtonComponent, SpeechToTextButtonComponent, KENDO_BUTTONS } from '@progress/kendo-angular-buttons';
|
15
|
+
import * as i3 from '@progress/kendo-angular-inputs';
|
16
|
+
import { TextBoxComponent, TextAreaComponent, InputSeparatorComponent, TextBoxSuffixTemplateDirective, TextAreaSuffixComponent, KENDO_TEXTAREA } from '@progress/kendo-angular-inputs';
|
15
17
|
import * as i1 from '@progress/kendo-angular-intl';
|
16
18
|
import { fromEvent, Subscription, Subject } from 'rxjs';
|
17
|
-
import { debounceTime } from 'rxjs/operators';
|
19
|
+
import { debounceTime, take } from 'rxjs/operators';
|
18
20
|
import { IconsService } from '@progress/kendo-angular-icons';
|
19
|
-
import
|
21
|
+
import * as i1$2 from '@progress/kendo-angular-popup';
|
22
|
+
import { PopupComponent, KENDO_POPUP, PopupService } from '@progress/kendo-angular-popup';
|
20
23
|
import { DialogContainerService, DialogService, WindowService, WindowContainerService } from '@progress/kendo-angular-dialog';
|
21
|
-
import
|
24
|
+
import * as i5 from '@progress/kendo-angular-layout';
|
25
|
+
import { PanelBarComponent, KENDO_CARD } from '@progress/kendo-angular-layout';
|
26
|
+
import * as i4 from '@progress/kendo-angular-menu';
|
27
|
+
import { KENDO_CONTEXTMENU } from '@progress/kendo-angular-menu';
|
22
28
|
|
23
29
|
/**
|
24
30
|
* Defines a template for displaying message attachments.
|
@@ -136,8 +142,8 @@ const packageMetadata = {
|
|
136
142
|
productName: 'Kendo UI for Angular',
|
137
143
|
productCode: 'KENDOUIANGULAR',
|
138
144
|
productCodes: ['KENDOUIANGULAR'],
|
139
|
-
publishDate:
|
140
|
-
version: '19.3.0
|
145
|
+
publishDate: 1755030560,
|
146
|
+
version: '19.3.0',
|
141
147
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
142
148
|
};
|
143
149
|
|
@@ -211,7 +217,7 @@ class MessageBoxComponent {
|
|
211
217
|
* @hidden
|
212
218
|
*/
|
213
219
|
inputKeydown(e) {
|
214
|
-
if (e.
|
220
|
+
if (e.code === Keys.Enter || e.code === Keys.NumpadEnter) {
|
215
221
|
this.sendClick();
|
216
222
|
}
|
217
223
|
}
|
@@ -219,7 +225,7 @@ class MessageBoxComponent {
|
|
219
225
|
* @hidden
|
220
226
|
*/
|
221
227
|
textAreaKeydown(e) {
|
222
|
-
const isEnter = e.
|
228
|
+
const isEnter = e.code === Keys.Enter || e.code === Keys.NumpadEnter;
|
223
229
|
if (!isEnter) {
|
224
230
|
return;
|
225
231
|
}
|
@@ -298,7 +304,7 @@ class MessageBoxComponent {
|
|
298
304
|
</ng-container>
|
299
305
|
|
300
306
|
<ng-template *ngIf="messageBoxTemplate" [ngTemplateOutlet]="messageBoxTemplate?.templateRef"></ng-template>
|
301
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "component", type: InputSeparatorComponent, selector: "kendo-input-separator, kendo-textbox-separator", inputs: ["orientation"] }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "[kendoTextBoxSuffixTemplate]", inputs: ["showSeparator"] }, { kind: "component", type: TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }] });
|
307
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "maxResizableRows", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "component", type: InputSeparatorComponent, selector: "kendo-input-separator, kendo-textbox-separator", inputs: ["orientation"] }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "[kendoTextBoxSuffixTemplate]", inputs: ["showSeparator"] }, { kind: "component", type: TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }] });
|
302
308
|
}
|
303
309
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageBoxComponent, decorators: [{
|
304
310
|
type: Component,
|
@@ -553,7 +559,7 @@ class SuggestedActionsComponent extends ChatItem {
|
|
553
559
|
this.dispatch.next(action);
|
554
560
|
}
|
555
561
|
actionKeydown(e, action) {
|
556
|
-
const handler = this.keyHandlers[e
|
562
|
+
const handler = this.keyHandlers[normalizeNumpadKeys(e)];
|
557
563
|
if (handler) {
|
558
564
|
handler(e, action);
|
559
565
|
}
|
@@ -917,7 +923,8 @@ class MessageAttachmentsComponent extends ChatItem {
|
|
917
923
|
itemKeydown(e, attachment) {
|
918
924
|
const keyHandlers = this.layout === 'list' ?
|
919
925
|
this.listKeyHandlers : this.carouselKeyHandlers;
|
920
|
-
const
|
926
|
+
const code = normalizeNumpadKeys(e);
|
927
|
+
const handler = keyHandlers[code];
|
921
928
|
if (handler) {
|
922
929
|
handler(e, attachment);
|
923
930
|
}
|
@@ -1149,7 +1156,9 @@ class MessageListComponent {
|
|
1149
1156
|
return this.intl.formatDate(date, { date: 'full' });
|
1150
1157
|
}
|
1151
1158
|
onKeydown(e) {
|
1152
|
-
|
1159
|
+
// On some keyboards Numpad keys are used for Home/End/PageUp/PageDown.
|
1160
|
+
const code = normalizeNumpadKeys(e);
|
1161
|
+
const action = this.keyActions[code];
|
1153
1162
|
if (action) {
|
1154
1163
|
action(e);
|
1155
1164
|
}
|
@@ -1511,7 +1520,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1511
1520
|
/**
|
1512
1521
|
* @hidden
|
1513
1522
|
*/
|
1514
|
-
let Messages$
|
1523
|
+
let Messages$2 = class Messages extends ComponentMessages {
|
1515
1524
|
/**
|
1516
1525
|
* Sets the placeholder text for the message text input.
|
1517
1526
|
*/
|
@@ -1543,7 +1552,7 @@ let Messages$1 = class Messages extends ComponentMessages {
|
|
1543
1552
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
1544
1553
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: Messages, selector: "kendoConversationalUIMessages", inputs: { messagePlaceholder: "messagePlaceholder", send: "send", messageListLabel: "messageListLabel", messageBoxInputLabel: "messageBoxInputLabel", messageAttachmentLeftArrow: "messageAttachmentLeftArrow", messageAttachmentRightArrow: "messageAttachmentRightArrow", messageAvatarAlt: "messageAvatarAlt" }, usesInheritance: true, ngImport: i0 });
|
1545
1554
|
};
|
1546
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages$
|
1555
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages$2, decorators: [{
|
1547
1556
|
type: Directive,
|
1548
1557
|
args: [{
|
1549
1558
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
@@ -1569,7 +1578,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1569
1578
|
/**
|
1570
1579
|
* @hidden
|
1571
1580
|
*/
|
1572
|
-
let LocalizedMessagesDirective$
|
1581
|
+
let LocalizedMessagesDirective$2 = class LocalizedMessagesDirective extends Messages$2 {
|
1573
1582
|
service;
|
1574
1583
|
constructor(service) {
|
1575
1584
|
super();
|
@@ -1578,18 +1587,18 @@ let LocalizedMessagesDirective$1 = class LocalizedMessagesDirective extends Mess
|
|
1578
1587
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
1579
1588
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoChatLocalizedMessages]", providers: [
|
1580
1589
|
{
|
1581
|
-
provide: Messages$
|
1590
|
+
provide: Messages$2,
|
1582
1591
|
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
1583
1592
|
}
|
1584
1593
|
], usesInheritance: true, ngImport: i0 });
|
1585
1594
|
};
|
1586
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective$
|
1595
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective$2, decorators: [{
|
1587
1596
|
type: Directive,
|
1588
1597
|
args: [{
|
1589
1598
|
providers: [
|
1590
1599
|
{
|
1591
|
-
provide: Messages$
|
1592
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective$
|
1600
|
+
provide: Messages$2,
|
1601
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective$2)
|
1593
1602
|
}
|
1594
1603
|
],
|
1595
1604
|
selector: '[kendoChatLocalizedMessages]',
|
@@ -1786,7 +1795,7 @@ class ChatComponent {
|
|
1786
1795
|
(sendMessage)="sendMessage.emit($event)"
|
1787
1796
|
>
|
1788
1797
|
</kendo-message-box>
|
1789
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective$
|
1798
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective$2, selector: "[kendoChatLocalizedMessages]" }, { kind: "directive", type: ScrollAnchorDirective, selector: "[kendoChatScrollAnchor]", inputs: ["autoScroll"], outputs: ["autoScrollChange"], exportAs: ["scrollAnchor"] }, { kind: "component", type: MessageListComponent, selector: "kendo-chat-message-list", inputs: ["messages", "attachmentTemplate", "messageTemplate", "localization", "user"], outputs: ["executeAction", "navigate", "resize"] }, { kind: "component", type: MessageBoxComponent, selector: "kendo-message-box", inputs: ["user", "autoScroll", "type", "localization", "messageBoxTemplate"], outputs: ["sendMessage"] }] });
|
1790
1799
|
}
|
1791
1800
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChatComponent, decorators: [{
|
1792
1801
|
type: Component,
|
@@ -1858,7 +1867,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1858
1867
|
</kendo-message-box>
|
1859
1868
|
`,
|
1860
1869
|
standalone: true,
|
1861
|
-
imports: [LocalizedMessagesDirective$
|
1870
|
+
imports: [LocalizedMessagesDirective$2, ScrollAnchorDirective, MessageListComponent, MessageBoxComponent]
|
1862
1871
|
}]
|
1863
1872
|
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { messages: [{
|
1864
1873
|
type: Input
|
@@ -2003,6 +2012,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2003
2012
|
type: Input
|
2004
2013
|
}] } });
|
2005
2014
|
|
2015
|
+
/**
|
2016
|
+
* @hidden
|
2017
|
+
* Default settings for the Speech to Text button.
|
2018
|
+
* These settings can be overridden by the user.
|
2019
|
+
*/
|
2020
|
+
const STB_DEFAULT_SETTINGS = {
|
2021
|
+
continuous: false,
|
2022
|
+
disabled: false,
|
2023
|
+
fillMode: 'flat',
|
2024
|
+
integrationMode: 'webSpeech',
|
2025
|
+
interimResults: false,
|
2026
|
+
lang: 'en-US',
|
2027
|
+
maxAlternatives: 1,
|
2028
|
+
rounded: 'medium',
|
2029
|
+
size: 'medium',
|
2030
|
+
themeColor: 'base'
|
2031
|
+
};
|
2006
2032
|
/**
|
2007
2033
|
* @hidden
|
2008
2034
|
*/
|
@@ -2017,6 +2043,24 @@ class AIPromptService {
|
|
2017
2043
|
promptCommands;
|
2018
2044
|
promptOutputs;
|
2019
2045
|
promptSuggestions;
|
2046
|
+
textAreaSettings;
|
2047
|
+
outputTemplate;
|
2048
|
+
outputBodyTemplate;
|
2049
|
+
_speechToTextButton;
|
2050
|
+
get speechToTextButton() {
|
2051
|
+
return this._speechToTextButton;
|
2052
|
+
}
|
2053
|
+
set speechToTextButton(settings) {
|
2054
|
+
if (settings === true) {
|
2055
|
+
this._speechToTextButton = STB_DEFAULT_SETTINGS;
|
2056
|
+
}
|
2057
|
+
else if (settings === false) {
|
2058
|
+
this._speechToTextButton = null;
|
2059
|
+
}
|
2060
|
+
else {
|
2061
|
+
this._speechToTextButton = { ...settings };
|
2062
|
+
}
|
2063
|
+
}
|
2020
2064
|
getFlattenPromptCommands(commands = this.promptCommands) {
|
2021
2065
|
let newArr = [];
|
2022
2066
|
commands.forEach(c => {
|
@@ -2151,9 +2195,10 @@ class AIPromptToolbarFocusableDirective {
|
|
2151
2195
|
this.element.focus();
|
2152
2196
|
}
|
2153
2197
|
keyDownHandler = (e) => {
|
2198
|
+
const code = normalizeNumpadKeys(e);
|
2154
2199
|
const targetsSelf = e.target === this.element;
|
2155
|
-
const isLeftArrow =
|
2156
|
-
const isRightArrow =
|
2200
|
+
const isLeftArrow = code === Keys.ArrowLeft;
|
2201
|
+
const isRightArrow = code === Keys.ArrowRight;
|
2157
2202
|
const isArrow = isLeftArrow || isRightArrow;
|
2158
2203
|
if (!targetsSelf || !isArrow) {
|
2159
2204
|
return;
|
@@ -2186,7 +2231,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2186
2231
|
/**
|
2187
2232
|
* @hidden
|
2188
2233
|
*/
|
2189
|
-
class Messages extends ComponentMessages {
|
2234
|
+
let Messages$1 = class Messages extends ComponentMessages {
|
2190
2235
|
/**
|
2191
2236
|
* Sets the Toolbar button text for the **Prompt** view.
|
2192
2237
|
*/
|
@@ -2223,10 +2268,14 @@ class Messages extends ComponentMessages {
|
|
2223
2268
|
* Sets the title of the **Prompt suggestions** button.
|
2224
2269
|
*/
|
2225
2270
|
promptSuggestions;
|
2271
|
+
/**
|
2272
|
+
* Sets the aria-label for the **Speech to Text** button.
|
2273
|
+
*/
|
2274
|
+
speechToTextButton;
|
2226
2275
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
2227
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.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 });
|
2228
|
-
}
|
2229
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, decorators: [{
|
2276
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: Messages, inputs: { promptView: "promptView", outputView: "outputView", generateOutput: "generateOutput", promptPlaceholder: "promptPlaceholder", copyOutput: "copyOutput", retryGeneration: "retryGeneration", outputTitle: "outputTitle", outputRetryTitle: "outputRetryTitle", promptSuggestions: "promptSuggestions", speechToTextButton: "speechToTextButton" }, usesInheritance: true, ngImport: i0 });
|
2277
|
+
};
|
2278
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages$1, decorators: [{
|
2230
2279
|
type: Directive
|
2231
2280
|
}], propDecorators: { promptView: [{
|
2232
2281
|
type: Input
|
@@ -2246,12 +2295,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2246
2295
|
type: Input
|
2247
2296
|
}], promptSuggestions: [{
|
2248
2297
|
type: Input
|
2298
|
+
}], speechToTextButton: [{
|
2299
|
+
type: Input
|
2249
2300
|
}] } });
|
2250
2301
|
|
2251
2302
|
/**
|
2252
2303
|
* @hidden
|
2253
2304
|
*/
|
2254
|
-
class LocalizedMessagesDirective extends Messages {
|
2305
|
+
let LocalizedMessagesDirective$1 = class LocalizedMessagesDirective extends Messages$1 {
|
2255
2306
|
service;
|
2256
2307
|
constructor(service) {
|
2257
2308
|
super();
|
@@ -2260,18 +2311,18 @@ class LocalizedMessagesDirective extends Messages {
|
|
2260
2311
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
2261
2312
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoAIPromptLocalizedMessages]", providers: [
|
2262
2313
|
{
|
2263
|
-
provide: Messages,
|
2314
|
+
provide: Messages$1,
|
2264
2315
|
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
2265
2316
|
}
|
2266
2317
|
], usesInheritance: true, ngImport: i0 });
|
2267
|
-
}
|
2268
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
2318
|
+
};
|
2319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective$1, decorators: [{
|
2269
2320
|
type: Directive,
|
2270
2321
|
args: [{
|
2271
2322
|
providers: [
|
2272
2323
|
{
|
2273
|
-
provide: Messages,
|
2274
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
2324
|
+
provide: Messages$1,
|
2325
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective$1)
|
2275
2326
|
}
|
2276
2327
|
],
|
2277
2328
|
selector: '[kendoAIPromptLocalizedMessages]',
|
@@ -2279,6 +2330,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2279
2330
|
}]
|
2280
2331
|
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
2281
2332
|
|
2333
|
+
/**
|
2334
|
+
* Represents the template for the response in the AIPrompt component. The template context is set to the current output object.
|
2335
|
+
*
|
2336
|
+
* @example
|
2337
|
+
* ```html
|
2338
|
+
* <kendo-aiprompt>
|
2339
|
+
* <ng-template kendoAIPromptOutputTemplate let-output>
|
2340
|
+
* <div>{{output.prompt}}</div>
|
2341
|
+
* </ng-template>
|
2342
|
+
* </kendo-aiprompt>
|
2343
|
+
* ```
|
2344
|
+
*/
|
2345
|
+
class AIPromptOutputTemplateDirective {
|
2346
|
+
templateRef;
|
2347
|
+
constructor(templateRef) {
|
2348
|
+
this.templateRef = templateRef;
|
2349
|
+
}
|
2350
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
2351
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptOutputTemplateDirective, isStandalone: true, selector: "[kendoAIPromptOutputTemplate]", ngImport: i0 });
|
2352
|
+
}
|
2353
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputTemplateDirective, decorators: [{
|
2354
|
+
type: Directive,
|
2355
|
+
args: [{
|
2356
|
+
selector: '[kendoAIPromptOutputTemplate]',
|
2357
|
+
standalone: true
|
2358
|
+
}]
|
2359
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
2360
|
+
|
2361
|
+
/**
|
2362
|
+
* Represents the template for the body of the response in the AIPrompt component. The template context is set to the current output object.
|
2363
|
+
*
|
2364
|
+
* @example
|
2365
|
+
* ```html
|
2366
|
+
* <kendo-aiprompt>
|
2367
|
+
* <ng-template kendoAIPromptOutputBodyTemplate let-output>
|
2368
|
+
* <div>{{output.prompt}}</div>
|
2369
|
+
* </ng-template>
|
2370
|
+
* </kendo-aiprompt>
|
2371
|
+
* ```
|
2372
|
+
*/
|
2373
|
+
class AIPromptOutputBodyTemplateDirective {
|
2374
|
+
templateRef;
|
2375
|
+
constructor(templateRef) {
|
2376
|
+
this.templateRef = templateRef;
|
2377
|
+
}
|
2378
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputBodyTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
2379
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptOutputBodyTemplateDirective, isStandalone: true, selector: "[kendoAIPromptOutputBodyTemplate]", ngImport: i0 });
|
2380
|
+
}
|
2381
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputBodyTemplateDirective, decorators: [{
|
2382
|
+
type: Directive,
|
2383
|
+
args: [{
|
2384
|
+
selector: '[kendoAIPromptOutputBodyTemplate]',
|
2385
|
+
standalone: true
|
2386
|
+
}]
|
2387
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
2388
|
+
|
2282
2389
|
/**
|
2283
2390
|
* Represents the [Kendo UI AIPrompt component for Angular](slug:overview_aiprompt).
|
2284
2391
|
*
|
@@ -2301,21 +2408,29 @@ class AIPromptComponent {
|
|
2301
2408
|
service;
|
2302
2409
|
navigationService;
|
2303
2410
|
ngZone;
|
2411
|
+
element;
|
2412
|
+
renderer;
|
2304
2413
|
hostClasses = true;
|
2305
2414
|
get dirAttr() {
|
2306
2415
|
return this.direction;
|
2307
2416
|
}
|
2308
|
-
constructor(localization, service, navigationService, ngZone) {
|
2417
|
+
constructor(localization, service, navigationService, ngZone, element, renderer) {
|
2309
2418
|
this.localization = localization;
|
2310
2419
|
this.service = service;
|
2311
2420
|
this.navigationService = navigationService;
|
2312
2421
|
this.ngZone = ngZone;
|
2422
|
+
this.element = element;
|
2423
|
+
this.renderer = renderer;
|
2313
2424
|
validatePackage(packageMetadata);
|
2314
2425
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
2315
2426
|
this.subs.add(localization.changes.subscribe(({ rtl }) => {
|
2316
2427
|
this.direction = rtl ? 'rtl' : 'ltr';
|
2317
2428
|
}));
|
2318
2429
|
}
|
2430
|
+
/**
|
2431
|
+
* @hidden
|
2432
|
+
*/
|
2433
|
+
fabButton;
|
2319
2434
|
/**
|
2320
2435
|
* @hidden
|
2321
2436
|
*/
|
@@ -2324,6 +2439,14 @@ class AIPromptComponent {
|
|
2324
2439
|
* @hidden
|
2325
2440
|
*/
|
2326
2441
|
toolbarActionsTemplate;
|
2442
|
+
/**
|
2443
|
+
* @hidden
|
2444
|
+
*/
|
2445
|
+
outputTemplate;
|
2446
|
+
/**
|
2447
|
+
* @hidden
|
2448
|
+
*/
|
2449
|
+
outputBodyTemplate;
|
2327
2450
|
/**
|
2328
2451
|
* The active view index of the AIPrompt component.
|
2329
2452
|
*/
|
@@ -2337,54 +2460,120 @@ class AIPromptComponent {
|
|
2337
2460
|
return this._activeView;
|
2338
2461
|
}
|
2339
2462
|
/**
|
2340
|
-
* Sets the collection of commands to render in the
|
2463
|
+
* Sets the collection of commands to render in the Command view.
|
2341
2464
|
*/
|
2342
2465
|
set promptCommands(value) {
|
2343
2466
|
this.service.promptCommands = value;
|
2344
2467
|
}
|
2345
2468
|
/**
|
2346
|
-
* Sets the collection of suggestions to render in the
|
2469
|
+
* Sets the collection of suggestions to render in the Prompt view.
|
2347
2470
|
*/
|
2348
2471
|
set promptSuggestions(value) {
|
2349
2472
|
this.service.promptSuggestions = value;
|
2350
2473
|
}
|
2351
2474
|
/**
|
2352
|
-
* Sets the collection of generated prompt outputs to render in the
|
2475
|
+
* Sets the collection of generated prompt outputs to render in the Output view.
|
2353
2476
|
*/
|
2354
2477
|
set promptOutputs(value) {
|
2355
2478
|
this.service.promptOutputs = value;
|
2356
2479
|
}
|
2357
2480
|
/**
|
2358
|
-
* Specifies
|
2359
|
-
*
|
2481
|
+
* Specifies whether the rating buttons appear in each Output view card.
|
2482
|
+
* The rating buttons do not appear by default.
|
2360
2483
|
* @default false
|
2361
2484
|
*/
|
2362
2485
|
set showOutputRating(value) {
|
2363
2486
|
this.service.showOutputRating = value;
|
2364
2487
|
}
|
2488
|
+
/**
|
2489
|
+
* Specifies whether the Stop generation button appears in the Output view.
|
2490
|
+
* The Stop generation button does not appear by default.
|
2491
|
+
* @default false
|
2492
|
+
*/
|
2493
|
+
streaming = false;
|
2494
|
+
/**
|
2495
|
+
* Sets the settings for the Speech to Text button in the Prompt view
|
2496
|
+
* ([see example](slug:configuration_aiprompt#enabling-speech-to-text)).
|
2497
|
+
*/
|
2498
|
+
set speechToTextButton(settings) {
|
2499
|
+
if (settings) {
|
2500
|
+
this.service.speechToTextButton = settings;
|
2501
|
+
}
|
2502
|
+
else {
|
2503
|
+
this.service.speechToTextButton = false;
|
2504
|
+
}
|
2505
|
+
}
|
2506
|
+
/**
|
2507
|
+
* Sets the settings for the TextArea in the Prompt view
|
2508
|
+
* ([see example](slug:configuration_aiprompt#configuring-the-prompt-text-area)).
|
2509
|
+
*/
|
2510
|
+
set textAreaSettings(settings) {
|
2511
|
+
this.service.textAreaSettings = settings;
|
2512
|
+
}
|
2513
|
+
/**
|
2514
|
+
* Sets the SVG icon for the Generate button in the Prompt view.
|
2515
|
+
*/
|
2516
|
+
generateButtonSVGIcon = sparklesIcon;
|
2517
|
+
/**
|
2518
|
+
* Sets the icon for the Generate button in the Prompt view.
|
2519
|
+
* @default 'sparkles'
|
2520
|
+
*/
|
2521
|
+
generateButtonIcon = 'sparkles';
|
2522
|
+
/**
|
2523
|
+
* Sets the disabled state for the Generate button in the Prompt view.
|
2524
|
+
* @default false
|
2525
|
+
*/
|
2526
|
+
disabledGenerateButton = false;
|
2365
2527
|
/**
|
2366
2528
|
* Fires when the `activeView` property is updated.
|
2367
2529
|
* Use this event for two-way binding of the `activeView` property.
|
2368
2530
|
*/
|
2369
2531
|
activeViewChange = new EventEmitter();
|
2370
2532
|
/**
|
2371
|
-
* Fires when
|
2533
|
+
* Fires when you click the Generate button in the Prompt view or the Retry button in the Output view.
|
2372
2534
|
* Use the event's `isRetry` field to determine the source element.
|
2373
2535
|
*/
|
2374
2536
|
promptRequest = new EventEmitter();
|
2375
2537
|
/**
|
2376
|
-
* Fires when
|
2538
|
+
* Fires when you click a Command view command.
|
2377
2539
|
* The event data contains the selected command.
|
2378
2540
|
*/
|
2379
2541
|
commandExecute = new EventEmitter();
|
2380
2542
|
/**
|
2381
|
-
* Fires when
|
2543
|
+
* Fires when you click a Copy button in any Output view card.
|
2382
2544
|
*/
|
2383
2545
|
outputCopy = new EventEmitter();
|
2384
2546
|
/**
|
2385
|
-
* Fires when
|
2547
|
+
* Fires when you click a rating button in any Output view card.
|
2386
2548
|
*/
|
2387
2549
|
outputRatingChange = new EventEmitter();
|
2550
|
+
/**
|
2551
|
+
* Fires when you click the Stop Generation button in the Output view.
|
2552
|
+
*/
|
2553
|
+
promptRequestCancel = new EventEmitter();
|
2554
|
+
ngOnInit() {
|
2555
|
+
const aiPromptElement = this.element.nativeElement;
|
2556
|
+
this.subs.add(this.renderer.listen(aiPromptElement, 'keydown', (event) => {
|
2557
|
+
if (event.key === 'Escape') {
|
2558
|
+
this.promptRequestCancel.emit();
|
2559
|
+
}
|
2560
|
+
}));
|
2561
|
+
}
|
2562
|
+
ngOnChanges(changes) {
|
2563
|
+
if (changes['streaming'] && changes['streaming'].currentValue === true) {
|
2564
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
2565
|
+
this.fabButton?.focus();
|
2566
|
+
});
|
2567
|
+
}
|
2568
|
+
}
|
2569
|
+
ngAfterContentChecked() {
|
2570
|
+
if (this.outputTemplate !== this.service.outputTemplate) {
|
2571
|
+
this.service.outputTemplate = this.outputTemplate;
|
2572
|
+
}
|
2573
|
+
if (this.outputBodyTemplate !== this.service.outputBodyTemplate) {
|
2574
|
+
this.service.outputBodyTemplate = this.outputBodyTemplate;
|
2575
|
+
}
|
2576
|
+
}
|
2388
2577
|
ngAfterViewInit() {
|
2389
2578
|
this.ngZone.runOutsideAngular(() => {
|
2390
2579
|
this.service.aiPrompt = this;
|
@@ -2418,12 +2607,24 @@ class AIPromptComponent {
|
|
2418
2607
|
* @hidden
|
2419
2608
|
*/
|
2420
2609
|
outputIcon = commentIcon;
|
2610
|
+
/**
|
2611
|
+
* @hidden
|
2612
|
+
*/
|
2613
|
+
fabStopGenerationSVGIcon = stopSmIcon;
|
2421
2614
|
/**
|
2422
2615
|
* @hidden
|
2423
2616
|
*/
|
2424
2617
|
get viewsArray() {
|
2425
2618
|
return this.views?.toArray();
|
2426
2619
|
}
|
2620
|
+
/**
|
2621
|
+
* @hidden
|
2622
|
+
*/
|
2623
|
+
fabPositionMode = 'absolute';
|
2624
|
+
/**
|
2625
|
+
* @hidden
|
2626
|
+
*/
|
2627
|
+
fabAlignment = { vertical: 'bottom', horizontal: 'end' };
|
2427
2628
|
direction;
|
2428
2629
|
_activeView = 0;
|
2429
2630
|
/**
|
@@ -2459,8 +2660,8 @@ class AIPromptComponent {
|
|
2459
2660
|
};
|
2460
2661
|
this.promptRequest.emit(eventArgs);
|
2461
2662
|
}
|
2462
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }, { token: ToolbarNavigationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
2463
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptComponent, isStandalone: true, 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: [
|
2663
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }, { token: ToolbarNavigationService }, { token: i0.NgZone }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
2664
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptComponent, isStandalone: true, selector: "kendo-aiprompt", inputs: { activeView: "activeView", promptCommands: "promptCommands", promptSuggestions: "promptSuggestions", promptOutputs: "promptOutputs", showOutputRating: "showOutputRating", streaming: "streaming", speechToTextButton: "speechToTextButton", textAreaSettings: "textAreaSettings", generateButtonSVGIcon: "generateButtonSVGIcon", generateButtonIcon: "generateButtonIcon", disabledGenerateButton: "disabledGenerateButton" }, outputs: { activeViewChange: "activeViewChange", promptRequest: "promptRequest", commandExecute: "commandExecute", outputCopy: "outputCopy", outputRatingChange: "outputRatingChange", promptRequestCancel: "promptRequestCancel" }, host: { properties: { "class.k-prompt": "this.hostClasses", "attr.dir": "this.dirAttr" } }, providers: [
|
2464
2665
|
LocalizationService,
|
2465
2666
|
AIPromptService,
|
2466
2667
|
ToolbarNavigationService,
|
@@ -2468,7 +2669,7 @@ class AIPromptComponent {
|
|
2468
2669
|
provide: L10N_PREFIX,
|
2469
2670
|
useValue: 'kendo.aiprompt'
|
2470
2671
|
}
|
2471
|
-
], queries: [{ propertyName: "toolbarActionsTemplate", first: true, predicate: AIPromptToolbarActionsDirective, descendants: true }, { propertyName: "views", predicate: BaseView }], exportAs: ["kendoAIPrompt"], ngImport: i0, template: `
|
2672
|
+
], queries: [{ propertyName: "toolbarActionsTemplate", first: true, predicate: AIPromptToolbarActionsDirective, descendants: true }, { propertyName: "outputTemplate", first: true, predicate: AIPromptOutputTemplateDirective, descendants: true }, { propertyName: "outputBodyTemplate", first: true, predicate: AIPromptOutputBodyTemplateDirective, descendants: true }, { propertyName: "views", predicate: BaseView }], viewQueries: [{ propertyName: "fabButton", first: true, predicate: ["fabButton"], descendants: true }], exportAs: ["kendoAIPrompt"], usesOnChanges: true, ngImport: i0, template: `
|
2472
2673
|
<ng-container kendoAIPromptLocalizedMessages
|
2473
2674
|
i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
|
2474
2675
|
promptView="Ask AI"
|
@@ -2487,7 +2688,9 @@ class AIPromptComponent {
|
|
2487
2688
|
i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
|
2488
2689
|
outputRetryTitle="Generated with AI"
|
2489
2690
|
i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
|
2490
|
-
promptSuggestions="Prompt suggestions"
|
2691
|
+
promptSuggestions="Prompt suggestions"
|
2692
|
+
i18n-speechToTextButton="kendo.aiprompt.speechToTextButton|The aria-label for the Speech to Text button."
|
2693
|
+
speechToTextButton="Voice input">
|
2491
2694
|
</ng-container>
|
2492
2695
|
<div class="k-prompt-header">
|
2493
2696
|
<div class="k-toolbar-flat k-toolbar k-toolbar-md"
|
@@ -2512,6 +2715,16 @@ class AIPromptComponent {
|
|
2512
2715
|
</div>
|
2513
2716
|
</div>
|
2514
2717
|
<div class="k-prompt-content">
|
2718
|
+
<kendo-floatingactionbutton #fabButton *ngIf="streaming && selectedView?.viewType === 'output'"
|
2719
|
+
class="k-prompt-stop-fab"
|
2720
|
+
buttonClass="k-generating k-active"
|
2721
|
+
[positionMode]="fabPositionMode"
|
2722
|
+
[align]="fabAlignment"
|
2723
|
+
[svgIcon]="fabStopGenerationSVGIcon"
|
2724
|
+
icon="stop"
|
2725
|
+
(click)="promptRequestCancel.emit()"
|
2726
|
+
>
|
2727
|
+
</kendo-floatingactionbutton>
|
2515
2728
|
<div class="k-prompt-view">
|
2516
2729
|
<ng-container *ngTemplateOutlet="viewTemplate">
|
2517
2730
|
</ng-container>
|
@@ -2524,12 +2737,16 @@ class AIPromptComponent {
|
|
2524
2737
|
type="button"
|
2525
2738
|
themeColor="primary"
|
2526
2739
|
rounded="full"
|
2527
|
-
[
|
2528
|
-
|
2740
|
+
[attr.title]="messageFor('generateOutput')"
|
2741
|
+
[attr.aria-label]="messageFor('generateOutput')"
|
2742
|
+
[attr.aria-disabled]="disabledGenerateButton"
|
2743
|
+
[svgIcon]="generateButtonSVGIcon"
|
2744
|
+
[icon]="generateButtonIcon"
|
2745
|
+
[disabled]="disabledGenerateButton"
|
2529
2746
|
(click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
|
2530
2747
|
</div>
|
2531
2748
|
</div>
|
2532
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoAIPromptLocalizedMessages]" }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
2749
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective$1, selector: "[kendoAIPromptLocalizedMessages]" }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FloatingActionButtonComponent, selector: "kendo-floatingactionbutton", inputs: ["themeColor", "size", "rounded", "disabled", "align", "offset", "positionMode", "icon", "svgIcon", "iconClass", "buttonClass", "dialClass", "text", "dialItemAnimation", "tabIndex", "dialItems"], outputs: ["blur", "focus", "dialItemClick", "open", "close"] }] });
|
2533
2750
|
}
|
2534
2751
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptComponent, decorators: [{
|
2535
2752
|
type: Component,
|
@@ -2564,7 +2781,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2564
2781
|
i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
|
2565
2782
|
outputRetryTitle="Generated with AI"
|
2566
2783
|
i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
|
2567
|
-
promptSuggestions="Prompt suggestions"
|
2784
|
+
promptSuggestions="Prompt suggestions"
|
2785
|
+
i18n-speechToTextButton="kendo.aiprompt.speechToTextButton|The aria-label for the Speech to Text button."
|
2786
|
+
speechToTextButton="Voice input">
|
2568
2787
|
</ng-container>
|
2569
2788
|
<div class="k-prompt-header">
|
2570
2789
|
<div class="k-toolbar-flat k-toolbar k-toolbar-md"
|
@@ -2589,6 +2808,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2589
2808
|
</div>
|
2590
2809
|
</div>
|
2591
2810
|
<div class="k-prompt-content">
|
2811
|
+
<kendo-floatingactionbutton #fabButton *ngIf="streaming && selectedView?.viewType === 'output'"
|
2812
|
+
class="k-prompt-stop-fab"
|
2813
|
+
buttonClass="k-generating k-active"
|
2814
|
+
[positionMode]="fabPositionMode"
|
2815
|
+
[align]="fabAlignment"
|
2816
|
+
[svgIcon]="fabStopGenerationSVGIcon"
|
2817
|
+
icon="stop"
|
2818
|
+
(click)="promptRequestCancel.emit()"
|
2819
|
+
>
|
2820
|
+
</kendo-floatingactionbutton>
|
2592
2821
|
<div class="k-prompt-view">
|
2593
2822
|
<ng-container *ngTemplateOutlet="viewTemplate">
|
2594
2823
|
</ng-container>
|
@@ -2601,27 +2830,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2601
2830
|
type="button"
|
2602
2831
|
themeColor="primary"
|
2603
2832
|
rounded="full"
|
2604
|
-
[
|
2605
|
-
|
2833
|
+
[attr.title]="messageFor('generateOutput')"
|
2834
|
+
[attr.aria-label]="messageFor('generateOutput')"
|
2835
|
+
[attr.aria-disabled]="disabledGenerateButton"
|
2836
|
+
[svgIcon]="generateButtonSVGIcon"
|
2837
|
+
[icon]="generateButtonIcon"
|
2838
|
+
[disabled]="disabledGenerateButton"
|
2606
2839
|
(click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
|
2607
2840
|
</div>
|
2608
2841
|
</div>
|
2609
2842
|
`,
|
2610
2843
|
standalone: true,
|
2611
|
-
imports: [LocalizedMessagesDirective, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet]
|
2844
|
+
imports: [LocalizedMessagesDirective$1, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet, FloatingActionButtonComponent]
|
2612
2845
|
}]
|
2613
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }, { type: ToolbarNavigationService }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
|
2846
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }, { type: ToolbarNavigationService }, { type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { hostClasses: [{
|
2614
2847
|
type: HostBinding,
|
2615
2848
|
args: ['class.k-prompt']
|
2616
2849
|
}], dirAttr: [{
|
2617
2850
|
type: HostBinding,
|
2618
2851
|
args: ['attr.dir']
|
2852
|
+
}], fabButton: [{
|
2853
|
+
type: ViewChild,
|
2854
|
+
args: ['fabButton']
|
2619
2855
|
}], views: [{
|
2620
2856
|
type: ContentChildren,
|
2621
2857
|
args: [BaseView]
|
2622
2858
|
}], toolbarActionsTemplate: [{
|
2623
2859
|
type: ContentChild,
|
2624
2860
|
args: [AIPromptToolbarActionsDirective]
|
2861
|
+
}], outputTemplate: [{
|
2862
|
+
type: ContentChild,
|
2863
|
+
args: [AIPromptOutputTemplateDirective]
|
2864
|
+
}], outputBodyTemplate: [{
|
2865
|
+
type: ContentChild,
|
2866
|
+
args: [AIPromptOutputBodyTemplateDirective]
|
2625
2867
|
}], activeView: [{
|
2626
2868
|
type: Input
|
2627
2869
|
}], promptCommands: [{
|
@@ -2632,6 +2874,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2632
2874
|
type: Input
|
2633
2875
|
}], showOutputRating: [{
|
2634
2876
|
type: Input
|
2877
|
+
}], streaming: [{
|
2878
|
+
type: Input
|
2879
|
+
}], speechToTextButton: [{
|
2880
|
+
type: Input
|
2881
|
+
}], textAreaSettings: [{
|
2882
|
+
type: Input
|
2883
|
+
}], generateButtonSVGIcon: [{
|
2884
|
+
type: Input
|
2885
|
+
}], generateButtonIcon: [{
|
2886
|
+
type: Input
|
2887
|
+
}], disabledGenerateButton: [{
|
2888
|
+
type: Input
|
2635
2889
|
}], activeViewChange: [{
|
2636
2890
|
type: Output
|
2637
2891
|
}], promptRequest: [{
|
@@ -2642,6 +2896,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2642
2896
|
type: Output
|
2643
2897
|
}], outputRatingChange: [{
|
2644
2898
|
type: Output
|
2899
|
+
}], promptRequestCancel: [{
|
2900
|
+
type: Output
|
2645
2901
|
}] } });
|
2646
2902
|
|
2647
2903
|
/**
|
@@ -2747,7 +3003,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2747
3003
|
* </kendo-aiprompt-messages>
|
2748
3004
|
* ```
|
2749
3005
|
*/
|
2750
|
-
class AIPromptCustomMessagesComponent extends Messages {
|
3006
|
+
class AIPromptCustomMessagesComponent extends Messages$1 {
|
2751
3007
|
service;
|
2752
3008
|
constructor(service) {
|
2753
3009
|
super();
|
@@ -2759,7 +3015,7 @@ class AIPromptCustomMessagesComponent extends Messages {
|
|
2759
3015
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptCustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
2760
3016
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptCustomMessagesComponent, isStandalone: true, selector: "kendo-aiprompt-messages", providers: [
|
2761
3017
|
{
|
2762
|
-
provide: Messages,
|
3018
|
+
provide: Messages$1,
|
2763
3019
|
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
2764
3020
|
}
|
2765
3021
|
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
@@ -2769,7 +3025,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2769
3025
|
args: [{
|
2770
3026
|
providers: [
|
2771
3027
|
{
|
2772
|
-
provide: Messages,
|
3028
|
+
provide: Messages$1,
|
2773
3029
|
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
2774
3030
|
}
|
2775
3031
|
],
|
@@ -2906,6 +3162,12 @@ class AIPromptOutputCardComponent {
|
|
2906
3162
|
this.positiveRatingIcon = thumbUpOutlineIcon;
|
2907
3163
|
}
|
2908
3164
|
}
|
3165
|
+
/**
|
3166
|
+
* @hidden
|
3167
|
+
*/
|
3168
|
+
get customBodyTemplate() {
|
3169
|
+
return this.service.outputBodyTemplate?.templateRef;
|
3170
|
+
}
|
2909
3171
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputCardComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
2910
3172
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptOutputCardComponent, isStandalone: true, 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: `
|
2911
3173
|
<div class="k-card-header">
|
@@ -2916,7 +3178,13 @@ class AIPromptOutputCardComponent {
|
|
2916
3178
|
<div class="k-card-subtitle">{{promptOutput.prompt}}</div>
|
2917
3179
|
</div>
|
2918
3180
|
<div class="k-card-body">
|
2919
|
-
<
|
3181
|
+
<ng-container *ngIf="customBodyTemplate; else defaultTemplate">
|
3182
|
+
<ng-container *ngTemplateOutlet="customBodyTemplate; context: { $implicit: promptOutput }">
|
3183
|
+
</ng-container>
|
3184
|
+
</ng-container>
|
3185
|
+
<ng-template #defaultTemplate>
|
3186
|
+
<p>{{promptOutput.output}}</p>
|
3187
|
+
</ng-template>
|
2920
3188
|
</div>
|
2921
3189
|
<div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
|
2922
3190
|
<button kendoButton
|
@@ -2950,7 +3218,7 @@ class AIPromptOutputCardComponent {
|
|
2950
3218
|
</button>
|
2951
3219
|
</ng-container>
|
2952
3220
|
</div>
|
2953
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
3221
|
+
`, isInline: true, dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
2954
3222
|
}
|
2955
3223
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputCardComponent, decorators: [{
|
2956
3224
|
type: Component,
|
@@ -2965,7 +3233,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2965
3233
|
<div class="k-card-subtitle">{{promptOutput.prompt}}</div>
|
2966
3234
|
</div>
|
2967
3235
|
<div class="k-card-body">
|
2968
|
-
<
|
3236
|
+
<ng-container *ngIf="customBodyTemplate; else defaultTemplate">
|
3237
|
+
<ng-container *ngTemplateOutlet="customBodyTemplate; context: { $implicit: promptOutput }">
|
3238
|
+
</ng-container>
|
3239
|
+
</ng-container>
|
3240
|
+
<ng-template #defaultTemplate>
|
3241
|
+
<p>{{promptOutput.output}}</p>
|
3242
|
+
</ng-template>
|
2969
3243
|
</div>
|
2970
3244
|
<div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
|
2971
3245
|
<button kendoButton
|
@@ -3001,7 +3275,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3001
3275
|
</div>
|
3002
3276
|
`,
|
3003
3277
|
standalone: true,
|
3004
|
-
imports: [ButtonComponent, NgIf]
|
3278
|
+
imports: [ButtonComponent, NgIf, NgTemplateOutlet]
|
3005
3279
|
}]
|
3006
3280
|
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; }, propDecorators: { hostClass: [{
|
3007
3281
|
type: HostBinding,
|
@@ -3044,6 +3318,12 @@ class OutputViewComponent extends BaseView {
|
|
3044
3318
|
get promptOutputs() {
|
3045
3319
|
return this.service.promptOutputs;
|
3046
3320
|
}
|
3321
|
+
/**
|
3322
|
+
* @hidden
|
3323
|
+
*/
|
3324
|
+
get customTemplate() {
|
3325
|
+
return this.service.outputTemplate?.templateRef;
|
3326
|
+
}
|
3047
3327
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OutputViewComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
3048
3328
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OutputViewComponent, isStandalone: true, selector: "kendo-aiprompt-output-view", providers: [{
|
3049
3329
|
provide: BaseView,
|
@@ -3053,13 +3333,18 @@ class OutputViewComponent extends BaseView {
|
|
3053
3333
|
<div
|
3054
3334
|
class="k-card-list"
|
3055
3335
|
role="list">
|
3056
|
-
<
|
3057
|
-
|
3058
|
-
|
3059
|
-
|
3336
|
+
<ng-container *ngFor="let output of promptOutputs">
|
3337
|
+
<ng-container *ngIf="customTemplate; else defaultTemplate">
|
3338
|
+
<ng-container *ngTemplateOutlet="customTemplate; context: { $implicit: output }">
|
3339
|
+
</ng-container>
|
3340
|
+
</ng-container>
|
3341
|
+
<ng-template #defaultTemplate>
|
3342
|
+
<div kendoAIPromptOutputCard [promptOutput]="output"></div>
|
3343
|
+
</ng-template>
|
3344
|
+
</ng-container>
|
3060
3345
|
</div>
|
3061
3346
|
</ng-template>
|
3062
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: ["promptOutput"] }] });
|
3347
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: ["promptOutput"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
3063
3348
|
}
|
3064
3349
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OutputViewComponent, decorators: [{
|
3065
3350
|
type: Component,
|
@@ -3074,15 +3359,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3074
3359
|
<div
|
3075
3360
|
class="k-card-list"
|
3076
3361
|
role="list">
|
3077
|
-
<
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3362
|
+
<ng-container *ngFor="let output of promptOutputs">
|
3363
|
+
<ng-container *ngIf="customTemplate; else defaultTemplate">
|
3364
|
+
<ng-container *ngTemplateOutlet="customTemplate; context: { $implicit: output }">
|
3365
|
+
</ng-container>
|
3366
|
+
</ng-container>
|
3367
|
+
<ng-template #defaultTemplate>
|
3368
|
+
<div kendoAIPromptOutputCard [promptOutput]="output"></div>
|
3369
|
+
</ng-template>
|
3370
|
+
</ng-container>
|
3081
3371
|
</div>
|
3082
3372
|
</ng-template>
|
3083
3373
|
`,
|
3084
3374
|
standalone: true,
|
3085
|
-
imports: [NgFor, AIPromptOutputCardComponent]
|
3375
|
+
imports: [NgFor, AIPromptOutputCardComponent, NgIf, NgTemplateOutlet]
|
3086
3376
|
}]
|
3087
3377
|
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; } });
|
3088
3378
|
|
@@ -3140,6 +3430,42 @@ class PromptViewComponent extends BaseView {
|
|
3140
3430
|
suggestionClick(suggestion) {
|
3141
3431
|
this.textAreaValue = this.service.promptValue = suggestion;
|
3142
3432
|
}
|
3433
|
+
/**
|
3434
|
+
* @hidden
|
3435
|
+
*/
|
3436
|
+
suggestionKeydown(event, suggestion) {
|
3437
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
3438
|
+
this.suggestionClick(suggestion);
|
3439
|
+
}
|
3440
|
+
}
|
3441
|
+
/**
|
3442
|
+
* @hidden
|
3443
|
+
*/
|
3444
|
+
get speechToTextButtonSettings() {
|
3445
|
+
return this.service.speechToTextButton;
|
3446
|
+
}
|
3447
|
+
/**
|
3448
|
+
* @hidden
|
3449
|
+
*/
|
3450
|
+
get textareaSettings() {
|
3451
|
+
return this.service.textAreaSettings;
|
3452
|
+
}
|
3453
|
+
/**
|
3454
|
+
* @hidden
|
3455
|
+
*/
|
3456
|
+
onSpeechToTextResult(event) {
|
3457
|
+
if (event.alternatives && event.alternatives.length > 0) {
|
3458
|
+
this.textAreaValue += event.alternatives[0].transcript + ' ';
|
3459
|
+
}
|
3460
|
+
}
|
3461
|
+
/**
|
3462
|
+
* @hidden
|
3463
|
+
*/
|
3464
|
+
onSpeechToTextError(event) {
|
3465
|
+
if (isDevMode()) {
|
3466
|
+
console.error('Speech to Text error:', event.errorMessage);
|
3467
|
+
}
|
3468
|
+
}
|
3143
3469
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PromptViewComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
3144
3470
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PromptViewComponent, isStandalone: true, selector: "kendo-aiprompt-prompt-view", providers: [
|
3145
3471
|
{
|
@@ -3149,9 +3475,44 @@ class PromptViewComponent extends BaseView {
|
|
3149
3475
|
], usesInheritance: true, ngImport: i0, template: `
|
3150
3476
|
<ng-template #content>
|
3151
3477
|
<kendo-textarea
|
3152
|
-
[
|
3153
|
-
[
|
3154
|
-
[
|
3478
|
+
[cols]="textareaSettings?.cols"
|
3479
|
+
[disabled]="textareaSettings?.disabled"
|
3480
|
+
[fillMode]="textareaSettings?.fillMode"
|
3481
|
+
[flow]="textareaSettings?.flow ?? 'vertical'"
|
3482
|
+
[inputAttributes]="textareaSettings?.inputAttributes"
|
3483
|
+
[maxlength]="textareaSettings?.maxlength"
|
3484
|
+
[placeholder]="textareaSettings?.placeholder ?? messageFor('promptPlaceholder')"
|
3485
|
+
[readonly]="textareaSettings?.readonly"
|
3486
|
+
[resizable]="textareaSettings?.resizable ?? 'vertical'"
|
3487
|
+
[rounded]="textareaSettings?.rounded"
|
3488
|
+
[rows]="textareaSettings?.rows ?? 1"
|
3489
|
+
[selectOnFocus]="textareaSettings?.selectOnFocus"
|
3490
|
+
[showSuffixSeparator]="textareaSettings?.showSuffixSeparator ?? true"
|
3491
|
+
[size]="textareaSettings?.size"
|
3492
|
+
[tabIndex]="textareaSettings?.tabindex"
|
3493
|
+
[title]="textareaSettings?.title"
|
3494
|
+
[(value)]="textAreaValue"
|
3495
|
+
>
|
3496
|
+
<kendo-textarea-suffix *ngIf="speechToTextButtonSettings">
|
3497
|
+
<button kendoSpeechToTextButton
|
3498
|
+
role="button"
|
3499
|
+
[continuous]="speechToTextButtonSettings?.continuous"
|
3500
|
+
[disabled]="speechToTextButtonSettings?.disabled"
|
3501
|
+
[fillMode]="speechToTextButtonSettings?.fillMode ?? 'flat'"
|
3502
|
+
[integrationMode]="speechToTextButtonSettings?.integrationMode ?? 'webSpeech'"
|
3503
|
+
[interimResults]="speechToTextButtonSettings?.interimResults"
|
3504
|
+
[lang]="speechToTextButtonSettings?.lang"
|
3505
|
+
[maxAlternatives]="speechToTextButtonSettings?.maxAlternatives"
|
3506
|
+
[rounded]="speechToTextButtonSettings?.rounded"
|
3507
|
+
[size]="speechToTextButtonSettings?.size"
|
3508
|
+
[themeColor]="speechToTextButtonSettings?.themeColor"
|
3509
|
+
[attr.aria-label]="messageFor('speechToTextButton')"
|
3510
|
+
[attr.title]="messageFor('speechToTextButton')"
|
3511
|
+
[attr.aria-disabled]="speechToTextButtonSettings?.disabled"
|
3512
|
+
(error)="onSpeechToTextError($event)"
|
3513
|
+
(result)="onSpeechToTextResult($event)"
|
3514
|
+
></button>
|
3515
|
+
</kendo-textarea-suffix>
|
3155
3516
|
</kendo-textarea>
|
3156
3517
|
<div *ngIf="promptSuggestions"
|
3157
3518
|
class="k-prompt-expander">
|
@@ -3169,16 +3530,22 @@ class PromptViewComponent extends BaseView {
|
|
3169
3530
|
class="k-prompt-expander-content"
|
3170
3531
|
role="list"
|
3171
3532
|
[attr.id]="contentId">
|
3172
|
-
<div
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3533
|
+
<div class="k-suggestion-group" role="group">
|
3534
|
+
<div *ngFor="let suggestion of promptSuggestions"
|
3535
|
+
class="k-suggestion"
|
3536
|
+
role="button"
|
3537
|
+
[attr.tabindex]="0"
|
3538
|
+
[attr.aria-label]="suggestion"
|
3539
|
+
[attr.title]="suggestion"
|
3540
|
+
(click)="suggestionClick(suggestion)"
|
3541
|
+
(keydown)="suggestionKeydown($event, suggestion)">
|
3542
|
+
{{suggestion}}
|
3543
|
+
</div>
|
3177
3544
|
</div>
|
3178
3545
|
</div>
|
3179
3546
|
</div>
|
3180
3547
|
</ng-template>
|
3181
|
-
`, isInline: true, dependencies: [{ kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
3548
|
+
`, isInline: true, dependencies: [{ kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "maxResizableRows", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }, { kind: "component", type: SpeechToTextButtonComponent, selector: "button[kendoSpeechToTextButton]", inputs: ["disabled", "size", "rounded", "fillMode", "themeColor", "integrationMode", "lang", "continuous", "interimResults", "maxAlternatives"], outputs: ["start", "end", "result", "error", "click"], exportAs: ["kendoSpeechToTextButton"] }] });
|
3182
3549
|
}
|
3183
3550
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PromptViewComponent, decorators: [{
|
3184
3551
|
type: Component,
|
@@ -3193,9 +3560,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3193
3560
|
template: `
|
3194
3561
|
<ng-template #content>
|
3195
3562
|
<kendo-textarea
|
3196
|
-
[
|
3197
|
-
[
|
3198
|
-
[
|
3563
|
+
[cols]="textareaSettings?.cols"
|
3564
|
+
[disabled]="textareaSettings?.disabled"
|
3565
|
+
[fillMode]="textareaSettings?.fillMode"
|
3566
|
+
[flow]="textareaSettings?.flow ?? 'vertical'"
|
3567
|
+
[inputAttributes]="textareaSettings?.inputAttributes"
|
3568
|
+
[maxlength]="textareaSettings?.maxlength"
|
3569
|
+
[placeholder]="textareaSettings?.placeholder ?? messageFor('promptPlaceholder')"
|
3570
|
+
[readonly]="textareaSettings?.readonly"
|
3571
|
+
[resizable]="textareaSettings?.resizable ?? 'vertical'"
|
3572
|
+
[rounded]="textareaSettings?.rounded"
|
3573
|
+
[rows]="textareaSettings?.rows ?? 1"
|
3574
|
+
[selectOnFocus]="textareaSettings?.selectOnFocus"
|
3575
|
+
[showSuffixSeparator]="textareaSettings?.showSuffixSeparator ?? true"
|
3576
|
+
[size]="textareaSettings?.size"
|
3577
|
+
[tabIndex]="textareaSettings?.tabindex"
|
3578
|
+
[title]="textareaSettings?.title"
|
3579
|
+
[(value)]="textAreaValue"
|
3580
|
+
>
|
3581
|
+
<kendo-textarea-suffix *ngIf="speechToTextButtonSettings">
|
3582
|
+
<button kendoSpeechToTextButton
|
3583
|
+
role="button"
|
3584
|
+
[continuous]="speechToTextButtonSettings?.continuous"
|
3585
|
+
[disabled]="speechToTextButtonSettings?.disabled"
|
3586
|
+
[fillMode]="speechToTextButtonSettings?.fillMode ?? 'flat'"
|
3587
|
+
[integrationMode]="speechToTextButtonSettings?.integrationMode ?? 'webSpeech'"
|
3588
|
+
[interimResults]="speechToTextButtonSettings?.interimResults"
|
3589
|
+
[lang]="speechToTextButtonSettings?.lang"
|
3590
|
+
[maxAlternatives]="speechToTextButtonSettings?.maxAlternatives"
|
3591
|
+
[rounded]="speechToTextButtonSettings?.rounded"
|
3592
|
+
[size]="speechToTextButtonSettings?.size"
|
3593
|
+
[themeColor]="speechToTextButtonSettings?.themeColor"
|
3594
|
+
[attr.aria-label]="messageFor('speechToTextButton')"
|
3595
|
+
[attr.title]="messageFor('speechToTextButton')"
|
3596
|
+
[attr.aria-disabled]="speechToTextButtonSettings?.disabled"
|
3597
|
+
(error)="onSpeechToTextError($event)"
|
3598
|
+
(result)="onSpeechToTextResult($event)"
|
3599
|
+
></button>
|
3600
|
+
</kendo-textarea-suffix>
|
3199
3601
|
</kendo-textarea>
|
3200
3602
|
<div *ngIf="promptSuggestions"
|
3201
3603
|
class="k-prompt-expander">
|
@@ -3213,18 +3615,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3213
3615
|
class="k-prompt-expander-content"
|
3214
3616
|
role="list"
|
3215
3617
|
[attr.id]="contentId">
|
3216
|
-
<div
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3618
|
+
<div class="k-suggestion-group" role="group">
|
3619
|
+
<div *ngFor="let suggestion of promptSuggestions"
|
3620
|
+
class="k-suggestion"
|
3621
|
+
role="button"
|
3622
|
+
[attr.tabindex]="0"
|
3623
|
+
[attr.aria-label]="suggestion"
|
3624
|
+
[attr.title]="suggestion"
|
3625
|
+
(click)="suggestionClick(suggestion)"
|
3626
|
+
(keydown)="suggestionKeydown($event, suggestion)">
|
3627
|
+
{{suggestion}}
|
3628
|
+
</div>
|
3221
3629
|
</div>
|
3222
3630
|
</div>
|
3223
3631
|
</div>
|
3224
3632
|
</ng-template>
|
3225
3633
|
`,
|
3226
3634
|
standalone: true,
|
3227
|
-
imports: [TextAreaComponent, NgIf, ButtonComponent, NgFor]
|
3635
|
+
imports: [TextAreaComponent, NgIf, ButtonComponent, NgFor, TextAreaSuffixComponent, SpeechToTextButtonComponent]
|
3228
3636
|
}]
|
3229
3637
|
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; } });
|
3230
3638
|
|
@@ -3243,7 +3651,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3243
3651
|
* </kendo-chat-messages>
|
3244
3652
|
* ```
|
3245
3653
|
*/
|
3246
|
-
class CustomMessagesComponent extends Messages$
|
3654
|
+
class CustomMessagesComponent extends Messages$2 {
|
3247
3655
|
service;
|
3248
3656
|
constructor(service) {
|
3249
3657
|
super();
|
@@ -3255,7 +3663,7 @@ class CustomMessagesComponent extends Messages$1 {
|
|
3255
3663
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
3256
3664
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CustomMessagesComponent, isStandalone: true, selector: "kendo-chat-messages", providers: [
|
3257
3665
|
{
|
3258
|
-
provide: Messages$
|
3666
|
+
provide: Messages$2,
|
3259
3667
|
useExisting: forwardRef(() => CustomMessagesComponent)
|
3260
3668
|
}
|
3261
3669
|
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
@@ -3265,7 +3673,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3265
3673
|
args: [{
|
3266
3674
|
providers: [
|
3267
3675
|
{
|
3268
|
-
provide: Messages$
|
3676
|
+
provide: Messages$2,
|
3269
3677
|
useExisting: forwardRef(() => CustomMessagesComponent)
|
3270
3678
|
}
|
3271
3679
|
],
|
@@ -3387,57 +3795,1104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3387
3795
|
}] } });
|
3388
3796
|
|
3389
3797
|
/**
|
3390
|
-
*
|
3391
|
-
*
|
3392
|
-
* @example
|
3393
|
-
* ```ts
|
3394
|
-
* import { Component } from '@angular/core';
|
3395
|
-
* import { KENDO_AIPROMPT } from '@progress/kendo-angular-conversational-ui';
|
3396
|
-
*
|
3397
|
-
* @Component({
|
3398
|
-
* standalone: true,
|
3399
|
-
* imports: [KENDO_AIPROMPT],
|
3400
|
-
* selector: 'my-app',
|
3401
|
-
* template: `<kendo-aiprompt></kendo-aiprompt>`
|
3402
|
-
* })
|
3403
|
-
* export class AppComponent {}
|
3404
|
-
* ```
|
3798
|
+
* @hidden
|
3405
3799
|
*/
|
3406
|
-
|
3407
|
-
|
3408
|
-
|
3409
|
-
|
3410
|
-
|
3411
|
-
|
3412
|
-
|
3413
|
-
|
3414
|
-
|
3415
|
-
|
3800
|
+
class Messages extends ComponentMessages {
|
3801
|
+
/**
|
3802
|
+
* Sets the Commands button title.
|
3803
|
+
*/
|
3804
|
+
commandsButtonTitle;
|
3805
|
+
/**
|
3806
|
+
* Sets the Generate button title.
|
3807
|
+
*/
|
3808
|
+
generateButtonTitle;
|
3809
|
+
/**
|
3810
|
+
* Sets the Speech to Text button title.
|
3811
|
+
*/
|
3812
|
+
speechToTextButtonTitle;
|
3813
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
3814
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: Messages, inputs: { commandsButtonTitle: "commandsButtonTitle", generateButtonTitle: "generateButtonTitle", speechToTextButtonTitle: "speechToTextButtonTitle" }, usesInheritance: true, ngImport: i0 });
|
3815
|
+
}
|
3816
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, decorators: [{
|
3817
|
+
type: Directive
|
3818
|
+
}], propDecorators: { commandsButtonTitle: [{
|
3819
|
+
type: Input
|
3820
|
+
}], generateButtonTitle: [{
|
3821
|
+
type: Input
|
3822
|
+
}], speechToTextButtonTitle: [{
|
3823
|
+
type: Input
|
3824
|
+
}] } });
|
3825
|
+
|
3416
3826
|
/**
|
3417
|
-
*
|
3418
|
-
*
|
3419
|
-
* @example
|
3420
|
-
* ```ts
|
3421
|
-
* import { Component } from '@angular/core';
|
3422
|
-
* import { KENDO_CHAT } from '@progress/kendo-angular-conversational-ui';
|
3423
|
-
*
|
3424
|
-
* @Component({
|
3425
|
-
* standalone: true,
|
3426
|
-
* imports: [KENDO_CHAT],
|
3427
|
-
* selector: 'my-app',
|
3428
|
-
* template: `<kendo-chat></kendo-chat>`
|
3429
|
-
* })
|
3430
|
-
* export class AppComponent {}
|
3431
|
-
* ```
|
3827
|
+
* @hidden
|
3432
3828
|
*/
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3829
|
+
class LocalizedMessagesDirective extends Messages {
|
3830
|
+
service;
|
3831
|
+
constructor(service) {
|
3832
|
+
super();
|
3833
|
+
this.service = service;
|
3834
|
+
}
|
3835
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
3836
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoInlineAIPromptLocalizedMessages]", providers: [
|
3837
|
+
{
|
3838
|
+
provide: Messages,
|
3839
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
3840
|
+
}
|
3841
|
+
], usesInheritance: true, ngImport: i0 });
|
3842
|
+
}
|
3843
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
3844
|
+
type: Directive,
|
3845
|
+
args: [{
|
3846
|
+
providers: [
|
3847
|
+
{
|
3848
|
+
provide: Messages,
|
3849
|
+
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
3850
|
+
}
|
3851
|
+
],
|
3852
|
+
selector: '[kendoInlineAIPromptLocalizedMessages]',
|
3853
|
+
standalone: true
|
3854
|
+
}]
|
3855
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
3856
|
+
|
3857
|
+
/**
|
3858
|
+
* @hidden
|
3859
|
+
*/
|
3860
|
+
const defaultPopupSettings = {
|
3861
|
+
popupAlign: { vertical: 'top', horizontal: 'left' },
|
3862
|
+
anchorAlign: { horizontal: "left", vertical: "bottom" },
|
3863
|
+
positionMode: 'absolute',
|
3864
|
+
collision: { horizontal: 'fit', vertical: 'flip' },
|
3865
|
+
animate: true,
|
3866
|
+
offset: { top: 0, left: 0 },
|
3867
|
+
margin: { horizontal: 0, vertical: 0 },
|
3868
|
+
};
|
3869
|
+
/**
|
3870
|
+
* @hidden
|
3871
|
+
*/
|
3872
|
+
const calculateMeasurement = (value) => {
|
3873
|
+
return value + (typeof value === 'number' ? 'px' : '');
|
3874
|
+
};
|
3875
|
+
/**
|
3876
|
+
* @hidden
|
3877
|
+
*/
|
3878
|
+
const defaultOutputActions = [{
|
3879
|
+
name: 'copy',
|
3880
|
+
type: 'button',
|
3881
|
+
icon: 'copy',
|
3882
|
+
svgIcon: copyIcon,
|
3883
|
+
text: 'Copy',
|
3884
|
+
fillMode: 'flat',
|
3885
|
+
themeColor: 'primary',
|
3886
|
+
rounded: 'medium',
|
3887
|
+
},
|
3888
|
+
{
|
3889
|
+
name: 'retry',
|
3890
|
+
type: 'button',
|
3891
|
+
icon: 'arrow-rotate-cw',
|
3892
|
+
svgIcon: arrowRotateCwIcon,
|
3893
|
+
text: 'Retry',
|
3894
|
+
fillMode: 'flat',
|
3895
|
+
themeColor: 'primary',
|
3896
|
+
rounded: 'medium',
|
3897
|
+
},
|
3898
|
+
{
|
3899
|
+
name: 'discard',
|
3900
|
+
type: 'button',
|
3901
|
+
icon: 'cancel-outline',
|
3902
|
+
svgIcon: cancelOutlineIcon,
|
3903
|
+
text: 'Discard',
|
3904
|
+
fillMode: 'flat',
|
3905
|
+
themeColor: 'base',
|
3906
|
+
rounded: 'medium',
|
3907
|
+
}
|
3908
|
+
];
|
3909
|
+
|
3910
|
+
const TEXTAREA_MAX_ROWS = 5;
|
3911
|
+
const TEXTAREA_INITIAL_ROWS = 1;
|
3912
|
+
/**
|
3913
|
+
* @hidden
|
3914
|
+
*/
|
3915
|
+
class InlineAIPromptContentComponent {
|
3916
|
+
ngZone;
|
3917
|
+
renderer;
|
3918
|
+
element;
|
3919
|
+
localization;
|
3920
|
+
className = true;
|
3921
|
+
get dirAttr() {
|
3922
|
+
return this.direction;
|
3923
|
+
}
|
3924
|
+
get maxHeightStyle() {
|
3925
|
+
return this.calculateMeasurement(this.maxHeight);
|
3926
|
+
}
|
3927
|
+
get widthStyle() {
|
3928
|
+
return this.calculateMeasurement(this.width);
|
3929
|
+
}
|
3930
|
+
popupElement;
|
3931
|
+
promptValue = "";
|
3932
|
+
placeholder;
|
3933
|
+
promptOutput;
|
3934
|
+
enableSpeechToText = true;
|
3935
|
+
streaming = false;
|
3936
|
+
width = 550;
|
3937
|
+
maxHeight;
|
3938
|
+
appendTo;
|
3939
|
+
defaultOutputActions = defaultOutputActions;
|
3940
|
+
set outputActions(actions) {
|
3941
|
+
this._outputActions = this.mergeWithDefaultActions(actions);
|
3942
|
+
}
|
3943
|
+
get outputActions() {
|
3944
|
+
return this._outputActions;
|
3945
|
+
}
|
3946
|
+
set promptCommands(commands) {
|
3947
|
+
this._promptCommands = commands || [];
|
3948
|
+
this.commandMenuItems = this.transformCommands(commands || []);
|
3949
|
+
}
|
3950
|
+
get promptCommands() {
|
3951
|
+
return this._promptCommands;
|
3952
|
+
}
|
3953
|
+
outputTemplate;
|
3954
|
+
promptRequest = new EventEmitter();
|
3955
|
+
commandExecute = new EventEmitter();
|
3956
|
+
outputActionClick = new EventEmitter();
|
3957
|
+
promptRequestCancel = new EventEmitter();
|
3958
|
+
close = new EventEmitter();
|
3959
|
+
promptValueChange = new EventEmitter();
|
3960
|
+
onEscapeKey(event) {
|
3961
|
+
if (event.key === 'Escape') {
|
3962
|
+
if (this.streaming) {
|
3963
|
+
event.stopPropagation();
|
3964
|
+
this.promptRequestCancel.emit();
|
3965
|
+
}
|
3966
|
+
else {
|
3967
|
+
this.close.emit();
|
3968
|
+
}
|
3969
|
+
}
|
3970
|
+
}
|
3971
|
+
textArea;
|
3972
|
+
contextMenu;
|
3973
|
+
calculateMeasurement = calculateMeasurement;
|
3974
|
+
commandMenuIcon = menuIcon;
|
3975
|
+
sendIcon = paperPlaneIcon;
|
3976
|
+
stopGenerationIcon = stopSmIcon;
|
3977
|
+
isListening = false;
|
3978
|
+
commandMenuItems = [];
|
3979
|
+
messages = {};
|
3980
|
+
maxRows = TEXTAREA_MAX_ROWS;
|
3981
|
+
initialRows = TEXTAREA_INITIAL_ROWS;
|
3982
|
+
_outputActions = this.defaultOutputActions;
|
3983
|
+
_promptCommands = [];
|
3984
|
+
direction;
|
3985
|
+
localizationSubs = new Subscription();
|
3986
|
+
subs = new Subscription();
|
3987
|
+
constructor(ngZone, renderer, element, localization) {
|
3988
|
+
this.ngZone = ngZone;
|
3989
|
+
this.renderer = renderer;
|
3990
|
+
this.element = element;
|
3991
|
+
this.localization = localization;
|
3992
|
+
validatePackage(packageMetadata);
|
3993
|
+
if (!this.localization) {
|
3994
|
+
this.localization = inject(LocalizationService);
|
3995
|
+
}
|
3996
|
+
this.direction = this.localization?.rtl ? 'rtl' : 'ltr';
|
3997
|
+
this.localizationSubs.add(this.localization.changes.subscribe(({ rtl }) => {
|
3998
|
+
this.direction = rtl ? 'rtl' : 'ltr';
|
3999
|
+
}));
|
4000
|
+
}
|
4001
|
+
ngAfterViewInit() {
|
4002
|
+
this.ngZone.runOutsideAngular(() => {
|
4003
|
+
if (!isDocumentAvailable()) {
|
4004
|
+
return;
|
4005
|
+
}
|
4006
|
+
// add a delay to avoid catching the same click event that triggered the component opening
|
4007
|
+
setTimeout(() => {
|
4008
|
+
this.subs.add(this.renderer.listen('document', 'click', (e) => {
|
4009
|
+
this.outsideClickClose(e);
|
4010
|
+
}));
|
4011
|
+
});
|
4012
|
+
});
|
4013
|
+
}
|
4014
|
+
ngOnDestroy() {
|
4015
|
+
this.subs.unsubscribe();
|
4016
|
+
this.localizationSubs.unsubscribe();
|
4017
|
+
this.contextMenu?.hide();
|
4018
|
+
}
|
4019
|
+
focus() {
|
4020
|
+
if (this.textArea) {
|
4021
|
+
this.textArea.focus();
|
4022
|
+
}
|
4023
|
+
}
|
4024
|
+
onActionClick(event) {
|
4025
|
+
const eventArgs = {
|
4026
|
+
action: event,
|
4027
|
+
output: this.promptOutput,
|
4028
|
+
};
|
4029
|
+
this.outputActionClick.emit(eventArgs);
|
4030
|
+
this.handleDefaultActions(event);
|
4031
|
+
}
|
4032
|
+
handleDefaultActions(event) {
|
4033
|
+
switch (event.name) {
|
4034
|
+
case 'copy':
|
4035
|
+
navigator.clipboard.writeText(this.promptOutput.output);
|
4036
|
+
break;
|
4037
|
+
case 'retry':
|
4038
|
+
this.promptRequest.emit({
|
4039
|
+
prompt: this.promptOutput?.prompt,
|
4040
|
+
isRetry: true
|
4041
|
+
});
|
4042
|
+
break;
|
4043
|
+
case 'discard':
|
4044
|
+
this.close.emit();
|
4045
|
+
break;
|
4046
|
+
}
|
4047
|
+
}
|
4048
|
+
handleSpeechResult(event) {
|
4049
|
+
if (event.alternatives && event.alternatives.length > 0) {
|
4050
|
+
if (!isPresent(this.promptValue)) {
|
4051
|
+
this.promptValue = '';
|
4052
|
+
}
|
4053
|
+
this.promptValue += event.alternatives[0].transcript + ' ';
|
4054
|
+
}
|
4055
|
+
}
|
4056
|
+
onClick(action) {
|
4057
|
+
this.commandExecute.next(action);
|
4058
|
+
}
|
4059
|
+
handlePromptValueChange(value) {
|
4060
|
+
this.promptValue = value;
|
4061
|
+
this.promptValueChange.emit(value);
|
4062
|
+
}
|
4063
|
+
handleTextAreaKeydown(event) {
|
4064
|
+
if (event.key === 'Enter' && !event.shiftKey && !this.streaming) {
|
4065
|
+
event.preventDefault();
|
4066
|
+
this.handlePromptRequest();
|
4067
|
+
}
|
4068
|
+
}
|
4069
|
+
onCommandButtonClick(event) {
|
4070
|
+
event.preventDefault();
|
4071
|
+
event.stopPropagation();
|
4072
|
+
if (this.contextMenu) {
|
4073
|
+
this.contextMenu.show(this.popupElement);
|
4074
|
+
}
|
4075
|
+
}
|
4076
|
+
onCommandClick(event) {
|
4077
|
+
// avoid triggering the document click listener to keep the popup open
|
4078
|
+
if (event.originalEvent) {
|
4079
|
+
event.originalEvent.stopPropagation();
|
4080
|
+
event.originalEvent.preventDefault();
|
4081
|
+
}
|
4082
|
+
const eventArgs = {
|
4083
|
+
...event.item.originalCommand
|
4084
|
+
};
|
4085
|
+
this.commandExecute.emit(eventArgs);
|
4086
|
+
}
|
4087
|
+
messageFor(text) {
|
4088
|
+
if (this.messages?.[text]) {
|
4089
|
+
return this.messages[text];
|
4090
|
+
}
|
4091
|
+
return this.localization?.get(text);
|
4092
|
+
}
|
4093
|
+
handlePromptRequest() {
|
4094
|
+
if (this.streaming) {
|
4095
|
+
this.promptRequestCancel.emit();
|
4096
|
+
return;
|
4097
|
+
}
|
4098
|
+
if (!this.promptValue) {
|
4099
|
+
return;
|
4100
|
+
}
|
4101
|
+
const eventArgs = {
|
4102
|
+
prompt: this.promptValue
|
4103
|
+
};
|
4104
|
+
this.promptRequest.emit(eventArgs);
|
4105
|
+
}
|
4106
|
+
mergeWithDefaultActions(userActions) {
|
4107
|
+
if (!userActions || userActions.length === 0) {
|
4108
|
+
return [];
|
4109
|
+
}
|
4110
|
+
return userActions.map(userAction => {
|
4111
|
+
const defaultAction = defaultOutputActions.find(action => action.name === userAction?.name);
|
4112
|
+
if (defaultAction) {
|
4113
|
+
return { ...defaultAction, ...userAction };
|
4114
|
+
}
|
4115
|
+
return userAction;
|
4116
|
+
});
|
4117
|
+
}
|
4118
|
+
transformCommands = (commands) => commands.map(command => ({
|
4119
|
+
text: command.text,
|
4120
|
+
icon: command.icon,
|
4121
|
+
svgIcon: command.svgIcon,
|
4122
|
+
disabled: command.disabled,
|
4123
|
+
originalCommand: command,
|
4124
|
+
items: command.children ? this.transformCommands(command.children) : undefined
|
4125
|
+
}));
|
4126
|
+
outsideClickClose(e) {
|
4127
|
+
if (!this.element.nativeElement.contains(e.target)) {
|
4128
|
+
this.ngZone.run(() => {
|
4129
|
+
this.close.emit();
|
4130
|
+
});
|
4131
|
+
}
|
4132
|
+
}
|
4133
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptContentComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1$1.LocalizationService, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component });
|
4134
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptContentComponent, isStandalone: true, selector: "kendo-inlineaiprompt-content", inputs: { popupElement: "popupElement", promptValue: "promptValue", placeholder: "placeholder", promptOutput: "promptOutput", enableSpeechToText: "enableSpeechToText", streaming: "streaming", width: "width", maxHeight: "maxHeight", appendTo: "appendTo", outputActions: "outputActions", promptCommands: "promptCommands", outputTemplate: "outputTemplate" }, outputs: { promptRequest: "promptRequest", commandExecute: "commandExecute", outputActionClick: "outputActionClick", promptRequestCancel: "promptRequestCancel", close: "close", promptValueChange: "promptValueChange" }, host: { listeners: { "keydown": "onEscapeKey($event)" }, properties: { "class.k-prompt": "this.className", "attr.dir": "this.dirAttr", "style.max-height": "this.maxHeightStyle", "style.width": "this.widthStyle" } }, providers: [
|
4135
|
+
LocalizationService,
|
4136
|
+
{
|
4137
|
+
provide: L10N_PREFIX,
|
4138
|
+
useValue: 'kendo.inlineaiprompt',
|
4139
|
+
},
|
4140
|
+
], viewQueries: [{ propertyName: "textArea", first: true, predicate: TextAreaComponent, descendants: true }, { propertyName: "contextMenu", first: true, predicate: ["kendoContextMenu"], descendants: true }], exportAs: ["kendoInlineAIPromptContent"], ngImport: i0, template: `
|
4141
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
4142
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
4143
|
+
commandsButtonTitle="Command Menu"
|
4144
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
4145
|
+
generateButtonTitle="Generate"
|
4146
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
4147
|
+
speechToTextButtonTitle="Speech to Text"
|
4148
|
+
>
|
4149
|
+
</ng-container>
|
4150
|
+
<div class="k-prompt-content">
|
4151
|
+
<div class="k-prompt-view">
|
4152
|
+
<kendo-card *ngIf="promptOutput" width="100%">
|
4153
|
+
<kendo-card-body>
|
4154
|
+
<ng-container
|
4155
|
+
*ngIf="outputTemplate"
|
4156
|
+
[ngTemplateOutlet]="outputTemplate"
|
4157
|
+
[ngTemplateOutletContext]="{ $implicit: promptOutput }"
|
4158
|
+
>
|
4159
|
+
</ng-container>
|
4160
|
+
<ng-container *ngIf="!outputTemplate">{{promptOutput.output}}</ng-container>
|
4161
|
+
</kendo-card-body>
|
4162
|
+
<kendo-card-actions *ngIf="outputActions && outputActions.length > 0">
|
4163
|
+
<ng-container *ngFor="let action of outputActions">
|
4164
|
+
<button kendoButton *ngIf="action.type === 'button'"
|
4165
|
+
[attr.title]="action?.title"
|
4166
|
+
[fillMode]="action?.fillMode"
|
4167
|
+
[themeColor]="action?.themeColor"
|
4168
|
+
[rounded]="action?.rounded"
|
4169
|
+
[icon]="action?.icon"
|
4170
|
+
[svgIcon]="action?.svgIcon"
|
4171
|
+
(click)="onActionClick(action)"
|
4172
|
+
>{{action?.text}}</button>
|
4173
|
+
<div *ngIf="action.type === 'spacer'" class="k-spacer"></div>
|
4174
|
+
</ng-container>
|
4175
|
+
</kendo-card-actions>
|
4176
|
+
</kendo-card>
|
4177
|
+
<kendo-textarea
|
4178
|
+
[value]="promptValue ? promptValue : null"
|
4179
|
+
(valueChange)="handlePromptValueChange($event)"
|
4180
|
+
[rows]="initialRows"
|
4181
|
+
resizable="auto"
|
4182
|
+
flow="horizontal"
|
4183
|
+
[placeholder]="placeholder"
|
4184
|
+
[showPrefixSeparator]="true"
|
4185
|
+
[selectOnFocus]="true"
|
4186
|
+
[maxResizableRows]="maxRows"
|
4187
|
+
(keydown)="handleTextAreaKeydown($event)"
|
4188
|
+
>
|
4189
|
+
<kendo-textarea-prefix>
|
4190
|
+
<button
|
4191
|
+
kendoButton
|
4192
|
+
#commandMenuButton
|
4193
|
+
*ngIf="promptCommands && promptCommands.length > 0"
|
4194
|
+
[attr.title]="messageFor('commandsButtonTitle')"
|
4195
|
+
fillMode="flat"
|
4196
|
+
icon="menu"
|
4197
|
+
[svgIcon]="commandMenuIcon"
|
4198
|
+
(click)="onCommandButtonClick($event)"
|
4199
|
+
></button>
|
4200
|
+
<button
|
4201
|
+
kendoSpeechToTextButton
|
4202
|
+
*ngIf="enableSpeechToText"
|
4203
|
+
[attr.title]="messageFor('speechToTextButtonTitle')"
|
4204
|
+
fillMode="flat"
|
4205
|
+
(result)="handleSpeechResult($event)"
|
4206
|
+
(start)="isListening = true"
|
4207
|
+
(end)="isListening = false"
|
4208
|
+
></button>
|
4209
|
+
</kendo-textarea-prefix>
|
4210
|
+
<kendo-textarea-suffix>
|
4211
|
+
<button
|
4212
|
+
kendoButton
|
4213
|
+
[attr.title]="messageFor('generateButtonTitle')"
|
4214
|
+
fillMode="flat"
|
4215
|
+
class="k-prompt-send"
|
4216
|
+
[ngClass]="{ 'k-generating': streaming, 'k-active': streaming }"
|
4217
|
+
(click)="handlePromptRequest()"
|
4218
|
+
[disabled]="!streaming && (!promptValue?.trim() || isListening)"
|
4219
|
+
[svgIcon]="streaming ? stopGenerationIcon : sendIcon"
|
4220
|
+
[icon]="streaming ? 'stop-sm' : 'paper-plane'"
|
4221
|
+
></button>
|
4222
|
+
</kendo-textarea-suffix>
|
4223
|
+
</kendo-textarea>
|
4224
|
+
</div>
|
4225
|
+
</div>
|
4226
|
+
<kendo-contextmenu
|
4227
|
+
#kendoContextMenu
|
4228
|
+
[alignToAnchor]="true"
|
4229
|
+
[items]="commandMenuItems"
|
4230
|
+
[appendTo]="appendTo"
|
4231
|
+
class="k-hidden"
|
4232
|
+
(select)="onCommandClick($event)">
|
4233
|
+
</kendo-contextmenu>
|
4234
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoInlineAIPromptLocalizedMessages]" }, { kind: "component", type: i2.ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "component", type: i2.SpeechToTextButtonComponent, selector: "button[kendoSpeechToTextButton]", inputs: ["disabled", "size", "rounded", "fillMode", "themeColor", "integrationMode", "lang", "continuous", "interimResults", "maxAlternatives"], outputs: ["start", "end", "result", "error", "click"], exportAs: ["kendoSpeechToTextButton"] }, { kind: "component", type: i3.TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "maxResizableRows", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "component", type: i3.TextAreaPrefixComponent, selector: "kendo-textarea-prefix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaPrefix"] }, { kind: "component", type: i3.TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }, { kind: "component", type: i4.ContextMenuComponent, selector: "kendo-contextmenu", inputs: ["showOn", "target", "filter", "alignToAnchor", "vertical", "popupAnimate", "popupAlign", "anchorAlign", "collision", "appendTo", "ariaLabel"], outputs: ["popupOpen", "popupClose", "select", "open", "close"], exportAs: ["kendoContextMenu"] }, { kind: "component", type: i5.CardComponent, selector: "kendo-card", inputs: ["orientation", "width"] }, { kind: "component", type: i5.CardActionsComponent, selector: "kendo-card-actions", inputs: ["orientation", "layout", "actions"], outputs: ["action"] }, { kind: "component", type: i5.CardBodyComponent, selector: "kendo-card-body" }] });
|
4235
|
+
}
|
4236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptContentComponent, decorators: [{
|
4237
|
+
type: Component,
|
4238
|
+
args: [{
|
4239
|
+
exportAs: 'kendoInlineAIPromptContent',
|
4240
|
+
selector: 'kendo-inlineaiprompt-content',
|
4241
|
+
providers: [
|
4242
|
+
LocalizationService,
|
4243
|
+
{
|
4244
|
+
provide: L10N_PREFIX,
|
4245
|
+
useValue: 'kendo.inlineaiprompt',
|
4246
|
+
},
|
4247
|
+
],
|
4248
|
+
template: `
|
4249
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
4250
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
4251
|
+
commandsButtonTitle="Command Menu"
|
4252
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
4253
|
+
generateButtonTitle="Generate"
|
4254
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
4255
|
+
speechToTextButtonTitle="Speech to Text"
|
4256
|
+
>
|
4257
|
+
</ng-container>
|
4258
|
+
<div class="k-prompt-content">
|
4259
|
+
<div class="k-prompt-view">
|
4260
|
+
<kendo-card *ngIf="promptOutput" width="100%">
|
4261
|
+
<kendo-card-body>
|
4262
|
+
<ng-container
|
4263
|
+
*ngIf="outputTemplate"
|
4264
|
+
[ngTemplateOutlet]="outputTemplate"
|
4265
|
+
[ngTemplateOutletContext]="{ $implicit: promptOutput }"
|
4266
|
+
>
|
4267
|
+
</ng-container>
|
4268
|
+
<ng-container *ngIf="!outputTemplate">{{promptOutput.output}}</ng-container>
|
4269
|
+
</kendo-card-body>
|
4270
|
+
<kendo-card-actions *ngIf="outputActions && outputActions.length > 0">
|
4271
|
+
<ng-container *ngFor="let action of outputActions">
|
4272
|
+
<button kendoButton *ngIf="action.type === 'button'"
|
4273
|
+
[attr.title]="action?.title"
|
4274
|
+
[fillMode]="action?.fillMode"
|
4275
|
+
[themeColor]="action?.themeColor"
|
4276
|
+
[rounded]="action?.rounded"
|
4277
|
+
[icon]="action?.icon"
|
4278
|
+
[svgIcon]="action?.svgIcon"
|
4279
|
+
(click)="onActionClick(action)"
|
4280
|
+
>{{action?.text}}</button>
|
4281
|
+
<div *ngIf="action.type === 'spacer'" class="k-spacer"></div>
|
4282
|
+
</ng-container>
|
4283
|
+
</kendo-card-actions>
|
4284
|
+
</kendo-card>
|
4285
|
+
<kendo-textarea
|
4286
|
+
[value]="promptValue ? promptValue : null"
|
4287
|
+
(valueChange)="handlePromptValueChange($event)"
|
4288
|
+
[rows]="initialRows"
|
4289
|
+
resizable="auto"
|
4290
|
+
flow="horizontal"
|
4291
|
+
[placeholder]="placeholder"
|
4292
|
+
[showPrefixSeparator]="true"
|
4293
|
+
[selectOnFocus]="true"
|
4294
|
+
[maxResizableRows]="maxRows"
|
4295
|
+
(keydown)="handleTextAreaKeydown($event)"
|
4296
|
+
>
|
4297
|
+
<kendo-textarea-prefix>
|
4298
|
+
<button
|
4299
|
+
kendoButton
|
4300
|
+
#commandMenuButton
|
4301
|
+
*ngIf="promptCommands && promptCommands.length > 0"
|
4302
|
+
[attr.title]="messageFor('commandsButtonTitle')"
|
4303
|
+
fillMode="flat"
|
4304
|
+
icon="menu"
|
4305
|
+
[svgIcon]="commandMenuIcon"
|
4306
|
+
(click)="onCommandButtonClick($event)"
|
4307
|
+
></button>
|
4308
|
+
<button
|
4309
|
+
kendoSpeechToTextButton
|
4310
|
+
*ngIf="enableSpeechToText"
|
4311
|
+
[attr.title]="messageFor('speechToTextButtonTitle')"
|
4312
|
+
fillMode="flat"
|
4313
|
+
(result)="handleSpeechResult($event)"
|
4314
|
+
(start)="isListening = true"
|
4315
|
+
(end)="isListening = false"
|
4316
|
+
></button>
|
4317
|
+
</kendo-textarea-prefix>
|
4318
|
+
<kendo-textarea-suffix>
|
4319
|
+
<button
|
4320
|
+
kendoButton
|
4321
|
+
[attr.title]="messageFor('generateButtonTitle')"
|
4322
|
+
fillMode="flat"
|
4323
|
+
class="k-prompt-send"
|
4324
|
+
[ngClass]="{ 'k-generating': streaming, 'k-active': streaming }"
|
4325
|
+
(click)="handlePromptRequest()"
|
4326
|
+
[disabled]="!streaming && (!promptValue?.trim() || isListening)"
|
4327
|
+
[svgIcon]="streaming ? stopGenerationIcon : sendIcon"
|
4328
|
+
[icon]="streaming ? 'stop-sm' : 'paper-plane'"
|
4329
|
+
></button>
|
4330
|
+
</kendo-textarea-suffix>
|
4331
|
+
</kendo-textarea>
|
4332
|
+
</div>
|
4333
|
+
</div>
|
4334
|
+
<kendo-contextmenu
|
4335
|
+
#kendoContextMenu
|
4336
|
+
[alignToAnchor]="true"
|
4337
|
+
[items]="commandMenuItems"
|
4338
|
+
[appendTo]="appendTo"
|
4339
|
+
class="k-hidden"
|
4340
|
+
(select)="onCommandClick($event)">
|
4341
|
+
</kendo-contextmenu>
|
4342
|
+
`,
|
4343
|
+
standalone: true,
|
4344
|
+
imports: [NgClass, NgIf, NgFor, NgTemplateOutlet, LocalizedMessagesDirective, KENDO_BUTTONS, KENDO_TEXTAREA, KENDO_CONTEXTMENU, KENDO_CARD],
|
4345
|
+
}]
|
4346
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1$1.LocalizationService, decorators: [{
|
4347
|
+
type: Optional
|
4348
|
+
}, {
|
4349
|
+
type: SkipSelf
|
4350
|
+
}] }]; }, propDecorators: { className: [{
|
4351
|
+
type: HostBinding,
|
4352
|
+
args: ['class.k-prompt']
|
4353
|
+
}], dirAttr: [{
|
4354
|
+
type: HostBinding,
|
4355
|
+
args: ['attr.dir']
|
4356
|
+
}], maxHeightStyle: [{
|
4357
|
+
type: HostBinding,
|
4358
|
+
args: ['style.max-height']
|
4359
|
+
}], widthStyle: [{
|
4360
|
+
type: HostBinding,
|
4361
|
+
args: ['style.width']
|
4362
|
+
}], popupElement: [{
|
4363
|
+
type: Input
|
4364
|
+
}], promptValue: [{
|
4365
|
+
type: Input
|
4366
|
+
}], placeholder: [{
|
4367
|
+
type: Input
|
4368
|
+
}], promptOutput: [{
|
4369
|
+
type: Input
|
4370
|
+
}], enableSpeechToText: [{
|
4371
|
+
type: Input
|
4372
|
+
}], streaming: [{
|
4373
|
+
type: Input
|
4374
|
+
}], width: [{
|
4375
|
+
type: Input
|
4376
|
+
}], maxHeight: [{
|
4377
|
+
type: Input
|
4378
|
+
}], appendTo: [{
|
4379
|
+
type: Input
|
4380
|
+
}], outputActions: [{
|
4381
|
+
type: Input
|
4382
|
+
}], promptCommands: [{
|
4383
|
+
type: Input
|
4384
|
+
}], outputTemplate: [{
|
4385
|
+
type: Input
|
4386
|
+
}], promptRequest: [{
|
4387
|
+
type: Output
|
4388
|
+
}], commandExecute: [{
|
4389
|
+
type: Output
|
4390
|
+
}], outputActionClick: [{
|
4391
|
+
type: Output
|
4392
|
+
}], promptRequestCancel: [{
|
4393
|
+
type: Output
|
4394
|
+
}], close: [{
|
4395
|
+
type: Output
|
4396
|
+
}], promptValueChange: [{
|
4397
|
+
type: Output
|
4398
|
+
}], onEscapeKey: [{
|
4399
|
+
type: HostListener,
|
4400
|
+
args: ['keydown', ['$event']]
|
4401
|
+
}], textArea: [{
|
4402
|
+
type: ViewChild,
|
4403
|
+
args: [TextAreaComponent]
|
4404
|
+
}], contextMenu: [{
|
4405
|
+
type: ViewChild,
|
4406
|
+
args: ['kendoContextMenu']
|
4407
|
+
}] } });
|
4408
|
+
|
4409
|
+
/**
|
4410
|
+
* Defines a template for displaying the output of the Inline AI Prompt.
|
4411
|
+
*
|
4412
|
+
* @example
|
4413
|
+
* ```html
|
4414
|
+
* <kendo-inlineaiprompt>
|
4415
|
+
* <ng-template kendoInlineAIPromptOutputTemplate let-output>
|
4416
|
+
* <div class="custom-output">
|
4417
|
+
* <h4>AI Response:</h4>
|
4418
|
+
* <p>{{ output.output }}</p>
|
4419
|
+
* </div>
|
4420
|
+
* </ng-template>
|
4421
|
+
* </kendo-inlineaiprompt>
|
4422
|
+
* ```
|
4423
|
+
*/
|
4424
|
+
class InlineAIPromptOutputTemplateDirective {
|
4425
|
+
templateRef;
|
4426
|
+
constructor(templateRef) {
|
4427
|
+
this.templateRef = templateRef;
|
4428
|
+
}
|
4429
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptOutputTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
4430
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptOutputTemplateDirective, isStandalone: true, selector: "[kendoInlineAIPromptOutputTemplate]", ngImport: i0 });
|
4431
|
+
}
|
4432
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptOutputTemplateDirective, decorators: [{
|
4433
|
+
type: Directive,
|
4434
|
+
args: [{
|
4435
|
+
selector: '[kendoInlineAIPromptOutputTemplate]',
|
4436
|
+
standalone: true
|
4437
|
+
}]
|
4438
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
4439
|
+
type: Optional
|
4440
|
+
}] }]; } });
|
4441
|
+
|
4442
|
+
/**
|
4443
|
+
* Represents the Kendo UI InlineAIPrompt component for Angular.
|
4444
|
+
*
|
4445
|
+
* @remarks
|
4446
|
+
* Supported children components are: {@link InlineAIPromptCustomMessagesComponent}
|
4447
|
+
*
|
4448
|
+
* @example
|
4449
|
+
* ```html
|
4450
|
+
* <kendo-inlineaiprompt
|
4451
|
+
* placeholder="Enter your prompt..."
|
4452
|
+
* [promptOutput]="promptOutput"
|
4453
|
+
* (promptRequest)="onPromptRequest($event)">
|
4454
|
+
* </kendo-inlineaiprompt>
|
4455
|
+
* ```
|
4456
|
+
*/
|
4457
|
+
class InlineAIPromptComponent {
|
4458
|
+
ngZone;
|
4459
|
+
element;
|
4460
|
+
/**
|
4461
|
+
* Sets the text of the TextArea.
|
4462
|
+
*/
|
4463
|
+
promptValue = "";
|
4464
|
+
/**
|
4465
|
+
* Sets the placeholder text that appears in the text area when it is empty.
|
4466
|
+
*/
|
4467
|
+
placeholder;
|
4468
|
+
/**
|
4469
|
+
* Sets the output data for the prompt.
|
4470
|
+
* The output displays as a card above the text area.
|
4471
|
+
*/
|
4472
|
+
promptOutput;
|
4473
|
+
/**
|
4474
|
+
* Controls the visibility and settings of the Speech to Text button.
|
4475
|
+
*
|
4476
|
+
* @default true
|
4477
|
+
*/
|
4478
|
+
enableSpeechToText = true;
|
4479
|
+
/**
|
4480
|
+
* Sets the streaming state of the component.
|
4481
|
+
* When set to `true`, the send button displays a generating state and the component emits a `promptRequestCancel` event when you click it.
|
4482
|
+
*
|
4483
|
+
* @default false
|
4484
|
+
*/
|
4485
|
+
streaming = false;
|
4486
|
+
/**
|
4487
|
+
* Sets the width of the component.
|
4488
|
+
* Accepts a number for pixels or a string for other units.
|
4489
|
+
*
|
4490
|
+
* @default 550
|
4491
|
+
*/
|
4492
|
+
width = 550;
|
4493
|
+
/**
|
4494
|
+
* Sets the maximum height of the component.
|
4495
|
+
* Accepts a number for pixels or a string for other units.
|
4496
|
+
*/
|
4497
|
+
maxHeight;
|
4498
|
+
/**
|
4499
|
+
* Represents the configuration of the default output actions.
|
4500
|
+
* The default actions are `copy`, `retry`, and `discard`.
|
4501
|
+
*/
|
4502
|
+
defaultOutputActions = defaultOutputActions;
|
4503
|
+
/**
|
4504
|
+
* Sets the output actions that display in the output card.
|
4505
|
+
* The default actions are `copy`, `retry`, and `discard`.
|
4506
|
+
* To customize the appearance and order of the default actions, define them with the same `name`.
|
4507
|
+
*
|
4508
|
+
* @default [{ name: 'copy', type: 'button', icon: 'copy', svgIcon: copyIcon, text: 'Copy', fillMode: 'flat', themeColor: 'primary', rounded: 'medium'}, { name: 'retry', type: 'button', icon: 'arrow-rotate-cw', svgIcon: arrowRotateCwIcon, text: 'Retry', fillMode: 'flat', themeColor: 'primary', rounded: 'medium'}, { name: 'discard', type: 'button', icon: 'cancel-outline', svgIcon: cancelOutlineIcon, text: 'Discard', fillMode: 'flat', themeColor: 'base', rounded: 'medium'}]
|
4509
|
+
*/
|
4510
|
+
outputActions = defaultOutputActions;
|
4511
|
+
/**
|
4512
|
+
* Sets the available prompt commands.
|
4513
|
+
*/
|
4514
|
+
promptCommands;
|
4515
|
+
/**
|
4516
|
+
* Sets the popup settings for the component.
|
4517
|
+
*/
|
4518
|
+
set popupSettings(settings) {
|
4519
|
+
this._popupSettings = { ...defaultPopupSettings, ...settings };
|
4520
|
+
}
|
4521
|
+
get popupSettings() {
|
4522
|
+
return this._popupSettings;
|
4523
|
+
}
|
4524
|
+
/**
|
4525
|
+
* Fires when you click the send button.
|
4526
|
+
*/
|
4527
|
+
promptRequest = new EventEmitter();
|
4528
|
+
/**
|
4529
|
+
* Fires when you click a command.
|
4530
|
+
*/
|
4531
|
+
commandExecute = new EventEmitter();
|
4532
|
+
/**
|
4533
|
+
* Fires when you click an output action button.
|
4534
|
+
*/
|
4535
|
+
outputActionClick = new EventEmitter();
|
4536
|
+
/**
|
4537
|
+
* Fires when you cancel the prompt request by clicking the stop button.
|
4538
|
+
*/
|
4539
|
+
promptRequestCancel = new EventEmitter();
|
4540
|
+
/**
|
4541
|
+
* Fires when the component closes, either by clicking outside the popup, clicking the Discard action, or after pressing the Escape key.
|
4542
|
+
*/
|
4543
|
+
close = new EventEmitter();
|
4544
|
+
/**
|
4545
|
+
* Fires when the value of the TextArea changes.
|
4546
|
+
*/
|
4547
|
+
promptValueChange = new EventEmitter();
|
4548
|
+
popupElement;
|
4549
|
+
popupViewContainer;
|
4550
|
+
contentComponent;
|
4551
|
+
outputTemplate;
|
4552
|
+
/**
|
4553
|
+
* @hidden
|
4554
|
+
*/
|
4555
|
+
calculateMeasurement = calculateMeasurement;
|
4556
|
+
_popupSettings = defaultPopupSettings;
|
4557
|
+
subs = new Subscription();
|
4558
|
+
constructor(ngZone, element) {
|
4559
|
+
this.ngZone = ngZone;
|
4560
|
+
this.element = element;
|
4561
|
+
validatePackage(packageMetadata);
|
4562
|
+
}
|
4563
|
+
ngAfterViewInit() {
|
4564
|
+
if (this.contentComponent && this.popupElement) {
|
4565
|
+
this.contentComponent.popupElement = this.popupElement;
|
4566
|
+
}
|
4567
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
4568
|
+
if (this.contentComponent && this.popupViewContainer) {
|
4569
|
+
this.contentComponent.appendTo = this.popupViewContainer;
|
4570
|
+
}
|
4571
|
+
});
|
4572
|
+
}
|
4573
|
+
ngOnDestroy() {
|
4574
|
+
this.subs.unsubscribe();
|
4575
|
+
}
|
4576
|
+
/**
|
4577
|
+
* Focuses the TextArea of the Inline AI Prompt.
|
4578
|
+
*/
|
4579
|
+
focus() {
|
4580
|
+
if (this.contentComponent?.textArea) {
|
4581
|
+
this.contentComponent.textArea.focus();
|
4582
|
+
}
|
4583
|
+
}
|
4584
|
+
/**
|
4585
|
+
* @hidden
|
4586
|
+
*/
|
4587
|
+
onPromptRequest(event) {
|
4588
|
+
this.promptRequest.emit(event);
|
4589
|
+
}
|
4590
|
+
/**
|
4591
|
+
* @hidden
|
4592
|
+
*/
|
4593
|
+
onCommandExecute(event) {
|
4594
|
+
this.commandExecute.emit(event);
|
4595
|
+
}
|
4596
|
+
/**
|
4597
|
+
* @hidden
|
4598
|
+
*/
|
4599
|
+
onOutputActionClick(event) {
|
4600
|
+
this.outputActionClick.emit(event);
|
4601
|
+
}
|
4602
|
+
/**
|
4603
|
+
* @hidden
|
4604
|
+
*/
|
4605
|
+
onPromptRequestCancel() {
|
4606
|
+
this.promptRequestCancel.emit();
|
4607
|
+
}
|
4608
|
+
/**
|
4609
|
+
* @hidden
|
4610
|
+
*/
|
4611
|
+
onClose() {
|
4612
|
+
this.close.emit();
|
4613
|
+
}
|
4614
|
+
/**
|
4615
|
+
* @hidden
|
4616
|
+
*/
|
4617
|
+
onPromptValueChange(value) {
|
4618
|
+
this.promptValueChange.emit(value);
|
4619
|
+
}
|
4620
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
4621
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptComponent, isStandalone: true, selector: "kendo-inlineaiprompt", inputs: { promptValue: "promptValue", placeholder: "placeholder", promptOutput: "promptOutput", enableSpeechToText: "enableSpeechToText", streaming: "streaming", width: "width", maxHeight: "maxHeight", outputActions: "outputActions", promptCommands: "promptCommands", popupSettings: "popupSettings" }, outputs: { promptRequest: "promptRequest", commandExecute: "commandExecute", outputActionClick: "outputActionClick", promptRequestCancel: "promptRequestCancel", close: "close", promptValueChange: "promptValueChange" }, providers: [
|
4622
|
+
LocalizationService,
|
4623
|
+
{
|
4624
|
+
provide: L10N_PREFIX,
|
4625
|
+
useValue: 'kendo.inlineaiprompt',
|
4626
|
+
},
|
4627
|
+
], queries: [{ propertyName: "outputTemplate", first: true, predicate: InlineAIPromptOutputTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "popupElement", first: true, predicate: PopupComponent, descendants: true, read: ElementRef }, { propertyName: "popupViewContainer", first: true, predicate: PopupComponent, descendants: true, read: ViewContainerRef }, { propertyName: "contentComponent", first: true, predicate: InlineAIPromptContentComponent, descendants: true }], exportAs: ["kendoInlineAIPrompt"], ngImport: i0, template: `
|
4628
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
4629
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
4630
|
+
commandsButtonTitle="Command Menu"
|
4631
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
4632
|
+
generateButtonTitle="Generate"
|
4633
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
4634
|
+
speechToTextButtonTitle="Speech to Text"
|
4635
|
+
>
|
4636
|
+
</ng-container>
|
4637
|
+
<kendo-popup
|
4638
|
+
[style.width]="calculateMeasurement(width)"
|
4639
|
+
[anchor]="popupSettings?.anchor"
|
4640
|
+
[anchorAlign]="popupSettings?.anchorAlign"
|
4641
|
+
[offset]="popupSettings?.offset"
|
4642
|
+
[popupAlign]="popupSettings?.popupAlign"
|
4643
|
+
[animate]="popupSettings?.animate"
|
4644
|
+
[collision]="popupSettings?.collision"
|
4645
|
+
[positionMode]="popupSettings?.positionMode"
|
4646
|
+
[margin]="popupSettings?.margin"
|
4647
|
+
[popupClass]="popupSettings?.popupClass || 'k-prompt-popup'"
|
4648
|
+
>
|
4649
|
+
<kendo-inlineaiprompt-content
|
4650
|
+
[style.width]="width"
|
4651
|
+
[promptValue]="promptValue"
|
4652
|
+
[placeholder]="placeholder"
|
4653
|
+
[promptOutput]="promptOutput"
|
4654
|
+
[enableSpeechToText]="enableSpeechToText"
|
4655
|
+
[streaming]="streaming"
|
4656
|
+
[maxHeight]="maxHeight"
|
4657
|
+
[outputActions]="outputActions"
|
4658
|
+
[promptCommands]="promptCommands"
|
4659
|
+
[outputTemplate]="outputTemplate?.templateRef"
|
4660
|
+
(promptRequest)="onPromptRequest($event)"
|
4661
|
+
(commandExecute)="onCommandExecute($event)"
|
4662
|
+
(outputActionClick)="onOutputActionClick($event)"
|
4663
|
+
(promptRequestCancel)="onPromptRequestCancel()"
|
4664
|
+
(close)="onClose()"
|
4665
|
+
(promptValueChange)="onPromptValueChange($event)"
|
4666
|
+
>
|
4667
|
+
</kendo-inlineaiprompt-content>
|
4668
|
+
</kendo-popup>
|
4669
|
+
`, isInline: true, dependencies: [{ kind: "component", type: i1$2.PopupComponent, selector: "kendo-popup", inputs: ["animate", "anchor", "anchorAlign", "collision", "popupAlign", "copyAnchorStyles", "popupClass", "positionMode", "offset", "margin"], outputs: ["anchorViewportLeave", "close", "open", "positionChange"], exportAs: ["kendo-popup"] }, { kind: "component", type: InlineAIPromptContentComponent, selector: "kendo-inlineaiprompt-content", inputs: ["popupElement", "promptValue", "placeholder", "promptOutput", "enableSpeechToText", "streaming", "width", "maxHeight", "appendTo", "outputActions", "promptCommands", "outputTemplate"], outputs: ["promptRequest", "commandExecute", "outputActionClick", "promptRequestCancel", "close", "promptValueChange"], exportAs: ["kendoInlineAIPromptContent"] }, { kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoInlineAIPromptLocalizedMessages]" }] });
|
4670
|
+
}
|
4671
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptComponent, decorators: [{
|
4672
|
+
type: Component,
|
4673
|
+
args: [{
|
4674
|
+
exportAs: 'kendoInlineAIPrompt',
|
4675
|
+
selector: 'kendo-inlineaiprompt',
|
4676
|
+
providers: [
|
4677
|
+
LocalizationService,
|
4678
|
+
{
|
4679
|
+
provide: L10N_PREFIX,
|
4680
|
+
useValue: 'kendo.inlineaiprompt',
|
4681
|
+
},
|
4682
|
+
],
|
4683
|
+
template: `
|
4684
|
+
<ng-container kendoInlineAIPromptLocalizedMessages
|
4685
|
+
i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
|
4686
|
+
commandsButtonTitle="Command Menu"
|
4687
|
+
i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
|
4688
|
+
generateButtonTitle="Generate"
|
4689
|
+
i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
|
4690
|
+
speechToTextButtonTitle="Speech to Text"
|
4691
|
+
>
|
4692
|
+
</ng-container>
|
4693
|
+
<kendo-popup
|
4694
|
+
[style.width]="calculateMeasurement(width)"
|
4695
|
+
[anchor]="popupSettings?.anchor"
|
4696
|
+
[anchorAlign]="popupSettings?.anchorAlign"
|
4697
|
+
[offset]="popupSettings?.offset"
|
4698
|
+
[popupAlign]="popupSettings?.popupAlign"
|
4699
|
+
[animate]="popupSettings?.animate"
|
4700
|
+
[collision]="popupSettings?.collision"
|
4701
|
+
[positionMode]="popupSettings?.positionMode"
|
4702
|
+
[margin]="popupSettings?.margin"
|
4703
|
+
[popupClass]="popupSettings?.popupClass || 'k-prompt-popup'"
|
4704
|
+
>
|
4705
|
+
<kendo-inlineaiprompt-content
|
4706
|
+
[style.width]="width"
|
4707
|
+
[promptValue]="promptValue"
|
4708
|
+
[placeholder]="placeholder"
|
4709
|
+
[promptOutput]="promptOutput"
|
4710
|
+
[enableSpeechToText]="enableSpeechToText"
|
4711
|
+
[streaming]="streaming"
|
4712
|
+
[maxHeight]="maxHeight"
|
4713
|
+
[outputActions]="outputActions"
|
4714
|
+
[promptCommands]="promptCommands"
|
4715
|
+
[outputTemplate]="outputTemplate?.templateRef"
|
4716
|
+
(promptRequest)="onPromptRequest($event)"
|
4717
|
+
(commandExecute)="onCommandExecute($event)"
|
4718
|
+
(outputActionClick)="onOutputActionClick($event)"
|
4719
|
+
(promptRequestCancel)="onPromptRequestCancel()"
|
4720
|
+
(close)="onClose()"
|
4721
|
+
(promptValueChange)="onPromptValueChange($event)"
|
4722
|
+
>
|
4723
|
+
</kendo-inlineaiprompt-content>
|
4724
|
+
</kendo-popup>
|
4725
|
+
`,
|
4726
|
+
standalone: true,
|
4727
|
+
imports: [KENDO_POPUP, InlineAIPromptContentComponent, LocalizedMessagesDirective],
|
4728
|
+
}]
|
4729
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { promptValue: [{
|
4730
|
+
type: Input
|
4731
|
+
}], placeholder: [{
|
4732
|
+
type: Input
|
4733
|
+
}], promptOutput: [{
|
4734
|
+
type: Input
|
4735
|
+
}], enableSpeechToText: [{
|
4736
|
+
type: Input
|
4737
|
+
}], streaming: [{
|
4738
|
+
type: Input
|
4739
|
+
}], width: [{
|
4740
|
+
type: Input
|
4741
|
+
}], maxHeight: [{
|
4742
|
+
type: Input
|
4743
|
+
}], outputActions: [{
|
4744
|
+
type: Input
|
4745
|
+
}], promptCommands: [{
|
4746
|
+
type: Input
|
4747
|
+
}], popupSettings: [{
|
4748
|
+
type: Input
|
4749
|
+
}], promptRequest: [{
|
4750
|
+
type: Output
|
4751
|
+
}], commandExecute: [{
|
4752
|
+
type: Output
|
4753
|
+
}], outputActionClick: [{
|
4754
|
+
type: Output
|
4755
|
+
}], promptRequestCancel: [{
|
4756
|
+
type: Output
|
4757
|
+
}], close: [{
|
4758
|
+
type: Output
|
4759
|
+
}], promptValueChange: [{
|
4760
|
+
type: Output
|
4761
|
+
}], popupElement: [{
|
4762
|
+
type: ViewChild,
|
4763
|
+
args: [PopupComponent, { read: ElementRef }]
|
4764
|
+
}], popupViewContainer: [{
|
4765
|
+
type: ViewChild,
|
4766
|
+
args: [PopupComponent, { read: ViewContainerRef }]
|
4767
|
+
}], contentComponent: [{
|
4768
|
+
type: ViewChild,
|
4769
|
+
args: [InlineAIPromptContentComponent]
|
4770
|
+
}], outputTemplate: [{
|
4771
|
+
type: ContentChild,
|
4772
|
+
args: [InlineAIPromptOutputTemplateDirective]
|
4773
|
+
}] } });
|
4774
|
+
|
4775
|
+
/**
|
4776
|
+
* Represents the custom messages component of the Inline AI Prompt.
|
4777
|
+
*
|
4778
|
+
* Use this component to override default messages for the Inline AI Prompt.
|
4779
|
+
*
|
4780
|
+
* @example
|
4781
|
+
* ```html
|
4782
|
+
* <kendo-inlineaiprompt-messages
|
4783
|
+
* commandsButtonTitle="Commands Menu"
|
4784
|
+
* generateButtonTitle="Generate">
|
4785
|
+
* </kendo-inlineaiprompt-messages>
|
4786
|
+
* ```
|
4787
|
+
*/
|
4788
|
+
class InlineAIPromptCustomMessagesComponent extends Messages {
|
4789
|
+
service;
|
4790
|
+
constructor(service) {
|
4791
|
+
super();
|
4792
|
+
this.service = service;
|
4793
|
+
}
|
4794
|
+
get override() {
|
4795
|
+
return true;
|
4796
|
+
}
|
4797
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptCustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
4798
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptCustomMessagesComponent, isStandalone: true, selector: "kendo-inlineaiprompt-messages", providers: [
|
4799
|
+
{
|
4800
|
+
provide: Messages,
|
4801
|
+
useExisting: forwardRef(() => InlineAIPromptCustomMessagesComponent)
|
4802
|
+
}
|
4803
|
+
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
4804
|
+
}
|
4805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptCustomMessagesComponent, decorators: [{
|
4806
|
+
type: Component,
|
4807
|
+
args: [{
|
4808
|
+
providers: [
|
4809
|
+
{
|
4810
|
+
provide: Messages,
|
4811
|
+
useExisting: forwardRef(() => InlineAIPromptCustomMessagesComponent)
|
4812
|
+
}
|
4813
|
+
],
|
4814
|
+
selector: 'kendo-inlineaiprompt-messages',
|
4815
|
+
template: ``,
|
4816
|
+
standalone: true
|
4817
|
+
}]
|
4818
|
+
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
4819
|
+
|
4820
|
+
/**
|
4821
|
+
* Utility array that contains all AIPrompt related components and directives.
|
4822
|
+
*
|
4823
|
+
* @example
|
4824
|
+
* ```ts
|
4825
|
+
* import { Component } from '@angular/core';
|
4826
|
+
* import { KENDO_AIPROMPT } from '@progress/kendo-angular-conversational-ui';
|
4827
|
+
*
|
4828
|
+
* @Component({
|
4829
|
+
* standalone: true,
|
4830
|
+
* imports: [KENDO_AIPROMPT],
|
4831
|
+
* selector: 'my-app',
|
4832
|
+
* template: `<kendo-aiprompt></kendo-aiprompt>`
|
4833
|
+
* })
|
4834
|
+
* export class AppComponent {}
|
4835
|
+
* ```
|
4836
|
+
*/
|
4837
|
+
const KENDO_AIPROMPT = [
|
4838
|
+
AIPromptComponent,
|
4839
|
+
PromptViewComponent,
|
4840
|
+
OutputViewComponent,
|
4841
|
+
CommandViewComponent,
|
4842
|
+
CustomViewComponent,
|
4843
|
+
AIPromptCustomMessagesComponent,
|
4844
|
+
AIPromptToolbarActionsDirective,
|
4845
|
+
AIPromptToolbarFocusableDirective,
|
4846
|
+
AIPromptOutputTemplateDirective,
|
4847
|
+
AIPromptOutputBodyTemplateDirective,
|
4848
|
+
];
|
4849
|
+
/**
|
4850
|
+
* Utility array that contains all Chat related components and directives.
|
4851
|
+
*
|
4852
|
+
* @example
|
4853
|
+
* ```ts
|
4854
|
+
* import { Component } from '@angular/core';
|
4855
|
+
* import { KENDO_CHAT } from '@progress/kendo-angular-conversational-ui';
|
4856
|
+
*
|
4857
|
+
* @Component({
|
4858
|
+
* standalone: true,
|
4859
|
+
* imports: [KENDO_CHAT],
|
4860
|
+
* selector: 'my-app',
|
4861
|
+
* template: `<kendo-chat></kendo-chat>`
|
4862
|
+
* })
|
4863
|
+
* export class AppComponent {}
|
4864
|
+
* ```
|
4865
|
+
*/
|
4866
|
+
const KENDO_CHAT = [
|
4867
|
+
ChatComponent,
|
4868
|
+
CustomMessagesComponent,
|
4869
|
+
AttachmentTemplateDirective,
|
3437
4870
|
MessageTemplateDirective,
|
3438
4871
|
HeroCardComponent,
|
3439
4872
|
ChatMessageBoxTemplateDirective
|
3440
4873
|
];
|
4874
|
+
/**
|
4875
|
+
* Utility array that contains all InlineAIPrompt related components and directives.
|
4876
|
+
*
|
4877
|
+
* @example
|
4878
|
+
* ```ts
|
4879
|
+
* import { Component } from '@angular/core';
|
4880
|
+
* import { KENDO_INLINEAIPROMPT } from '@progress/kendo-angular-conversational-ui';
|
4881
|
+
*
|
4882
|
+
* @Component({
|
4883
|
+
* standalone: true,
|
4884
|
+
* imports: [KENDO_INLINEAIPROMPT],
|
4885
|
+
* selector: 'my-app',
|
4886
|
+
* template: `<kendo-inlineaiprompt></kendo-inlineaiprompt>`
|
4887
|
+
* })
|
4888
|
+
* export class AppComponent {}
|
4889
|
+
* ```
|
4890
|
+
*/
|
4891
|
+
const KENDO_INLINEAIPROMPT = [
|
4892
|
+
InlineAIPromptComponent,
|
4893
|
+
InlineAIPromptOutputTemplateDirective,
|
4894
|
+
InlineAIPromptCustomMessagesComponent
|
4895
|
+
];
|
3441
4896
|
/**
|
3442
4897
|
* Utility array that contains all `@progress/kendo-angular-conversational-ui` related components and directives.
|
3443
4898
|
*
|
@@ -3460,7 +4915,8 @@ const KENDO_CHAT = [
|
|
3460
4915
|
*/
|
3461
4916
|
const KENDO_CONVERSATIONALUI = [
|
3462
4917
|
...KENDO_AIPROMPT,
|
3463
|
-
...KENDO_CHAT
|
4918
|
+
...KENDO_CHAT,
|
4919
|
+
...KENDO_INLINEAIPROMPT
|
3464
4920
|
];
|
3465
4921
|
|
3466
4922
|
// IMPORTANT: NgModule export kept for backwards compatibility
|
@@ -3484,7 +4940,7 @@ const KENDO_CONVERSATIONALUI = [
|
|
3484
4940
|
*/
|
3485
4941
|
class AIPromptModule {
|
3486
4942
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
3487
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective], exports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective] });
|
4943
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective], exports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective] });
|
3488
4944
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService], imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent] });
|
3489
4945
|
}
|
3490
4946
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, decorators: [{
|
@@ -3553,8 +5009,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3553
5009
|
*/
|
3554
5010
|
class ConversationalUIModule {
|
3555
5011
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
3556
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective], exports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective] });
|
3557
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService], imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, ChatComponent, HeroCardComponent] });
|
5012
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective, InlineAIPromptComponent, InlineAIPromptOutputTemplateDirective, InlineAIPromptCustomMessagesComponent], exports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AIPromptOutputTemplateDirective, AIPromptOutputBodyTemplateDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective, InlineAIPromptComponent, InlineAIPromptOutputTemplateDirective, InlineAIPromptCustomMessagesComponent] });
|
5013
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService], imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, ChatComponent, HeroCardComponent, InlineAIPromptComponent] });
|
3558
5014
|
}
|
3559
5015
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConversationalUIModule, decorators: [{
|
3560
5016
|
type: NgModule,
|
@@ -3565,9 +5021,174 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
3565
5021
|
}]
|
3566
5022
|
}] });
|
3567
5023
|
|
5024
|
+
// IMPORTANT: NgModule export kept for backwards compatibility
|
5025
|
+
/**
|
5026
|
+
* Represents the [`NgModule`](link:site.data.urls.angular['ngmodules']) for the InlineAIPrompt component.
|
5027
|
+
*
|
5028
|
+
* @example
|
5029
|
+
* ```ts
|
5030
|
+
* import { NgModule } from '@angular/core';
|
5031
|
+
* import { BrowserModule } from '@angular/platform-browser';
|
5032
|
+
* import { InlineAIPromptModule } from '@progress/kendo-angular-conversational-ui';
|
5033
|
+
* import { AppComponent } from './app.component';
|
5034
|
+
*
|
5035
|
+
* @NgModule({
|
5036
|
+
* imports: [BrowserModule, InlineAIPromptModule],
|
5037
|
+
* declarations: [AppComponent],
|
5038
|
+
* bootstrap: [AppComponent]
|
5039
|
+
* })
|
5040
|
+
* export class AppModule {}
|
5041
|
+
* ```
|
5042
|
+
*/
|
5043
|
+
class InlineAIPromptModule {
|
5044
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
5045
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptModule, imports: [InlineAIPromptComponent, InlineAIPromptOutputTemplateDirective, InlineAIPromptCustomMessagesComponent], exports: [InlineAIPromptComponent, InlineAIPromptOutputTemplateDirective, InlineAIPromptCustomMessagesComponent] });
|
5046
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptModule, providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService], imports: [InlineAIPromptComponent] });
|
5047
|
+
}
|
5048
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptModule, decorators: [{
|
5049
|
+
type: NgModule,
|
5050
|
+
args: [{
|
5051
|
+
exports: [...KENDO_INLINEAIPROMPT],
|
5052
|
+
imports: [...KENDO_INLINEAIPROMPT],
|
5053
|
+
providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService]
|
5054
|
+
}]
|
5055
|
+
}] });
|
5056
|
+
|
5057
|
+
/**
|
5058
|
+
* Provides a service for opening Inline AI Prompt components dynamically.
|
5059
|
+
*
|
5060
|
+
* @example
|
5061
|
+
* ```ts
|
5062
|
+
* import { InlineAIPromptService } from '@progress/kendo-angular-conversational-ui';
|
5063
|
+
*
|
5064
|
+
* constructor(private inlineAIPromptService: InlineAIPromptService) {}
|
5065
|
+
*
|
5066
|
+
* openPrompt(anchor: ElementRef) {
|
5067
|
+
* const promptRef = this.inlineAIPromptService.open({
|
5068
|
+
* anchor: anchor,
|
5069
|
+
* placeholder: 'Enter your prompt...'
|
5070
|
+
* });
|
5071
|
+
* }
|
5072
|
+
* ```
|
5073
|
+
*/
|
5074
|
+
class InlineAIPromptService {
|
5075
|
+
popupService;
|
5076
|
+
constructor(popupService) {
|
5077
|
+
this.popupService = popupService;
|
5078
|
+
}
|
5079
|
+
/**
|
5080
|
+
* Opens an Inline AI Prompt component in a popup. The popup appears near the specified anchor element or at the provided offset coordinates.
|
5081
|
+
*
|
5082
|
+
* @param {InlineAIPromptSettings} options - The options for the InlineAIPromptComponent.
|
5083
|
+
* @returns {PopupRef} A reference to the popup.
|
5084
|
+
*/
|
5085
|
+
open(options) {
|
5086
|
+
const popupSettings = { ...defaultPopupSettings, ...options?.popupSettings };
|
5087
|
+
const popupRef = this.popupService.open({
|
5088
|
+
...(options?.popupSettings?.anchor && { anchor: options.popupSettings.anchor }),
|
5089
|
+
popupClass: 'k-prompt-popup',
|
5090
|
+
...popupSettings,
|
5091
|
+
content: InlineAIPromptContentComponent,
|
5092
|
+
});
|
5093
|
+
const promptInstance = popupRef.content?.instance;
|
5094
|
+
if (promptInstance) {
|
5095
|
+
const popupViewContainer = popupRef.popup.injector.get(ViewContainerRef);
|
5096
|
+
promptInstance.appendTo = popupViewContainer;
|
5097
|
+
promptInstance.popupElement = popupRef.popupElement;
|
5098
|
+
this.projectComponentInputs(promptInstance, options);
|
5099
|
+
if (promptInstance.close) {
|
5100
|
+
promptInstance.close.subscribe(() => {
|
5101
|
+
popupRef.close();
|
5102
|
+
});
|
5103
|
+
}
|
5104
|
+
if (popupRef.content.changeDetectorRef) {
|
5105
|
+
popupRef.content.changeDetectorRef.detectChanges();
|
5106
|
+
}
|
5107
|
+
}
|
5108
|
+
return popupRef;
|
5109
|
+
}
|
5110
|
+
/**
|
5111
|
+
* Projects the input options onto the component instance.
|
5112
|
+
*/
|
5113
|
+
projectComponentInputs(component, options) {
|
5114
|
+
if (!options) {
|
5115
|
+
return component;
|
5116
|
+
}
|
5117
|
+
Object.getOwnPropertyNames(options)
|
5118
|
+
.forEach((prop) => {
|
5119
|
+
component[prop] = options[prop];
|
5120
|
+
});
|
5121
|
+
return component;
|
5122
|
+
}
|
5123
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptService, deps: [{ token: i1$2.PopupService }], target: i0.ɵɵFactoryTarget.Injectable });
|
5124
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptService, providedIn: 'root' });
|
5125
|
+
}
|
5126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptService, decorators: [{
|
5127
|
+
type: Injectable,
|
5128
|
+
args: [{
|
5129
|
+
providedIn: 'root'
|
5130
|
+
}]
|
5131
|
+
}], ctorParameters: function () { return [{ type: i1$2.PopupService }]; } });
|
5132
|
+
|
5133
|
+
/**
|
5134
|
+
* Defines the settings for opening an Inline AI Prompt through the `InlineAIPromptService`.
|
5135
|
+
*/
|
5136
|
+
class InlineAIPromptSettings {
|
5137
|
+
/**
|
5138
|
+
* Specifies the settings for the Inline AI Prompt Popup.
|
5139
|
+
*/
|
5140
|
+
popupSettings;
|
5141
|
+
/**
|
5142
|
+
* Sets the width of the component.
|
5143
|
+
* Accepts a number for pixels or a string for other units, for example, `50%`.
|
5144
|
+
*/
|
5145
|
+
width;
|
5146
|
+
/**
|
5147
|
+
* Sets the maximum height of the component.
|
5148
|
+
* Accepts a number for pixels or a string for other units, for example, `50%`.
|
5149
|
+
*/
|
5150
|
+
maxHeight;
|
5151
|
+
/**
|
5152
|
+
* Sets the value of the Inline AI Prompt TextArea.
|
5153
|
+
*/
|
5154
|
+
promptValue;
|
5155
|
+
/**
|
5156
|
+
* Sets the placeholder of the Inline AI Prompt TextArea.
|
5157
|
+
*/
|
5158
|
+
placeholder;
|
5159
|
+
/**
|
5160
|
+
* Sets the action buttons for the output card.
|
5161
|
+
*/
|
5162
|
+
outputActions;
|
5163
|
+
/**
|
5164
|
+
* Sets the commands for the Inline AI Prompt TextArea prefix.
|
5165
|
+
*/
|
5166
|
+
promptCommands;
|
5167
|
+
/**
|
5168
|
+
* Sets the prompt output to display.
|
5169
|
+
*/
|
5170
|
+
promptOutput;
|
5171
|
+
/**
|
5172
|
+
* Sets the visibility and configuration of the Speech to Text button.
|
5173
|
+
*/
|
5174
|
+
enableSpeechToTextButton;
|
5175
|
+
/**
|
5176
|
+
* Sets the template for the output content. If not provided, the default output template is used.
|
5177
|
+
*/
|
5178
|
+
outputTemplate;
|
5179
|
+
/**
|
5180
|
+
* Sets whether the send button turns into a stop button.
|
5181
|
+
*/
|
5182
|
+
streaming;
|
5183
|
+
/**
|
5184
|
+
* Sets the titles of the buttons shown in the Inline AI Prompt. Use for localization.
|
5185
|
+
*/
|
5186
|
+
messages;
|
5187
|
+
}
|
5188
|
+
|
3568
5189
|
/**
|
3569
5190
|
* Generated bundle index. Do not edit.
|
3570
5191
|
*/
|
3571
5192
|
|
3572
|
-
export { AIPromptComponent, AIPromptCustomMessagesComponent, AIPromptModule, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AttachmentTemplateDirective, ChatComponent, ChatMessageBoxTemplateDirective, ChatModule, CommandViewComponent, ConversationalUIModule, CustomMessagesComponent, CustomViewComponent, ExecuteActionEvent, HeroCardComponent, KENDO_AIPROMPT, KENDO_CHAT, KENDO_CONVERSATIONALUI, MessageTemplateDirective, OutputViewComponent, PromptViewComponent, SendMessageEvent };
|
5193
|
+
export { AIPromptComponent, AIPromptCustomMessagesComponent, AIPromptModule, AIPromptOutputBodyTemplateDirective, AIPromptOutputTemplateDirective, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AttachmentTemplateDirective, ChatComponent, ChatMessageBoxTemplateDirective, ChatModule, CommandViewComponent, ConversationalUIModule, CustomMessagesComponent, CustomViewComponent, ExecuteActionEvent, HeroCardComponent, InlineAIPromptComponent, InlineAIPromptCustomMessagesComponent, InlineAIPromptModule, InlineAIPromptOutputTemplateDirective, InlineAIPromptService, InlineAIPromptSettings, KENDO_AIPROMPT, KENDO_CHAT, KENDO_CONVERSATIONALUI, KENDO_INLINEAIPROMPT, MessageTemplateDirective, OutputViewComponent, PromptViewComponent, SendMessageEvent };
|
3573
5194
|
|