@progress/kendo-angular-conversational-ui 14.4.0-develop.9 → 15.0.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.txt +146 -593
- package/ai-prompt/aiprompt.component.d.ts +120 -0
- package/ai-prompt/aiprompt.module.d.ts +25 -0
- package/ai-prompt/common/aiprompt.service.d.ts +26 -0
- package/ai-prompt/common/output-card.component.d.ts +36 -0
- package/ai-prompt/common/toolbar-focusable.directive.d.ts +24 -0
- package/ai-prompt/common/toolbar-navigation.service.d.ts +24 -0
- package/ai-prompt/localization/custom-messages.component.d.ts +17 -0
- package/ai-prompt/localization/localized-messages.directive.d.ts +16 -0
- package/ai-prompt/localization/messages.d.ts +49 -0
- package/ai-prompt/models/command-execute-event.d.ts +23 -0
- package/ai-prompt/models/command.interface.d.ts +30 -0
- package/ai-prompt/models/index.d.ts +10 -0
- package/ai-prompt/models/output-rating-change-event.d.ts +18 -0
- package/ai-prompt/models/prompt-output.interface.d.ts +41 -0
- package/ai-prompt/models/prompt-request-event.d.ts +22 -0
- package/ai-prompt/models/view-type.d.ts +8 -0
- package/ai-prompt/templates/toolbar-actions.template.d.ts +18 -0
- package/ai-prompt/utils.d.ts +19 -0
- package/ai-prompt/views/base-view.d.ts +46 -0
- package/ai-prompt/views/command-view.component.d.ts +23 -0
- package/ai-prompt/views/custom-view.component.d.ts +20 -0
- package/ai-prompt/views/index.d.ts +8 -0
- package/ai-prompt/views/output-view.component.d.ts +22 -0
- package/ai-prompt/views/prompt-view.component.d.ts +47 -0
- package/{api → chat/api}/execute-action-event.d.ts +2 -1
- package/chat/attachment-template.directive.d.ts +1 -1
- package/chat/attachment.component.d.ts +1 -1
- package/chat/builtin-actions.d.ts +1 -1
- package/chat/chat-view.d.ts +1 -1
- package/chat/chat.component.d.ts +3 -3
- package/chat/chat.module.d.ts +3 -3
- package/chat/message-attachments.component.d.ts +1 -1
- package/chat/message-box.component.d.ts +2 -2
- package/chat/message-list.component.d.ts +1 -1
- package/chat/message-template.directive.d.ts +1 -1
- package/chat/message.component.d.ts +1 -1
- package/chat/suggested-actions.component.d.ts +1 -1
- package/conversational-ui.module.d.ts +43 -0
- package/esm2020/ai-prompt/aiprompt.component.mjs +348 -0
- package/esm2020/ai-prompt/aiprompt.module.mjs +79 -0
- package/esm2020/ai-prompt/common/aiprompt.service.mjs +38 -0
- package/esm2020/ai-prompt/common/output-card.component.mjs +199 -0
- package/esm2020/ai-prompt/common/toolbar-focusable.directive.mjs +67 -0
- package/esm2020/ai-prompt/common/toolbar-navigation.service.mjs +55 -0
- package/esm2020/ai-prompt/localization/custom-messages.component.mjs +41 -0
- package/esm2020/ai-prompt/localization/localized-messages.directive.mjs +37 -0
- package/esm2020/ai-prompt/localization/messages.mjs +35 -0
- package/esm2020/ai-prompt/models/prompt-output.interface.mjs +5 -0
- package/esm2020/ai-prompt/models/prompt-request-event.mjs +5 -0
- package/esm2020/ai-prompt/models/view-type.mjs +5 -0
- package/esm2020/ai-prompt/templates/toolbar-actions.template.mjs +27 -0
- package/esm2020/ai-prompt/utils.mjs +26 -0
- package/esm2020/ai-prompt/views/base-view.mjs +89 -0
- package/esm2020/ai-prompt/views/command-view.component.mjs +82 -0
- package/esm2020/ai-prompt/views/custom-view.component.mjs +35 -0
- package/esm2020/ai-prompt/views/index.mjs +8 -0
- package/esm2020/ai-prompt/views/output-view.component.mjs +66 -0
- package/esm2020/ai-prompt/views/prompt-view.component.mjs +146 -0
- package/esm2020/chat/api/attachment.interface.mjs +5 -0
- package/esm2020/chat/api/message.interface.mjs +5 -0
- package/esm2020/chat/api/user.interface.mjs +5 -0
- package/esm2020/chat/attachment-template.directive.mjs +1 -1
- package/esm2020/chat/builtin-actions.mjs +1 -1
- package/esm2020/chat/chat.component.mjs +2 -2
- package/esm2020/chat/chat.module.mjs +3 -3
- package/esm2020/chat/common/models/message-box-options.mjs +5 -0
- package/esm2020/chat/message-box.component.mjs +2 -2
- package/esm2020/chat/message-list.component.mjs +2 -2
- package/esm2020/chat/message-template.directive.mjs +1 -1
- package/esm2020/conversational-ui.module.mjs +50 -0
- package/esm2020/index.mjs +10 -2
- package/esm2020/package-metadata.mjs +2 -2
- package/fesm2015/progress-kendo-angular-conversational-ui.mjs +1414 -152
- package/fesm2020/progress-kendo-angular-conversational-ui.mjs +1302 -46
- package/index.d.ts +11 -3
- package/package.json +10 -7
- package/schematics/ngAdd/index.js +4 -2
- /package/{api → chat/api}/action.interface.d.ts +0 -0
- /package/{api → chat/api}/attachment.interface.d.ts +0 -0
- /package/{api → chat/api}/index.d.ts +0 -0
- /package/{api → chat/api}/message.interface.d.ts +0 -0
- /package/{api → chat/api}/post-message-event.d.ts +0 -0
- /package/{api → chat/api}/preventable-event.d.ts +0 -0
- /package/{api → chat/api}/user.interface.d.ts +0 -0
- /package/{cards → chat/cards}/hero-card.component.d.ts +0 -0
- /package/{common → chat/common}/focused-state.directive.d.ts +0 -0
- /package/{common → chat/common}/models/message-box-options.d.ts +0 -0
- /package/{common → chat/common}/scroll-anchor.directive.d.ts +0 -0
- /package/{common → chat/common}/utils.d.ts +0 -0
- /package/esm2020/{api/attachment.interface.mjs → ai-prompt/models/command-execute-event.mjs} +0 -0
- /package/esm2020/{api/message.interface.mjs → ai-prompt/models/command.interface.mjs} +0 -0
- /package/esm2020/{api/user.interface.mjs → ai-prompt/models/index.mjs} +0 -0
- /package/esm2020/{common/models/message-box-options.mjs → ai-prompt/models/output-rating-change-event.mjs} +0 -0
- /package/esm2020/{api → chat/api}/action.interface.mjs +0 -0
- /package/esm2020/{api → chat/api}/execute-action-event.mjs +0 -0
- /package/esm2020/{api → chat/api}/index.mjs +0 -0
- /package/esm2020/{api → chat/api}/post-message-event.mjs +0 -0
- /package/esm2020/{api → chat/api}/preventable-event.mjs +0 -0
- /package/esm2020/{cards → chat/cards}/hero-card.component.mjs +0 -0
- /package/esm2020/{common → chat/common}/focused-state.directive.mjs +0 -0
- /package/esm2020/{common → chat/common}/scroll-anchor.directive.mjs +0 -0
- /package/esm2020/{common → chat/common}/utils.mjs +0 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
6
|
+
import { BaseView } from './base-view';
|
7
|
+
import { PromptOutput } from '../models/prompt-output.interface';
|
8
|
+
import { AIPromptService } from '../common/aiprompt.service';
|
9
|
+
import * as i0 from "@angular/core";
|
10
|
+
/**
|
11
|
+
* The component for rendering the **Output** view.
|
12
|
+
*/
|
13
|
+
export declare class OutputViewComponent extends BaseView {
|
14
|
+
private service;
|
15
|
+
constructor(localization: LocalizationService, service: AIPromptService);
|
16
|
+
/**
|
17
|
+
* @hidden
|
18
|
+
*/
|
19
|
+
get promptOutputs(): Array<PromptOutput>;
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<OutputViewComponent, never>;
|
21
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<OutputViewComponent, "kendo-aiprompt-output-view", never, {}, {}, never, never>;
|
22
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
6
|
+
import { SVGIcon } from '@progress/kendo-svg-icons';
|
7
|
+
import { BaseView } from './base-view';
|
8
|
+
import { AIPromptService } from '../common/aiprompt.service';
|
9
|
+
import * as i0 from "@angular/core";
|
10
|
+
/**
|
11
|
+
* The component for rendering the **Prompt** view.
|
12
|
+
*/
|
13
|
+
export declare class PromptViewComponent extends BaseView {
|
14
|
+
private service;
|
15
|
+
constructor(localization: LocalizationService, service: AIPromptService);
|
16
|
+
/**
|
17
|
+
* @hidden
|
18
|
+
*/
|
19
|
+
get suggestionsIcons(): {
|
20
|
+
font: string;
|
21
|
+
svg: SVGIcon;
|
22
|
+
};
|
23
|
+
/**
|
24
|
+
* @hidden
|
25
|
+
*/
|
26
|
+
showSuggestions: boolean;
|
27
|
+
/**
|
28
|
+
* @hidden
|
29
|
+
*/
|
30
|
+
contentId: string;
|
31
|
+
/**
|
32
|
+
* @hidden
|
33
|
+
*/
|
34
|
+
get promptSuggestions(): string[];
|
35
|
+
/**
|
36
|
+
*
|
37
|
+
* @hidden
|
38
|
+
*/
|
39
|
+
set textAreaValue(value: string);
|
40
|
+
get textAreaValue(): string;
|
41
|
+
/**
|
42
|
+
* @hidden
|
43
|
+
*/
|
44
|
+
suggestionClick(suggestion: string): void;
|
45
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PromptViewComponent, never>;
|
46
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PromptViewComponent, "kendo-aiprompt-prompt-view", never, {}, {}, never, never>;
|
47
|
+
}
|
@@ -3,7 +3,8 @@
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
5
5
|
import { PreventableEvent } from "./preventable-event";
|
6
|
-
import {
|
6
|
+
import { Message } from "./message.interface";
|
7
|
+
import { Action } from "./action.interface";
|
7
8
|
/**
|
8
9
|
* Arguments for the `executeAction` event. The `executeAction` event fires when the user clicks
|
9
10
|
* a quick action button. Calling `preventDefault()` suppresses the built-in action handler.
|
@@ -11,7 +11,7 @@ import * as i0 from "@angular/core";
|
|
11
11
|
* refer to the article on [message attachments]({% slug attachments_chat %}).
|
12
12
|
*
|
13
13
|
* {% meta height:700 %}
|
14
|
-
* {% embed_file attachments/templates/app.component.ts preview %}
|
14
|
+
* {% embed_file chat/attachments/templates/app.component.ts preview %}
|
15
15
|
* {% embed_file shared/app.module.ts preview %}
|
16
16
|
* {% embed_file shared/main.ts hidden %}
|
17
17
|
* {% endmeta %}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* Copyright © 2024 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 { Attachment } from '
|
5
|
+
import { Attachment } from './api/attachment.interface';
|
6
6
|
import { AttachmentTemplateDirective } from './attachment-template.directive';
|
7
7
|
import * as i0 from "@angular/core";
|
8
8
|
/**
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* Copyright © 2024 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 { Action } from '
|
5
|
+
import { Action } from './api/action.interface';
|
6
6
|
import { ChatComponent } from './chat.component';
|
7
7
|
/**
|
8
8
|
* @hidden
|
package/chat/chat-view.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* Copyright © 2024 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 { Message, User, Action, Attachment, AttachmentLayout } from '
|
5
|
+
import { Message, User, Action, Attachment, AttachmentLayout } from './api';
|
6
6
|
/**
|
7
7
|
* @hidden
|
8
8
|
*/
|
package/chat/chat.component.d.ts
CHANGED
@@ -6,8 +6,8 @@ import { AfterViewInit, ElementRef, EventEmitter, OnDestroy, NgZone } from '@ang
|
|
6
6
|
import { AttachmentTemplateDirective } from './attachment-template.directive';
|
7
7
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
8
8
|
import { MessageTemplateDirective } from './message-template.directive';
|
9
|
-
import { ExecuteActionEvent, Message, SendMessageEvent, User } from '
|
10
|
-
import { MessageBoxType } from '
|
9
|
+
import { ExecuteActionEvent, Message, SendMessageEvent, User } from './api';
|
10
|
+
import { MessageBoxType } from './common/models/message-box-options';
|
11
11
|
import { ChatMessageBoxTemplateDirective } from './message-box.directive';
|
12
12
|
import { MessageBoxComponent } from './message-box.component';
|
13
13
|
import * as i0 from "@angular/core";
|
@@ -15,7 +15,7 @@ import * as i0 from "@angular/core";
|
|
15
15
|
* Represents the Kendo UI Chat component for Angular.
|
16
16
|
*
|
17
17
|
* {% meta height:700 %}
|
18
|
-
* {% embed_file echo/app.component.ts preview %}
|
18
|
+
* {% embed_file chat/echo/app.component.ts preview %}
|
19
19
|
* {% embed_file shared/app.module.ts %}
|
20
20
|
* {% embed_file shared/main.ts hidden %}
|
21
21
|
* {% endmeta %}
|
package/chat/chat.module.d.ts
CHANGED
@@ -7,15 +7,15 @@ import * as i1 from "./chat.component";
|
|
7
7
|
import * as i2 from "./l10n/custom-messages.component";
|
8
8
|
import * as i3 from "./attachment-template.directive";
|
9
9
|
import * as i4 from "./message-template.directive";
|
10
|
-
import * as i5 from "
|
10
|
+
import * as i5 from "./cards/hero-card.component";
|
11
11
|
import * as i6 from "./message-box.directive";
|
12
12
|
import * as i7 from "./attachment.component";
|
13
|
-
import * as i8 from "
|
13
|
+
import * as i8 from "./common/focused-state.directive";
|
14
14
|
import * as i9 from "./l10n/localized-messages.directive";
|
15
15
|
import * as i10 from "./message-attachments.component";
|
16
16
|
import * as i11 from "./message.component";
|
17
17
|
import * as i12 from "./message-list.component";
|
18
|
-
import * as i13 from "
|
18
|
+
import * as i13 from "./common/scroll-anchor.directive";
|
19
19
|
import * as i14 from "./suggested-actions.component";
|
20
20
|
import * as i15 from "./message-box.component";
|
21
21
|
import * as i16 from "@progress/kendo-angular-buttons";
|
@@ -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 { AfterViewInit, ElementRef, NgZone, OnDestroy, QueryList } from '@angular/core';
|
6
|
-
import { Attachment, AttachmentLayout } from '
|
6
|
+
import { Attachment, AttachmentLayout } from './api/attachment.interface';
|
7
7
|
import { ChatItem } from './chat-item';
|
8
8
|
import { AttachmentTemplateDirective } from './attachment-template.directive';
|
9
9
|
import { SVGIcon } from '@progress/kendo-svg-icons';
|
@@ -3,8 +3,8 @@
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
5
5
|
import { ElementRef, EventEmitter } from '@angular/core';
|
6
|
-
import { User } from '
|
7
|
-
import { MessageBoxType } from '
|
6
|
+
import { User } from './api/user.interface';
|
7
|
+
import { MessageBoxType } from './common/models/message-box-options';
|
8
8
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
9
9
|
import { ChatMessageBoxTemplateDirective } from './message-box.directive';
|
10
10
|
import { SVGIcon } from '@progress/kendo-svg-icons';
|
@@ -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 { AfterViewInit, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList, Renderer2 } from '@angular/core';
|
6
|
-
import { Action, ExecuteActionEvent, Message, User } from '
|
6
|
+
import { Action, ExecuteActionEvent, Message, User } from './api';
|
7
7
|
import { ChatItem } from './chat-item';
|
8
8
|
import { ViewItem } from './chat-view';
|
9
9
|
import { AttachmentTemplateDirective } from './attachment-template.directive';
|
@@ -11,7 +11,7 @@ import * as i0 from "@angular/core";
|
|
11
11
|
* refer to the article on [message templates]({% slug message_templates_chat %}).
|
12
12
|
*
|
13
13
|
* {% meta height:700 %}
|
14
|
-
* {% embed_file messages/templates/app.component.ts preview %}
|
14
|
+
* {% embed_file chat/messages/templates/app.component.ts preview %}
|
15
15
|
* {% embed_file shared/app.module.ts preview %}
|
16
16
|
* {% embed_file shared/main.ts hidden %}
|
17
17
|
* {% endmeta %}
|
@@ -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 { ElementRef } from '@angular/core';
|
6
|
-
import { Message } from '
|
6
|
+
import { Message } from './api/message.interface';
|
7
7
|
import { ChatItem } from './chat-item';
|
8
8
|
import { MessageTemplateDirective } from './message-template.directive';
|
9
9
|
import { IntlService } from '@progress/kendo-angular-intl';
|
@@ -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 { ElementRef, EventEmitter, QueryList } from '@angular/core';
|
6
|
-
import { Action } from '
|
6
|
+
import { Action } from './api/action.interface';
|
7
7
|
import { ChatItem } from './chat-item';
|
8
8
|
import * as i0 from "@angular/core";
|
9
9
|
/**
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
import * as i0 from "@angular/core";
|
6
|
+
import * as i1 from "./ai-prompt/aiprompt.module";
|
7
|
+
import * as i2 from "./chat/chat.module";
|
8
|
+
/**
|
9
|
+
* Represents the [NgModule](link:site.data.urls.angular['ngmodules'])
|
10
|
+
* definition for the Conversational UI components.
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
*
|
14
|
+
* ```ts-no-run
|
15
|
+
* // Import the Conversational UI module
|
16
|
+
* import { ConversationalUIModule } from '@progress/kendo-angular-conversational-ui';
|
17
|
+
*
|
18
|
+
* // The browser platform with a compiler
|
19
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
20
|
+
*
|
21
|
+
* import { NgModule } from '@angular/core';
|
22
|
+
*
|
23
|
+
* // Import the app component
|
24
|
+
* import { AppComponent } from './app.component';
|
25
|
+
*
|
26
|
+
* // Define the app module
|
27
|
+
* _@NgModule({
|
28
|
+
* declarations: [AppComponent], // declare app component
|
29
|
+
* imports: [BrowserModule, ConversationalUIModule], // import Conversational UI module
|
30
|
+
* bootstrap: [AppComponent]
|
31
|
+
* })
|
32
|
+
* export class AppModule {}
|
33
|
+
*
|
34
|
+
* // Compile and launch the module
|
35
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
36
|
+
*
|
37
|
+
* ```
|
38
|
+
*/
|
39
|
+
export declare class ConversationalUIModule {
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ConversationalUIModule, never>;
|
41
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ConversationalUIModule, never, never, [typeof i1.AIPromptModule, typeof i2.ChatModule]>;
|
42
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ConversationalUIModule>;
|
43
|
+
}
|
@@ -0,0 +1,348 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
import { Component, ContentChild, ContentChildren, EventEmitter, HostBinding, Input, NgZone, Output, QueryList } from "@angular/core";
|
6
|
+
import { sparklesIcon, commentIcon } from "@progress/kendo-svg-icons";
|
7
|
+
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
8
|
+
import { validatePackage } from "@progress/kendo-licensing";
|
9
|
+
import { BaseView } from "./views/base-view";
|
10
|
+
import { packageMetadata } from "../package-metadata";
|
11
|
+
import { Subscription } from "rxjs";
|
12
|
+
import { AIPromptService } from "./common/aiprompt.service";
|
13
|
+
import { AIPromptToolbarActionsDirective } from "./templates/toolbar-actions.template";
|
14
|
+
import { ToolbarNavigationService } from "./common/toolbar-navigation.service";
|
15
|
+
import * as i0 from "@angular/core";
|
16
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
17
|
+
import * as i2 from "./common/aiprompt.service";
|
18
|
+
import * as i3 from "./common/toolbar-navigation.service";
|
19
|
+
import * as i4 from "@progress/kendo-angular-buttons";
|
20
|
+
import * as i5 from "./localization/localized-messages.directive";
|
21
|
+
import * as i6 from "@angular/common";
|
22
|
+
import * as i7 from "./common/toolbar-focusable.directive";
|
23
|
+
/**
|
24
|
+
* Represents the Kendo UI AIPrompt component for Angular
|
25
|
+
*/
|
26
|
+
export class AIPromptComponent {
|
27
|
+
constructor(localization, service, navigationService, ngZone) {
|
28
|
+
this.localization = localization;
|
29
|
+
this.service = service;
|
30
|
+
this.navigationService = navigationService;
|
31
|
+
this.ngZone = ngZone;
|
32
|
+
this.hostClasses = true;
|
33
|
+
/**
|
34
|
+
* The active view index of the AIPrompt component.
|
35
|
+
*/
|
36
|
+
this.activeView = 0;
|
37
|
+
/**
|
38
|
+
* Fires when the `activeView` property of the component is updated.
|
39
|
+
* Used to provide a two-way binding for the `activeView` property.
|
40
|
+
*/
|
41
|
+
this.activeViewChange = new EventEmitter();
|
42
|
+
/**
|
43
|
+
* Fires each time the user clicks the Prompt view Generate button or the Output view Retry button.
|
44
|
+
* To distinguish the source element, use the event's `isRetry` field.
|
45
|
+
*/
|
46
|
+
this.promptRequest = new EventEmitter();
|
47
|
+
/**
|
48
|
+
* Fires each time the user clicks a Command view command. Exposes the selected command as event data.
|
49
|
+
*/
|
50
|
+
this.commandExecute = new EventEmitter();
|
51
|
+
/**
|
52
|
+
* Fires each time the user clicks any Output view Copy button.
|
53
|
+
*/
|
54
|
+
this.outputCopy = new EventEmitter();
|
55
|
+
/**
|
56
|
+
* Fires each time the user clicks a rating button in any Output view card.
|
57
|
+
*/
|
58
|
+
this.outputRatingChange = new EventEmitter();
|
59
|
+
this.subs = new Subscription();
|
60
|
+
/**
|
61
|
+
* @hidden
|
62
|
+
*/
|
63
|
+
this.sparklesIcon = sparklesIcon;
|
64
|
+
/**
|
65
|
+
* @hidden
|
66
|
+
*/
|
67
|
+
this.outputIcon = commentIcon;
|
68
|
+
validatePackage(packageMetadata);
|
69
|
+
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
70
|
+
this.subs.add(localization.changes.subscribe(({ rtl }) => {
|
71
|
+
this.direction = rtl ? 'rtl' : 'ltr';
|
72
|
+
}));
|
73
|
+
}
|
74
|
+
get dirAttr() {
|
75
|
+
return this.direction;
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* The collection of commands that will be rendered in the Command view.
|
79
|
+
*/
|
80
|
+
set promptCommands(value) {
|
81
|
+
this.service.promptCommands = value;
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* The collection of suggestions that will be rendered in the Prompt view.
|
85
|
+
*/
|
86
|
+
set promptSuggestions(value) {
|
87
|
+
this.service.promptSuggestions = value;
|
88
|
+
}
|
89
|
+
/**
|
90
|
+
* The collection of generated prompt outputs that will be rendered in the Output view.
|
91
|
+
*/
|
92
|
+
set promptOutputs(value) {
|
93
|
+
this.service.promptOutputs = value;
|
94
|
+
}
|
95
|
+
/**
|
96
|
+
* Specifies if the rating buttons in each Output view card will be rendered.
|
97
|
+
* By default, rating buttons are not rendered.
|
98
|
+
*
|
99
|
+
* @default false
|
100
|
+
*/
|
101
|
+
set showOutputRating(value) {
|
102
|
+
this.service.showOutputRating = value;
|
103
|
+
}
|
104
|
+
ngAfterViewInit() {
|
105
|
+
this.ngZone.runOutsideAngular(() => {
|
106
|
+
this.service.aiPrompt = this;
|
107
|
+
this.subs.add(this.service.requestEvent.subscribe(ev => this.promptRequest.emit(ev)));
|
108
|
+
this.subs.add(this.service.executeEvent.subscribe(ev => this.commandExecute.emit(ev)));
|
109
|
+
this.subs.add(this.service.outputCopyEvent.subscribe(ev => this.outputCopy.emit(ev)));
|
110
|
+
this.subs.add(this.service.outputRatingChangeEvent.subscribe(ev => this.outputRatingChange.emit(ev)));
|
111
|
+
});
|
112
|
+
}
|
113
|
+
ngOnDestroy() {
|
114
|
+
this.subs.unsubscribe();
|
115
|
+
}
|
116
|
+
/**
|
117
|
+
* Focuses the first focusable element in the AI Prompt.
|
118
|
+
*/
|
119
|
+
focus() {
|
120
|
+
this.navigationService.focusFirst();
|
121
|
+
}
|
122
|
+
/**
|
123
|
+
* @hidden
|
124
|
+
*/
|
125
|
+
get selectedView() {
|
126
|
+
return this.viewsArray[this.activeView];
|
127
|
+
}
|
128
|
+
/**
|
129
|
+
* @hidden
|
130
|
+
*/
|
131
|
+
get viewsArray() {
|
132
|
+
return this.views?.toArray();
|
133
|
+
}
|
134
|
+
/**
|
135
|
+
* @hidden
|
136
|
+
*/
|
137
|
+
viewChange(idx) {
|
138
|
+
if (idx !== this.activeView) {
|
139
|
+
this.activeView = idx;
|
140
|
+
this.activeViewChange.emit(idx);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
/**
|
144
|
+
* @hidden
|
145
|
+
*/
|
146
|
+
messageFor(text) {
|
147
|
+
return this.localization.get(text);
|
148
|
+
}
|
149
|
+
/**
|
150
|
+
* @hidden
|
151
|
+
*/
|
152
|
+
get viewTemplate() {
|
153
|
+
return this.selectedView.viewType === 'custom' ? this.selectedView?.viewTemplate : this.selectedView?.template;
|
154
|
+
}
|
155
|
+
/**
|
156
|
+
* @hidden
|
157
|
+
*/
|
158
|
+
handleGenerateOutput() {
|
159
|
+
const value = this.service.promptValue;
|
160
|
+
const eventArgs = {
|
161
|
+
prompt: value,
|
162
|
+
sender: this,
|
163
|
+
isRetry: false
|
164
|
+
};
|
165
|
+
this.promptRequest.emit(eventArgs);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
AIPromptComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AIPromptService }, { token: i3.ToolbarNavigationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
169
|
+
AIPromptComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptComponent, selector: "kendo-aiprompt", inputs: { activeView: "activeView", promptCommands: "promptCommands", promptSuggestions: "promptSuggestions", promptOutputs: "promptOutputs", showOutputRating: "showOutputRating" }, outputs: { activeViewChange: "activeViewChange", promptRequest: "promptRequest", commandExecute: "commandExecute", outputCopy: "outputCopy", outputRatingChange: "outputRatingChange" }, host: { properties: { "class.k-prompt": "this.hostClasses", "attr.dir": "this.dirAttr" } }, providers: [
|
170
|
+
LocalizationService,
|
171
|
+
AIPromptService,
|
172
|
+
ToolbarNavigationService,
|
173
|
+
{
|
174
|
+
provide: L10N_PREFIX,
|
175
|
+
useValue: 'kendo.aiprompt'
|
176
|
+
}
|
177
|
+
], queries: [{ propertyName: "toolbarActionsTemplate", first: true, predicate: AIPromptToolbarActionsDirective, descendants: true }, { propertyName: "views", predicate: BaseView }], exportAs: ["kendoAIPrompt"], ngImport: i0, template: `
|
178
|
+
<ng-container kendoAIPromptLocalizedMessages
|
179
|
+
i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
|
180
|
+
promptView="Ask AI"
|
181
|
+
i18n-outputView="kendo.aiprompt.outputView|The Toolbar button text for the Output view."
|
182
|
+
outputView="Output"
|
183
|
+
i18n-generateOutput="kendo.aiprompt.generateOutput|The text for the Generate button in the Prompt view."
|
184
|
+
generateOutput="Generate"
|
185
|
+
i18n-promptPlaceholder="kendo.aiprompt.promptPlaceholder|The placeholder text for the Prompt view textarea."
|
186
|
+
promptPlaceholder="Ask or generate content with AI"
|
187
|
+
i18n-copyOutput="kendo.aiprompt.copyOutput|The Copy button text in each Output view card."
|
188
|
+
copyOutput="Copy"
|
189
|
+
i18n-retryGeneration="kendo.aiprompt.retryGeneration|The Retry button text in each Output view card."
|
190
|
+
retryGeneration="Retry"
|
191
|
+
i18n-outputTitle="kendo.aiprompt.outputTitle|The title of each Output view card."
|
192
|
+
outputTitle="Generated with AI"
|
193
|
+
i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
|
194
|
+
outputRetryTitle="Generated with AI"
|
195
|
+
i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
|
196
|
+
promptSuggestions="Prompt suggestions">
|
197
|
+
</ng-container>
|
198
|
+
<div class="k-prompt-header">
|
199
|
+
<div class="k-toolbar-flat k-toolbar k-toolbar-md"
|
200
|
+
role="toolbar">
|
201
|
+
<button *ngFor="let view of viewsArray; let idx = index"
|
202
|
+
kendoButton
|
203
|
+
kendoAIPromptToolbarFocusable
|
204
|
+
type="button"
|
205
|
+
fillMode="flat"
|
206
|
+
rounded="full"
|
207
|
+
themeColor="primary"
|
208
|
+
[svgIcon]="view.svgIcon"
|
209
|
+
[icon]="view.icon"
|
210
|
+
[selected]="idx === activeView"
|
211
|
+
(click)="viewChange(idx)">
|
212
|
+
{{view.buttonText}}
|
213
|
+
</button>
|
214
|
+
|
215
|
+
<ng-template *ngIf="toolbarActionsTemplate"
|
216
|
+
[ngTemplateOutlet]="toolbarActionsTemplate?.templateRef">
|
217
|
+
</ng-template>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
<div class="k-prompt-content">
|
221
|
+
<div class="k-prompt-view">
|
222
|
+
<ng-container *ngTemplateOutlet="viewTemplate">
|
223
|
+
</ng-container>
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
<div class="k-prompt-footer" *ngIf="selectedView.viewType === 'prompt'">
|
227
|
+
<div class="k-actions k-actions-start k-actions-horizontal k-prompt-actions">
|
228
|
+
<button
|
229
|
+
kendoButton
|
230
|
+
type="button"
|
231
|
+
themeColor="primary"
|
232
|
+
rounded="full"
|
233
|
+
[svgIcon]="sparklesIcon"
|
234
|
+
icon="sparkles"
|
235
|
+
(click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
`, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: i5.LocalizedMessagesDirective, selector: "[kendoAIPromptLocalizedMessages]" }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]" }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
239
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptComponent, decorators: [{
|
240
|
+
type: Component,
|
241
|
+
args: [{
|
242
|
+
exportAs: 'kendoAIPrompt',
|
243
|
+
selector: 'kendo-aiprompt',
|
244
|
+
providers: [
|
245
|
+
LocalizationService,
|
246
|
+
AIPromptService,
|
247
|
+
ToolbarNavigationService,
|
248
|
+
{
|
249
|
+
provide: L10N_PREFIX,
|
250
|
+
useValue: 'kendo.aiprompt'
|
251
|
+
}
|
252
|
+
],
|
253
|
+
template: `
|
254
|
+
<ng-container kendoAIPromptLocalizedMessages
|
255
|
+
i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
|
256
|
+
promptView="Ask AI"
|
257
|
+
i18n-outputView="kendo.aiprompt.outputView|The Toolbar button text for the Output view."
|
258
|
+
outputView="Output"
|
259
|
+
i18n-generateOutput="kendo.aiprompt.generateOutput|The text for the Generate button in the Prompt view."
|
260
|
+
generateOutput="Generate"
|
261
|
+
i18n-promptPlaceholder="kendo.aiprompt.promptPlaceholder|The placeholder text for the Prompt view textarea."
|
262
|
+
promptPlaceholder="Ask or generate content with AI"
|
263
|
+
i18n-copyOutput="kendo.aiprompt.copyOutput|The Copy button text in each Output view card."
|
264
|
+
copyOutput="Copy"
|
265
|
+
i18n-retryGeneration="kendo.aiprompt.retryGeneration|The Retry button text in each Output view card."
|
266
|
+
retryGeneration="Retry"
|
267
|
+
i18n-outputTitle="kendo.aiprompt.outputTitle|The title of each Output view card."
|
268
|
+
outputTitle="Generated with AI"
|
269
|
+
i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
|
270
|
+
outputRetryTitle="Generated with AI"
|
271
|
+
i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
|
272
|
+
promptSuggestions="Prompt suggestions">
|
273
|
+
</ng-container>
|
274
|
+
<div class="k-prompt-header">
|
275
|
+
<div class="k-toolbar-flat k-toolbar k-toolbar-md"
|
276
|
+
role="toolbar">
|
277
|
+
<button *ngFor="let view of viewsArray; let idx = index"
|
278
|
+
kendoButton
|
279
|
+
kendoAIPromptToolbarFocusable
|
280
|
+
type="button"
|
281
|
+
fillMode="flat"
|
282
|
+
rounded="full"
|
283
|
+
themeColor="primary"
|
284
|
+
[svgIcon]="view.svgIcon"
|
285
|
+
[icon]="view.icon"
|
286
|
+
[selected]="idx === activeView"
|
287
|
+
(click)="viewChange(idx)">
|
288
|
+
{{view.buttonText}}
|
289
|
+
</button>
|
290
|
+
|
291
|
+
<ng-template *ngIf="toolbarActionsTemplate"
|
292
|
+
[ngTemplateOutlet]="toolbarActionsTemplate?.templateRef">
|
293
|
+
</ng-template>
|
294
|
+
</div>
|
295
|
+
</div>
|
296
|
+
<div class="k-prompt-content">
|
297
|
+
<div class="k-prompt-view">
|
298
|
+
<ng-container *ngTemplateOutlet="viewTemplate">
|
299
|
+
</ng-container>
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
<div class="k-prompt-footer" *ngIf="selectedView.viewType === 'prompt'">
|
303
|
+
<div class="k-actions k-actions-start k-actions-horizontal k-prompt-actions">
|
304
|
+
<button
|
305
|
+
kendoButton
|
306
|
+
type="button"
|
307
|
+
themeColor="primary"
|
308
|
+
rounded="full"
|
309
|
+
[svgIcon]="sparklesIcon"
|
310
|
+
icon="sparkles"
|
311
|
+
(click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
|
312
|
+
</div>
|
313
|
+
</div>
|
314
|
+
`
|
315
|
+
}]
|
316
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }, { type: i3.ToolbarNavigationService }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
|
317
|
+
type: HostBinding,
|
318
|
+
args: ['class.k-prompt']
|
319
|
+
}], dirAttr: [{
|
320
|
+
type: HostBinding,
|
321
|
+
args: ['attr.dir']
|
322
|
+
}], views: [{
|
323
|
+
type: ContentChildren,
|
324
|
+
args: [BaseView]
|
325
|
+
}], toolbarActionsTemplate: [{
|
326
|
+
type: ContentChild,
|
327
|
+
args: [AIPromptToolbarActionsDirective]
|
328
|
+
}], activeView: [{
|
329
|
+
type: Input
|
330
|
+
}], promptCommands: [{
|
331
|
+
type: Input
|
332
|
+
}], promptSuggestions: [{
|
333
|
+
type: Input
|
334
|
+
}], promptOutputs: [{
|
335
|
+
type: Input
|
336
|
+
}], showOutputRating: [{
|
337
|
+
type: Input
|
338
|
+
}], activeViewChange: [{
|
339
|
+
type: Output
|
340
|
+
}], promptRequest: [{
|
341
|
+
type: Output
|
342
|
+
}], commandExecute: [{
|
343
|
+
type: Output
|
344
|
+
}], outputCopy: [{
|
345
|
+
type: Output
|
346
|
+
}], outputRatingChange: [{
|
347
|
+
type: Output
|
348
|
+
}] } });
|