@progress/kendo-angular-conversational-ui 19.3.0-develop.2 → 19.3.0-develop.21

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.
Files changed (28) hide show
  1. package/ai-prompt/aiprompt.component.d.ts +71 -12
  2. package/ai-prompt/aiprompt.module.d.ts +3 -1
  3. package/ai-prompt/common/aiprompt.service.d.ts +10 -0
  4. package/ai-prompt/common/output-card.component.d.ts +4 -0
  5. package/ai-prompt/models/ai-prompt-settings.d.ts +60 -0
  6. package/ai-prompt/models/index.d.ts +1 -0
  7. package/ai-prompt/templates/aiprompt-output-body-template.directive.d.ts +24 -0
  8. package/ai-prompt/templates/aiprompt-output-template.directive.d.ts +24 -0
  9. package/ai-prompt/views/output-view.component.d.ts +4 -0
  10. package/ai-prompt/views/prompt-view.component.d.ts +19 -1
  11. package/conversational-ui.module.d.ts +9 -7
  12. package/directives.d.ts +4 -2
  13. package/esm2022/ai-prompt/aiprompt.component.mjs +136 -19
  14. package/esm2022/ai-prompt/aiprompt.module.mjs +3 -1
  15. package/esm2022/ai-prompt/common/aiprompt.service.mjs +35 -0
  16. package/esm2022/ai-prompt/common/output-card.component.mjs +23 -5
  17. package/esm2022/ai-prompt/models/ai-prompt-settings.mjs +5 -0
  18. package/esm2022/ai-prompt/templates/aiprompt-output-body-template.directive.mjs +33 -0
  19. package/esm2022/ai-prompt/templates/aiprompt-output-template.directive.mjs +33 -0
  20. package/esm2022/ai-prompt/views/output-view.component.mjs +27 -11
  21. package/esm2022/ai-prompt/views/prompt-view.component.mjs +115 -21
  22. package/esm2022/conversational-ui.module.mjs +10 -8
  23. package/esm2022/directives.mjs +5 -1
  24. package/esm2022/index.mjs +2 -0
  25. package/esm2022/package-metadata.mjs +2 -2
  26. package/fesm2022/progress-kendo-angular-conversational-ui.mjs +393 -57
  27. package/index.d.ts +2 -0
  28. package/package.json +12 -12
@@ -5,10 +5,10 @@
5
5
  import { Component, ContentChild, ContentChildren, EventEmitter, HostBinding, Input, NgZone, Output, QueryList } from "@angular/core";
6
6
  import { NgFor, NgIf, NgTemplateOutlet } from "@angular/common";
7
7
  import { Subscription } from "rxjs";
8
- import { sparklesIcon, commentIcon } from "@progress/kendo-svg-icons";
8
+ import { sparklesIcon, commentIcon, stopSmIcon } from "@progress/kendo-svg-icons";
9
9
  import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
10
10
  import { validatePackage } from "@progress/kendo-licensing";
11
- import { ButtonComponent } from "@progress/kendo-angular-buttons";
11
+ import { ButtonComponent, FloatingActionButtonComponent } from "@progress/kendo-angular-buttons";
12
12
  import { BaseView } from "./views/base-view";
13
13
  import { packageMetadata } from "../package-metadata";
14
14
  import { AIPromptService } from "./common/aiprompt.service";
@@ -16,6 +16,8 @@ import { AIPromptToolbarActionsDirective } from "./templates/toolbar-actions.tem
16
16
  import { ToolbarNavigationService } from "./common/toolbar-navigation.service";
17
17
  import { AIPromptToolbarFocusableDirective } from "./common/toolbar-focusable.directive";
18
18
  import { LocalizedMessagesDirective } from "./localization/localized-messages.directive";
19
+ import { AIPromptOutputTemplateDirective } from "./templates/aiprompt-output-template.directive";
20
+ import { AIPromptOutputBodyTemplateDirective } from "./templates/aiprompt-output-body-template.directive";
19
21
  import * as i0 from "@angular/core";
