@progress/kendo-vue-conversational-ui 7.0.0-develop.3 → 7.0.0-develop.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai-prompt/AIPrompt.js +1 -1
- package/ai-prompt/AIPrompt.mjs +23 -10
- package/ai-prompt/AIPromptContent.js +1 -1
- package/ai-prompt/AIPromptContent.mjs +40 -9
- package/ai-prompt/AIPromptHeader.js +1 -1
- package/ai-prompt/AIPromptHeader.mjs +0 -1
- package/ai-prompt/views/AIPromptCommandsView.js +1 -1
- package/ai-prompt/views/AIPromptCommandsView.mjs +25 -23
- package/ai-prompt/views/AIPromptOutputView.js +1 -1
- package/ai-prompt/views/AIPromptOutputView.mjs +147 -108
- package/ai-prompt/views/AIPromptView.js +2 -1
- package/ai-prompt/views/AIPromptView.mjs +85 -55
- package/ai-prompt/views/constants.js +8 -0
- package/ai-prompt/views/constants.mjs +25 -0
- package/chat/components/SuggestionGroup.js +8 -0
- package/chat/components/SuggestionGroup.mjs +54 -0
- package/dist/cdn/js/kendo-vue-conversational-ui.js +1 -1
- package/index.d.mts +108 -6
- package/index.d.ts +108 -6
- package/index.js +1 -1
- package/index.mjs +21 -18
- package/package.json +7 -7
|
@@ -5,29 +5,28 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
9
|
-
import { AIPromptContent as
|
|
10
|
-
import { AIPromptFooter as
|
|
11
|
-
import {
|
|
12
|
-
import { TextArea as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
import { defineComponent as A, createVNode as e, h as u, mergeProps as P, isVNode as R } from "vue";
|
|
9
|
+
import { AIPromptContent as b } from "../AIPromptContent.mjs";
|
|
10
|
+
import { AIPromptFooter as V } from "../AIPromptFooter.mjs";
|
|
11
|
+
import { promptViewDefaults as v } from "./constants.mjs";
|
|
12
|
+
import { TextArea as T } from "@progress/kendo-vue-inputs";
|
|
13
|
+
import { Button as k, SpeechToTextButton as B } from "@progress/kendo-vue-buttons";
|
|
14
|
+
import { sparklesIcon as C } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { AIPromptViewRender as j } from "./AIPromptViewRender.mjs";
|
|
16
|
+
import { AIPromptExpander as O } from "../AIPromptExpander.mjs";
|
|
17
|
+
import { SuggestionGroup as $ } from "../../chat/components/SuggestionGroup.mjs";
|
|
18
|
+
import { templateRendering as m, getListeners as c, getTemplate as d } from "@progress/kendo-vue-common";
|
|
19
|
+
function h(t) {
|
|
20
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !R(t);
|
|
19
21
|
}
|
|
20
|
-
const
|
|
21
|
-
name: "prompt-view",
|
|
22
|
-
buttonText: "Ask AI",
|
|
23
|
-
buttonIcon: m
|
|
24
|
-
}, q = /* @__PURE__ */ I({
|
|
22
|
+
const K = /* @__PURE__ */ A({
|
|
25
23
|
name: "KendoAIPromptView",
|
|
26
24
|
props: {
|
|
27
25
|
promptInput: [Object, String],
|
|
28
26
|
generateButton: [Object, String],
|
|
29
27
|
promptValue: String,
|
|
30
|
-
promptSuggestions: Array
|
|
28
|
+
promptSuggestions: Array,
|
|
29
|
+
enableSpeechToText: [Boolean, Object]
|
|
31
30
|
},
|
|
32
31
|
inject: {
|
|
33
32
|
kendoAIPrompt: {
|
|
@@ -46,29 +45,53 @@ const b = {
|
|
|
46
45
|
},
|
|
47
46
|
methods: {
|
|
48
47
|
handleOnRequest() {
|
|
49
|
-
this.kendoAIPrompt.onPromptRequest && this.kendoAIPrompt.onPromptRequest.call(null, this.
|
|
48
|
+
this.kendoAIPrompt.onPromptRequest && this.kendoAIPrompt.onPromptRequest.call(null, this.computedValue), this.value = "";
|
|
50
49
|
},
|
|
51
50
|
handleSuggestionSelect(t) {
|
|
52
51
|
this.value = t;
|
|
53
52
|
},
|
|
54
53
|
onTextChange(t) {
|
|
55
54
|
this.value = t.value;
|
|
55
|
+
},
|
|
56
|
+
onSpeechResult(t) {
|
|
57
|
+
if (t.isFinal && t.alternatives.length > 0) {
|
|
58
|
+
const o = t.alternatives[0].transcript, n = this.value, r = n && !n.endsWith(" ") && !n.endsWith(`
|
|
59
|
+
`);
|
|
60
|
+
this.value = n + (r ? " " : "") + o;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
onSpeechStart() {
|
|
64
|
+
},
|
|
65
|
+
onSpeechEnd() {
|
|
66
|
+
},
|
|
67
|
+
getButtonDisabledState() {
|
|
68
|
+
const t = this.$props.promptValue !== void 0 ? this.$props.promptValue : this.value;
|
|
69
|
+
return !(t != null && t.trim());
|
|
56
70
|
}
|
|
57
71
|
},
|
|
58
72
|
render() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = this.$props,
|
|
73
|
+
const t = "Generate", {
|
|
74
|
+
promptSuggestions: o,
|
|
75
|
+
enableSpeechToText: n
|
|
76
|
+
} = this.$props, r = m.call(this, this.$props.promptInput, c.call(this)), f = () => n ? e("div", {
|
|
77
|
+
class: "k-input-suffix k-input-suffix-horizontal"
|
|
78
|
+
}, [e(B, P({
|
|
79
|
+
fillMode: "flat",
|
|
80
|
+
onStart: this.onSpeechStart,
|
|
81
|
+
onEnd: this.onSpeechEnd,
|
|
82
|
+
onResult: this.onSpeechResult
|
|
83
|
+
}, typeof n == "object" ? n : {}), null)]) : null, g = e(T, {
|
|
63
84
|
value: this.computedValue,
|
|
64
|
-
|
|
85
|
+
onInput: this.onTextChange,
|
|
65
86
|
placeholder: "Ask or generate content with AI ...",
|
|
66
|
-
rows: 2
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
87
|
+
rows: 2,
|
|
88
|
+
class: "!k-flex-col",
|
|
89
|
+
inputSuffix: f
|
|
90
|
+
}, null), S = d.call(this, {
|
|
91
|
+
h: u,
|
|
92
|
+
template: r,
|
|
93
|
+
defaultRendering: g
|
|
94
|
+
}), I = m.call(this, this.$props.generateButton, c.call(this)), x = e(k, {
|
|
72
95
|
type: "button",
|
|
73
96
|
themeColor: "primary",
|
|
74
97
|
fillMode: "solid",
|
|
@@ -76,37 +99,44 @@ const b = {
|
|
|
76
99
|
rounded: "full",
|
|
77
100
|
size: "medium",
|
|
78
101
|
onClick: this.handleOnRequest,
|
|
102
|
+
disabled: this.getButtonDisabledState(),
|
|
79
103
|
title: "Generate",
|
|
80
|
-
svgIcon:
|
|
81
|
-
},
|
|
82
|
-
default: () => [
|
|
83
|
-
}),
|
|
84
|
-
h:
|
|
85
|
-
template:
|
|
86
|
-
defaultRendering:
|
|
104
|
+
svgIcon: C
|
|
105
|
+
}, h(t) ? t : {
|
|
106
|
+
default: () => [t]
|
|
107
|
+
}), i = d.call(this, {
|
|
108
|
+
h: u,
|
|
109
|
+
template: I,
|
|
110
|
+
defaultRendering: x
|
|
87
111
|
});
|
|
88
|
-
return e(
|
|
89
|
-
name:
|
|
112
|
+
return e(j, {
|
|
113
|
+
name: v.name
|
|
90
114
|
}, {
|
|
91
|
-
default: () =>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
default: () => {
|
|
116
|
+
var s, a;
|
|
117
|
+
return [e(b, {
|
|
118
|
+
streaming: (s = this.kendoAIPrompt) == null ? void 0 : s.streaming,
|
|
119
|
+
onCancel: (a = this.kendoAIPrompt) == null ? void 0 : a.onCancel
|
|
120
|
+
}, {
|
|
121
|
+
default: () => [S, o && o.length > 0 && e(O, {
|
|
122
|
+
title: "Prompt Suggestions"
|
|
123
|
+
}, {
|
|
124
|
+
default: () => [e($, {
|
|
125
|
+
suggestions: o.map((p, l) => ({
|
|
126
|
+
id: l,
|
|
127
|
+
text: p,
|
|
128
|
+
description: p
|
|
129
|
+
})),
|
|
130
|
+
onSuggestionClick: (p, l) => this.handleSuggestionSelect(l.text)
|
|
131
|
+
}, null)]
|
|
132
|
+
})]
|
|
133
|
+
}), e(V, null, h(i) ? i : {
|
|
134
|
+
default: () => [i]
|
|
135
|
+
})];
|
|
136
|
+
}
|
|
106
137
|
});
|
|
107
138
|
}
|
|
108
139
|
});
|
|
109
140
|
export {
|
|
110
|
-
|
|
111
|
-
b as promptViewDefaults
|
|
141
|
+
K as AIPromptView
|
|
112
142
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@progress/kendo-svg-icons"),e={name:"Output view",buttonText:"Output",buttonIcon:t.commentIcon},o={name:"Commands view",buttonIcon:t.moreHorizontalIcon},n={name:"prompt-view",buttonText:"Ask AI",buttonIcon:t.sparklesIcon};exports.commandsViewDefaults=o;exports.outputViewDefaults=e;exports.promptViewDefaults=n;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { commentIcon as t, moreHorizontalIcon as o, sparklesIcon as n } from "@progress/kendo-svg-icons";
|
|
9
|
+
const m = {
|
|
10
|
+
name: "Output view",
|
|
11
|
+
buttonText: "Output",
|
|
12
|
+
buttonIcon: t
|
|
13
|
+
}, u = {
|
|
14
|
+
name: "Commands view",
|
|
15
|
+
buttonIcon: o
|
|
16
|
+
}, c = {
|
|
17
|
+
name: "prompt-view",
|
|
18
|
+
buttonText: "Ask AI",
|
|
19
|
+
buttonIcon: n
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
u as commandsViewDefaults,
|
|
23
|
+
m as outputViewDefaults,
|
|
24
|
+
c as promptViewDefaults
|
|
25
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("vue"),r=require("@progress/kendo-vue-common"),t=d.defineComponent({name:"KendoSuggestionGroup",props:{suggestions:{type:Array,required:!0},onSuggestionClick:{type:Function,required:!0}},methods:{handleSuggestionClick(i,e){e.disabled||this.onSuggestionClick(i,e)},handleKeyDown(i,e){(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this.onSuggestionClick(i,e))}},render(){const{suggestions:i}=this.$props;return d.createVNode("div",{role:"group",class:"k-suggestion-group"},[i.map(e=>d.createVNode("span",{role:"button",tabindex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:o=>!e.disabled&&this.handleSuggestionClick(o,e),onKeydown:o=>!e.disabled&&this.handleKeyDown(o,e),key:e.id,title:e.description,class:r.classNames("k-suggestion",{"k-disabled":e.disabled})},[e.text]))])}});exports.SuggestionGroup=t;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { defineComponent as r, createVNode as o } from "vue";
|
|
9
|
+
import { classNames as a } from "@progress/kendo-vue-common";
|
|
10
|
+
const n = /* @__PURE__ */ r({
|
|
11
|
+
name: "KendoSuggestionGroup",
|
|
12
|
+
props: {
|
|
13
|
+
suggestions: {
|
|
14
|
+
type: Array,
|
|
15
|
+
required: !0
|
|
16
|
+
},
|
|
17
|
+
onSuggestionClick: {
|
|
18
|
+
type: Function,
|
|
19
|
+
required: !0
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
methods: {
|
|
23
|
+
handleSuggestionClick(i, e) {
|
|
24
|
+
e.disabled || this.onSuggestionClick(i, e);
|
|
25
|
+
},
|
|
26
|
+
handleKeyDown(i, e) {
|
|
27
|
+
(i.key === "Enter" || i.key === " ") && (i.preventDefault(), this.onSuggestionClick(i, e));
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
render() {
|
|
31
|
+
const {
|
|
32
|
+
suggestions: i
|
|
33
|
+
} = this.$props;
|
|
34
|
+
return o("div", {
|
|
35
|
+
role: "group",
|
|
36
|
+
class: "k-suggestion-group"
|
|
37
|
+
}, [i.map((e) => o("span", {
|
|
38
|
+
role: "button",
|
|
39
|
+
tabindex: e.disabled ? -1 : 0,
|
|
40
|
+
"aria-label": e.description,
|
|
41
|
+
"aria-disabled": e.disabled,
|
|
42
|
+
onClick: (d) => !e.disabled && this.handleSuggestionClick(d, e),
|
|
43
|
+
onKeydown: (d) => !e.disabled && this.handleKeyDown(d, e),
|
|
44
|
+
key: e.id,
|
|
45
|
+
title: e.description,
|
|
46
|
+
class: a("k-suggestion", {
|
|
47
|
+
"k-disabled": e.disabled
|
|
48
|
+
})
|
|
49
|
+
}, [e.text]))]);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
n as SuggestionGroup
|
|
54
|
+
};
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-vue-inputs"),require("@progress/kendo-svg-icons"),require("@progress/kendo-vue-layout"),require("@progress/kendo-vue-intl")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common","@progress/kendo-vue-buttons","@progress/kendo-vue-inputs","@progress/kendo-svg-icons","@progress/kendo-vue-layout","@progress/kendo-vue-intl"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueConversationalUi={},e.Vue,e.KendoVueCommon,e.KendoVueButtons,e.KendoVueInputs,e.KendoSVGIcons,e.KendoVueLayout,e.KendoVueIntl)}(this,(function(e,t,o,n,r,i,a,s){"use strict";function l(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const d=t.defineComponent({name:"KendoAIPromptHeader",props:{activeView:String,toolbarItems:Array,onActiveviewchange:Function},methods:{handleClick(e){this.$emit("activeviewchange",e)}},render(){let e;const{activeView:r,toolbarItems:i}=this.$props;return t.createVNode("div",{class:"k-prompt-header"},[t.createVNode(n.Toolbar,{overflow:"none",keyboardNavigation:!1,class:"k-toolbar-flat"},l(e=i.map((function(e){const i=o.getTemplate.call(this,{h:t.h,template:e.content,defaultRendering:null,additionalProps:{item:e}});return e.content?i:t.createVNode(n.Button,{type:"button",key:e.name,class:o.classNames("k-toolbar-item",{"k-selected":r===e.name}),size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,"aria-hidden":"true",onClick:()=>this.handleClick(e.name)},{default:()=>[e.buttonText]})}),this))?e:{default:()=>[e]})])}}),u=t.defineComponent({name:"KendoAIPromptContent",render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-content"},[t.createVNode("div",{class:"k-prompt-view"},[e])])}}),p=t.defineComponent({name:"KendoAIPromptFooter",render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-footer"},[t.createVNode("div",{class:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},[e])])}}),c=t.defineComponent({name:"KendoAIPromptViewRender",inheritAttrs:!1,props:{name:String},inject:{kendoAIPrompt:{default:null}},render(){const e=o.getDefaultSlots(this);return this.kendoAIPrompt.activeView===this.$props.name?e:null}});function m(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const h=t.defineComponent({name:"KendoAIPromptExpander",props:{title:String},data:()=>({expanded:!0}),methods:{buttonClick(){this.expanded=!this.expanded}},render(){const e=o.getDefaultSlots(this),{title:r}=this.$props;return t.createVNode("div",{class:"k-prompt-expander"},[t.createVNode(n.Button,{type:"button",fillMode:"flat",svgIcon:this.expanded?i.chevronUpIcon:i.chevronDownIcon,title:r,onClick:this.buttonClick},m(r)?r:{default:()=>[r]}),this.expanded&&t.createVNode("div",{class:"k-prompt-expander-content"},[e])])}});function g(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const f={name:"prompt-view",buttonText:"Ask AI",buttonIcon:i.sparklesIcon},v=t.defineComponent({name:"KendoAIPromptView",props:{promptInput:[Object,String],generateButton:[Object,String],promptValue:String,promptSuggestions:Array},inject:{kendoAIPrompt:{default:null}},computed:{computedValue(){return void 0!==this.$props.promptValue?this.$props.promptValue:this.value}},data:()=>({value:""}),methods:{handleOnRequest(){this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,this.value),this.value=""},handleSuggestionSelect(e){this.value=e},onTextChange(e){this.value=e.value}},render(){let e;const a="Generate",{promptSuggestions:s}=this.$props,l=o.templateRendering.call(this,this.$props.promptInput,o.getListeners.call(this)),d=t.createVNode(r.TextArea,{value:this.computedValue,onChange:this.onTextChange,placeholder:"Ask or generate content with AI ...",rows:2},null),m=o.getTemplate.call(this,{h:t.h,template:l,defaultRendering:d}),v=o.templateRendering.call(this,this.$props.generateButton,o.getListeners.call(this)),V=t.createVNode(n.Button,{type:"button",themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:this.handleOnRequest,title:"Generate",svgIcon:i.sparklesIcon},g(a)?a:{default:()=>[a]}),I=o.getTemplate.call(this,{h:t.h,template:v,defaultRendering:V});return t.createVNode(c,{name:f.name},{default:()=>[t.createVNode(u,null,{default:()=>[m,s&&s.length>0&&t.createVNode(h,{title:"Prompt Suggestions"},g(e=s.map((function(e){return t.createVNode("div",{key:e,class:"k-prompt-suggestion",onClick:()=>this.handleSuggestionSelect(e)},[e])}),this))?e:{default:()=>[e]})]}),t.createVNode(p,null,g(I)?I:{default:()=>[I]})]})}}),V="avatar.alt",I="messageList.ariaLabel",k="aIPrompt.noOutputs",y={[V]:"Avatar",[I]:"Message list",[k]:"No output from Ai available"};function C(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}let b=function(e){return e.positive="positive",e.negative="negative",e}({});const A={name:"output-view",buttonText:"Output",buttonIcon:i.commentIcon},P=t.defineComponent({name:"KendoAIPromptOutputView",emits:{copy:null,retry:null,rating:null},props:{outputs:Array,outputCard:[String,Function,Object],showOutputRating:Boolean},inject:{kendoAIPrompt:{default:null},kendoLocalizationService:{default:null}},data:()=>({copiedIndex:-1,copyButtonIcon:i.copyIcon}),methods:{retryPrompt(e){this.$emit("retry",e),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0})},copyToClipboard(e,t){null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),this.copiedIndex=t,this.copyButtonIcon=i.checkIcon,this.$emit("copy",null==e?void 0:e.responseContent),setTimeout((()=>{this.copyButtonIcon=i.copyIcon,this.copiedIndex=-1}),1e3)},outputRating(e,t){this.$emit("rating",e,t),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1})}},render(){let e;const{outputs:r,showOutputRating:l,outputCard:d}=this.$props,p=s.provideLocalizationService(this),m=o.templateRendering.call(this,d,o.getListeners.call(this));return t.createVNode(c,{name:A.name},{default:()=>[t.createVNode(u,null,{default:()=>[t.createVNode("div",{class:"k-card-list"},[r&&r.length>0?r.map((function(e,r){const s=o.getTemplate.call(this,{h:t.h,template:m,defaultRendering:null,additionalProps:{output:e}});return d?s:t.createVNode(a.Card,{key:e.id,class:e.class},{default:()=>[t.createVNode(a.CardHeader,null,{default:()=>[e.title&&t.createVNode(a.CardTitle,null,{default:()=>[e.title]}),e.subTitle&&t.createVNode(a.CardSubtitle,null,{default:()=>[e.subTitle]})]}),t.createVNode(a.CardBody,null,{default:()=>[e.responseContent]}),t.createVNode(a.CardActions,null,{default:()=>[t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:this.copiedIndex===r?this.copyButtonIcon:i.copyIcon,"aria-hidden":"true",onClick:()=>this.copyToClipboard(e,r)},{default:()=>["Copy"]}),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:i.rotateIcon,"aria-hidden":"true",onClick:()=>this.retryPrompt(e,r)},{default:()=>["Retry"]}),l&&t.createVNode("span",{class:"k-spacer"},null),l&&t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:i.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"positive")},null),l&&t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:i.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"negative")},null)]})]})}),this):t.createVNode(a.Card,null,{default:()=>[t.createVNode(a.CardBody,null,C(e=p.toLanguageString(k,y[k]))?e:{default:()=>[e]})]})])]})]})}}),w=t.defineComponent({name:"KendoAIPrompt",props:{activeView:{type:String,required:!0},dir:String,toolbarItems:Array,outputs:Array,promptPlaceholder:String},provide(){return{kendoAIPrompt:this.$data.contextState}},data(){return{contextState:{activeView:this.$props.activeView,onActiveViewChange:this.onActiveViewChange,onPromptRequest:this.onPromptRequest,onCommandExecute:this.onCommandExecute,onStateAction:this.onStateAction}}},watch:{activeView(e){this.contextState.activeView=e}},methods:{onStateAction(e){this.contextState.activeView=e.activeView},onActiveViewChange(e){this.$emit("activeviewchange",e)},onPromptRequest(e,t){this.$emit("promptrequest",e,t)},onCommandExecute(e){this.$emit("commandexecute",e)}},render(){const e=o.getDefaultSlots(this),{toolbarItems:n,dir:r}=this.$props,i=(n||[f,A]).map((e=>{const t=o.templateRendering.call(this,e.content,o.getListeners.call(this));return{...e,content:t}}));return t.createVNode("div",{class:"k-prompt",dir:r},[t.createVNode(d,{activeView:this.contextState.activeView,toolbarItems:i,onActiveviewchange:this.onActiveViewChange},null),e])}}),N={name:"commands-view",buttonIcon:i.moreHorizontalIcon},S=t.defineComponent({name:"KendoAIPromptCommandsView",props:{commands:Array},inject:{kendoAIPrompt:{default:null}},render(){const{commands:e}=this.$props,o=e=>{var t;const o=e.target;(null==(t=o.items)||!t.length)&&this.kendoAIPrompt.onCommandExecute&&(this.$emit("commandexecute",o),this.kendoAIPrompt.onCommandExecute.call(null,o))};return t.createVNode(c,{name:N.name},{default:()=>[t.createVNode(u,null,{default:()=>[t.createVNode("div",{class:"k-prompt-view"},[t.createVNode(a.PanelBar,{onSelect:o,items:e},null)])]})]})}});e.AIPrompt=w,e.AIPromptCommandsView=S,e.AIPromptContent=u,e.AIPromptFooter=p,e.AIPromptHeader=d,e.AIPromptOutputRating=b,e.AIPromptOutputView=P,e.AIPromptView=v,e.AIPromptViewRender=c,e.commandsViewDefaults=N,e.outputViewDefaults=A,e.promptViewDefaults=f}));
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-vue-inputs"),require("@progress/kendo-vue-layout"),require("@progress/kendo-vue-intl")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common","@progress/kendo-vue-buttons","@progress/kendo-svg-icons","@progress/kendo-vue-inputs","@progress/kendo-vue-layout","@progress/kendo-vue-intl"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueConversationalUi={},e.Vue,e.KendoVueCommon,e.KendoVueButtons,e.KendoSVGIcons,e.KendoVueInputs,e.KendoVueLayout,e.KendoVueIntl)}(this,(function(e,t,o,n,i,a,r,l){"use strict";function s(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const d=t.defineComponent({name:"KendoAIPromptHeader",props:{activeView:String,toolbarItems:Array,onActiveviewchange:Function},methods:{handleClick(e){this.$emit("activeviewchange",e)}},render(){let e;const{activeView:i,toolbarItems:a}=this.$props;return t.createVNode("div",{class:"k-prompt-header"},[t.createVNode(n.Toolbar,{overflow:"none",keyboardNavigation:!1,class:"k-toolbar-flat"},s(e=a.map((function(e){const a=o.getTemplate.call(this,{h:t.h,template:e.content,defaultRendering:null,additionalProps:{item:e}});return e.content?a:t.createVNode(n.Button,{type:"button",key:e.name,class:o.classNames("k-toolbar-item",{"k-selected":i===e.name}),size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,onClick:()=>this.handleClick(e.name)},{default:()=>[e.buttonText]})}),this))?e:{default:()=>[e]})])}}),u={name:"Output view",buttonText:"Output",buttonIcon:i.commentIcon},c={name:"Commands view",buttonIcon:i.moreHorizontalIcon},p={name:"prompt-view",buttonText:"Ask AI",buttonIcon:i.sparklesIcon},m=t.defineComponent({name:"KendoAIPrompt",props:{activeView:{type:String,required:!0},dir:String,toolbarItems:Array,outputs:Array,promptPlaceholder:String,streaming:Boolean,loading:Boolean},provide(){return{kendoAIPrompt:this.$data.contextState}},data(){return{contextState:{activeView:this.$props.activeView,streaming:this.$props.streaming,loading:this.$props.loading,onCancel:this.onCancel,onActiveViewChange:this.onActiveViewChange,onPromptRequest:this.onPromptRequest,onCommandExecute:this.onCommandExecute,onStateAction:this.onStateAction}}},watch:{activeView(e){this.contextState.activeView=e},streaming(e){this.contextState.streaming=e},loading(e){this.contextState.loading=e}},methods:{onStateAction(e){this.contextState.activeView=e.activeView},onActiveViewChange(e){this.$emit("activeviewchange",e)},onPromptRequest(e,t){this.$emit("promptrequest",e,t)},onCommandExecute(e){this.$emit("commandexecute",e)},onCancel(){this.$emit("cancel")}},render(){const e=o.getDefaultSlots(this),{toolbarItems:n,dir:i}=this.$props,a=(n||[p,u]).map((e=>{const t=o.templateRendering.call(this,e.content,o.getListeners.call(this));return{...e,content:t}}));return t.createVNode("div",{class:"k-prompt",dir:i},[t.createVNode(d,{activeView:this.contextState.activeView,toolbarItems:a,onActiveviewchange:this.onActiveViewChange},null),e])}}),h=t.defineComponent({name:"KendoAIPromptFooter",render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-footer"},[t.createVNode("div",{class:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},[e])])}}),g=t.defineComponent({name:"KendoAIPromptContent",props:{onCancel:Function,streaming:Boolean},inject:{kendoAIPrompt:{default:null}},computed:{showFloatingButton(){var e;const t=(null==(e=this.kendoAIPrompt)?void 0:e.activeView)===u.name;return this.streaming&&t}},methods:{handleKeyDown(e){"Escape"===e.key&&this.showFloatingButton&&this.onCancel&&(e.preventDefault(),this.$props.onCancel())}},render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-content",onKeydown:this.handleKeyDown},[this.showFloatingButton&&t.createVNode(n.FloatingActionButton,{onClick:this.onCancel,svgIcon:i.stopSmIcon,size:"small",positionMode:"absolute",class:"k-prompt-stop-fab k-generating"},null),t.createVNode("div",{class:"k-prompt-view"},[e])])}}),v=t.defineComponent({name:"KendoAIPromptViewRender",inheritAttrs:!1,props:{name:String},inject:{kendoAIPrompt:{default:null}},render(){const e=o.getDefaultSlots(this);return this.kendoAIPrompt.activeView===this.$props.name?e:null}});function f(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const k=t.defineComponent({name:"KendoAIPromptExpander",props:{title:String},data:()=>({expanded:!0}),methods:{buttonClick(){this.expanded=!this.expanded}},render(){const e=o.getDefaultSlots(this),{title:a}=this.$props;return t.createVNode("div",{class:"k-prompt-expander"},[t.createVNode(n.Button,{type:"button",fillMode:"flat",svgIcon:this.expanded?i.chevronUpIcon:i.chevronDownIcon,title:a,onClick:this.buttonClick},f(a)?a:{default:()=>[a]}),this.expanded&&t.createVNode("div",{class:"k-prompt-expander-content"},[e])])}}),V=t.defineComponent({name:"KendoSuggestionGroup",props:{suggestions:{type:Array,required:!0},onSuggestionClick:{type:Function,required:!0}},methods:{handleSuggestionClick(e,t){t.disabled||this.onSuggestionClick(e,t)},handleKeyDown(e,t){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),this.onSuggestionClick(e,t))}},render(){const{suggestions:e}=this.$props;return t.createVNode("div",{role:"group",class:"k-suggestion-group"},[e.map((e=>t.createVNode("span",{role:"button",tabindex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:t=>!e.disabled&&this.handleSuggestionClick(t,e),onKeydown:t=>!e.disabled&&this.handleKeyDown(t,e),key:e.id,title:e.description,class:o.classNames("k-suggestion",{"k-disabled":e.disabled})},[e.text])))])}});function C(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const I=t.defineComponent({name:"KendoAIPromptView",props:{promptInput:[Object,String],generateButton:[Object,String],promptValue:String,promptSuggestions:Array,enableSpeechToText:[Boolean,Object]},inject:{kendoAIPrompt:{default:null}},computed:{computedValue(){return void 0!==this.$props.promptValue?this.$props.promptValue:this.value}},data:()=>({value:""}),methods:{handleOnRequest(){this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,this.computedValue),this.value=""},handleSuggestionSelect(e){this.value=e},onTextChange(e){this.value=e.value},onSpeechResult(e){if(e.isFinal&&e.alternatives.length>0){const t=e.alternatives[0].transcript,o=this.value,n=o&&!o.endsWith(" ")&&!o.endsWith("\n");this.value=o+(n?" ":"")+t}},onSpeechStart(){},onSpeechEnd(){},getButtonDisabledState(){const e=void 0!==this.$props.promptValue?this.$props.promptValue:this.value;return!(null!=e&&e.trim())}},render(){const e="Generate",{promptSuggestions:r,enableSpeechToText:l}=this.$props,s=o.templateRendering.call(this,this.$props.promptInput,o.getListeners.call(this)),d=t.createVNode(a.TextArea,{value:this.computedValue,onInput:this.onTextChange,placeholder:"Ask or generate content with AI ...",rows:2,class:"!k-flex-col",inputSuffix:()=>l?t.createVNode("div",{class:"k-input-suffix k-input-suffix-horizontal"},[t.createVNode(n.SpeechToTextButton,t.mergeProps({fillMode:"flat",onStart:this.onSpeechStart,onEnd:this.onSpeechEnd,onResult:this.onSpeechResult},"object"==typeof l?l:{}),null)]):null},null),u=o.getTemplate.call(this,{h:t.h,template:s,defaultRendering:d}),c=o.templateRendering.call(this,this.$props.generateButton,o.getListeners.call(this)),m=t.createVNode(n.Button,{type:"button",themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:this.handleOnRequest,disabled:this.getButtonDisabledState(),title:"Generate",svgIcon:i.sparklesIcon},C(e)?e:{default:()=>[e]}),f=o.getTemplate.call(this,{h:t.h,template:c,defaultRendering:m});return t.createVNode(v,{name:p.name},{default:()=>{var e,o;return[t.createVNode(g,{streaming:null==(e=this.kendoAIPrompt)?void 0:e.streaming,onCancel:null==(o=this.kendoAIPrompt)?void 0:o.onCancel},{default:()=>[u,r&&r.length>0&&t.createVNode(k,{title:"Prompt Suggestions"},{default:()=>[t.createVNode(V,{suggestions:r.map(((e,t)=>({id:t,text:e,description:e}))),onSuggestionClick:(e,t)=>this.handleSuggestionSelect(t.text)},null)]})]}),t.createVNode(h,null,C(f)?f:{default:()=>[f]})]}})}}),y="avatar.alt",b="messageList.ariaLabel",A="aIPrompt.noOutputs",S={[y]:"Avatar",[b]:"Message list",[A]:"No output from Ai available"};function N(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}let w=function(e){return e.positive="positive",e.negative="negative",e}({});const P=t.defineComponent({name:"KendoAIPromptOutputView",emits:{copy:null,retry:null,rating:null},props:{outputs:Array,outputCard:Object,showOutputRating:Boolean},inject:{kendoAIPrompt:{default:null},kendoLocalizationService:{default:null}},data:()=>({copiedIndex:-1,copyButtonIcon:i.copyIcon,contentRef:null}),methods:{retryPrompt(e){this.$emit("retry",e),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),this.scrollToTopOutput()},copyToClipboard(e,t){null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),this.copiedIndex=t,this.copyButtonIcon=i.checkIcon,this.$emit("copy",null==e?void 0:e.responseContent),setTimeout((()=>{this.copyButtonIcon=i.copyIcon,this.copiedIndex=-1}),1e3)},outputRating(e,t){this.$emit("rating",e,t),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),this.scrollToTopOutput()},scrollToTopOutput(){var e,t;null==(t=null==(e=this.contentRef)?void 0:e.scrollTo)||t.call(e,{top:0,behavior:"smooth"})}},render(){let e;const{outputs:o,showOutputRating:a,outputCard:s}=this.$props,d=l.provideLocalizationService(this),{header:c,body:p,actions:m}=s||{},h=t.createVNode(r.Card,null,{default:()=>[t.createVNode(r.CardHeader,null,{default:()=>[t.createVNode(r.CardTitle,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}},null)]}),t.createVNode(r.CardSubtitle,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}},null)]})]}),t.createVNode(r.CardBody,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}},null)]}),t.createVNode(r.CardActions,null,{default:()=>[t.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}},null)]})]}),f=null==o?void 0:o.map(((e,o)=>t.createVNode(r.Card,{key:`${e.id}_${o}`,class:e.class},{default:()=>[t.createVNode(r.CardHeader,null,{default:()=>[c?c(e):t.createVNode(t.Fragment,null,[e.title&&t.createVNode(r.CardTitle,null,{default:()=>[e.title]}),e.subTitle&&t.createVNode(r.CardSubtitle,null,{default:()=>[e.subTitle]})])]}),t.createVNode(r.CardBody,null,{default:()=>[p?p(e):e.responseContent]}),t.createVNode(r.CardActions,null,{default:()=>[m?m(e):t.createVNode(t.Fragment,null,[t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:this.copiedIndex===o?this.copyButtonIcon:i.copyIcon,"aria-hidden":"true",onClick:()=>this.copyToClipboard(e,o)},{default:()=>["Copy"]}),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:i.arrowRotateCwIcon,"aria-hidden":"true",onClick:()=>this.retryPrompt(e)},{default:()=>["Retry"]}),a&&t.createVNode(t.Fragment,null,[t.createVNode("span",{class:"k-spacer"},null),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:i.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"positive")},null),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:i.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"negative")},null)])])]})]}))),k=t.createVNode(r.Card,null,{default:()=>[t.createVNode(r.CardBody,null,N(e=d.toLanguageString(A,S[A]))?e:{default:()=>[e]})]});return t.createVNode(v,{name:u.name},{default:()=>{var e,o;return[t.createVNode(g,{ref:e=>this.contentRef=e,streaming:null==(e=this.kendoAIPrompt)?void 0:e.streaming,onCancel:null==(o=this.kendoAIPrompt)?void 0:o.onCancel},{default:()=>{var e,o;return[t.createVNode("div",{class:"k-card-list"},[(null==(e=this.kendoAIPrompt)?void 0:e.loading)&&h,f,(!f||0===f.length)&&!(null!=(o=this.kendoAIPrompt)&&o.loading)&&k])]}})]}})}}),x=t.defineComponent({name:"KendoAIPromptCommandsView",props:{commands:Array},inject:{kendoAIPrompt:{default:null}},render(){const{commands:e}=this.$props,o=e=>{var t;const o=e.target;(null==(t=o.items)||!t.length)&&this.kendoAIPrompt.onCommandExecute&&(this.$emit("commandexecute",o),this.kendoAIPrompt.onCommandExecute.call(null,o))};return t.createVNode(v,{name:c.name},{default:()=>{var n,i;return[t.createVNode(g,{streaming:null==(n=this.kendoAIPrompt)?void 0:n.streaming,onCancel:null==(i=this.kendoAIPrompt)?void 0:i.onCancel},{default:()=>[t.createVNode("div",{class:"k-prompt-view"},[t.createVNode(r.PanelBar,{onSelect:o,items:e},null)])]})]}})}});e.AIPrompt=m,e.AIPromptCommandsView=x,e.AIPromptContent=g,e.AIPromptFooter=h,e.AIPromptHeader=d,e.AIPromptOutputRating=w,e.AIPromptOutputView=P,e.AIPromptView=I,e.AIPromptViewRender=v,e.SuggestionGroup=V,e.commandsViewDefaults=c,e.outputViewDefaults=u,e.promptViewDefaults=p}));
|
package/index.d.mts
CHANGED
|
@@ -26,6 +26,8 @@ dir: PropType<string>;
|
|
|
26
26
|
toolbarItems: PropType<AIPromptToolbarItemInterface[]>;
|
|
27
27
|
outputs: PropType<AIPromptOutputInterface[]>;
|
|
28
28
|
promptPlaceholder: PropType<string>;
|
|
29
|
+
streaming: PropType<boolean>;
|
|
30
|
+
loading: PropType<boolean>;
|
|
29
31
|
}>, {}, {
|
|
30
32
|
contextState: AIPromptContextInterface;
|
|
31
33
|
}, {}, {
|
|
@@ -33,6 +35,7 @@ onStateAction(action: StateActionInterface): void;
|
|
|
33
35
|
onActiveViewChange(event: string): void;
|
|
34
36
|
onPromptRequest(prompt?: string, outputItem?: AIPromptOutputInterface): void;
|
|
35
37
|
onCommandExecute(event: AIPromptCommandInterface): void;
|
|
38
|
+
onCancel(): void;
|
|
36
39
|
}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
37
40
|
activeView: {
|
|
38
41
|
type: PropType<string>;
|
|
@@ -42,10 +45,30 @@ dir: PropType<string>;
|
|
|
42
45
|
toolbarItems: PropType<AIPromptToolbarItemInterface[]>;
|
|
43
46
|
outputs: PropType<AIPromptOutputInterface[]>;
|
|
44
47
|
promptPlaceholder: PropType<string>;
|
|
48
|
+
streaming: PropType<boolean>;
|
|
49
|
+
loading: PropType<boolean>;
|
|
45
50
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, () => {
|
|
46
51
|
kendoAIPrompt: any;
|
|
47
52
|
}, true, {}, any>;
|
|
48
53
|
|
|
54
|
+
/**
|
|
55
|
+
* The fields of the AIPromptOutputView card prop.
|
|
56
|
+
*/
|
|
57
|
+
export declare interface AIPromptCardInterface {
|
|
58
|
+
/**
|
|
59
|
+
* Custom template for AIPromptCard header.
|
|
60
|
+
*/
|
|
61
|
+
header?: (props: AIPromptOutputInterface) => any;
|
|
62
|
+
/**
|
|
63
|
+
* Custom template for AIPromptCard body.
|
|
64
|
+
*/
|
|
65
|
+
body?: (props: AIPromptOutputInterface) => any;
|
|
66
|
+
/**
|
|
67
|
+
* Custom template for AIPromptCard actions.
|
|
68
|
+
*/
|
|
69
|
+
actions?: (props: AIPromptOutputInterface) => any;
|
|
70
|
+
}
|
|
71
|
+
|
|
49
72
|
/**
|
|
50
73
|
* An interface for the Command view command.
|
|
51
74
|
*/
|
|
@@ -82,13 +105,26 @@ export declare interface AIPromptCommandsViewProps {
|
|
|
82
105
|
/**
|
|
83
106
|
* @hidden
|
|
84
107
|
*/
|
|
85
|
-
export declare const AIPromptContent: DefineComponent< {
|
|
108
|
+
export declare const AIPromptContent: DefineComponent<ExtractPropTypes< {
|
|
109
|
+
onCancel: PropType<() => void>;
|
|
110
|
+
streaming: PropType<boolean>;
|
|
111
|
+
}>, {}, {}, {
|
|
112
|
+
showFloatingButton(): boolean;
|
|
113
|
+
}, {
|
|
114
|
+
handleKeyDown(event: KeyboardEvent): void;
|
|
115
|
+
}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
116
|
+
onCancel: PropType<() => void>;
|
|
117
|
+
streaming: PropType<boolean>;
|
|
118
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
86
119
|
|
|
87
120
|
/**
|
|
88
121
|
* The AIPrompt context that is passed to the view.
|
|
89
122
|
*/
|
|
90
123
|
declare interface AIPromptContextInterface {
|
|
91
124
|
activeView?: string;
|
|
125
|
+
streaming?: boolean;
|
|
126
|
+
loading?: boolean;
|
|
127
|
+
onCancel?: () => void;
|
|
92
128
|
onPromptRequest?: (prompt?: string, outputItem?: AIPromptOutputInterface) => void;
|
|
93
129
|
onCommandExecute?: (command: AIPromptCommandInterface) => void;
|
|
94
130
|
onActiveViewChange?: (view: string) => void;
|
|
@@ -173,27 +209,29 @@ export declare enum AIPromptOutputRating {
|
|
|
173
209
|
*/
|
|
174
210
|
export declare const AIPromptOutputView: DefineComponent<ExtractPropTypes< {
|
|
175
211
|
outputs: PropType<AIPromptOutputInterface[]>;
|
|
176
|
-
outputCard: PropType<
|
|
212
|
+
outputCard: PropType<AIPromptCardInterface>;
|
|
177
213
|
showOutputRating: PropType<boolean>;
|
|
178
214
|
}>, {}, {
|
|
179
215
|
copiedIndex: number;
|
|
180
216
|
copyButtonIcon: SVGIcon;
|
|
217
|
+
contentRef: any;
|
|
181
218
|
}, {}, {
|
|
182
219
|
retryPrompt(output: AIPromptOutputInterface): void;
|
|
183
220
|
copyToClipboard(output: AIPromptOutputInterface, index: number): void;
|
|
184
221
|
outputRating(output: AIPromptOutputInterface, ratingType: AIPromptOutputRating): void;
|
|
222
|
+
scrollToTopOutput(): void;
|
|
185
223
|
}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
186
224
|
copy: any;
|
|
187
225
|
retry: any;
|
|
188
226
|
rating: any;
|
|
189
227
|
}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
190
228
|
outputs: PropType<AIPromptOutputInterface[]>;
|
|
191
|
-
outputCard: PropType<
|
|
229
|
+
outputCard: PropType<AIPromptCardInterface>;
|
|
192
230
|
showOutputRating: PropType<boolean>;
|
|
193
231
|
}>> & Readonly<{
|
|
194
232
|
onCopy?: (...args: any[] | unknown[]) => any;
|
|
195
|
-
onRating?: (...args: any[] | unknown[]) => any;
|
|
196
233
|
onRetry?: (...args: any[] | unknown[]) => any;
|
|
234
|
+
onRating?: (...args: any[] | unknown[]) => any;
|
|
197
235
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
198
236
|
|
|
199
237
|
/**
|
|
@@ -205,10 +243,13 @@ export declare interface AIPromptOutputViewProps {
|
|
|
205
243
|
*/
|
|
206
244
|
outputs?: AIPromptOutputInterface[];
|
|
207
245
|
/**
|
|
208
|
-
* Represents a template that allows you to define custom Card
|
|
246
|
+
* Represents a template that allows you to define custom Card fields for:
|
|
247
|
+
* header
|
|
248
|
+
* body
|
|
249
|
+
* actions
|
|
209
250
|
* The custom fields will override the default one.
|
|
210
251
|
*/
|
|
211
|
-
outputCard?:
|
|
252
|
+
outputCard?: AIPromptCardInterface;
|
|
212
253
|
/**
|
|
213
254
|
* Specifies if the rating buttons in each card will be rendered.
|
|
214
255
|
* By default, rating buttons are not rendered.
|
|
@@ -254,6 +295,14 @@ export declare interface AIPromptProps {
|
|
|
254
295
|
* The direction of the Prompt.
|
|
255
296
|
*/
|
|
256
297
|
dir?: string;
|
|
298
|
+
/**
|
|
299
|
+
* If true, the prompt is in a streaming state.
|
|
300
|
+
*/
|
|
301
|
+
streaming?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* If true, the prompt is in a loading state.
|
|
304
|
+
*/
|
|
305
|
+
loading?: boolean;
|
|
257
306
|
/**
|
|
258
307
|
* The onActiveViewChange event handler of the Kendo UI for Vue AIPrompt component.
|
|
259
308
|
* Fires when active view is changed. Exposes the name of the new active view as event data.
|
|
@@ -269,6 +318,10 @@ export declare interface AIPromptProps {
|
|
|
269
318
|
* Fires when user clicks the `Generate` button in the Prompt view.
|
|
270
319
|
*/
|
|
271
320
|
onPromptrequest?: (prompt?: string, outputItem?: AIPromptOutputInterface) => void;
|
|
321
|
+
/**
|
|
322
|
+
* Called when the prompt is cancelled.
|
|
323
|
+
*/
|
|
324
|
+
onCancel?: () => void;
|
|
272
325
|
}
|
|
273
326
|
|
|
274
327
|
/**
|
|
@@ -301,6 +354,7 @@ promptInput: PropType<any>;
|
|
|
301
354
|
generateButton: PropType<any>;
|
|
302
355
|
promptValue: PropType<string>;
|
|
303
356
|
promptSuggestions: PropType<string[]>;
|
|
357
|
+
enableSpeechToText: PropType<boolean | object>;
|
|
304
358
|
}>, {}, {
|
|
305
359
|
value: string;
|
|
306
360
|
}, {
|
|
@@ -309,11 +363,16 @@ computedValue(): any;
|
|
|
309
363
|
handleOnRequest(): void;
|
|
310
364
|
handleSuggestionSelect(suggestion: string): void;
|
|
311
365
|
onTextChange(event: any): void;
|
|
366
|
+
onSpeechResult(event: any): void;
|
|
367
|
+
onSpeechStart(): void;
|
|
368
|
+
onSpeechEnd(): void;
|
|
369
|
+
getButtonDisabledState(): boolean;
|
|
312
370
|
}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
313
371
|
promptInput: PropType<any>;
|
|
314
372
|
generateButton: PropType<any>;
|
|
315
373
|
promptValue: PropType<string>;
|
|
316
374
|
promptSuggestions: PropType<string[]>;
|
|
375
|
+
enableSpeechToText: PropType<boolean | object>;
|
|
317
376
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
318
377
|
|
|
319
378
|
/**
|
|
@@ -335,6 +394,18 @@ export declare interface AIPromptViewRenderProps {
|
|
|
335
394
|
name: string;
|
|
336
395
|
}
|
|
337
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Represents the structure of a chat suggestion item that can be displayed above the message input.
|
|
399
|
+
*
|
|
400
|
+
* @interface ChatSuggestion
|
|
401
|
+
*/
|
|
402
|
+
export declare interface ChatSuggestion {
|
|
403
|
+
id: string | number;
|
|
404
|
+
text: string;
|
|
405
|
+
description?: string;
|
|
406
|
+
disabled?: boolean;
|
|
407
|
+
}
|
|
408
|
+
|
|
338
409
|
/**
|
|
339
410
|
* @hidden
|
|
340
411
|
*/
|
|
@@ -375,4 +446,35 @@ declare interface StateActionInterface {
|
|
|
375
446
|
activeView: string;
|
|
376
447
|
}
|
|
377
448
|
|
|
449
|
+
/**
|
|
450
|
+
* @hidden
|
|
451
|
+
*/
|
|
452
|
+
export declare const SuggestionGroup: DefineComponent<ExtractPropTypes< {
|
|
453
|
+
suggestions: {
|
|
454
|
+
type: PropType<ChatSuggestion[]>;
|
|
455
|
+
required: true;
|
|
456
|
+
};
|
|
457
|
+
onSuggestionClick: {
|
|
458
|
+
type: PropType<(event: MouseEvent, suggestion: ChatSuggestion) => void>;
|
|
459
|
+
required: true;
|
|
460
|
+
};
|
|
461
|
+
}>, {}, {}, {}, {
|
|
462
|
+
handleSuggestionClick(event: MouseEvent, suggestion: ChatSuggestion): void;
|
|
463
|
+
handleKeyDown(event: KeyboardEvent, suggestion: ChatSuggestion): void;
|
|
464
|
+
}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
465
|
+
suggestions: {
|
|
466
|
+
type: PropType<ChatSuggestion[]>;
|
|
467
|
+
required: true;
|
|
468
|
+
};
|
|
469
|
+
onSuggestionClick: {
|
|
470
|
+
type: PropType<(event: MouseEvent, suggestion: ChatSuggestion) => void>;
|
|
471
|
+
required: true;
|
|
472
|
+
};
|
|
473
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
474
|
+
|
|
475
|
+
export declare interface SuggestionGroupProps {
|
|
476
|
+
suggestions: ChatSuggestion[];
|
|
477
|
+
onSuggestionClick: (event: MouseEvent, suggestion: ChatSuggestion) => void;
|
|
478
|
+
}
|
|
479
|
+
|
|
378
480
|
export { }
|