@progress/kendo-angular-conversational-ui 19.3.0-develop.3 → 19.3.0-develop.31

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 (65) hide show
  1. package/ai-prompt/aiprompt.component.d.ts +80 -13
  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/localization/messages.d.ts +5 -1
  6. package/ai-prompt/models/ai-prompt-settings.d.ts +60 -0
  7. package/ai-prompt/models/index.d.ts +1 -0
  8. package/ai-prompt/templates/aiprompt-output-body-template.directive.d.ts +24 -0
  9. package/ai-prompt/templates/aiprompt-output-template.directive.d.ts +24 -0
  10. package/ai-prompt/views/output-view.component.d.ts +4 -0
  11. package/ai-prompt/views/prompt-view.component.d.ts +23 -1
  12. package/conversational-ui.module.d.ts +12 -7
  13. package/directives.d.ts +8 -2
  14. package/esm2022/ai-prompt/aiprompt.component.mjs +177 -25
  15. package/esm2022/ai-prompt/aiprompt.module.mjs +3 -1
  16. package/esm2022/ai-prompt/common/aiprompt.service.mjs +35 -0
  17. package/esm2022/ai-prompt/common/output-card.component.mjs +23 -5
  18. package/esm2022/ai-prompt/localization/messages.mjs +7 -1
  19. package/esm2022/ai-prompt/models/ai-prompt-settings.mjs +5 -0
  20. package/esm2022/ai-prompt/templates/aiprompt-output-body-template.directive.mjs +33 -0
  21. package/esm2022/ai-prompt/templates/aiprompt-output-template.directive.mjs +33 -0
  22. package/esm2022/ai-prompt/views/output-view.component.mjs +27 -11
  23. package/esm2022/ai-prompt/views/prompt-view.component.mjs +139 -21
  24. package/esm2022/chat/message-box.component.mjs +1 -1
  25. package/esm2022/conversational-ui.module.mjs +13 -8
  26. package/esm2022/directives.mjs +15 -2
  27. package/esm2022/index.mjs +7 -0
  28. package/esm2022/inline-ai-prompt/inlineaiprompt-content.component.mjs +552 -0
  29. package/esm2022/inline-ai-prompt/inlineaiprompt.component.mjs +342 -0
  30. package/esm2022/inline-ai-prompt/inlineaiprompt.service.mjs +85 -0
  31. package/esm2022/inline-ai-prompt/localization/custom-messages.component.mjs +53 -0
  32. package/esm2022/inline-ai-prompt/localization/localized-messages.directive.mjs +39 -0
  33. package/esm2022/inline-ai-prompt/localization/messages.mjs +35 -0
  34. package/esm2022/inline-ai-prompt/models/command.interface.mjs +5 -0
  35. package/esm2022/inline-ai-prompt/models/index.mjs +5 -0
  36. package/esm2022/inline-ai-prompt/models/inlineaiprompt-popupsettings.mjs +5 -0
  37. package/esm2022/inline-ai-prompt/models/inlineaiprompt-settings.mjs +59 -0
  38. package/esm2022/inline-ai-prompt/models/messages.mjs +8 -0
  39. package/esm2022/inline-ai-prompt/models/output-action-click-event.mjs +5 -0
  40. package/esm2022/inline-ai-prompt/models/output-action.interface.mjs +5 -0
  41. package/esm2022/inline-ai-prompt/models/prompt-output.interface.mjs +5 -0
  42. package/esm2022/inline-ai-prompt/models/prompt-request-event.mjs +5 -0
  43. package/esm2022/inline-ai-prompt/output-template.directive.mjs +38 -0
  44. package/esm2022/inline-ai-prompt/utils.mjs +22 -0
  45. package/esm2022/package-metadata.mjs +2 -2
  46. package/fesm2022/progress-kendo-angular-conversational-ui.mjs +1696 -140
  47. package/index.d.ts +7 -0
  48. package/inline-ai-prompt/inlineaiprompt-content.component.d.ts +82 -0
  49. package/inline-ai-prompt/inlineaiprompt.component.d.ts +150 -0
  50. package/inline-ai-prompt/inlineaiprompt.service.d.ts +41 -0
  51. package/inline-ai-prompt/localization/custom-messages.component.d.ts +27 -0
  52. package/inline-ai-prompt/localization/localized-messages.directive.d.ts +16 -0
  53. package/inline-ai-prompt/localization/messages.d.ts +25 -0
  54. package/inline-ai-prompt/models/command.interface.d.ts +38 -0
  55. package/inline-ai-prompt/models/index.d.ts +12 -0
  56. package/inline-ai-prompt/models/inlineaiprompt-popupsettings.d.ts +10 -0
  57. package/inline-ai-prompt/models/inlineaiprompt-settings.d.ts +66 -0
  58. package/inline-ai-prompt/models/messages.d.ts +21 -0
  59. package/inline-ai-prompt/models/output-action-click-event.d.ts +19 -0
  60. package/inline-ai-prompt/models/output-action.interface.d.ts +52 -0
  61. package/inline-ai-prompt/models/prompt-output.interface.d.ts +25 -0
  62. package/inline-ai-prompt/models/prompt-request-event.d.ts +17 -0
  63. package/inline-ai-prompt/output-template.directive.d.ts +27 -0
  64. package/inline-ai-prompt/utils.d.ts +13 -0
  65. package/package.json +13 -12
