@progress/kendo-react-conversational-ui 11.4.0-develop.3 → 11.4.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/README.md +16 -0
- package/ai-prompt/AIPrompt.js +1 -1
- package/ai-prompt/AIPrompt.mjs +10 -9
- package/ai-prompt/AIPromptContent.js +1 -1
- package/ai-prompt/AIPromptContent.mjs +22 -15
- package/ai-prompt/AIPromptExpander.js +1 -1
- package/ai-prompt/AIPromptExpander.mjs +15 -13
- package/ai-prompt/views/AIPromptCommandsView.js +1 -1
- package/ai-prompt/views/AIPromptCommandsView.mjs +13 -17
- package/ai-prompt/views/AIPromptOutputView.js +1 -1
- package/ai-prompt/views/AIPromptOutputView.mjs +27 -31
- package/ai-prompt/views/AIPromptView.js +2 -1
- package/ai-prompt/views/AIPromptView.mjs +75 -38
- package/ai-prompt/views/constants.js +8 -0
- package/ai-prompt/views/constants.mjs +25 -0
- package/chat/components/SuggestionsGroup.js +8 -0
- package/chat/components/SuggestionsGroup.mjs +32 -0
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/index.d.mts +242 -0
- package/index.d.ts +242 -0
- package/index.js +1 -1
- package/index.mjs +26 -21
- package/inline-ai-prompt/InlineAIPrompt.js +8 -0
- package/inline-ai-prompt/InlineAIPrompt.mjs +175 -0
- package/inline-ai-prompt/InlineAIPromptInput.js +9 -0
- package/inline-ai-prompt/InlineAIPromptInput.mjs +102 -0
- package/inline-ai-prompt/InlineAIPromptPopup.js +8 -0
- package/inline-ai-prompt/InlineAIPromptPopup.mjs +36 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -27,6 +27,22 @@ Among the features which the KendoReact Chat component delivers are:
|
|
|
27
27
|
- [Keyboard navigation](https://www.telerik.com/kendo-react-ui/components/conversationalui/keyboard-navigation/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-chat)—Built-in keyboard shortcuts for usability and navigation in the component.
|
|
28
28
|
- [Theme support](https://www.telerik.com/kendo-react-ui/components/styling/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-chat)—The KendoReact Chat, as well as all 100+ components in the KendoReact suite, are styled in three polished themes (Bootstrap, Material, and Default) and can be further customized to match your specific design guidelines.
|
|
29
29
|
|
|
30
|
+
## Using for Free vs Commercial License
|
|
31
|
+
|
|
32
|
+
The following table outlines the key resources available with KendoReact and KendoReact Free.
|
|
33
|
+
|
|
34
|
+
| | [KendoReact Free](https://www.telerik.com/kendo-react-ui/components/free) | [KendoReact](https://www.telerik.com/kendo-react-ui) |
|
|
35
|
+
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| React components | 50+ | 120+ |
|
|
37
|
+
| Four professional themes | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
38
|
+
| Four Figma UI Kits | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
39
|
+
| Page Templates & Building Blocks | 1 template | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
40
|
+
| ThemeBuilder | Free\* | Ultimate |
|
|
41
|
+
| Source code | No | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
42
|
+
| Visual Studio Code extension | 1 starter template | Full functionality |
|
|
43
|
+
| Legendary customer support | No | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
44
|
+
| AI coding assistant | No | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
|
|
45
|
+
|
|
30
46
|
## Support Options
|
|
31
47
|
|
|
32
48
|
For any issues you might encounter while working with the KendoReact Chat, use any of the available support channels:
|
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 e=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),g=require("./AIPromptHeader.js"),r=require("./views/constants.js"),q=require("./AIPromptContext.js"),h=require("@progress/kendo-react-common"),b=n=>{const{activeView:t,toolbarItems:c,children:s,onActiveViewChange:o,onPromptRequest:i,onCommandExecute:m,style:l,dir:u,className:p,streaming:d,loading:v,onCancel:P,...w}=n,S=c||[r.promptViewDefaults,r.outputViewDefaults],[A,C]=e.useState({activeView:t}),a={...A,activeView:t,streaming:d,loading:v,onCancel:P,onActiveViewChange:o,onPromptRequest:i,onCommandExecute:m},I=V=>{C(V)};return e.createElement(q.AIPromptContext.Provider,{value:[a,I]},e.createElement("div",{className:h.classNames("k-prompt",p),style:l,dir:u,...w},e.createElement(g.PromptHeader,{activeView:a.activeView,toolbarItems:S,activeViewChange:o}),s))};exports.AIPrompt=b;
|
package/ai-prompt/AIPrompt.mjs
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import t from "react";
|
|
9
|
-
import { PromptHeader as
|
|
10
|
-
import { promptViewDefaults as
|
|
11
|
-
import { outputViewDefaults as x } from "./views/AIPromptOutputView.mjs";
|
|
9
|
+
import { PromptHeader as P } from "./AIPromptHeader.mjs";
|
|
10
|
+
import { promptViewDefaults as g, outputViewDefaults as x } from "./views/constants.mjs";
|
|
12
11
|
import { AIPromptContext as A } from "./AIPromptContext.mjs";
|
|
13
12
|
import { classNames as E } from "@progress/kendo-react-common";
|
|
14
13
|
const _ = (r) => {
|
|
@@ -23,21 +22,23 @@ const _ = (r) => {
|
|
|
23
22
|
dir: l,
|
|
24
23
|
className: p,
|
|
25
24
|
streaming: u,
|
|
25
|
+
loading: d,
|
|
26
26
|
onCancel: f,
|
|
27
27
|
...v
|
|
28
|
-
} = r, w = m || [
|
|
29
|
-
...
|
|
28
|
+
} = r, w = m || [g, x], [V, S] = t.useState({ activeView: e }), a = {
|
|
29
|
+
...V,
|
|
30
30
|
activeView: e,
|
|
31
31
|
streaming: u,
|
|
32
|
+
loading: d,
|
|
32
33
|
onCancel: f,
|
|
33
34
|
onActiveViewChange: o,
|
|
34
35
|
onPromptRequest: i,
|
|
35
36
|
onCommandExecute: n
|
|
36
|
-
},
|
|
37
|
-
|
|
37
|
+
}, h = (C) => {
|
|
38
|
+
S(C);
|
|
38
39
|
};
|
|
39
|
-
return /* @__PURE__ */ t.createElement(A.Provider, { value: [a,
|
|
40
|
-
|
|
40
|
+
return /* @__PURE__ */ t.createElement(A.Provider, { value: [a, h] }, /* @__PURE__ */ t.createElement("div", { className: E("k-prompt", p), style: s, dir: l, ...v }, /* @__PURE__ */ t.createElement(
|
|
41
|
+
P,
|
|
41
42
|
{
|
|
42
43
|
activeView: a.activeView,
|
|
43
44
|
toolbarItems: w,
|
|
@@ -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("react"),g=require("@progress/kendo-svg-icons"),I=require("@progress/kendo-react-buttons"),n=require("../messages/index.js"),k=require("@progress/kendo-react-intl"),C=require("./AIPromptContext.js"),w=require("./views/constants.js"),s=t.forwardRef((i,r)=>{const{children:l,streaming:u,onCancel:e}=i,a=k.useLocalization().toLanguageString(n.aIPromptCancel,n.messages[n.aIPromptCancel]),[m]=C.useAIPromptContext(),p=m.activeView===w.outputViewDefaults.name,o=u&&p,d=t.useCallback(c=>{c.key==="Escape"&&o&&e&&(c.preventDefault(),e())},[o,e]);return t.createElement("div",{className:"k-prompt-content",ref:r,onKeyDown:d},o&&t.createElement(I.FloatingActionButton,{onClick:e,svgIcon:g.stopSmIcon,icon:"stop-sm",size:"small",positionMode:"absolute",className:"k-prompt-stop-fab k-generating","aria-label":a,title:a}),t.createElement("div",{className:"k-prompt-view"},l))});s.displayName="KendoReactAIPromptContent";exports.AIPromptContent=s;
|
|
@@ -6,27 +6,34 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import t from "react";
|
|
9
|
-
import { stopSmIcon as
|
|
10
|
-
import { FloatingActionButton as
|
|
11
|
-
import { aIPromptCancel as
|
|
12
|
-
import { useLocalization as
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
import { stopSmIcon as f } from "@progress/kendo-svg-icons";
|
|
10
|
+
import { FloatingActionButton as g } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { aIPromptCancel as i, messages as d } from "../messages/index.mjs";
|
|
12
|
+
import { useLocalization as w } from "@progress/kendo-react-intl";
|
|
13
|
+
import { useAIPromptContext as k } from "./AIPromptContext.mjs";
|
|
14
|
+
import { outputViewDefaults as C } from "./views/constants.mjs";
|
|
15
|
+
const I = t.forwardRef((r, s) => {
|
|
16
|
+
const { children: c, streaming: m, onCancel: o } = r, n = w().toLanguageString(i, d[i]), [l] = k(), p = l.activeView === C.name, e = m && p, u = t.useCallback(
|
|
17
|
+
(a) => {
|
|
18
|
+
a.key === "Escape" && e && o && (a.preventDefault(), o());
|
|
19
|
+
},
|
|
20
|
+
[e, o]
|
|
21
|
+
);
|
|
22
|
+
return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-content", ref: s, onKeyDown: u }, e && /* @__PURE__ */ t.createElement(
|
|
23
|
+
g,
|
|
17
24
|
{
|
|
18
|
-
onClick:
|
|
19
|
-
svgIcon:
|
|
25
|
+
onClick: o,
|
|
26
|
+
svgIcon: f,
|
|
20
27
|
icon: "stop-sm",
|
|
21
28
|
size: "small",
|
|
22
29
|
positionMode: "absolute",
|
|
23
30
|
className: "k-prompt-stop-fab k-generating",
|
|
24
|
-
"aria-label":
|
|
25
|
-
title:
|
|
31
|
+
"aria-label": n,
|
|
32
|
+
title: n
|
|
26
33
|
}
|
|
27
|
-
), /* @__PURE__ */ t.createElement("div", { className: "k-prompt-view" },
|
|
34
|
+
), /* @__PURE__ */ t.createElement("div", { className: "k-prompt-view" }, c));
|
|
28
35
|
});
|
|
29
|
-
|
|
36
|
+
I.displayName = "KendoReactAIPromptContent";
|
|
30
37
|
export {
|
|
31
|
-
|
|
38
|
+
I as AIPromptContent
|
|
32
39
|
};
|
|
@@ -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("react"),d=require("@progress/kendo-react-buttons"),r=require("@progress/kendo-svg-icons"),i=n=>{const[e,c]=t.useState(!0),{children:a,title:o}=n;return t.createElement("div",{className:"k-prompt-expander"},t.createElement(d.Button,{"aria-controls":n.id,fillMode:"flat",svgIcon:e?r.chevronUpIcon:r.chevronDownIcon,title:o,onClick:()=>c(!e),"aria-expanded":e},o),e&&t.createElement("div",{id:n.id,className:"k-prompt-expander-content"},a))};exports.AIPromptExpander=i;
|
|
@@ -5,22 +5,24 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import { Button as
|
|
10
|
-
import { chevronUpIcon as
|
|
11
|
-
const
|
|
12
|
-
const [
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
|
|
8
|
+
import t from "react";
|
|
9
|
+
import { Button as c } from "@progress/kendo-react-buttons";
|
|
10
|
+
import { chevronUpIcon as d, chevronDownIcon as i } from "@progress/kendo-svg-icons";
|
|
11
|
+
const s = (n) => {
|
|
12
|
+
const [e, r] = t.useState(!0), { children: a, title: o } = n;
|
|
13
|
+
return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-expander" }, /* @__PURE__ */ t.createElement(
|
|
14
|
+
c,
|
|
15
15
|
{
|
|
16
|
+
"aria-controls": n.id,
|
|
16
17
|
fillMode: "flat",
|
|
17
|
-
svgIcon:
|
|
18
|
-
title:
|
|
19
|
-
onClick: () => r(!
|
|
18
|
+
svgIcon: e ? d : i,
|
|
19
|
+
title: o,
|
|
20
|
+
onClick: () => r(!e),
|
|
21
|
+
"aria-expanded": e
|
|
20
22
|
},
|
|
21
|
-
|
|
22
|
-
),
|
|
23
|
+
o
|
|
24
|
+
), e && /* @__PURE__ */ t.createElement("div", { id: n.id, className: "k-prompt-expander-content" }, a));
|
|
23
25
|
};
|
|
24
26
|
export {
|
|
25
|
-
|
|
27
|
+
s as AIPromptExpander
|
|
26
28
|
};
|
|
@@ -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 n=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),p=require("../AIPromptContent.js"),C=require("./AIPromptViewRender.js"),I=require("../AIPromptContext.js"),i=require("@progress/kendo-react-layout"),P=require("./constants.js"),s=t=>t==null?void 0:t.map(e=>n.createElement(i.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&s(e.children||[]))),d=t=>{const{commands:e}=t,[r]=I.useAIPromptContext(),u=m=>{var a,c,l;const o=(c=(a=m.target)==null?void 0:a.props)==null?void 0:c.data;(l=o.children)!=null&&l.length||r.onCommandExecute&&r.onCommandExecute.call(null,o)};return n.createElement(C.AIPromptViewRender,{name:P.commandsViewDefaults.name},n.createElement(p.AIPromptContent,{streaming:r.streaming,onCancel:r.onCancel},n.createElement("div",{className:"k-prompt-view"},n.createElement(i.PanelBar,{onSelect:u,selected:""},s(e!=null?e:[])))))};exports.AIPromptCommandsView=d;
|
|
@@ -5,24 +5,20 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import { AIPromptContent as
|
|
10
|
-
import { AIPromptViewRender as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var a, l, m;
|
|
20
|
-
const o = (l = (a = s.target) == null ? void 0 : a.props) == null ? void 0 : l.data;
|
|
21
|
-
(m = o.children) != null && m.length || r.onCommandExecute && r.onCommandExecute.call(null, o);
|
|
8
|
+
import r from "react";
|
|
9
|
+
import { AIPromptContent as s } from "../AIPromptContent.mjs";
|
|
10
|
+
import { AIPromptViewRender as f } from "./AIPromptViewRender.mjs";
|
|
11
|
+
import { useAIPromptContext as u } from "../AIPromptContext.mjs";
|
|
12
|
+
import { PanelBar as C, PanelBarItem as I } from "@progress/kendo-react-layout";
|
|
13
|
+
import { commandsViewDefaults as d } from "./constants.mjs";
|
|
14
|
+
const i = (t) => t == null ? void 0 : t.map((e) => /* @__PURE__ */ r.createElement(I, { title: e.text, key: e.id, svgIcon: e.svgIcon, data: e }, e.children && i(e.children || []))), w = (t) => {
|
|
15
|
+
const { commands: e } = t, [n] = u(), c = (p) => {
|
|
16
|
+
var l, a, m;
|
|
17
|
+
const o = (a = (l = p.target) == null ? void 0 : l.props) == null ? void 0 : a.data;
|
|
18
|
+
(m = o.children) != null && m.length || n.onCommandExecute && n.onCommandExecute.call(null, o);
|
|
22
19
|
};
|
|
23
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ r.createElement(f, { name: d.name }, /* @__PURE__ */ r.createElement(s, { streaming: n.streaming, onCancel: n.onCancel }, /* @__PURE__ */ r.createElement("div", { className: "k-prompt-view" }, /* @__PURE__ */ r.createElement(C, { onSelect: c, selected: "" }, i(e != null ? e : [])))));
|
|
24
21
|
};
|
|
25
22
|
export {
|
|
26
|
-
|
|
27
|
-
E as commandsViewDefaults
|
|
23
|
+
w as AIPromptCommandsView
|
|
28
24
|
};
|
|
@@ -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("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),q=require("../AIPromptContent.js"),w=require("../AIPromptContext.js"),m=require("../../messages/index.js"),v=require("./AIPromptViewRender.js"),n=require("@progress/kendo-react-layout"),r=require("@progress/kendo-svg-icons"),a=require("@progress/kendo-react-buttons"),x=require("@progress/kendo-react-intl"),A=require("./constants.js"),O=g=>{const[y,d]=e.useState(""),o=e.useRef(null),[l]=w.useAIPromptContext(),{outputs:s,showOutputRating:R,outputCard:I}=g,{header:u,body:p,actions:C}=I||{},b=x.useLocalization(),h=t=>{l.onPromptRequest&&l.onPromptRequest.call(null,t.prompt,{...t,isRetry:!0}),E()},P=t=>{t!=null&&t.responseContent&&navigator.clipboard.writeText(t.responseContent),d(t.id),setTimeout(()=>{d("")},1e3)},k=(t,i)=>{l.onPromptRequest&&l.onPromptRequest.call(null,t.prompt,{...t,ratingType:i,isRetry:!1}),E()},E=()=>{o&&o.current&&o.current.scrollTo({top:0,behavior:"smooth"})},T=e.createElement(n.Card,null,e.createElement(n.CardHeader,null,e.createElement(n.CardTitle,null,e.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}})),e.createElement(n.CardSubtitle,null,e.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),e.createElement(n.CardBody,null,e.createElement("span",{className:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}})),e.createElement(n.CardActions,null,e.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),c=s==null?void 0:s.map((t,i)=>e.createElement(n.Card,{key:`${t.id}_${i}`},e.createElement(n.CardHeader,null,u?u(t):e.createElement(e.Fragment,null,t.title&&e.createElement(n.CardTitle,null,t.title),t.subTitle&&e.createElement(n.CardSubtitle,null,t.subTitle))),e.createElement(n.CardBody,null,p?p(t):t.responseContent),e.createElement(n.CardActions,null,C?C(t):e.createElement(e.Fragment,null,e.createElement(a.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:y===t.id?r.checkIcon:r.copyIcon,onClick:()=>P(t)},"Copy"),e.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:r.arrowRotateCwIcon,onClick:()=>h(t)},"Retry"),R&&e.createElement(e.Fragment,null,e.createElement("span",{className:"k-spacer"}),e.createElement(a.Button,{size:"medium",themeColor:t.ratingType==="positive"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:r.thumbUpOutlineIcon,onClick:()=>k(t,"positive")}),e.createElement(a.Button,{size:"medium",themeColor:t.ratingType==="negative"?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:r.thumbDownOutlineIcon,onClick:()=>k(t,"negative")})))))),f=e.createElement(n.Card,null,e.createElement(n.CardBody,null,b.toLanguageString(m.aIPromptNoOutputs,m.messages[m.aIPromptNoOutputs])));return e.createElement(v.AIPromptViewRender,{name:A.outputViewDefaults.name},e.createElement(q.AIPromptContent,{ref:o,streaming:l.streaming,onCancel:l.onCancel},e.createElement("div",{className:"k-card-list"},l.loading&&T,c,(!c||c.length===0)&&!l.loading&&f)))};exports.AIPromptOutputView=O;
|
|
@@ -6,30 +6,27 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import e from "react";
|
|
9
|
-
import { AIPromptContent as
|
|
9
|
+
import { AIPromptContent as O } from "../AIPromptContent.mjs";
|
|
10
10
|
import { useAIPromptContext as z } from "../AIPromptContext.mjs";
|
|
11
|
-
import { aIPromptNoOutputs as
|
|
11
|
+
import { aIPromptNoOutputs as E, messages as A } from "../../messages/index.mjs";
|
|
12
12
|
import { AIPromptViewRender as q } from "./AIPromptViewRender.mjs";
|
|
13
|
-
import { Card as s, CardHeader as g, CardTitle as f, CardSubtitle as y, CardBody as
|
|
14
|
-
import {
|
|
13
|
+
import { Card as s, CardHeader as g, CardTitle as f, CardSubtitle as y, CardBody as i, CardActions as R } from "@progress/kendo-react-layout";
|
|
14
|
+
import { checkIcon as M, copyIcon as F, arrowRotateCwIcon as S, thumbUpOutlineIcon as V, thumbDownOutlineIcon as _ } from "@progress/kendo-svg-icons";
|
|
15
15
|
import { Button as r } from "@progress/kendo-react-buttons";
|
|
16
|
-
import { useLocalization as
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, x = (t) => {
|
|
25
|
-
t != null && t.responseContent && navigator.clipboard.writeText(t.responseContent), i(t.id), setTimeout(() => {
|
|
26
|
-
i("");
|
|
16
|
+
import { useLocalization as B } from "@progress/kendo-react-intl";
|
|
17
|
+
import { outputViewDefaults as D } from "./constants.mjs";
|
|
18
|
+
const X = (h) => {
|
|
19
|
+
const [b, c] = e.useState(""), l = e.useRef(null), [n] = z(), { outputs: o, showOutputRating: I, outputCard: T } = h, { header: d, body: p, actions: k } = T || {}, w = B(), v = (t) => {
|
|
20
|
+
n.onPromptRequest && n.onPromptRequest.call(null, t.prompt, { ...t, isRetry: !0 }), C();
|
|
21
|
+
}, P = (t) => {
|
|
22
|
+
t != null && t.responseContent && navigator.clipboard.writeText(t.responseContent), c(t.id), setTimeout(() => {
|
|
23
|
+
c("");
|
|
27
24
|
}, 1e3);
|
|
28
|
-
},
|
|
29
|
-
n.onPromptRequest && n.onPromptRequest.call(null, t.prompt, { ...t, ratingType: m, isRetry: !1 }),
|
|
30
|
-
},
|
|
25
|
+
}, u = (t, m) => {
|
|
26
|
+
n.onPromptRequest && n.onPromptRequest.call(null, t.prompt, { ...t, ratingType: m, isRetry: !1 }), C();
|
|
27
|
+
}, C = () => {
|
|
31
28
|
l && l.current && l.current.scrollTo({ top: 0, behavior: "smooth" });
|
|
32
|
-
},
|
|
29
|
+
}, x = /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement(g, null, /* @__PURE__ */ e.createElement(f, null, /* @__PURE__ */ e.createElement("span", { className: "k-skeleton k-skeleton-text k-skeleton-pulse", style: { width: "200px" } })), /* @__PURE__ */ e.createElement(y, null, /* @__PURE__ */ e.createElement("span", { className: "k-skeleton k-skeleton-text k-skeleton-pulse", style: { width: "100%" } }))), /* @__PURE__ */ e.createElement(i, null, /* @__PURE__ */ e.createElement("span", { className: "k-skeleton k-skeleton-rect k-skeleton-pulse", style: { height: "80px" } })), /* @__PURE__ */ e.createElement(R, null, /* @__PURE__ */ e.createElement("span", { className: "k-skeleton k-skeleton-text k-skeleton-pulse", style: { width: "100%" } }))), a = o == null ? void 0 : o.map((t, m) => /* @__PURE__ */ e.createElement(s, { key: `${t.id}_${m}` }, /* @__PURE__ */ e.createElement(g, null, d ? d(t) : /* @__PURE__ */ e.createElement(e.Fragment, null, t.title && /* @__PURE__ */ e.createElement(f, null, t.title), t.subTitle && /* @__PURE__ */ e.createElement(y, null, t.subTitle))), /* @__PURE__ */ e.createElement(i, null, p ? p(t) : t.responseContent), /* @__PURE__ */ e.createElement(R, null, k ? k(t) : /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
33
30
|
r,
|
|
34
31
|
{
|
|
35
32
|
size: "medium",
|
|
@@ -37,8 +34,8 @@ const L = {
|
|
|
37
34
|
fillMode: "flat",
|
|
38
35
|
rounded: "medium",
|
|
39
36
|
title: "Copy",
|
|
40
|
-
svgIcon: b === t.id ?
|
|
41
|
-
onClick: () =>
|
|
37
|
+
svgIcon: b === t.id ? M : F,
|
|
38
|
+
onClick: () => P(t)
|
|
42
39
|
},
|
|
43
40
|
"Copy"
|
|
44
41
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -49,8 +46,8 @@ const L = {
|
|
|
49
46
|
fillMode: "flat",
|
|
50
47
|
rounded: "medium",
|
|
51
48
|
title: "Retry",
|
|
52
|
-
svgIcon:
|
|
53
|
-
onClick: () =>
|
|
49
|
+
svgIcon: S,
|
|
50
|
+
onClick: () => v(t)
|
|
54
51
|
},
|
|
55
52
|
"Retry"
|
|
56
53
|
), I && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("span", { className: "k-spacer" }), /* @__PURE__ */ e.createElement(
|
|
@@ -61,8 +58,8 @@ const L = {
|
|
|
61
58
|
fillMode: "flat",
|
|
62
59
|
rounded: "medium",
|
|
63
60
|
title: "Rate up",
|
|
64
|
-
svgIcon:
|
|
65
|
-
onClick: () =>
|
|
61
|
+
svgIcon: V,
|
|
62
|
+
onClick: () => u(t, "positive")
|
|
66
63
|
}
|
|
67
64
|
), /* @__PURE__ */ e.createElement(
|
|
68
65
|
r,
|
|
@@ -72,13 +69,12 @@ const L = {
|
|
|
72
69
|
fillMode: "flat",
|
|
73
70
|
rounded: "medium",
|
|
74
71
|
title: "Rate down",
|
|
75
|
-
svgIcon:
|
|
76
|
-
onClick: () =>
|
|
72
|
+
svgIcon: _,
|
|
73
|
+
onClick: () => u(t, "negative")
|
|
77
74
|
}
|
|
78
|
-
)))))),
|
|
79
|
-
return /* @__PURE__ */ e.createElement(q, { name:
|
|
75
|
+
)))))), N = /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement(i, null, w.toLanguageString(E, A[E])));
|
|
76
|
+
return /* @__PURE__ */ e.createElement(q, { name: D.name }, /* @__PURE__ */ e.createElement(O, { ref: l, streaming: n.streaming, onCancel: n.onCancel }, /* @__PURE__ */ e.createElement("div", { className: "k-card-list" }, n.loading && x, a, (!a || a.length === 0) && !n.loading && N)));
|
|
80
77
|
};
|
|
81
78
|
export {
|
|
82
|
-
X as AIPromptOutputView
|
|
83
|
-
L as outputViewDefaults
|
|
79
|
+
X as AIPromptOutputView
|
|
84
80
|
};
|
|
@@ -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 e=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),y=require("../AIPromptContent.js"),j=require("../AIPromptFooter.js"),P=require("@progress/kendo-react-buttons"),h=require("@progress/kendo-react-inputs"),G=require("@progress/kendo-svg-icons"),x=require("@progress/kendo-react-common"),O=require("./AIPromptViewRender.js"),F=require("../AIPromptExpander.js"),M=require("../AIPromptContext.js"),z=require("../../chat/components/SuggestionsGroup.js"),W=require("./constants.js"),D=A=>{const{promptInput:I=h.TextArea,generateButton:f=P.Button,enableSpeechToText:n=!1,promptValue:S,promptSuggestions:a}=A,[r,s]=e.useState(S||""),[c]=M.useAIPromptContext(),[C,i]=x.useCustomComponent(f),[q,p]=x.useCustomComponent(I),T=()=>{c.onPromptRequest&&c.onPromptRequest.call(null,r),s("")},R=t=>{s(t)},k=t=>{s(t.target.value)},E={title:"Generate",children:"Generate",svgIcon:G.sparklesIcon},b={placeholder:"Ask or generate content with AI ...",rows:2},m=Object.keys(i).length>0?i:E,V=Object.keys(p).length>0?p:b,d=t=>{const{isFinal:o,alternatives:g}=t;if(o&&g.length>0){const v=g[0].transcript,w=(()=>{const l=r,B=l&&!l.endsWith(" ")&&!l.endsWith(`
|
|
9
|
+
`);return l+(B?" ":"")+v})();s(w)}};let u;return n&&(typeof n=="object"?u={...n,onResult:n.onResult||d}:u={onResult:d}),e.createElement(O.AIPromptViewRender,{name:W.promptViewDefaults.name},e.createElement(y.AIPromptContent,{streaming:c.streaming,onCancel:c.onCancel},e.createElement(q,{value:r,className:"!k-flex-col",suffix:n?e.createElement(h.InputSuffix,{orientation:"horizontal"},e.createElement(P.SpeechToTextButton,{fillMode:"flat",...u})):void 0,onChange:k,...V}),a&&a.length>0&&e.createElement(F.AIPromptExpander,{id:"prompt-suggestions",title:"Prompt Suggestions"},e.createElement(z.SuggestionGroup,{suggestions:a.map((t,o)=>({id:o,text:t,description:t})),onSuggestionClick:(t,o)=>{R(o.text)}}))),e.createElement(j.AIPromptFooter,null,e.createElement(C,{themeColor:"primary",fillMode:"solid",rounded:"full",size:"medium",onClick:T,disabled:!r.trim(),...m},m.children)))};exports.AIPromptView=D;
|
|
@@ -6,58 +6,95 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import e from "react";
|
|
9
|
-
import { AIPromptContent as
|
|
10
|
-
import { AIPromptFooter as
|
|
11
|
-
import { Button as
|
|
12
|
-
import { TextArea as
|
|
13
|
-
import { sparklesIcon as
|
|
14
|
-
import { useCustomComponent as
|
|
15
|
-
import { AIPromptViewRender as
|
|
16
|
-
import { AIPromptExpander as
|
|
17
|
-
import { useAIPromptContext as
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
o
|
|
9
|
+
import { AIPromptContent as B } from "../AIPromptContent.mjs";
|
|
10
|
+
import { AIPromptFooter as y } from "../AIPromptFooter.mjs";
|
|
11
|
+
import { SpeechToTextButton as j, Button as q } from "@progress/kendo-react-buttons";
|
|
12
|
+
import { InputSuffix as G, TextArea as O } from "@progress/kendo-react-inputs";
|
|
13
|
+
import { sparklesIcon as _ } from "@progress/kendo-svg-icons";
|
|
14
|
+
import { useCustomComponent as g } from "@progress/kendo-react-common";
|
|
15
|
+
import { AIPromptViewRender as z } from "./AIPromptViewRender.mjs";
|
|
16
|
+
import { AIPromptExpander as F } from "../AIPromptExpander.mjs";
|
|
17
|
+
import { useAIPromptContext as M } from "../AIPromptContext.mjs";
|
|
18
|
+
import { SuggestionGroup as W } from "../../chat/components/SuggestionsGroup.mjs";
|
|
19
|
+
import { promptViewDefaults as $ } from "./constants.mjs";
|
|
20
|
+
const te = (h) => {
|
|
21
|
+
const {
|
|
22
|
+
promptInput: x = O,
|
|
23
|
+
generateButton: P = q,
|
|
24
|
+
enableSpeechToText: o = !1,
|
|
25
|
+
promptValue: A,
|
|
26
|
+
promptSuggestions: m
|
|
27
|
+
} = h, [r, s] = e.useState(A || ""), [l] = M(), [S, p] = g(P), [T, c] = g(x), C = () => {
|
|
28
|
+
l.onPromptRequest && l.onPromptRequest.call(null, r), s("");
|
|
25
29
|
}, I = (t) => {
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
+
s(t);
|
|
31
|
+
}, E = (t) => {
|
|
32
|
+
s(t.target.value);
|
|
33
|
+
}, R = {
|
|
30
34
|
title: "Generate",
|
|
31
35
|
children: "Generate",
|
|
32
|
-
svgIcon:
|
|
33
|
-
},
|
|
36
|
+
svgIcon: _
|
|
37
|
+
}, b = {
|
|
34
38
|
placeholder: "Ask or generate content with AI ...",
|
|
35
39
|
rows: 2
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
}, u = Object.keys(p).length > 0 ? p : R, k = Object.keys(c).length > 0 ? c : b, f = (t) => {
|
|
41
|
+
const { isFinal: n, alternatives: d } = t;
|
|
42
|
+
if (n && d.length > 0) {
|
|
43
|
+
const V = d[0].transcript, v = (() => {
|
|
44
|
+
const a = r, w = a && !a.endsWith(" ") && !a.endsWith(`
|
|
45
|
+
`);
|
|
46
|
+
return a + (w ? " " : "") + V;
|
|
47
|
+
})();
|
|
48
|
+
s(v);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
let i;
|
|
52
|
+
return o && (typeof o == "object" ? i = {
|
|
53
|
+
...o,
|
|
54
|
+
onResult: o.onResult || f
|
|
55
|
+
} : i = {
|
|
56
|
+
onResult: f
|
|
57
|
+
}), /* @__PURE__ */ e.createElement(z, { name: $.name }, /* @__PURE__ */ e.createElement(B, { streaming: l.streaming, onCancel: l.onCancel }, /* @__PURE__ */ e.createElement(
|
|
58
|
+
T,
|
|
39
59
|
{
|
|
40
|
-
|
|
41
|
-
className: "k-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
value: r,
|
|
61
|
+
className: "!k-flex-col",
|
|
62
|
+
suffix: o ? /* @__PURE__ */ e.createElement(G, { orientation: "horizontal" }, /* @__PURE__ */ e.createElement(
|
|
63
|
+
j,
|
|
64
|
+
{
|
|
65
|
+
fillMode: "flat",
|
|
66
|
+
...i
|
|
67
|
+
}
|
|
68
|
+
)) : void 0,
|
|
69
|
+
onChange: E,
|
|
70
|
+
...k
|
|
71
|
+
}
|
|
72
|
+
), m && m.length > 0 && /* @__PURE__ */ e.createElement(F, { id: "prompt-suggestions", title: "Prompt Suggestions" }, /* @__PURE__ */ e.createElement(
|
|
73
|
+
W,
|
|
74
|
+
{
|
|
75
|
+
suggestions: m.map((t, n) => ({
|
|
76
|
+
id: n,
|
|
77
|
+
text: t,
|
|
78
|
+
description: t
|
|
79
|
+
})),
|
|
80
|
+
onSuggestionClick: (t, n) => {
|
|
81
|
+
I(n.text);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
))), /* @__PURE__ */ e.createElement(y, null, /* @__PURE__ */ e.createElement(
|
|
85
|
+
S,
|
|
48
86
|
{
|
|
49
87
|
themeColor: "primary",
|
|
50
88
|
fillMode: "solid",
|
|
51
89
|
rounded: "full",
|
|
52
90
|
size: "medium",
|
|
53
|
-
onClick:
|
|
91
|
+
onClick: C,
|
|
54
92
|
disabled: !r.trim(),
|
|
55
|
-
...
|
|
93
|
+
...u
|
|
56
94
|
},
|
|
57
|
-
|
|
95
|
+
u.children
|
|
58
96
|
)));
|
|
59
97
|
};
|
|
60
98
|
export {
|
|
61
|
-
|
|
62
|
-
V as promptViewDefaults
|
|
99
|
+
te as AIPromptView
|
|
63
100
|
};
|
|
@@ -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 c=require("react"),d=require("@progress/kendo-react-common");function i(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(r,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return r.default=t,Object.freeze(r)}const l=i(c),s=t=>{const{suggestions:r,onSuggestionClick:a}=t,n=(e,o)=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(e,o))};return l.createElement("div",{role:"group",className:"k-suggestion-group"},r.map(e=>l.createElement("span",{role:"button",tabIndex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:o=>!e.disabled&&a(o,e),onKeyDown:o=>!e.disabled&&n(o,e),key:e.id,title:e.description,className:d.classNames("k-suggestion",{"k-disabled":e.disabled})},e.text)))};exports.SuggestionGroup=s;
|