@progress/kendo-vue-conversational-ui 7.0.0-develop.2 → 7.0.0-develop.4
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 +6 -6
package/ai-prompt/AIPrompt.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),m=require("./AIPromptHeader.js"),a=require("./views/constants.js"),i=require("@progress/kendo-vue-common"),p=o.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(t){this.contextState.activeView=t},streaming(t){this.contextState.streaming=t},loading(t){this.contextState.loading=t}},methods:{onStateAction(t){this.contextState.activeView=t.activeView},onActiveViewChange(t){this.$emit("activeviewchange",t)},onPromptRequest(t,e){this.$emit("promptrequest",t,e)},onCommandExecute(t){this.$emit("commandexecute",t)},onCancel(){this.$emit("cancel")}},render(){const t=i.getDefaultSlots(this),{toolbarItems:e,dir:r}=this.$props,s=(e||[a.promptViewDefaults,a.outputViewDefaults]).map(n=>{const c=i.templateRendering.call(this,n.content,i.getListeners.call(this));return{...n,content:c}});return o.createVNode("div",{class:"k-prompt",dir:r},[o.createVNode(m.AIPromptHeader,{activeView:this.contextState.activeView,toolbarItems:s,onActiveviewchange:this.onActiveViewChange},null),t])}});exports.AIPrompt=p;
|
package/ai-prompt/AIPrompt.mjs
CHANGED
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { defineComponent as s, createVNode as i } from "vue";
|
|
9
9
|
import { AIPromptHeader as c } from "./AIPromptHeader.mjs";
|
|
10
|
-
import { promptViewDefaults as m } from "./views/
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
const g = /* @__PURE__ */ s({
|
|
10
|
+
import { promptViewDefaults as m, outputViewDefaults as p } from "./views/constants.mjs";
|
|
11
|
+
import { getDefaultSlots as h, templateRendering as l, getListeners as d } from "@progress/kendo-vue-common";
|
|
12
|
+
const V = /* @__PURE__ */ s({
|
|
14
13
|
name: "KendoAIPrompt",
|
|
15
14
|
props: {
|
|
16
15
|
activeView: {
|
|
@@ -20,7 +19,9 @@ const g = /* @__PURE__ */ s({
|
|
|
20
19
|
dir: String,
|
|
21
20
|
toolbarItems: Array,
|
|
22
21
|
outputs: Array,
|
|
23
|
-
promptPlaceholder: String
|
|
22
|
+
promptPlaceholder: String,
|
|
23
|
+
streaming: Boolean,
|
|
24
|
+
loading: Boolean
|
|
24
25
|
},
|
|
25
26
|
provide() {
|
|
26
27
|
return {
|
|
@@ -31,6 +32,9 @@ const g = /* @__PURE__ */ s({
|
|
|
31
32
|
return {
|
|
32
33
|
contextState: {
|
|
33
34
|
activeView: this.$props.activeView,
|
|
35
|
+
streaming: this.$props.streaming,
|
|
36
|
+
loading: this.$props.loading,
|
|
37
|
+
onCancel: this.onCancel,
|
|
34
38
|
onActiveViewChange: this.onActiveViewChange,
|
|
35
39
|
onPromptRequest: this.onPromptRequest,
|
|
36
40
|
onCommandExecute: this.onCommandExecute,
|
|
@@ -41,6 +45,12 @@ const g = /* @__PURE__ */ s({
|
|
|
41
45
|
watch: {
|
|
42
46
|
activeView(t) {
|
|
43
47
|
this.contextState.activeView = t;
|
|
48
|
+
},
|
|
49
|
+
streaming(t) {
|
|
50
|
+
this.contextState.streaming = t;
|
|
51
|
+
},
|
|
52
|
+
loading(t) {
|
|
53
|
+
this.contextState.loading = t;
|
|
44
54
|
}
|
|
45
55
|
},
|
|
46
56
|
methods: {
|
|
@@ -55,17 +65,20 @@ const g = /* @__PURE__ */ s({
|
|
|
55
65
|
},
|
|
56
66
|
onCommandExecute(t) {
|
|
57
67
|
this.$emit("commandexecute", t);
|
|
68
|
+
},
|
|
69
|
+
onCancel() {
|
|
70
|
+
this.$emit("cancel");
|
|
58
71
|
}
|
|
59
72
|
},
|
|
60
73
|
render() {
|
|
61
74
|
const t = h(this), {
|
|
62
75
|
toolbarItems: e,
|
|
63
76
|
dir: n
|
|
64
|
-
} = this.$props,
|
|
65
|
-
const
|
|
77
|
+
} = this.$props, a = (e || [m, p]).map((o) => {
|
|
78
|
+
const r = l.call(this, o.content, d.call(this));
|
|
66
79
|
return {
|
|
67
80
|
...o,
|
|
68
|
-
content:
|
|
81
|
+
content: r
|
|
69
82
|
};
|
|
70
83
|
});
|
|
71
84
|
return i("div", {
|
|
@@ -73,11 +86,11 @@ const g = /* @__PURE__ */ s({
|
|
|
73
86
|
dir: n
|
|
74
87
|
}, [i(c, {
|
|
75
88
|
activeView: this.contextState.activeView,
|
|
76
|
-
toolbarItems:
|
|
89
|
+
toolbarItems: a,
|
|
77
90
|
onActiveviewchange: this.onActiveViewChange
|
|
78
91
|
}, null), t]);
|
|
79
92
|
}
|
|
80
93
|
});
|
|
81
94
|
export {
|
|
82
|
-
|
|
95
|
+
V as AIPrompt
|
|
83
96
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("@progress/kendo-vue-common"),s=require("@progress/kendo-svg-icons"),i=require("@progress/kendo-vue-buttons"),r=require("./views/constants.js"),a=e.defineComponent({name:"KendoAIPromptContent",props:{onCancel:Function,streaming:Boolean},inject:{kendoAIPrompt:{default:null}},computed:{showFloatingButton(){var o;const t=((o=this.kendoAIPrompt)==null?void 0:o.activeView)===r.outputViewDefaults.name;return this.streaming&&t}},methods:{handleKeyDown(t){t.key==="Escape"&&this.showFloatingButton&&this.onCancel&&(t.preventDefault(),this.$props.onCancel())}},render(){const t=n.getDefaultSlots(this);return e.createVNode("div",{class:"k-prompt-content",onKeydown:this.handleKeyDown},[this.showFloatingButton&&e.createVNode(i.FloatingActionButton,{onClick:this.onCancel,svgIcon:s.stopSmIcon,size:"small",positionMode:"absolute",class:"k-prompt-stop-fab k-generating"},null),e.createVNode("div",{class:"k-prompt-view"},[t])])}});exports.AIPromptContent=a;
|
|
@@ -5,19 +5,50 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as e, createVNode as
|
|
9
|
-
import { getDefaultSlots as
|
|
10
|
-
|
|
8
|
+
import { defineComponent as e, createVNode as o } from "vue";
|
|
9
|
+
import { getDefaultSlots as i } from "@progress/kendo-vue-common";
|
|
10
|
+
import { stopSmIcon as s } from "@progress/kendo-svg-icons";
|
|
11
|
+
import { FloatingActionButton as r } from "@progress/kendo-vue-buttons";
|
|
12
|
+
import { outputViewDefaults as a } from "./views/constants.mjs";
|
|
13
|
+
const d = /* @__PURE__ */ e({
|
|
11
14
|
name: "KendoAIPromptContent",
|
|
15
|
+
props: {
|
|
16
|
+
onCancel: Function,
|
|
17
|
+
streaming: Boolean
|
|
18
|
+
},
|
|
19
|
+
inject: {
|
|
20
|
+
kendoAIPrompt: {
|
|
21
|
+
default: null
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
showFloatingButton() {
|
|
26
|
+
var n;
|
|
27
|
+
const t = ((n = this.kendoAIPrompt) == null ? void 0 : n.activeView) === a.name;
|
|
28
|
+
return this.streaming && t;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
handleKeyDown(t) {
|
|
33
|
+
t.key === "Escape" && this.showFloatingButton && this.onCancel && (t.preventDefault(), this.$props.onCancel());
|
|
34
|
+
}
|
|
35
|
+
},
|
|
12
36
|
render() {
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
class: "k-prompt-content"
|
|
16
|
-
|
|
37
|
+
const t = i(this);
|
|
38
|
+
return o("div", {
|
|
39
|
+
class: "k-prompt-content",
|
|
40
|
+
onKeydown: this.handleKeyDown
|
|
41
|
+
}, [this.showFloatingButton && o(r, {
|
|
42
|
+
onClick: this.onCancel,
|
|
43
|
+
svgIcon: s,
|
|
44
|
+
size: "small",
|
|
45
|
+
positionMode: "absolute",
|
|
46
|
+
class: "k-prompt-stop-fab k-generating"
|
|
47
|
+
}, null), o("div", {
|
|
17
48
|
class: "k-prompt-view"
|
|
18
|
-
}, [
|
|
49
|
+
}, [t])]);
|
|
19
50
|
}
|
|
20
51
|
});
|
|
21
52
|
export {
|
|
22
|
-
|
|
53
|
+
d as AIPromptContent
|
|
23
54
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),n=require("@progress/kendo-vue-common"),r=require("@progress/kendo-vue-buttons");function
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),n=require("@progress/kendo-vue-common"),r=require("@progress/kendo-vue-buttons");function i(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!o.isVNode(e)}const s=o.defineComponent({name:"KendoAIPromptHeader",props:{activeView:String,toolbarItems:Array,onActiveviewchange:Function},methods:{handleClick(e){this.$emit("activeviewchange",e)}},render(){let e;const{activeView:a,toolbarItems:l}=this.$props;return o.createVNode("div",{class:"k-prompt-header"},[o.createVNode(r.Toolbar,{overflow:"none",keyboardNavigation:!1,class:"k-toolbar-flat"},i(e=l.map(function(t){const c=n.getTemplate.call(this,{h:o.h,template:t.content,defaultRendering:null,additionalProps:{item:t}});return t.content?c:o.createVNode(r.Button,{type:"button",key:t.name,class:n.classNames("k-toolbar-item",{"k-selected":a===t.name}),size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:t.buttonText,svgIcon:t.buttonIcon,onClick:()=>this.handleClick(t.name)},{default:()=>[t.buttonText]})},this))?e:{default:()=>[e]})])}});exports.AIPromptHeader=s;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),a=require("../AIPromptContent.js"),s=require("./AIPromptViewRender.js"),d=require("./constants.js"),c=require("@progress/kendo-vue-layout"),i=t.defineComponent({name:"KendoAIPromptCommandsView",props:{commands:Array},inject:{kendoAIPrompt:{default:null}},render(){const{commands:m}=this.$props,r=o=>{var n;const e=o.target;!((n=e.items)!=null&&n.length)&&this.kendoAIPrompt.onCommandExecute&&(this.$emit("commandexecute",e),this.kendoAIPrompt.onCommandExecute.call(null,e))};return t.createVNode(s.AIPromptViewRender,{name:d.commandsViewDefaults.name},{default:()=>{var o,e;return[t.createVNode(a.AIPromptContent,{streaming:(o=this.kendoAIPrompt)==null?void 0:o.streaming,onCancel:(e=this.kendoAIPrompt)==null?void 0:e.onCancel},{default:()=>[t.createVNode("div",{class:"k-prompt-view"},[t.createVNode(c.PanelBar,{onSelect:r,items:m},null)])]})]}})}});exports.AIPromptCommandsView=i;
|
|
@@ -5,15 +5,12 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as a, createVNode as
|
|
8
|
+
import { defineComponent as a, createVNode as m } from "vue";
|
|
9
9
|
import { AIPromptContent as i } from "../AIPromptContent.mjs";
|
|
10
10
|
import { AIPromptViewRender as d } from "./AIPromptViewRender.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import { PanelBar as
|
|
13
|
-
const
|
|
14
|
-
name: "commands-view",
|
|
15
|
-
buttonIcon: c
|
|
16
|
-
}, C = /* @__PURE__ */ a({
|
|
11
|
+
import { commandsViewDefaults as s } from "./constants.mjs";
|
|
12
|
+
import { PanelBar as p } from "@progress/kendo-vue-layout";
|
|
13
|
+
const C = /* @__PURE__ */ a({
|
|
17
14
|
name: "KendoAIPromptCommandsView",
|
|
18
15
|
props: {
|
|
19
16
|
commands: Array
|
|
@@ -26,26 +23,31 @@ const l = {
|
|
|
26
23
|
render() {
|
|
27
24
|
const {
|
|
28
25
|
commands: n
|
|
29
|
-
} = this.$props,
|
|
30
|
-
var
|
|
31
|
-
const
|
|
32
|
-
!((
|
|
26
|
+
} = this.$props, r = (e) => {
|
|
27
|
+
var t;
|
|
28
|
+
const o = e.target;
|
|
29
|
+
!((t = o.items) != null && t.length) && this.kendoAIPrompt.onCommandExecute && (this.$emit("commandexecute", o), this.kendoAIPrompt.onCommandExecute.call(null, o));
|
|
33
30
|
};
|
|
34
|
-
return
|
|
35
|
-
name:
|
|
31
|
+
return m(d, {
|
|
32
|
+
name: s.name
|
|
36
33
|
}, {
|
|
37
|
-
default: () =>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
default: () => {
|
|
35
|
+
var e, o;
|
|
36
|
+
return [m(i, {
|
|
37
|
+
streaming: (e = this.kendoAIPrompt) == null ? void 0 : e.streaming,
|
|
38
|
+
onCancel: (o = this.kendoAIPrompt) == null ? void 0 : o.onCancel
|
|
39
|
+
}, {
|
|
40
|
+
default: () => [m("div", {
|
|
41
|
+
class: "k-prompt-view"
|
|
42
|
+
}, [m(p, {
|
|
43
|
+
onSelect: r,
|
|
44
|
+
items: n
|
|
45
|
+
}, null)])]
|
|
46
|
+
})];
|
|
47
|
+
}
|
|
45
48
|
});
|
|
46
49
|
}
|
|
47
50
|
});
|
|
48
51
|
export {
|
|
49
|
-
C as AIPromptCommandsView
|
|
50
|
-
l as commandsViewDefaults
|
|
52
|
+
C as AIPromptCommandsView
|
|
51
53
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("../AIPromptContent.js"),c=require("../../messages/main.js"),g=require("./AIPromptViewRender.js"),N=require("./constants.js"),n=require("@progress/kendo-vue-layout"),l=require("@progress/kendo-svg-icons"),s=require("@progress/kendo-vue-buttons"),P=require("@progress/kendo-vue-intl");function b(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}let R=function(t){return t.positive="positive",t.negative="negative",t}({});const v=e.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(){return{copiedIndex:-1,copyButtonIcon:l.copyIcon,contentRef:null}},methods:{retryPrompt(t){this.$emit("retry",t),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,t.prompt,{...t,isRetry:!0}),this.scrollToTopOutput()},copyToClipboard(t,r){t!=null&&t.responseContent&&navigator.clipboard.writeText(t.responseContent),this.copiedIndex=r,this.copyButtonIcon=l.checkIcon,this.$emit("copy",t==null?void 0:t.responseContent),setTimeout(()=>{this.copyButtonIcon=l.copyIcon,this.copiedIndex=-1},1e3)},outputRating(t,r){this.$emit("rating",t,r),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,t.prompt,{...t,ratingType:r,isRetry:!1}),this.scrollToTopOutput()},scrollToTopOutput(){var t,r;(r=(t=this.contentRef)==null?void 0:t.scrollTo)==null||r.call(t,{top:0,behavior:"smooth"})}},render(){let t;const{outputs:r,showOutputRating:k,outputCard:y}=this.$props,f=P.provideLocalizationService(this),{header:u,body:p,actions:m}=y||{},I=e.createVNode(n.Card,null,{default:()=>[e.createVNode(n.CardHeader,null,{default:()=>[e.createVNode(n.CardTitle,null,{default:()=>[e.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}},null)]}),e.createVNode(n.CardSubtitle,null,{default:()=>[e.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}},null)]})]}),e.createVNode(n.CardBody,null,{default:()=>[e.createVNode("span",{class:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}},null)]}),e.createVNode(n.CardActions,null,{default:()=>[e.createVNode("span",{class:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}},null)]})]}),d=r==null?void 0:r.map((o,a)=>e.createVNode(n.Card,{key:`${o.id}_${a}`,class:o.class},{default:()=>[e.createVNode(n.CardHeader,null,{default:()=>[u?u(o):e.createVNode(e.Fragment,null,[o.title&&e.createVNode(n.CardTitle,null,{default:()=>[o.title]}),o.subTitle&&e.createVNode(n.CardSubtitle,null,{default:()=>[o.subTitle]})])]}),e.createVNode(n.CardBody,null,{default:()=>[p?p(o):o.responseContent]}),e.createVNode(n.CardActions,null,{default:()=>[m?m(o):e.createVNode(e.Fragment,null,[e.createVNode(s.Button,{type:"button",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:this.copiedIndex===a?this.copyButtonIcon:l.copyIcon,"aria-hidden":"true",onClick:()=>this.copyToClipboard(o,a)},{default:()=>["Copy"]}),e.createVNode(s.Button,{type:"button",size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:l.arrowRotateCwIcon,"aria-hidden":"true",onClick:()=>this.retryPrompt(o)},{default:()=>["Retry"]}),k&&e.createVNode(e.Fragment,null,[e.createVNode("span",{class:"k-spacer"},null),e.createVNode(s.Button,{type:"button",size:"medium",themeColor:o.ratingType==="positive"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:l.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(o,"positive")},null),e.createVNode(s.Button,{type:"button",size:"medium",themeColor:o.ratingType==="negative"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:l.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(o,"negative")},null)])])]})]})),V=e.createVNode(n.Card,null,{default:()=>[e.createVNode(n.CardBody,null,b(t=f.toLanguageString(c.aIPromptNoOutputs,c.messages[c.aIPromptNoOutputs]))?t:{default:()=>[t]})]});return e.createVNode(g.AIPromptViewRender,{name:N.outputViewDefaults.name},{default:()=>{var o,a;return[e.createVNode(C.AIPromptContent,{ref:i=>this.contentRef=i,streaming:(o=this.kendoAIPrompt)==null?void 0:o.streaming,onCancel:(a=this.kendoAIPrompt)==null?void 0:a.onCancel},{default:()=>{var i,h;return[e.createVNode("div",{class:"k-card-list"},[((i=this.kendoAIPrompt)==null?void 0:i.loading)&&I,d,(!d||d.length===0)&&!((h=this.kendoAIPrompt)!=null&&h.loading)&&V])]}})]}})}});exports.AIPromptOutputRating=R;exports.AIPromptOutputView=v;
|
|
@@ -5,26 +5,22 @@
|
|
|
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 { aIPromptNoOutputs as
|
|
11
|
-
import { AIPromptViewRender as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
function
|
|
18
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
8
|
+
import { defineComponent as w, createVNode as t, Fragment as a, isVNode as A } from "vue";
|
|
9
|
+
import { AIPromptContent as O } from "../AIPromptContent.mjs";
|
|
10
|
+
import { aIPromptNoOutputs as k, messages as x } from "../../messages/main.mjs";
|
|
11
|
+
import { AIPromptViewRender as B } from "./AIPromptViewRender.mjs";
|
|
12
|
+
import { outputViewDefaults as z } from "./constants.mjs";
|
|
13
|
+
import { Card as d, CardHeader as y, CardTitle as g, CardSubtitle as I, CardBody as p, CardActions as C } from "@progress/kendo-vue-layout";
|
|
14
|
+
import { copyIcon as m, arrowRotateCwIcon as S, thumbUpOutlineIcon as V, thumbDownOutlineIcon as $, checkIcon as j } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { Button as r } from "@progress/kendo-vue-buttons";
|
|
16
|
+
import { provideLocalizationService as q } from "@progress/kendo-vue-intl";
|
|
17
|
+
function M(e) {
|
|
18
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !A(e);
|
|
19
19
|
}
|
|
20
|
-
let
|
|
20
|
+
let G = /* @__PURE__ */ function(e) {
|
|
21
21
|
return e.positive = "positive", e.negative = "negative", e;
|
|
22
22
|
}({});
|
|
23
|
-
const
|
|
24
|
-
name: "output-view",
|
|
25
|
-
buttonText: "Output",
|
|
26
|
-
buttonIcon: T
|
|
27
|
-
}, E = /* @__PURE__ */ h({
|
|
23
|
+
const J = /* @__PURE__ */ w({
|
|
28
24
|
name: "KendoAIPromptOutputView",
|
|
29
25
|
emits: {
|
|
30
26
|
copy: null,
|
|
@@ -33,7 +29,7 @@ const q = {
|
|
|
33
29
|
},
|
|
34
30
|
props: {
|
|
35
31
|
outputs: Array,
|
|
36
|
-
outputCard:
|
|
32
|
+
outputCard: Object,
|
|
37
33
|
showOutputRating: Boolean
|
|
38
34
|
},
|
|
39
35
|
inject: {
|
|
@@ -47,7 +43,8 @@ const q = {
|
|
|
47
43
|
data() {
|
|
48
44
|
return {
|
|
49
45
|
copiedIndex: -1,
|
|
50
|
-
copyButtonIcon:
|
|
46
|
+
copyButtonIcon: m,
|
|
47
|
+
contentRef: null
|
|
51
48
|
};
|
|
52
49
|
},
|
|
53
50
|
methods: {
|
|
@@ -55,11 +52,11 @@ const q = {
|
|
|
55
52
|
this.$emit("retry", e), this.kendoAIPrompt.onPromptRequest && this.kendoAIPrompt.onPromptRequest.call(null, e.prompt, {
|
|
56
53
|
...e,
|
|
57
54
|
isRetry: !0
|
|
58
|
-
});
|
|
55
|
+
}), this.scrollToTopOutput();
|
|
59
56
|
},
|
|
60
57
|
copyToClipboard(e, n) {
|
|
61
|
-
e != null && e.responseContent && navigator.clipboard.writeText(e.responseContent), this.copiedIndex = n, this.copyButtonIcon =
|
|
62
|
-
this.copyButtonIcon =
|
|
58
|
+
e != null && e.responseContent && navigator.clipboard.writeText(e.responseContent), this.copiedIndex = n, this.copyButtonIcon = j, this.$emit("copy", e == null ? void 0 : e.responseContent), setTimeout(() => {
|
|
59
|
+
this.copyButtonIcon = m, this.copiedIndex = -1;
|
|
63
60
|
}, 1e3);
|
|
64
61
|
},
|
|
65
62
|
outputRating(e, n) {
|
|
@@ -67,6 +64,13 @@ const q = {
|
|
|
67
64
|
...e,
|
|
68
65
|
ratingType: n,
|
|
69
66
|
isRetry: !1
|
|
67
|
+
}), this.scrollToTopOutput();
|
|
68
|
+
},
|
|
69
|
+
scrollToTopOutput() {
|
|
70
|
+
var e, n;
|
|
71
|
+
(n = (e = this.contentRef) == null ? void 0 : e.scrollTo) == null || n.call(e, {
|
|
72
|
+
top: 0,
|
|
73
|
+
behavior: "smooth"
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
76
|
},
|
|
@@ -74,97 +78,132 @@ const q = {
|
|
|
74
78
|
let e;
|
|
75
79
|
const {
|
|
76
80
|
outputs: n,
|
|
77
|
-
showOutputRating:
|
|
78
|
-
outputCard:
|
|
79
|
-
} = this.$props,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
defaultRendering: null,
|
|
91
|
-
additionalProps: {
|
|
92
|
-
output: o
|
|
81
|
+
showOutputRating: R,
|
|
82
|
+
outputCard: b
|
|
83
|
+
} = this.$props, P = q(this), {
|
|
84
|
+
header: c,
|
|
85
|
+
body: u,
|
|
86
|
+
actions: f
|
|
87
|
+
} = b || {}, T = t(d, null, {
|
|
88
|
+
default: () => [t(y, null, {
|
|
89
|
+
default: () => [t(g, null, {
|
|
90
|
+
default: () => [t("span", {
|
|
91
|
+
class: "k-skeleton k-skeleton-text k-skeleton-pulse",
|
|
92
|
+
style: {
|
|
93
|
+
width: "200px"
|
|
93
94
|
}
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
class:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
svgIcon: w,
|
|
128
|
-
"aria-hidden": "true",
|
|
129
|
-
onClick: () => this.retryPrompt(o, l)
|
|
130
|
-
}, {
|
|
131
|
-
default: () => ["Retry"]
|
|
132
|
-
}), r && t("span", {
|
|
133
|
-
class: "k-spacer"
|
|
134
|
-
}, null), r && t(i, {
|
|
135
|
-
type: "button",
|
|
136
|
-
size: "medium",
|
|
137
|
-
themeColor: o.ratingType === "positive" ? "primary" : "base",
|
|
138
|
-
fillMode: "flat",
|
|
139
|
-
rounded: "medium",
|
|
140
|
-
title: "Rate up",
|
|
141
|
-
svgIcon: A,
|
|
142
|
-
"aria-hidden": "true",
|
|
143
|
-
onClick: () => this.outputRating(o, "positive")
|
|
144
|
-
}, null), r && t(i, {
|
|
145
|
-
type: "button",
|
|
146
|
-
size: "medium",
|
|
147
|
-
themeColor: o.ratingType === "negative" ? "primary" : "base",
|
|
148
|
-
fillMode: "flat",
|
|
149
|
-
rounded: "medium",
|
|
150
|
-
title: "Rate down",
|
|
151
|
-
svgIcon: O,
|
|
152
|
-
"aria-hidden": "true",
|
|
153
|
-
onClick: () => this.outputRating(o, "negative")
|
|
154
|
-
}, null)]
|
|
155
|
-
})]
|
|
156
|
-
});
|
|
157
|
-
}, this) : t(m, null, {
|
|
158
|
-
default: () => [t(c, null, x(e = p.toLanguageString(d, C[d])) ? e : {
|
|
159
|
-
default: () => [e]
|
|
160
|
-
})]
|
|
95
|
+
}, null)]
|
|
96
|
+
}), t(I, null, {
|
|
97
|
+
default: () => [t("span", {
|
|
98
|
+
class: "k-skeleton k-skeleton-text k-skeleton-pulse",
|
|
99
|
+
style: {
|
|
100
|
+
width: "100%"
|
|
101
|
+
}
|
|
102
|
+
}, null)]
|
|
103
|
+
})]
|
|
104
|
+
}), t(p, null, {
|
|
105
|
+
default: () => [t("span", {
|
|
106
|
+
class: "k-skeleton k-skeleton-rect k-skeleton-pulse",
|
|
107
|
+
style: {
|
|
108
|
+
height: "80px"
|
|
109
|
+
}
|
|
110
|
+
}, null)]
|
|
111
|
+
}), t(C, null, {
|
|
112
|
+
default: () => [t("span", {
|
|
113
|
+
class: "k-skeleton k-skeleton-text k-skeleton-pulse",
|
|
114
|
+
style: {
|
|
115
|
+
width: "100%"
|
|
116
|
+
}
|
|
117
|
+
}, null)]
|
|
118
|
+
})]
|
|
119
|
+
}), s = n == null ? void 0 : n.map((o, l) => t(d, {
|
|
120
|
+
key: `${o.id}_${l}`,
|
|
121
|
+
class: o.class
|
|
122
|
+
}, {
|
|
123
|
+
default: () => [t(y, null, {
|
|
124
|
+
default: () => [c ? c(o) : t(a, null, [o.title && t(g, null, {
|
|
125
|
+
default: () => [o.title]
|
|
126
|
+
}), o.subTitle && t(I, null, {
|
|
127
|
+
default: () => [o.subTitle]
|
|
161
128
|
})])]
|
|
129
|
+
}), t(p, null, {
|
|
130
|
+
default: () => [u ? u(o) : o.responseContent]
|
|
131
|
+
}), t(C, null, {
|
|
132
|
+
default: () => [f ? f(o) : t(a, null, [t(r, {
|
|
133
|
+
type: "button",
|
|
134
|
+
size: "medium",
|
|
135
|
+
themeColor: "primary",
|
|
136
|
+
fillMode: "flat",
|
|
137
|
+
rounded: "medium",
|
|
138
|
+
title: "Copy",
|
|
139
|
+
svgIcon: this.copiedIndex === l ? this.copyButtonIcon : m,
|
|
140
|
+
"aria-hidden": "true",
|
|
141
|
+
onClick: () => this.copyToClipboard(o, l)
|
|
142
|
+
}, {
|
|
143
|
+
default: () => ["Copy"]
|
|
144
|
+
}), t(r, {
|
|
145
|
+
type: "button",
|
|
146
|
+
size: "medium",
|
|
147
|
+
themeColor: "base",
|
|
148
|
+
fillMode: "flat",
|
|
149
|
+
rounded: "medium",
|
|
150
|
+
title: "Retry",
|
|
151
|
+
svgIcon: S,
|
|
152
|
+
"aria-hidden": "true",
|
|
153
|
+
onClick: () => this.retryPrompt(o)
|
|
154
|
+
}, {
|
|
155
|
+
default: () => ["Retry"]
|
|
156
|
+
}), R && t(a, null, [t("span", {
|
|
157
|
+
class: "k-spacer"
|
|
158
|
+
}, null), t(r, {
|
|
159
|
+
type: "button",
|
|
160
|
+
size: "medium",
|
|
161
|
+
themeColor: o.ratingType === "positive" ? "primary" : "base",
|
|
162
|
+
fillMode: "flat",
|
|
163
|
+
rounded: "medium",
|
|
164
|
+
title: "Rate up",
|
|
165
|
+
svgIcon: V,
|
|
166
|
+
"aria-hidden": "true",
|
|
167
|
+
onClick: () => this.outputRating(o, "positive")
|
|
168
|
+
}, null), t(r, {
|
|
169
|
+
type: "button",
|
|
170
|
+
size: "medium",
|
|
171
|
+
themeColor: o.ratingType === "negative" ? "primary" : "base",
|
|
172
|
+
fillMode: "flat",
|
|
173
|
+
rounded: "medium",
|
|
174
|
+
title: "Rate down",
|
|
175
|
+
svgIcon: $,
|
|
176
|
+
"aria-hidden": "true",
|
|
177
|
+
onClick: () => this.outputRating(o, "negative")
|
|
178
|
+
}, null)])])]
|
|
179
|
+
})]
|
|
180
|
+
})), v = t(d, null, {
|
|
181
|
+
default: () => [t(p, null, M(e = P.toLanguageString(k, x[k])) ? e : {
|
|
182
|
+
default: () => [e]
|
|
162
183
|
})]
|
|
163
184
|
});
|
|
185
|
+
return t(B, {
|
|
186
|
+
name: z.name
|
|
187
|
+
}, {
|
|
188
|
+
default: () => {
|
|
189
|
+
var o, l;
|
|
190
|
+
return [t(O, {
|
|
191
|
+
ref: (i) => this.contentRef = i,
|
|
192
|
+
streaming: (o = this.kendoAIPrompt) == null ? void 0 : o.streaming,
|
|
193
|
+
onCancel: (l = this.kendoAIPrompt) == null ? void 0 : l.onCancel
|
|
194
|
+
}, {
|
|
195
|
+
default: () => {
|
|
196
|
+
var i, h;
|
|
197
|
+
return [t("div", {
|
|
198
|
+
class: "k-card-list"
|
|
199
|
+
}, [((i = this.kendoAIPrompt) == null ? void 0 : i.loading) && T, s, (!s || s.length === 0) && !((h = this.kendoAIPrompt) != null && h.loading) && v])];
|
|
200
|
+
}
|
|
201
|
+
})];
|
|
202
|
+
}
|
|
203
|
+
});
|
|
164
204
|
}
|
|
165
205
|
});
|
|
166
206
|
export {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
q as outputViewDefaults
|
|
207
|
+
G as AIPromptOutputRating,
|
|
208
|
+
J as AIPromptOutputView
|
|
170
209
|
};
|
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),I=require("../AIPromptContent.js"),V=require("../AIPromptFooter.js"),P=require("./constants.js"),A=require("@progress/kendo-vue-inputs"),c=require("@progress/kendo-vue-buttons"),x=require("@progress/kendo-svg-icons"),R=require("./AIPromptViewRender.js"),b=require("../AIPromptExpander.js"),k=require("../../chat/components/SuggestionGroup.js"),o=require("@progress/kendo-vue-common");function d(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const v=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 this.$props.promptValue!==void 0?this.$props.promptValue:this.value}},data(){return{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 r=e.alternatives[0].transcript,n=this.value,s=n&&!n.endsWith(" ")&&!n.endsWith(`
|
|
9
|
+
`);this.value=n+(s?" ":"")+r}},onSpeechStart(){},onSpeechEnd(){},getButtonDisabledState(){const e=this.$props.promptValue!==void 0?this.$props.promptValue:this.value;return!(e!=null&&e.trim())}},render(){const e="Generate",{promptSuggestions:r,enableSpeechToText:n}=this.$props,s=o.templateRendering.call(this,this.$props.promptInput,o.getListeners.call(this)),h=()=>n?t.createVNode("div",{class:"k-input-suffix k-input-suffix-horizontal"},[t.createVNode(c.SpeechToTextButton,t.mergeProps({fillMode:"flat",onStart:this.onSpeechStart,onEnd:this.onSpeechEnd,onResult:this.onSpeechResult},typeof n=="object"?n:{}),null)]):null,m=t.createVNode(A.TextArea,{value:this.computedValue,onInput:this.onTextChange,placeholder:"Ask or generate content with AI ...",rows:2,class:"!k-flex-col",inputSuffix:h},null),g=o.getTemplate.call(this,{h:t.h,template:s,defaultRendering:m}),f=o.templateRendering.call(this,this.$props.generateButton,o.getListeners.call(this)),S=t.createVNode(c.Button,{type:"button",themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:this.handleOnRequest,disabled:this.getButtonDisabledState(),title:"Generate",svgIcon:x.sparklesIcon},d(e)?e:{default:()=>[e]}),i=o.getTemplate.call(this,{h:t.h,template:f,defaultRendering:S});return t.createVNode(R.AIPromptViewRender,{name:P.promptViewDefaults.name},{default:()=>{var a,p;return[t.createVNode(I.AIPromptContent,{streaming:(a=this.kendoAIPrompt)==null?void 0:a.streaming,onCancel:(p=this.kendoAIPrompt)==null?void 0:p.onCancel},{default:()=>[g,r&&r.length>0&&t.createVNode(b.AIPromptExpander,{title:"Prompt Suggestions"},{default:()=>[t.createVNode(k.SuggestionGroup,{suggestions:r.map((u,l)=>({id:l,text:u,description:u})),onSuggestionClick:(u,l)=>this.handleSuggestionSelect(l.text)},null)]})]}),t.createVNode(V.AIPromptFooter,null,d(i)?i:{default:()=>[i]})]}})}});exports.AIPromptView=v;
|