@@ -2,13 +2,13 @@
2
2
  * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { Component, ContentChild, ContentChildren, EventEmitter, HostBinding, Input, NgZone, Output, QueryList } from "@angular/core";
5
+ import { Component, ContentChild, ContentChildren, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, QueryList, Renderer2, ViewChild } 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,9 @@ 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";
21
+ import { take } from "rxjs/operators";
19
22
  import * as i0 from "@angular/core";
20
23
  import * as i1 from "@progress/kendo-angular-l10n";
21
24
  import * as i2 from "./common/aiprompt.service";
@@ -42,21 +45,29 @@ export class AIPromptComponent {
42
45
  service;
43
46
  navigationService;
44
47
  ngZone;
48
+ element;
49
+ renderer;
45
50
  hostClasses = true;
46
51
  get dirAttr() {
47
52
  return this.direction;
48
53
  }
49
- constructor(localization, service, navigationService, ngZone) {
54
+ constructor(localization, service, navigationService, ngZone, element, renderer) {
50
55
  this.localization = localization;
51
56
  this.service = service;
52
57
  this.navigationService = navigationService;
53
58
  this.ngZone = ngZone;
59
+ this.element = element;
60
+ this.renderer = renderer;
54
61
  validatePackage(packageMetadata);
55
62
  this.direction = localization.rtl ? 'rtl' : 'ltr';
56
63
  this.subs.add(localization.changes.subscribe(({ rtl }) => {
57
64
  this.direction = rtl ? 'rtl' : 'ltr';
58
65
  }));
59
66
  }
67
+ /**
68
+ * @hidden
69
+ */
70
+ fabButton;
60
71
  /**
61
72
  * @hidden
62
73
  */
@@ -65,6 +76,14 @@ export class AIPromptComponent {
65
76
  * @hidden
66
77
  */
67
78
  toolbarActionsTemplate;
79
+ /**
80
+ * @hidden
81
+ */
82
+ outputTemplate;
83
+ /**
84
+ * @hidden
85
+ */
86
+ outputBodyTemplate;
68
87
  /**
69
88
  * The active view index of the AIPrompt component.
70
89
  */
@@ -78,54 +97,120 @@ export class AIPromptComponent {
78
97
  return this._activeView;
79
98
  }
80
99
  /**
81
- * Sets the collection of commands to render in the **Command** view.
100
+ * Sets the collection of commands to render in the Command view.
82
101
  */
83
102
  set promptCommands(value) {
84
103
  this.service.promptCommands = value;
85
104
  }
86
105
  /**
87
- * Sets the collection of suggestions to render in the **Prompt** view.
106
+ * Sets the collection of suggestions to render in the Prompt view.
88
107
  */
89
108
  set promptSuggestions(value) {
90
109
  this.service.promptSuggestions = value;
91
110
  }
92
111
  /**
93
- * Sets the collection of generated prompt outputs to render in the **Output** view.
112
+ * Sets the collection of generated prompt outputs to render in the Output view.
94
113
  */
95
114
  set promptOutputs(value) {
96
115
  this.service.promptOutputs = value;
97
116
  }
98
117
  /**
99
- * Specifies if the rating buttons appear in each **Output** view card.
100
- * By default, the rating buttons do not appear.
118
+ * Specifies whether the rating buttons appear in each Output view card.
119
+ * The rating buttons do not appear by default.
101
120
  * @default false
102
121
  */
103
122
  set showOutputRating(value) {
104
123
  this.service.showOutputRating = value;
105
124
  }
125
+ /**
126
+ * Specifies whether the Stop generation button appears in the Output view.
127
+ * The Stop generation button does not appear by default.
128
+ * @default false
129
+ */
130
+ streaming = false;
131
+ /**
132
+ * Sets the settings for the Speech to Text button in the Prompt view
133
+ * ([see example](slug:configuration_aiprompt#enabling-speech-to-text)).
134
+ */
135
+ set speechToTextButton(settings) {
136
+ if (settings) {
137
+ this.service.speechToTextButton = settings;
138
+ }
139
+ else {
140
+ this.service.speechToTextButton = false;
141
+ }
142
+ }
143
+ /**
144
+ * Sets the settings for the TextArea in the Prompt view
145
+ * ([see example](slug:configuration_aiprompt#configuring-the-prompt-text-area)).
146
+ */
147
+ set textAreaSettings(settings) {
148
+ this.service.textAreaSettings = settings;
149
+ }
150
+ /**
151
+ * Sets the SVG icon for the Generate button in the Prompt view.
152
+ */
153
+ generateButtonSVGIcon = sparklesIcon;
154
+ /**
155
+ * Sets the icon for the Generate button in the Prompt view.
156
+ * @default 'sparkles'
157
+ */
158
+ generateButtonIcon = 'sparkles';
159
+ /**
160
+ * Sets the disabled state for the Generate button in the Prompt view.
161
+ * @default false
162
+ */
163
+ disabledGenerateButton = false;
106
164
  /**
107
165
  * Fires when the `activeView` property is updated.
108
166
  * Use this event for two-way binding of the `activeView` property.
109
167
  */
110
168
  activeViewChange = new EventEmitter();
111
169
  /**
112
- * Fires when the user clicks the **Generate** button in the **Prompt** view or the **Retry** button in the **Output** view.
170
+ * Fires when you click the Generate button in the Prompt view or the Retry button in the Output view.
113
171
  * Use the event's `isRetry` field to determine the source element.
114
172
  */
115
173
  promptRequest = new EventEmitter();
116
174
  /**
117
- * Fires when the user clicks a **Command** view command.
175
+ * Fires when you click a Command view command.
118
176
  * The event data contains the selected command.
119
177
  */
120
178
  commandExecute = new EventEmitter();
121
179
  /**
122
- * Fires when the user clicks a **Copy** button in any **Output** view card.
180
+ * Fires when you click a Copy button in any Output view card.
123
181
  */
124
182
  outputCopy = new EventEmitter();
125
183
  /**
126
- * Fires when the user clicks a rating button in any **Output** view card.
184
+ * Fires when you click a rating button in any Output view card.
127
185
  */
128
186
  outputRatingChange = new EventEmitter();
187
+ /**
188
+ * Fires when you click the Stop Generation button in the Output view.
189
+ */
190
+ promptRequestCancel = new EventEmitter();
191
+ ngOnInit() {
192
+ const aiPromptElement = this.element.nativeElement;
193
+ this.subs.add(this.renderer.listen(aiPromptElement, 'keydown', (event) => {
194
+ if (event.key === 'Escape') {
195
+ this.promptRequestCancel.emit();
196
+ }
197
+ }));
198
+ }
199
+ ngOnChanges(changes) {
200
+ if (changes['streaming'] && changes['streaming'].currentValue === true) {
201
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
202
+ this.fabButton?.focus();
203
+ });
204
+ }
205
+ }
206
+ ngAfterContentChecked() {
207
+ if (this.outputTemplate !== this.service.outputTemplate) {
208
+ this.service.outputTemplate = this.outputTemplate;
209
+ }
210
+ if (this.outputBodyTemplate !== this.service.outputBodyTemplate) {
211
+ this.service.outputBodyTemplate = this.outputBodyTemplate;
212
+ }
213
+ }
129
214
  ngAfterViewInit() {
130
215
  this.ngZone.runOutsideAngular(() => {
131
216
  this.service.aiPrompt = this;
@@ -159,12 +244,24 @@ export class AIPromptComponent {
159
244
  * @hidden
160
245
  */
161
246
  outputIcon = commentIcon;
247
+ /**
248
+ * @hidden
249
+ */
250
+ fabStopGenerationSVGIcon = stopSmIcon;
162
251
  /**
163
252
  * @hidden
164
253
  */
165
254
  get viewsArray() {
166
255
  return this.views?.toArray();
167
256
  }
257
+ /**
258
+ * @hidden
259
+ */
260
+ fabPositionMode = 'absolute';
261
+ /**
262
+ * @hidden
263
+ */
264
+ fabAlignment = { vertical: 'bottom', horizontal: 'end' };
168
265
  direction;
169
266
  _activeView = 0;
170
267
  /**
@@ -200,8 +297,8 @@ export class AIPromptComponent {
200
297
  };
201
298
  this.promptRequest.emit(eventArgs);
202
299
  }
203
- 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: [
300
+ 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 }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
301
+ 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
302
  LocalizationService,
206
303
  AIPromptService,
207
304
  ToolbarNavigationService,
@@ -209,7 +306,7 @@ export class AIPromptComponent {
209
306
  provide: L10N_PREFIX,
210
307
  useValue: 'kendo.aiprompt'
211
308
  }
212
- ], queries: [{ propertyName: "toolbarActionsTemplate", first: true, predicate: AIPromptToolbarActionsDirective, descendants: true }, { propertyName: "views", predicate: BaseView }], exportAs: ["kendoAIPrompt"], ngImport: i0, template: `
309
+ ], 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: `
213
310
  <ng-container kendoAIPromptLocalizedMessages
214
311
  i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
215
312
  promptView="Ask AI"
@@ -228,7 +325,9 @@ export class AIPromptComponent {
228
325
  i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
229
326
  outputRetryTitle="Generated with AI"
230
327
  i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
231
- promptSuggestions="Prompt suggestions">
328
+ promptSuggestions="Prompt suggestions"
329
+ i18n-speechToTextButton="kendo.aiprompt.speechToTextButton|The aria-label for the Speech to Text button."
330
+ speechToTextButton="Voice input">
232
331
  </ng-container>
233
332
  <div class="k-prompt-header">
234
333
  <div class="k-toolbar-flat k-toolbar k-toolbar-md"
@@ -253,6 +352,16 @@ export class AIPromptComponent {
253
352
  </div>
254
353
  </div>
255
354
  <div class="k-prompt-content">
355
+ <kendo-floatingactionbutton #fabButton *ngIf="streaming && selectedView?.viewType === 'output'"
356
+ class="k-prompt-stop-fab"
357
+ buttonClass="k-generating k-active"
358
+ [positionMode]="fabPositionMode"
359
+ [align]="fabAlignment"
360
+ [svgIcon]="fabStopGenerationSVGIcon"
361
+ icon="stop"
362
+ (click)="promptRequestCancel.emit()"
363
+ >
364
+ </kendo-floatingactionbutton>
256
365
  <div class="k-prompt-view">
257
366
  <ng-container *ngTemplateOutlet="viewTemplate">
258
367
  </ng-container>
@@ -265,12 +374,16 @@ export class AIPromptComponent {
265
374
  type="button"
266
375
  themeColor="primary"
267
376
  rounded="full"
268
- [svgIcon]="sparklesIcon"
269
- icon="sparkles"
377
+ [attr.title]="messageFor('generateOutput')"
378
+ [attr.aria-label]="messageFor('generateOutput')"
379
+ [attr.aria-disabled]="disabledGenerateButton"
380
+ [svgIcon]="generateButtonSVGIcon"
381
+ [icon]="generateButtonIcon"
382
+ [disabled]="disabledGenerateButton"
270
383
  (click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
271
384
  </div>
272
385
  </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"] }] });
386
+ `, 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
387
  }
275
388
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptComponent, decorators: [{
276
389
  type: Component,
@@ -305,7 +418,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
305
418
  i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
306
419
  outputRetryTitle="Generated with AI"
307
420
  i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
308
- promptSuggestions="Prompt suggestions">
421
+ promptSuggestions="Prompt suggestions"
422
+ i18n-speechToTextButton="kendo.aiprompt.speechToTextButton|The aria-label for the Speech to Text button."
423
+ speechToTextButton="Voice input">
309
424
  </ng-container>
310
425
  <div class="k-prompt-header">
311
426
  <div class="k-toolbar-flat k-toolbar k-toolbar-md"
@@ -330,6 +445,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
330
445
  </div>
331
446
  </div>
332
447
  <div class="k-prompt-content">
448
+ <kendo-floatingactionbutton #fabButton *ngIf="streaming && selectedView?.viewType === 'output'"
449
+ class="k-prompt-stop-fab"
450
+ buttonClass="k-generating k-active"
451
+ [positionMode]="fabPositionMode"
452
+ [align]="fabAlignment"
453
+ [svgIcon]="fabStopGenerationSVGIcon"
454
+ icon="stop"
455
+ (click)="promptRequestCancel.emit()"
456
+ >
457
+ </kendo-floatingactionbutton>
333
458
  <div class="k-prompt-view">
334
459
  <ng-container *ngTemplateOutlet="viewTemplate">
335
460
  </ng-container>
@@ -342,27 +467,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
342
467
  type="button"
343
468
  themeColor="primary"
344
469
  rounded="full"
345
- [svgIcon]="sparklesIcon"
346
- icon="sparkles"
470
+ [attr.title]="messageFor('generateOutput')"
471
+ [attr.aria-label]="messageFor('generateOutput')"
472
+ [attr.aria-disabled]="disabledGenerateButton"
473
+ [svgIcon]="generateButtonSVGIcon"
474
+ [icon]="generateButtonIcon"
475
+ [disabled]="disabledGenerateButton"
347
476
  (click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
348
477
  </div>
349
478
  </div>
350
479
  `,
351
480
  standalone: true,
352
- imports: [LocalizedMessagesDirective, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet]
481
+ imports: [LocalizedMessagesDirective, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet, FloatingActionButtonComponent]
353
482
  }]
354
- }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }, { type: i3.ToolbarNavigationService }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
483
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }, { type: i3.ToolbarNavigationService }, { type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { hostClasses: [{
355
484
  type: HostBinding,
356
485
  args: ['class.k-prompt']
357
486
  }], dirAttr: [{
358
487
  type: HostBinding,
359
488
  args: ['attr.dir']
489
+ }], fabButton: [{
490
+ type: ViewChild,
491
+ args: ['fabButton']
360
492
  }], views: [{
361
493
  type: ContentChildren,
362
494
  args: [BaseView]
363
495
  }], toolbarActionsTemplate: [{
364
496
  type: ContentChild,
365
497
  args: [AIPromptToolbarActionsDirective]
498
+ }], outputTemplate: [{
499
+ type: ContentChild,
500
+ args: [AIPromptOutputTemplateDirective]
501
+ }], outputBodyTemplate: [{
502
+ type: ContentChild,
503
+ args: [AIPromptOutputBodyTemplateDirective]
366
504
  }], activeView: [{
367
505
  type: Input
368
506
  }], promptCommands: [{
@@ -373,6 +511,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
373
511
  type: Input
374
512
  }], showOutputRating: [{
375
513
  type: Input
514
+ }], streaming: [{
515
+ type: Input
516
+ }], speechToTextButton: [{
517
+ type: Input
518
+ }], textAreaSettings: [{
519
+ type: Input
520
+ }], generateButtonSVGIcon: [{
521
+ type: Input
522
+ }], generateButtonIcon: [{
523
+ type: Input
524
+ }], disabledGenerateButton: [{
525
+ type: Input
376
526
  }], activeViewChange: [{
377
527
  type: Output
378
528
  }], promptRequest: [{
@@ -383,4 +533,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
383
533
  type: Output
384
534
  }], outputRatingChange: [{
385
535
  type: Output
536
+ }], promptRequestCancel: [{
537
+ type: Output
386
538
  }] } });
@@ -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,
@@ -45,8 +45,12 @@ export class Messages extends ComponentMessages {
45
45
  * Sets the title of the **Prompt suggestions** button.
46
46
  */
47
47
  promptSuggestions;
48
+ /**
49
+ * Sets the aria-label for the **Speech to Text** button.
50
+ */
51
+ speechToTextButton;
48
52
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
49
- 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 });
53
+ 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 });
50
54
  }
51
55
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Messages, decorators: [{
52
56
  type: Directive
@@ -68,4 +72,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
68
72
  type: Input
69
73
  }], promptSuggestions: [{
70
74
  type: Input
75
+ }], speechToTextButton: [{
76
+ type: Input
71
77
  }] } });
@@ -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 }]; } });