20
22
  import * as i1 from "@progress/kendo-angular-l10n";
21
23
  import * as i2 from "./common/aiprompt.service";
@@ -65,6 +67,14 @@ export class AIPromptComponent {
65
67
  * @hidden
66
68
  */
67
69
  toolbarActionsTemplate;
70
+ /**
71
+ * @hidden
72
+ */
73
+ outputTemplate;
74
+ /**
75
+ * @hidden
76
+ */
77
+ outputBodyTemplate;
68
78
  /**
69
79
  * The active view index of the AIPrompt component.
70
80
  */
@@ -78,54 +88,105 @@ export class AIPromptComponent {
78
88
  return this._activeView;
79
89
  }
80
90
  /**
81
- * Sets the collection of commands to render in the **Command** view.
91
+ * Sets the collection of commands to render in the Command view.
82
92
  */
83
93
  set promptCommands(value) {
84
94
  this.service.promptCommands = value;
85
95
  }
86
96
  /**
87
- * Sets the collection of suggestions to render in the **Prompt** view.
97
+ * Sets the collection of suggestions to render in the Prompt view.
88
98
  */
89
99
  set promptSuggestions(value) {
90
100
  this.service.promptSuggestions = value;
91
101
  }
92
102
  /**
93
- * Sets the collection of generated prompt outputs to render in the **Output** view.
103
+ * Sets the collection of generated prompt outputs to render in the Output view.
94
104
  */
95
105
  set promptOutputs(value) {
96
106
  this.service.promptOutputs = value;
97
107
  }
98
108
  /**
99
- * Specifies if the rating buttons appear in each **Output** view card.
100
- * By default, the rating buttons do not appear.
109
+ * Specifies whether the rating buttons appear in each Output view card.
110
+ * The rating buttons do not appear by default.
101
111
  * @default false
102
112
  */
103
113
  set showOutputRating(value) {
104
114
  this.service.showOutputRating = value;
105
115
  }
116
+ /**
117
+ * Specifies whether the Stop generation button appears in the Output view.
118
+ * The Stop generation button does not appear by default.
119
+ * @default false
120
+ */
121
+ streaming = false;
122
+ /**
123
+ * Sets the settings for the Speech to Text button in the Prompt view
124
+ * ([see example](slug:configuration_aiprompt#enabling-speech-to-text)).
125
+ */
126
+ set speechToTextButton(settings) {
127
+ if (settings) {
128
+ this.service.speechToTextButton = settings;
129
+ }
130
+ else {
131
+ this.service.speechToTextButton = false;
132
+ }
133
+ }
134
+ /**
135
+ * Sets the settings for the TextArea in the Prompt view
136
+ * ([see example](slug:configuration_aiprompt#configuring-the-prompt-text-area)).
137
+ */
138
+ set textAreaSettings(settings) {
139
+ this.service.textAreaSettings = settings;
140
+ }
141
+ /**
142
+ * Sets the SVG icon for the Generate button in the Prompt view.
143
+ */
144
+ generateButtonSVGIcon = sparklesIcon;
145
+ /**
146
+ * Sets the icon for the Generate button in the Prompt view.
147
+ * @default 'sparkles'
148
+ */
149
+ generateButtonIcon = 'sparkles';
150
+ /**
151
+ * Sets the disabled state for the Generate button in the Prompt view.
152
+ * @default false
153
+ */
154
+ disabledGenerateButton = false;
106
155
  /**
107
156
  * Fires when the `activeView` property is updated.
108
157
  * Use this event for two-way binding of the `activeView` property.
109
158
  */
110
159
  activeViewChange = new EventEmitter();
111
160
  /**
112
- * Fires when the user clicks the **Generate** button in the **Prompt** view or the **Retry** button in the **Output** view.
161
+ * Fires when you click the Generate button in the Prompt view or the Retry button in the Output view.
113
162
  * Use the event's `isRetry` field to determine the source element.
114
163
  */
115
164
  promptRequest = new EventEmitter();
116
165
  /**
117
- * Fires when the user clicks a **Command** view command.
166
+ * Fires when you click a Command view command.
118
167
  * The event data contains the selected command.
119
168
  */
120
169
  commandExecute = new EventEmitter();
121
170
  /**
122
- * Fires when the user clicks a **Copy** button in any **Output** view card.
171
+ * Fires when you click a Copy button in any Output view card.
123
172
  */
124
173
  outputCopy = new EventEmitter();
125
174
  /**
126
- * Fires when the user clicks a rating button in any **Output** view card.
175
+ * Fires when you click a rating button in any Output view card.
127
176
  */
128
177
  outputRatingChange = new EventEmitter();
178
+ /**
179
+ * Fires when you click the Stop Generation button in the Output view.
180
+ */
181
+ promptRequestCancel = new EventEmitter();
182
+ ngAfterContentChecked() {
183
+ if (this.outputTemplate !== this.service.outputTemplate) {
184
+ this.service.outputTemplate = this.outputTemplate;
185
+ }
186
+ if (this.outputBodyTemplate !== this.service.outputBodyTemplate) {
187
+ this.service.outputBodyTemplate = this.outputBodyTemplate;
188
+ }
189
+ }
129
190
  ngAfterViewInit() {
130
191
  this.ngZone.runOutsideAngular(() => {
131
192
  this.service.aiPrompt = this;
@@ -159,12 +220,24 @@ export class AIPromptComponent {
159
220
  * @hidden
160
221
  */
161
222
  outputIcon = commentIcon;
223
+ /**
224
+ * @hidden
225
+ */
226
+ fabStopGenerationSVGIcon = stopSmIcon;
162
227
  /**
163
228
  * @hidden
164
229
  */
165
230
  get viewsArray() {
166
231
  return this.views?.toArray();
167
232
  }
233
+ /**
234
+ * @hidden
235
+ */
236
+ fabPositionMode = 'absolute';
237
+ /**
238
+ * @hidden
239
+ */
240
+ fabAlignment = { vertical: 'bottom', horizontal: 'end' };
168
241
  direction;
169
242
  _activeView = 0;
170
243
  /**
@@ -201,7 +274,7 @@ export class AIPromptComponent {
201
274
  this.promptRequest.emit(eventArgs);
202
275
  }
203
276
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AIPromptService }, { token: i3.ToolbarNavigationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
204
- 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: [
277
+ 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: [
205
278
  LocalizationService,
206
279
  AIPromptService,
207
280
  ToolbarNavigationService,
@@ -209,7 +282,7 @@ export class AIPromptComponent {
209
282
  provide: L10N_PREFIX,
210
283
  useValue: 'kendo.aiprompt'
211
284
  }
212
- ], queries: [{ propertyName: "toolbarActionsTemplate", first: true, predicate: AIPromptToolbarActionsDirective, descendants: true }, { propertyName: "views", predicate: BaseView }], exportAs: ["kendoAIPrompt"], ngImport: i0, template: `
285
+ ], 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 }], exportAs: ["kendoAIPrompt"], ngImport: i0, template: `
213
286
  <ng-container kendoAIPromptLocalizedMessages
214
287
  i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
215
288
  promptView="Ask AI"
@@ -253,6 +326,16 @@ export class AIPromptComponent {
253
326
  </div>
254
327
  </div>
255
328
  <div class="k-prompt-content">
329
+ <kendo-floatingactionbutton *ngIf="streaming && selectedView?.viewType === 'output'"
330
+ class="k-prompt-stop-fab"
331
+ buttonClass="k-generating k-active"
332
+ [positionMode]="fabPositionMode"
333
+ [align]="fabAlignment"
334
+ [svgIcon]="fabStopGenerationSVGIcon"
335
+ icon="stop"
336
+ (click)="promptRequestCancel.emit()"
337
+ >
338
+ </kendo-floatingactionbutton>
256
339
  <div class="k-prompt-view">
257
340
  <ng-container *ngTemplateOutlet="viewTemplate">
258
341
  </ng-container>
@@ -265,12 +348,14 @@ export class AIPromptComponent {
265
348
  type="button"
266
349
  themeColor="primary"
267
350
  rounded="full"
268
- [svgIcon]="sparklesIcon"
269
- icon="sparkles"
351
+ [attr.title]="messageFor('generateOutput')"
352
+ [svgIcon]="generateButtonSVGIcon"
353
+ [icon]="generateButtonIcon"
354
+ [disabled]="disabledGenerateButton"
270
355
  (click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
271
356
  </div>
272
357
  </div>
273
- `, 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"] }] });
358
+ `, 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"] }, { 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"] }] });
274
359
  }
275
360
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptComponent, decorators: [{
276
361
  type: Component,
@@ -330,6 +415,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
330
415
  </div>
331
416
  </div>
332
417
  <div class="k-prompt-content">
418
+ <kendo-floatingactionbutton *ngIf="streaming && selectedView?.viewType === 'output'"
419
+ class="k-prompt-stop-fab"
420
+ buttonClass="k-generating k-active"
421
+ [positionMode]="fabPositionMode"
422
+ [align]="fabAlignment"
423
+ [svgIcon]="fabStopGenerationSVGIcon"
424
+ icon="stop"
425
+ (click)="promptRequestCancel.emit()"
426
+ >
427
+ </kendo-floatingactionbutton>
333
428
  <div class="k-prompt-view">
334
429
  <ng-container *ngTemplateOutlet="viewTemplate">
335
430
  </ng-container>
@@ -342,14 +437,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
342
437
  type="button"
343
438
  themeColor="primary"
344
439
  rounded="full"
345
- [svgIcon]="sparklesIcon"
346
- icon="sparkles"
440
+ [attr.title]="messageFor('generateOutput')"
441
+ [svgIcon]="generateButtonSVGIcon"
442
+ [icon]="generateButtonIcon"
443
+ [disabled]="disabledGenerateButton"
347
444
  (click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
348
445
  </div>
349
446
  </div>
350
447
  `,
351
448
  standalone: true,
352
- imports: [LocalizedMessagesDirective, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet]
449
+ imports: [LocalizedMessagesDirective, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet, FloatingActionButtonComponent]
353
450
  }]
354
451
  }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }, { type: i3.ToolbarNavigationService }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
355
452
  type: HostBinding,
@@ -363,6 +460,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
363
460
  }], toolbarActionsTemplate: [{
364
461
  type: ContentChild,
365
462
  args: [AIPromptToolbarActionsDirective]
463
+ }], outputTemplate: [{
464
+ type: ContentChild,
465
+ args: [AIPromptOutputTemplateDirective]
466
+ }], outputBodyTemplate: [{
467
+ type: ContentChild,
468
+ args: [AIPromptOutputBodyTemplateDirective]
366
469
  }], activeView: [{
367
470
  type: Input
368
471
  }], promptCommands: [{
@@ -373,6 +476,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
373
476
  type: Input
374
477
  }], showOutputRating: [{
375
478
  type: Input
479
+ }], streaming: [{
480
+ type: Input
481
+ }], speechToTextButton: [{
482
+ type: Input
483
+ }], textAreaSettings: [{
484
+ type: Input
485
+ }], generateButtonSVGIcon: [{
486
+ type: Input
487
+ }], generateButtonIcon: [{
488
+ type: Input
489
+ }], disabledGenerateButton: [{
490
+ type: Input
376
491
  }], activeViewChange: [{
377
492
  type: Output
378
493
  }], promptRequest: [{
@@ -383,4 +498,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
383
498
  type: Output
384
499
  }], outputRatingChange: [{
385
500
  type: Output
501
+ }], promptRequestCancel: [{
502
+ type: Output
386
503
  }] } });
@@ -17,6 +17,8 @@ import * as i5 from "./views/custom-view.component";
17
17
  import * as i6 from "./localization/custom-messages.component";
18
18
  import * as i7 from "./templates/toolbar-actions.template";
19
19
  import * as i8 from "./common/toolbar-focusable.directive";
20
+ import * as i9 from "./templates/aiprompt-output-template.directive";
21
+ import * as i10 from "./templates/aiprompt-output-body-template.directive";
20
22
  // IMPORTANT: NgModule export kept for backwards compatibility
21
23
  /**
22
24
  * Represents the [`NgModule`](link:site.data.urls.angular['ngmodules']) for the AIPrompt component.
@@ -38,7 +40,7 @@ import * as i8 from "./common/toolbar-focusable.directive";
38
40
  */
39
41
  export class AIPromptModule {
40
42
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
41
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, imports: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent, i5.CustomViewComponent, i6.AIPromptCustomMessagesComponent, i7.AIPromptToolbarActionsDirective, i8.AIPromptToolbarFocusableDirective], exports: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent, i5.CustomViewComponent, i6.AIPromptCustomMessagesComponent, i7.AIPromptToolbarActionsDirective, i8.AIPromptToolbarFocusableDirective] });
43
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, imports: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent, i5.CustomViewComponent, i6.AIPromptCustomMessagesComponent, i7.AIPromptToolbarActionsDirective, i8.AIPromptToolbarFocusableDirective, i9.AIPromptOutputTemplateDirective, i10.AIPromptOutputBodyTemplateDirective], exports: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent, i5.CustomViewComponent, i6.AIPromptCustomMessagesComponent, i7.AIPromptToolbarActionsDirective, i8.AIPromptToolbarFocusableDirective, i9.AIPromptOutputTemplateDirective, i10.AIPromptOutputBodyTemplateDirective] });
42
44
  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: [i1.AIPromptComponent, i2.PromptViewComponent, i3.OutputViewComponent, i4.CommandViewComponent] });
