@progress/kendo-vue-conversational-ui 7.0.0-develop.5 → 7.0.0-develop.6
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 +21 -15
- package/dist/cdn/js/kendo-vue-conversational-ui.js +1 -1
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +14 -8
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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),h=require("./AIPromptHeader.js"),s=require("./views/constants.js"),t=require("@progress/kendo-vue-common"),i=require("../package-metadata.js"),d=a.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{showLicenseWatermark:!1,licenseMessage:"",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,o){this.$emit("promptrequest",e,o)},onCommandExecute(e){this.$emit("commandexecute",e)},onCancel(){this.$emit("cancel")}},render(){t.validatePackage(i.packageMetadata),this.showLicenseWatermark=t.shouldShowValidationUI(i.packageMetadata),this.licenseMessage=t.getLicenseMessage(i.packageMetadata);const e=t.getDefaultSlots(this),{toolbarItems:o,dir:r}=this.$props,c=(o||[s.promptViewDefaults,s.outputViewDefaults]).map(n=>{const l=t.templateRendering.call(this,n.content,t.getListeners.call(this));return{...n,content:l}}),m=this.showLicenseWatermark?a.createVNode(t.WatermarkOverlay,{message:this.licenseMessage},null):null;return a.createVNode("div",{class:"k-prompt",dir:r},[a.createVNode(h.AIPromptHeader,{activeView:this.contextState.activeView,toolbarItems:c,onActiveviewchange:this.onActiveViewChange},null),e,m])}});exports.AIPrompt=d;
|
package/ai-prompt/AIPrompt.mjs
CHANGED
|
@@ -5,11 +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
|
|
9
|
-
import { AIPromptHeader as
|
|
10
|
-
import { promptViewDefaults as
|
|
11
|
-
import { getDefaultSlots as
|
|
12
|
-
|
|
8
|
+
import { defineComponent as m, createVNode as i } from "vue";
|
|
9
|
+
import { AIPromptHeader as h } from "./AIPromptHeader.mjs";
|
|
10
|
+
import { promptViewDefaults as l, outputViewDefaults as p } from "./views/constants.mjs";
|
|
11
|
+
import { validatePackage as d, shouldShowValidationUI as g, getLicenseMessage as u, getDefaultSlots as w, templateRendering as v, getListeners as S, WatermarkOverlay as V } from "@progress/kendo-vue-common";
|
|
12
|
+
import { packageMetadata as o } from "../package-metadata.mjs";
|
|
13
|
+
const $ = /* @__PURE__ */ m({
|
|
13
14
|
name: "KendoAIPrompt",
|
|
14
15
|
props: {
|
|
15
16
|
activeView: {
|
|
@@ -30,6 +31,8 @@ const V = /* @__PURE__ */ s({
|
|
|
30
31
|
},
|
|
31
32
|
data() {
|
|
32
33
|
return {
|
|
34
|
+
showLicenseWatermark: !1,
|
|
35
|
+
licenseMessage: "",
|
|
33
36
|
contextState: {
|
|
34
37
|
activeView: this.$props.activeView,
|
|
35
38
|
streaming: this.$props.streaming,
|
|
@@ -71,26 +74,29 @@ const V = /* @__PURE__ */ s({
|
|
|
71
74
|
}
|
|
72
75
|
},
|
|
73
76
|
render() {
|
|
74
|
-
|
|
77
|
+
d(o), this.showLicenseWatermark = g(o), this.licenseMessage = u(o);
|
|
78
|
+
const t = w(this), {
|
|
75
79
|
toolbarItems: e,
|
|
76
80
|
dir: n
|
|
77
|
-
} = this.$props,
|
|
78
|
-
const
|
|
81
|
+
} = this.$props, s = (e || [l, p]).map((a) => {
|
|
82
|
+
const c = v.call(this, a.content, S.call(this));
|
|
79
83
|
return {
|
|
80
|
-
...
|
|
81
|
-
content:
|
|
84
|
+
...a,
|
|
85
|
+
content: c
|
|
82
86
|
};
|
|
83
|
-
})
|
|
87
|
+
}), r = this.showLicenseWatermark ? i(V, {
|
|
88
|
+
message: this.licenseMessage
|
|
89
|
+
}, null) : null;
|
|
84
90
|
return i("div", {
|
|
85
91
|
class: "k-prompt",
|
|
86
92
|
dir: n
|
|
87
|
-
}, [i(
|
|
93
|
+
}, [i(h, {
|
|
88
94
|
activeView: this.contextState.activeView,
|
|
89
|
-
toolbarItems:
|
|
95
|
+
toolbarItems: s,
|
|
90
96
|
onActiveviewchange: this.onActiveViewChange
|
|
91
|
-
}, null), t]);
|
|
97
|
+
}, null), t, r]);
|
|
92
98
|
}
|
|
93
99
|
});
|
|
94
100
|
export {
|
|
95
|
-
|
|
101
|
+
$ as AIPrompt
|
|
96
102
|
};
|
|
@@ -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-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}));
|
|
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,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: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"},l(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={name:"@progress/kendo-vue-conversational-ui",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:0,version:"7.0.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"},h=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{showLicenseWatermark:!1,licenseMessage:"",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(){o.validatePackage(m),this.showLicenseWatermark=o.shouldShowValidationUI(m),this.licenseMessage=o.getLicenseMessage(m);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}})),r=this.showLicenseWatermark?t.createVNode(o.WatermarkOverlay,{message:this.licenseMessage},null):null;return t.createVNode("div",{class:"k-prompt",dir:i},[t.createVNode(d,{activeView:this.contextState.activeView,toolbarItems:a,onActiveviewchange:this.onActiveViewChange},null),e,r])}}),g=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])])}}),v=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])])}}),k=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 V=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])])}}),I=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 y=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:s}=this.$props,l=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:()=>s?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 s?s:{}),null)]):null},null),u=o.getTemplate.call(this,{h:t.h,template:l,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]}),h=o.getTemplate.call(this,{h:t.h,template:c,defaultRendering:m});return t.createVNode(k,{name:p.name},{default:()=>{var e,o;return[t.createVNode(v,{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(V,{title:"Prompt Suggestions"},{default:()=>[t.createVNode(I,{suggestions:r.map(((e,t)=>({id:t,text:e,description:e}))),onSuggestionClick:(e,t)=>this.handleSuggestionSelect(t.text)},null)]})]}),t.createVNode(g,null,C(h)?h:{default:()=>[h]})]}})}}),b="avatar.alt",N="messageList.ariaLabel",A="aIPrompt.noOutputs",w={[b]:"Avatar",[N]:"Message list",[A]:"No output from Ai available"};function S(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}let P=function(e){return e.positive="positive",e.negative="negative",e}({});const x=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:l}=this.$props,d=s.provideLocalizationService(this),{header:c,body:p,actions:m}=l||{},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)]})]}),g=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)])])]})]}))),f=t.createVNode(r.Card,null,{default:()=>[t.createVNode(r.CardBody,null,S(e=d.toLanguageString(A,w[A]))?e:{default:()=>[e]})]});return t.createVNode(k,{name:u.name},{default:()=>{var e,o;return[t.createVNode(v,{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,g,(!g||0===g.length)&&!(null!=(o=this.kendoAIPrompt)&&o.loading)&&f])]}})]}})}}),R=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(k,{name:c.name},{default:()=>{var n,i;return[t.createVNode(v,{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=h,e.AIPromptCommandsView=R,e.AIPromptContent=v,e.AIPromptFooter=g,e.AIPromptHeader=d,e.AIPromptOutputRating=P,e.AIPromptOutputView=x,e.AIPromptView=y,e.AIPromptViewRender=k,e.SuggestionGroup=I,e.commandsViewDefaults=c,e.outputViewDefaults=u,e.promptViewDefaults=p}));
|
package/index.d.mts
CHANGED
|
@@ -29,6 +29,8 @@ promptPlaceholder: PropType<string>;
|
|
|
29
29
|
streaming: PropType<boolean>;
|
|
30
30
|
loading: PropType<boolean>;
|
|
31
31
|
}>, {}, {
|
|
32
|
+
showLicenseWatermark: boolean;
|
|
33
|
+
licenseMessage: string;
|
|
32
34
|
contextState: AIPromptContextInterface;
|
|
33
35
|
}, {}, {
|
|
34
36
|
onStateAction(action: StateActionInterface): void;
|
package/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ promptPlaceholder: PropType<string>;
|
|
|
29
29
|
streaming: PropType<boolean>;
|
|
30
30
|
loading: PropType<boolean>;
|
|
31
31
|
}>, {}, {
|
|
32
|
+
showLicenseWatermark: boolean;
|
|
33
|
+
licenseMessage: string;
|
|
32
34
|
contextState: AIPromptContextInterface;
|
|
33
35
|
}, {}, {
|
|
34
36
|
onStateAction(action: StateActionInterface): void;
|
|
@@ -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 e={name:"@progress/kendo-vue-conversational-ui",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate: 1754860622,version:"7.0.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"};exports.packageMetadata=e;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
const e = {
|
|
9
|
+
name: "@progress/kendo-vue-conversational-ui",
|
|
10
|
+
productName: "Kendo UI for Vue",
|
|
11
|
+
productCode: "KENDOUIVUE",
|
|
12
|
+
productCodes: ["KENDOUIVUE"],
|
|
13
|
+
publishDate: 1754860622,
|
|
14
|
+
version: "7.0.0-develop.6",
|
|
15
|
+
licensingDocsUrl: "https://www.telerik.com/kendo-vue-ui/my-license/"
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
e as packageMetadata
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-vue-conversational-ui",
|
|
3
|
-
"version": "7.0.0-develop.
|
|
3
|
+
"version": "7.0.0-develop.6",
|
|
4
4
|
"description": "TODO",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@progress/kendo-licensing": "^1.7.0",
|
|
22
|
-
"@progress/kendo-vue-buttons": "7.0.0-develop.
|
|
23
|
-
"@progress/kendo-vue-common": "7.0.0-develop.
|
|
24
|
-
"@progress/kendo-vue-intl": "7.0.0-develop.
|
|
25
|
-
"@progress/kendo-vue-inputs": "7.0.0-develop.
|
|
26
|
-
"@progress/kendo-vue-layout": "7.0.0-develop.
|
|
27
|
-
"@progress/kendo-svg-icons": "^4.
|
|
22
|
+
"@progress/kendo-vue-buttons": "7.0.0-develop.6",
|
|
23
|
+
"@progress/kendo-vue-common": "7.0.0-develop.6",
|
|
24
|
+
"@progress/kendo-vue-intl": "7.0.0-develop.6",
|
|
25
|
+
"@progress/kendo-vue-inputs": "7.0.0-develop.6",
|
|
26
|
+
"@progress/kendo-vue-layout": "7.0.0-develop.6",
|
|
27
|
+
"@progress/kendo-svg-icons": "^4.4.0",
|
|
28
28
|
"vue": "^3.0.2"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {},
|
|
@@ -40,7 +40,13 @@
|
|
|
40
40
|
],
|
|
41
41
|
"@progress": {
|
|
42
42
|
"friendlyName": "ConversationalUi",
|
|
43
|
-
"framework": "Kendo UI for Vue"
|
|
43
|
+
"framework": "Kendo UI for Vue",
|
|
44
|
+
"package": {
|
|
45
|
+
"productName": "Kendo UI for Vue",
|
|
46
|
+
"productCode": "KENDOUIVUE",
|
|
47
|
+
"publishDate": 1754860622,
|
|
48
|
+
"licensingDocsUrl": "https://www.telerik.com/kendo-vue-ui/my-license/"
|
|
49
|
+
}
|
|
44
50
|
},
|
|
45
51
|
"publishConfig": {
|
|
46
52
|
"access": "public"
|