43
45
  }
44
46
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptModule, decorators: [{
@@ -5,6 +5,23 @@
5
5
  import { Injectable } from '@angular/core';
6
6
  import { Subject } from 'rxjs';
7
7
  import * as i0 from "@angular/core";
8
+ /**
9
+ * @hidden
10
+ * Default settings for the Speech to Text button.
11
+ * These settings can be overridden by the user.
12
+ */
13
+ const STB_DEFAULT_SETTINGS = {
14
+ continuous: false,
15
+ disabled: false,
16
+ fillMode: 'flat',
17
+ integrationMode: 'webSpeech',
18
+ interimResults: false,
19
+ lang: 'en-US',
20
+ maxAlternatives: 1,
21
+ rounded: 'medium',
22
+ size: 'medium',
23
+ themeColor: 'base'
24
+ };
8
25
  /**
9
26
  * @hidden
10
27
  */
@@ -19,6 +36,24 @@ export class AIPromptService {
19
36
  promptCommands;
20
37
  promptOutputs;
21
38
  promptSuggestions;
39
+ textAreaSettings;
40
+ outputTemplate;
41
+ outputBodyTemplate;
42
+ _speechToTextButton;
43
+ get speechToTextButton() {
44
+ return this._speechToTextButton;
45
+ }
46
+ set speechToTextButton(settings) {
47
+ if (settings === true) {
48
+ this._speechToTextButton = STB_DEFAULT_SETTINGS;
49
+ }
50
+ else if (settings === false) {
51
+ this._speechToTextButton = null;
52
+ }
53
+ else {
54
+ this._speechToTextButton = { ...settings };
55
+ }
56
+ }
22
57
  getFlattenPromptCommands(commands = this.promptCommands) {
23
58
  let newArr = [];
24
59
  commands.forEach(c => {
@@ -3,7 +3,7 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Component, HostBinding, Input } from '@angular/core';
6
- import { NgIf } from '@angular/common';
6
+ import { NgIf, NgTemplateOutlet } from '@angular/common';
7
7
  import { LocalizationService } from '@progress/kendo-angular-l10n';
8
8
  import { guid, isPresent } from '@progress/kendo-angular-common';
9
9
  import { ButtonComponent } from "@progress/kendo-angular-buttons";
@@ -97,6 +97,12 @@ export class AIPromptOutputCardComponent {
97
97
  this.positiveRatingIcon = thumbUpOutlineIcon;
98
98
  }
99
99
  }
100
+ /**
101
+ * @hidden
102
+ */
103
+ get customBodyTemplate() {
104
+ return this.service.outputBodyTemplate?.templateRef;
105
+ }
100
106
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputCardComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
101
107
  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: `
102
108
  <div class="k-card-header">
@@ -107,7 +113,13 @@ export class AIPromptOutputCardComponent {
107
113
  <div class="k-card-subtitle">{{promptOutput.prompt}}</div>
108
114
  </div>
109
115
  <div class="k-card-body">
110
- <p>{{promptOutput.output}}</p>
116
+ <ng-container *ngIf="customBodyTemplate; else defaultTemplate">
117
+ <ng-container *ngTemplateOutlet="customBodyTemplate; context: { $implicit: promptOutput }">
118
+ </ng-container>
119
+ </ng-container>
120
+ <ng-template #defaultTemplate>
121
+ <p>{{promptOutput.output}}</p>
122
+ </ng-template>
111
123
  </div>
112
124
  <div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
113
125
  <button kendoButton
@@ -141,7 +153,7 @@ export class AIPromptOutputCardComponent {
141
153
  </button>
142
154
  </ng-container>
143
155
  </div>
144
- `, 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"] }] });
156
+ `, 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"] }] });
145
157
  }
146
158
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputCardComponent, decorators: [{
147
159
  type: Component,
@@ -156,7 +168,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
156
168
  <div class="k-card-subtitle">{{promptOutput.prompt}}</div>
157
169
  </div>
158
170
  <div class="k-card-body">
159
- <p>{{promptOutput.output}}</p>
171
+ <ng-container *ngIf="customBodyTemplate; else defaultTemplate">
172
+ <ng-container *ngTemplateOutlet="customBodyTemplate; context: { $implicit: promptOutput }">
173
+ </ng-container>
174
+ </ng-container>
175
+ <ng-template #defaultTemplate>
176
+ <p>{{promptOutput.output}}</p>
177
+ </ng-template>
160
178
  </div>
161
179
  <div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
162
180
  <button kendoButton
@@ -192,7 +210,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
192
210
  </div>
193
211
  `,
194
212
  standalone: true,
195
- imports: [ButtonComponent, NgIf]
213
+ imports: [ButtonComponent, NgIf, NgTemplateOutlet]
196
214
  }]
197
215
  }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }]; }, propDecorators: { hostClass: [{
198
216
  type: HostBinding,
@@ -0,0 +1,5 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ export {};
@@ -0,0 +1,33 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, TemplateRef } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Represents the template for the body of the response in the AIPrompt component. The template context is set to the current output object.
9
+ *
10
+ * @example
11
+ * ```html
12
+ * <kendo-aiprompt>
13
+ * <ng-template kendoAIPromptOutputBodyTemplate let-output>
14
+ * <div>{{output.prompt}}</div>
15
+ * </ng-template>
16
+ * </kendo-aiprompt>
17
+ * ```
18
+ */
19
+ export class AIPromptOutputBodyTemplateDirective {
20
+ templateRef;
21
+ constructor(templateRef) {
22
+ this.templateRef = templateRef;
23
+ }
24
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputBodyTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
25
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptOutputBodyTemplateDirective, isStandalone: true, selector: "[kendoAIPromptOutputBodyTemplate]", ngImport: i0 });
26
+ }
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputBodyTemplateDirective, decorators: [{
28
+ type: Directive,
29
+ args: [{
30
+ selector: '[kendoAIPromptOutputBodyTemplate]',
31
+ standalone: true
32
+ }]
33
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
@@ -0,0 +1,33 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, TemplateRef } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Represents the template for the response in the AIPrompt component. The template context is set to the current output object.
9
+ *
10
+ * @example
11
+ * ```html
12
+ * <kendo-aiprompt>
13
+ * <ng-template kendoAIPromptOutputTemplate let-output>
14
+ * <div>{{output.prompt}}</div>
15
+ * </ng-template>
16
+ * </kendo-aiprompt>
17
+ * ```
18
+ */
19
+ export class AIPromptOutputTemplateDirective {
20
+ templateRef;
21
+ constructor(templateRef) {
22
+ this.templateRef = templateRef;
23
+ }
24
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
25
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AIPromptOutputTemplateDirective, isStandalone: true, selector: "[kendoAIPromptOutputTemplate]", ngImport: i0 });
26
+ }
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptOutputTemplateDirective, decorators: [{
28
+ type: Directive,
29
+ args: [{
30
+ selector: '[kendoAIPromptOutputTemplate]',
31
+ standalone: true
32
+ }]
33
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
@@ -7,7 +7,7 @@ import { LocalizationService } from '@progress/kendo-angular-l10n';
7
7
  import { BaseView } from './base-view';
8
8
  import { AIPromptService } from '../common/aiprompt.service';
9
9
  import { AIPromptOutputCardComponent } from '../common/output-card.component';
10
- import { NgFor } from '@angular/common';
10
+ import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
11
11
  import * as i0 from "@angular/core";
12
12
  import * as i1 from "@progress/kendo-angular-l10n";
13
13
  import * as i2 from "../common/aiprompt.service";
@@ -33,6 +33,12 @@ export class OutputViewComponent extends BaseView {
33
33
  get promptOutputs() {
34
34
  return this.service.promptOutputs;
35
35
  }
36
+ /**
37
+ * @hidden
38
+ */
39
+ get customTemplate() {
40
+ return this.service.outputTemplate?.templateRef;
41
+ }
36
42
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OutputViewComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
37
43
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OutputViewComponent, isStandalone: true, selector: "kendo-aiprompt-output-view", providers: [{
38
44
  provide: BaseView,
@@ -42,13 +48,18 @@ export class OutputViewComponent extends BaseView {
42
48
  <div
43
49
  class="k-card-list"
44
50
  role="list">
45
- <div *ngFor="let output of promptOutputs"
46
- kendoAIPromptOutputCard
47
- [promptOutput]="output">
48
- </div>
51
+ <ng-container *ngFor="let output of promptOutputs">
52
+ <ng-container *ngIf="customTemplate; else defaultTemplate">
53
+ <ng-container *ngTemplateOutlet="customTemplate; context: { $implicit: output }">
54
+ </ng-container>
55
+ </ng-container>
56
+ <ng-template #defaultTemplate>
57
+ <div kendoAIPromptOutputCard [promptOutput]="output"></div>
58
+ </ng-template>
59
+ </ng-container>
49
60
  </div>
50
61
  </ng-template>
51
- `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: ["promptOutput"] }] });
62
+ `, 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"] }] });
52
63
  }
53
64
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OutputViewComponent, decorators: [{
54
65
  type: Component,
@@ -63,14 +74,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
63
74
  <div
64
75
  class="k-card-list"
65
76
  role="list">
66
- <div *ngFor="let output of promptOutputs"
67
- kendoAIPromptOutputCard
68
- [promptOutput]="output">
69
- </div>
77
+ <ng-container *ngFor="let output of promptOutputs">
78
+ <ng-container *ngIf="customTemplate; else defaultTemplate">
79
+ <ng-container *ngTemplateOutlet="customTemplate; context: { $implicit: output }">
80
+ </ng-container>
81
+ </ng-container>
82
+ <ng-template #defaultTemplate>
83
+ <div kendoAIPromptOutputCard [promptOutput]="output"></div>
84
+ </ng-template>
85
+ </ng-container>
70
86
  </div>
71
87
  </ng-template>
72
88
  `,
73
89
  standalone: true,
74
- imports: [NgFor, AIPromptOutputCardComponent]
90
+ imports: [NgFor, AIPromptOutputCardComponent, NgIf, NgTemplateOutlet]
75
91
  }]
76
92
  }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }]; } });