@copilotkit/react-ui 1.8.13-next.1 → 1.8.13-next.3
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/CHANGELOG.md +18 -0
- package/dist/{chunk-RVLCPPEL.mjs → chunk-5INP2EWU.mjs} +6 -4
- package/dist/chunk-5INP2EWU.mjs.map +1 -0
- package/dist/{chunk-XFCMZH2H.mjs → chunk-6VUDBDUN.mjs} +2 -2
- package/dist/{chunk-24TDU7MY.mjs → chunk-ALWZ35SI.mjs} +2 -2
- package/dist/{chunk-IIRQWGWV.mjs → chunk-B3D7U7TJ.mjs} +5 -3
- package/dist/chunk-B3D7U7TJ.mjs.map +1 -0
- package/dist/{chunk-KQ44Z255.mjs → chunk-EMIYIMQ6.mjs} +4 -4
- package/dist/{chunk-ZDKVXAL3.mjs → chunk-FWKHST6I.mjs} +75 -39
- package/dist/chunk-FWKHST6I.mjs.map +1 -0
- package/dist/{chunk-NWE7CLTB.mjs → chunk-IAHSHPRJ.mjs} +22 -21
- package/dist/chunk-IAHSHPRJ.mjs.map +1 -0
- package/dist/{chunk-XZNY26GH.mjs → chunk-IMBPSLL4.mjs} +3 -3
- package/dist/chunk-IMBPSLL4.mjs.map +1 -0
- package/dist/{chunk-MDMNZ6JL.mjs → chunk-JU3HNL5N.mjs} +2 -2
- package/dist/{chunk-DSQGQJI4.mjs → chunk-MPZAMNCN.mjs} +2 -2
- package/dist/{chunk-K7SXHJRT.mjs → chunk-QEZ3YYLO.mjs} +2 -2
- package/dist/chunk-QGSPTXOV.mjs +24 -0
- package/dist/chunk-QGSPTXOV.mjs.map +1 -0
- package/dist/chunk-SC6JRFAJ.mjs +1 -0
- package/dist/{chunk-LUPGADWY.mjs → chunk-UKWBNVMQ.mjs} +2 -2
- package/dist/{chunk-OZXUB3V7.mjs → chunk-XMNTLIK5.mjs} +5 -4
- package/dist/chunk-XMNTLIK5.mjs.map +1 -0
- package/dist/chunk-YTXEWDNC.mjs +117 -0
- package/dist/chunk-YTXEWDNC.mjs.map +1 -0
- package/dist/components/chat/Button.d.ts +2 -0
- package/dist/components/chat/Chat.d.ts +11 -2
- package/dist/components/chat/Chat.js +117 -50
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +13 -12
- package/dist/components/chat/Header.d.ts +2 -0
- package/dist/components/chat/Input.d.ts +2 -0
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Markdown.d.ts +3 -1
- package/dist/components/chat/Markdown.js +65 -20
- package/dist/components/chat/Markdown.js.map +1 -1
- package/dist/components/chat/Markdown.mjs +1 -1
- package/dist/components/chat/Messages.d.ts +2 -1
- package/dist/components/chat/Messages.js +4 -2
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +1 -1
- package/dist/components/chat/Modal.d.ts +2 -2
- package/dist/components/chat/Modal.js +186 -88
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +19 -18
- package/dist/components/chat/Popup.d.ts +1 -1
- package/dist/components/chat/Popup.js +188 -90
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +20 -19
- package/dist/components/chat/Sidebar.d.ts +1 -1
- package/dist/components/chat/Sidebar.js +188 -90
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +20 -19
- package/dist/components/chat/Suggestion.d.ts +8 -3
- package/dist/components/chat/Suggestion.js +2 -2
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +1 -1
- package/dist/components/chat/Suggestions.d.ts +9 -0
- package/dist/components/chat/Suggestions.js +73 -0
- package/dist/components/chat/Suggestions.js.map +1 -0
- package/dist/components/chat/Suggestions.mjs +10 -0
- package/dist/components/chat/Suggestions.mjs.map +1 -0
- package/dist/components/chat/Window.d.ts +2 -0
- package/dist/components/chat/index.d.ts +6 -3
- package/dist/components/chat/index.js +194 -92
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +31 -24
- package/dist/components/chat/messages/AssistantMessage.d.ts +2 -0
- package/dist/components/chat/messages/AssistantMessage.js +68 -22
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +2 -2
- package/dist/components/chat/messages/RenderActionExecutionMessage.d.ts +2 -0
- package/dist/components/chat/messages/RenderActionExecutionMessage.js +68 -22
- package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +3 -3
- package/dist/components/chat/messages/RenderAgentStateMessage.d.ts +2 -0
- package/dist/components/chat/messages/RenderAgentStateMessage.js +68 -22
- package/dist/components/chat/messages/RenderAgentStateMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderAgentStateMessage.mjs +3 -3
- package/dist/components/chat/messages/RenderImageMessage.d.ts +2 -0
- package/dist/components/chat/messages/RenderImageMessage.js +68 -22
- package/dist/components/chat/messages/RenderImageMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderImageMessage.mjs +3 -3
- package/dist/components/chat/messages/RenderResultMessage.d.ts +2 -0
- package/dist/components/chat/messages/RenderResultMessage.js +68 -22
- package/dist/components/chat/messages/RenderResultMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderResultMessage.mjs +3 -3
- package/dist/components/chat/messages/RenderTextMessage.d.ts +2 -0
- package/dist/components/chat/messages/RenderTextMessage.js +72 -24
- package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderTextMessage.mjs +3 -3
- package/dist/components/chat/messages/UserMessage.d.ts +2 -0
- package/dist/components/chat/props.d.ts +27 -1
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.d.ts +6 -3
- package/dist/components/index.js +194 -92
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +35 -28
- package/dist/index.css +32 -28
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +194 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -28
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +11 -10
- package/src/components/chat/Chat.tsx +21 -13
- package/src/components/chat/Markdown.tsx +86 -29
- package/src/components/chat/Messages.tsx +2 -0
- package/src/components/chat/Modal.tsx +4 -0
- package/src/components/chat/Suggestion.tsx +10 -3
- package/src/components/chat/Suggestions.tsx +20 -0
- package/src/components/chat/index.tsx +2 -0
- package/src/components/chat/messages/AssistantMessage.tsx +2 -1
- package/src/components/chat/messages/RenderTextMessage.tsx +2 -0
- package/src/components/chat/props.ts +29 -0
- package/src/css/markdown.css +33 -28
- package/src/types/index.ts +1 -0
- package/dist/chunk-ABHUX6T6.mjs +0 -72
- package/dist/chunk-ABHUX6T6.mjs.map +0 -1
- package/dist/chunk-IIRQWGWV.mjs.map +0 -1
- package/dist/chunk-NWE7CLTB.mjs.map +0 -1
- package/dist/chunk-OZXUB3V7.mjs.map +0 -1
- package/dist/chunk-PXEVB7IK.mjs +0 -1
- package/dist/chunk-RVLCPPEL.mjs.map +0 -1
- package/dist/chunk-XZNY26GH.mjs.map +0 -1
- package/dist/chunk-ZDKVXAL3.mjs.map +0 -1
- /package/dist/{chunk-XFCMZH2H.mjs.map → chunk-6VUDBDUN.mjs.map} +0 -0
- /package/dist/{chunk-24TDU7MY.mjs.map → chunk-ALWZ35SI.mjs.map} +0 -0
- /package/dist/{chunk-KQ44Z255.mjs.map → chunk-EMIYIMQ6.mjs.map} +0 -0
- /package/dist/{chunk-MDMNZ6JL.mjs.map → chunk-JU3HNL5N.mjs.map} +0 -0
- /package/dist/{chunk-DSQGQJI4.mjs.map → chunk-MPZAMNCN.mjs.map} +0 -0
- /package/dist/{chunk-K7SXHJRT.mjs.map → chunk-QEZ3YYLO.mjs.map} +0 -0
- /package/dist/{chunk-PXEVB7IK.mjs.map → chunk-SC6JRFAJ.mjs.map} +0 -0
- /package/dist/{chunk-LUPGADWY.mjs.map → chunk-UKWBNVMQ.mjs.map} +0 -0
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-FWKHST6I.mjs";
|
|
4
4
|
import "../../chunk-TIDV74OE.mjs";
|
|
5
|
-
import "../../chunk-UFN2VWSR.mjs";
|
|
6
|
-
import "../../chunk-NWE7CLTB.mjs";
|
|
7
|
-
import "../../chunk-DSQGQJI4.mjs";
|
|
8
|
-
import "../../chunk-24TDU7MY.mjs";
|
|
9
|
-
import "../../chunk-LUPGADWY.mjs";
|
|
10
|
-
import "../../chunk-XFCMZH2H.mjs";
|
|
11
|
-
import "../../chunk-RVLCPPEL.mjs";
|
|
12
|
-
import "../../chunk-OZXUB3V7.mjs";
|
|
13
|
-
import "../../chunk-HWMFMBJC.mjs";
|
|
14
|
-
import "../../chunk-XZNY26GH.mjs";
|
|
15
|
-
import "../../chunk-PLHTVHUW.mjs";
|
|
16
|
-
import "../../chunk-KQ44Z255.mjs";
|
|
17
|
-
import "../../chunk-YQFVRDNC.mjs";
|
|
18
|
-
import "../../chunk-ABHUX6T6.mjs";
|
|
19
|
-
import "../../chunk-IIRQWGWV.mjs";
|
|
20
|
-
import "../../chunk-CGEAG65D.mjs";
|
|
21
|
-
import "../../chunk-KENCH7RN.mjs";
|
|
22
5
|
import "../../chunk-UH2UFL5W.mjs";
|
|
23
6
|
import "../../chunk-V7W6IM2V.mjs";
|
|
24
7
|
import "../../chunk-VGPQYMKJ.mjs";
|
|
@@ -27,6 +10,24 @@ import "../../chunk-6TCUJ3B7.mjs";
|
|
|
27
10
|
import "../../chunk-KXE2JCUH.mjs";
|
|
28
11
|
import "../../chunk-NRA3CFEE.mjs";
|
|
29
12
|
import "../../chunk-BH6PCAAL.mjs";
|
|
13
|
+
import "../../chunk-UFN2VWSR.mjs";
|
|
14
|
+
import "../../chunk-IAHSHPRJ.mjs";
|
|
15
|
+
import "../../chunk-MPZAMNCN.mjs";
|
|
16
|
+
import "../../chunk-ALWZ35SI.mjs";
|
|
17
|
+
import "../../chunk-UKWBNVMQ.mjs";
|
|
18
|
+
import "../../chunk-6VUDBDUN.mjs";
|
|
19
|
+
import "../../chunk-5INP2EWU.mjs";
|
|
20
|
+
import "../../chunk-XMNTLIK5.mjs";
|
|
21
|
+
import "../../chunk-HWMFMBJC.mjs";
|
|
22
|
+
import "../../chunk-QGSPTXOV.mjs";
|
|
23
|
+
import "../../chunk-IMBPSLL4.mjs";
|
|
24
|
+
import "../../chunk-PLHTVHUW.mjs";
|
|
25
|
+
import "../../chunk-EMIYIMQ6.mjs";
|
|
26
|
+
import "../../chunk-CGEAG65D.mjs";
|
|
27
|
+
import "../../chunk-YQFVRDNC.mjs";
|
|
28
|
+
import "../../chunk-YTXEWDNC.mjs";
|
|
29
|
+
import "../../chunk-KENCH7RN.mjs";
|
|
30
|
+
import "../../chunk-B3D7U7TJ.mjs";
|
|
30
31
|
import "../../chunk-IEMQ2SQW.mjs";
|
|
31
32
|
import "../../chunk-XWG3L6QC.mjs";
|
|
32
33
|
import "../../chunk-54JAUBUJ.mjs";
|
|
@@ -3,10 +3,10 @@ import { CopilotModalProps } from './Modal.js';
|
|
|
3
3
|
import 'react';
|
|
4
4
|
import './props.js';
|
|
5
5
|
import '@copilotkit/runtime-client-gql';
|
|
6
|
+
import '../../types/suggestions.js';
|
|
6
7
|
import './Chat.js';
|
|
7
8
|
import './ChatContext.js';
|
|
8
9
|
import '@copilotkit/react-core';
|
|
9
|
-
import '../../types/suggestions.js';
|
|
10
10
|
|
|
11
11
|
declare function CopilotPopup(props: CopilotModalProps): react_jsx_runtime.JSX.Element;
|
|
12
12
|
|
|
@@ -1058,7 +1058,8 @@ var Messages = ({
|
|
|
1058
1058
|
onRegenerate,
|
|
1059
1059
|
onCopy,
|
|
1060
1060
|
onThumbsUp,
|
|
1061
|
-
onThumbsDown
|
|
1061
|
+
onThumbsDown,
|
|
1062
|
+
markdownTagRenderers
|
|
1062
1063
|
}) => {
|
|
1063
1064
|
const context = useChatContext();
|
|
1064
1065
|
const initialMessages = (0, import_react6.useMemo)(
|
|
@@ -1097,7 +1098,8 @@ var Messages = ({
|
|
|
1097
1098
|
onRegenerate,
|
|
1098
1099
|
onCopy,
|
|
1099
1100
|
onThumbsUp,
|
|
1100
|
-
onThumbsDown
|
|
1101
|
+
onThumbsDown,
|
|
1102
|
+
markdownTagRenderers
|
|
1101
1103
|
},
|
|
1102
1104
|
index
|
|
1103
1105
|
);
|
|
@@ -1926,31 +1928,17 @@ var highlightStyle = {
|
|
|
1926
1928
|
// src/components/chat/Markdown.tsx
|
|
1927
1929
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
1928
1930
|
var import_remark_math = __toESM(require("remark-math"));
|
|
1931
|
+
var import_rehype_raw = __toESM(require("rehype-raw"));
|
|
1929
1932
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1930
|
-
var
|
|
1931
|
-
import_react_markdown.default,
|
|
1932
|
-
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
1933
|
-
);
|
|
1934
|
-
var Markdown = ({ content }) => {
|
|
1935
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedReactMarkdown, { components, remarkPlugins: [import_remark_gfm.default, import_remark_math.default], children: content }) });
|
|
1936
|
-
};
|
|
1937
|
-
var components = {
|
|
1933
|
+
var defaultComponents = {
|
|
1938
1934
|
a(_a) {
|
|
1939
1935
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1940
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1941
|
-
"a",
|
|
1942
|
-
__spreadProps(__spreadValues({
|
|
1943
|
-
style: { color: "blue", textDecoration: "underline" }
|
|
1944
|
-
}, props), {
|
|
1945
|
-
target: "_blank",
|
|
1946
|
-
rel: "noopener noreferrer",
|
|
1947
|
-
children
|
|
1948
|
-
})
|
|
1949
|
-
);
|
|
1936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("a", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { target: "_blank", rel: "noopener noreferrer", children }));
|
|
1950
1937
|
},
|
|
1938
|
+
// @ts-expect-error -- inline
|
|
1951
1939
|
code(_c) {
|
|
1952
1940
|
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
1953
|
-
if (children.length) {
|
|
1941
|
+
if (Array.isArray(children) && children.length) {
|
|
1954
1942
|
if (children[0] == "\u258D") {
|
|
1955
1943
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1956
1944
|
"span",
|
|
@@ -1963,7 +1951,7 @@ var components = {
|
|
|
1963
1951
|
}
|
|
1964
1952
|
);
|
|
1965
1953
|
}
|
|
1966
|
-
children[0] = children[0].replace("`\u258D`", "\u258D");
|
|
1954
|
+
children[0] = (children == null ? void 0 : children[0]).replace("`\u258D`", "\u258D");
|
|
1967
1955
|
}
|
|
1968
1956
|
const match = /language-(\w+)/.exec(className || "");
|
|
1969
1957
|
if (inline) {
|
|
@@ -1977,8 +1965,67 @@ var components = {
|
|
|
1977
1965
|
}, props),
|
|
1978
1966
|
Math.random()
|
|
1979
1967
|
);
|
|
1968
|
+
},
|
|
1969
|
+
h1: (_e) => {
|
|
1970
|
+
var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
|
|
1971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h1", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1972
|
+
},
|
|
1973
|
+
h2: (_g) => {
|
|
1974
|
+
var _h = _g, { children } = _h, props = __objRest(_h, ["children"]);
|
|
1975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h2", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1976
|
+
},
|
|
1977
|
+
h3: (_i) => {
|
|
1978
|
+
var _j = _i, { children } = _j, props = __objRest(_j, ["children"]);
|
|
1979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1980
|
+
},
|
|
1981
|
+
h4: (_k) => {
|
|
1982
|
+
var _l = _k, { children } = _l, props = __objRest(_l, ["children"]);
|
|
1983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1984
|
+
},
|
|
1985
|
+
h5: (_m) => {
|
|
1986
|
+
var _n = _m, { children } = _n, props = __objRest(_n, ["children"]);
|
|
1987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h5", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1988
|
+
},
|
|
1989
|
+
h6: (_o) => {
|
|
1990
|
+
var _p = _o, { children } = _p, props = __objRest(_p, ["children"]);
|
|
1991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h6", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1992
|
+
},
|
|
1993
|
+
p: (_q) => {
|
|
1994
|
+
var _r = _q, { children } = _r, props = __objRest(_r, ["children"]);
|
|
1995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1996
|
+
},
|
|
1997
|
+
pre: (_s) => {
|
|
1998
|
+
var _t = _s, { children } = _t, props = __objRest(_t, ["children"]);
|
|
1999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("pre", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
2000
|
+
},
|
|
2001
|
+
blockquote: (_u) => {
|
|
2002
|
+
var _v = _u, { children } = _v, props = __objRest(_v, ["children"]);
|
|
2003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("blockquote", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
2004
|
+
},
|
|
2005
|
+
ul: (_w) => {
|
|
2006
|
+
var _x = _w, { children } = _x, props = __objRest(_x, ["children"]);
|
|
2007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
2008
|
+
},
|
|
2009
|
+
li: (_y) => {
|
|
2010
|
+
var _z = _y, { children } = _z, props = __objRest(_z, ["children"]);
|
|
2011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", __spreadProps(__spreadValues({ className: "copilotKitMarkdownElement" }, props), { children }));
|
|
1980
2012
|
}
|
|
1981
2013
|
};
|
|
2014
|
+
var MemoizedReactMarkdown = (0, import_react11.memo)(
|
|
2015
|
+
import_react_markdown.default,
|
|
2016
|
+
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.components === nextProps.components
|
|
2017
|
+
);
|
|
2018
|
+
var Markdown = ({ content, components }) => {
|
|
2019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2020
|
+
MemoizedReactMarkdown,
|
|
2021
|
+
{
|
|
2022
|
+
components: __spreadValues(__spreadValues({}, defaultComponents), components),
|
|
2023
|
+
remarkPlugins: [import_remark_gfm.default, import_remark_math.default],
|
|
2024
|
+
rehypePlugins: [import_rehype_raw.default],
|
|
2025
|
+
children: content
|
|
2026
|
+
}
|
|
2027
|
+
) });
|
|
2028
|
+
};
|
|
1982
2029
|
|
|
1983
2030
|
// src/components/chat/messages/AssistantMessage.tsx
|
|
1984
2031
|
var import_react12 = require("react");
|
|
@@ -1993,7 +2040,8 @@ var AssistantMessage = (props) => {
|
|
|
1993
2040
|
onCopy,
|
|
1994
2041
|
onThumbsUp,
|
|
1995
2042
|
onThumbsDown,
|
|
1996
|
-
isCurrentMessage
|
|
2043
|
+
isCurrentMessage,
|
|
2044
|
+
markdownTagRenderers
|
|
1997
2045
|
} = props;
|
|
1998
2046
|
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
1999
2047
|
const handleCopy = () => {
|
|
@@ -2026,7 +2074,7 @@ var AssistantMessage = (props) => {
|
|
|
2026
2074
|
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: icons.activityIcon });
|
|
2027
2075
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2028
2076
|
(message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2029
|
-
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Markdown, { content: message || "" }),
|
|
2077
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Markdown, { content: message || "", components: markdownTagRenderers }),
|
|
2030
2078
|
isLoading && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingIcon, {}),
|
|
2031
2079
|
message && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2032
2080
|
"div",
|
|
@@ -2099,7 +2147,8 @@ function RenderTextMessage(_a) {
|
|
|
2099
2147
|
onRegenerate,
|
|
2100
2148
|
onCopy,
|
|
2101
2149
|
onThumbsUp,
|
|
2102
|
-
onThumbsDown
|
|
2150
|
+
onThumbsDown,
|
|
2151
|
+
markdownTagRenderers
|
|
2103
2152
|
} = props;
|
|
2104
2153
|
if (message.isTextMessage()) {
|
|
2105
2154
|
if (message.role === "user") {
|
|
@@ -2125,7 +2174,8 @@ function RenderTextMessage(_a) {
|
|
|
2125
2174
|
onRegenerate: () => onRegenerate == null ? void 0 : onRegenerate(message.id),
|
|
2126
2175
|
onCopy,
|
|
2127
2176
|
onThumbsUp,
|
|
2128
|
-
onThumbsDown
|
|
2177
|
+
onThumbsDown,
|
|
2178
|
+
markdownTagRenderers
|
|
2129
2179
|
},
|
|
2130
2180
|
index
|
|
2131
2181
|
);
|
|
@@ -2436,19 +2486,23 @@ function RenderImageMessage(_a) {
|
|
|
2436
2486
|
return null;
|
|
2437
2487
|
}
|
|
2438
2488
|
|
|
2489
|
+
// src/components/chat/Chat.tsx
|
|
2490
|
+
var import_react13 = __toESM(require("react"));
|
|
2491
|
+
var import_react_core10 = require("@copilotkit/react-core");
|
|
2492
|
+
|
|
2439
2493
|
// src/components/chat/Suggestion.tsx
|
|
2440
2494
|
var import_react_core9 = require("@copilotkit/react-core");
|
|
2441
2495
|
var import_shared2 = require("@copilotkit/shared");
|
|
2442
2496
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2443
2497
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2444
|
-
function Suggestion({ title,
|
|
2498
|
+
function Suggestion({ title, onClick, partial, className }) {
|
|
2445
2499
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2446
2500
|
"button",
|
|
2447
2501
|
{
|
|
2448
2502
|
disabled: partial,
|
|
2449
2503
|
onClick: (e) => {
|
|
2450
2504
|
e.preventDefault();
|
|
2451
|
-
onClick(
|
|
2505
|
+
onClick();
|
|
2452
2506
|
},
|
|
2453
2507
|
className: className || (partial ? "suggestion loading" : "suggestion"),
|
|
2454
2508
|
"data-test-id": "suggestion",
|
|
@@ -2527,8 +2581,6 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
2527
2581
|
});
|
|
2528
2582
|
|
|
2529
2583
|
// src/components/chat/Chat.tsx
|
|
2530
|
-
var import_react13 = __toESM(require("react"));
|
|
2531
|
-
var import_react_core10 = require("@copilotkit/react-core");
|
|
2532
2584
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
2533
2585
|
var import_shared3 = require("@copilotkit/shared");
|
|
2534
2586
|
var import_react_core11 = require("@copilotkit/react-core");
|
|
@@ -2611,8 +2663,24 @@ var ImageUploadQueue = ({
|
|
|
2611
2663
|
);
|
|
2612
2664
|
};
|
|
2613
2665
|
|
|
2614
|
-
// src/components/chat/
|
|
2666
|
+
// src/components/chat/Suggestions.tsx
|
|
2615
2667
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2668
|
+
function Suggestions({ suggestions, onSuggestionClick }) {
|
|
2669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2670
|
+
Suggestion,
|
|
2671
|
+
{
|
|
2672
|
+
title: suggestion.title,
|
|
2673
|
+
message: suggestion.message,
|
|
2674
|
+
partial: suggestion.partial,
|
|
2675
|
+
className: suggestion.className,
|
|
2676
|
+
onClick: () => onSuggestionClick(suggestion.message)
|
|
2677
|
+
},
|
|
2678
|
+
index
|
|
2679
|
+
)) });
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
// src/components/chat/Chat.tsx
|
|
2683
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2616
2684
|
function CopilotChat({
|
|
2617
2685
|
instructions,
|
|
2618
2686
|
onSubmitMessage,
|
|
@@ -2624,12 +2692,14 @@ function CopilotChat({
|
|
|
2624
2692
|
onCopy,
|
|
2625
2693
|
onThumbsUp,
|
|
2626
2694
|
onThumbsDown,
|
|
2695
|
+
markdownTagRenderers,
|
|
2627
2696
|
Messages: Messages2 = Messages,
|
|
2628
2697
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2629
2698
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
2630
2699
|
RenderAgentStateMessage: RenderAgentStateMessage2 = RenderAgentStateMessage,
|
|
2631
2700
|
RenderResultMessage: RenderResultMessage2 = RenderResultMessage,
|
|
2632
2701
|
RenderImageMessage: RenderImageMessage2 = RenderImageMessage,
|
|
2702
|
+
RenderSuggestionsList = Suggestions,
|
|
2633
2703
|
Input: Input2 = Input,
|
|
2634
2704
|
className,
|
|
2635
2705
|
icons,
|
|
@@ -2769,8 +2839,8 @@ function CopilotChat({
|
|
|
2769
2839
|
const removeSelectedImage = (index) => {
|
|
2770
2840
|
setSelectedImages((prev) => prev.filter((_, i) => i !== index));
|
|
2771
2841
|
};
|
|
2772
|
-
return /* @__PURE__ */ (0,
|
|
2773
|
-
/* @__PURE__ */ (0,
|
|
2842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2774
2844
|
Messages2,
|
|
2775
2845
|
{
|
|
2776
2846
|
AssistantMessage: AssistantMessage2,
|
|
@@ -2786,22 +2856,19 @@ function CopilotChat({
|
|
|
2786
2856
|
onCopy: handleCopy,
|
|
2787
2857
|
onThumbsUp,
|
|
2788
2858
|
onThumbsDown,
|
|
2789
|
-
|
|
2790
|
-
|
|
2859
|
+
markdownTagRenderers,
|
|
2860
|
+
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2861
|
+
RenderSuggestionsList,
|
|
2791
2862
|
{
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
onClick: (message) => handleSendMessage(message)
|
|
2797
|
-
},
|
|
2798
|
-
index
|
|
2799
|
-
)) })
|
|
2863
|
+
onSuggestionClick: handleSendMessage,
|
|
2864
|
+
suggestions: currentSuggestions
|
|
2865
|
+
}
|
|
2866
|
+
)
|
|
2800
2867
|
}
|
|
2801
2868
|
),
|
|
2802
|
-
imageUploadsEnabled && /* @__PURE__ */ (0,
|
|
2803
|
-
/* @__PURE__ */ (0,
|
|
2804
|
-
/* @__PURE__ */ (0,
|
|
2869
|
+
imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
2870
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
|
|
2871
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2805
2872
|
"input",
|
|
2806
2873
|
{
|
|
2807
2874
|
type: "file",
|
|
@@ -2813,7 +2880,7 @@ function CopilotChat({
|
|
|
2813
2880
|
}
|
|
2814
2881
|
)
|
|
2815
2882
|
] }),
|
|
2816
|
-
/* @__PURE__ */ (0,
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2817
2884
|
Input2,
|
|
2818
2885
|
{
|
|
2819
2886
|
inProgress: isLoading,
|
|
@@ -2836,10 +2903,10 @@ function WrappedCopilotChat({
|
|
|
2836
2903
|
}) {
|
|
2837
2904
|
const chatContext = import_react13.default.useContext(ChatContext);
|
|
2838
2905
|
if (!chatContext) {
|
|
2839
|
-
return /* @__PURE__ */ (0,
|
|
2840
|
-
}, children: /* @__PURE__ */ (0,
|
|
2906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2907
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
|
|
2841
2908
|
}
|
|
2842
|
-
return /* @__PURE__ */ (0,
|
|
2909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
|
|
2843
2910
|
}
|
|
2844
2911
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2845
2912
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
@@ -3024,55 +3091,85 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
3024
3091
|
};
|
|
3025
3092
|
|
|
3026
3093
|
// src/components/chat/Modal.tsx
|
|
3027
|
-
var
|
|
3028
|
-
var CopilotModal = ({
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3094
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3095
|
+
var CopilotModal = (_a) => {
|
|
3096
|
+
var _b = _a, {
|
|
3097
|
+
instructions,
|
|
3098
|
+
defaultOpen = false,
|
|
3099
|
+
clickOutsideToClose = true,
|
|
3100
|
+
hitEscapeToClose = true,
|
|
3101
|
+
onSetOpen,
|
|
3102
|
+
onSubmitMessage,
|
|
3103
|
+
onStopGeneration,
|
|
3104
|
+
onReloadMessages,
|
|
3105
|
+
shortcut = "/",
|
|
3106
|
+
icons,
|
|
3107
|
+
labels,
|
|
3108
|
+
makeSystemMessage,
|
|
3109
|
+
onInProgress,
|
|
3110
|
+
Window: Window2 = Window,
|
|
3111
|
+
Button: Button2 = Button,
|
|
3112
|
+
Header: Header2 = Header,
|
|
3113
|
+
Messages: Messages2 = Messages,
|
|
3114
|
+
Input: Input2 = Input,
|
|
3115
|
+
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
3116
|
+
UserMessage: UserMessage2 = UserMessage,
|
|
3117
|
+
onThumbsUp,
|
|
3118
|
+
onThumbsDown,
|
|
3119
|
+
onCopy,
|
|
3120
|
+
onRegenerate,
|
|
3121
|
+
markdownTagRenderers,
|
|
3122
|
+
className,
|
|
3123
|
+
children
|
|
3124
|
+
} = _b, props = __objRest(_b, [
|
|
3125
|
+
"instructions",
|
|
3126
|
+
"defaultOpen",
|
|
3127
|
+
"clickOutsideToClose",
|
|
3128
|
+
"hitEscapeToClose",
|
|
3129
|
+
"onSetOpen",
|
|
3130
|
+
"onSubmitMessage",
|
|
3131
|
+
"onStopGeneration",
|
|
3132
|
+
"onReloadMessages",
|
|
3133
|
+
"shortcut",
|
|
3134
|
+
"icons",
|
|
3135
|
+
"labels",
|
|
3136
|
+
"makeSystemMessage",
|
|
3137
|
+
"onInProgress",
|
|
3138
|
+
"Window",
|
|
3139
|
+
"Button",
|
|
3140
|
+
"Header",
|
|
3141
|
+
"Messages",
|
|
3142
|
+
"Input",
|
|
3143
|
+
"AssistantMessage",
|
|
3144
|
+
"UserMessage",
|
|
3145
|
+
"onThumbsUp",
|
|
3146
|
+
"onThumbsDown",
|
|
3147
|
+
"onCopy",
|
|
3148
|
+
"onRegenerate",
|
|
3149
|
+
"markdownTagRenderers",
|
|
3150
|
+
"className",
|
|
3151
|
+
"children"
|
|
3152
|
+
]);
|
|
3056
3153
|
const [openState, setOpenState] = import_react14.default.useState(defaultOpen);
|
|
3057
3154
|
const setOpen = (open) => {
|
|
3058
3155
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3059
3156
|
setOpenState(open);
|
|
3060
3157
|
};
|
|
3061
|
-
return /* @__PURE__ */ (0,
|
|
3158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
3062
3159
|
children,
|
|
3063
|
-
/* @__PURE__ */ (0,
|
|
3064
|
-
/* @__PURE__ */ (0,
|
|
3065
|
-
/* @__PURE__ */ (0,
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className, children: [
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button2, {}),
|
|
3162
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3066
3163
|
Window2,
|
|
3067
3164
|
{
|
|
3068
3165
|
clickOutsideToClose,
|
|
3069
3166
|
shortcut,
|
|
3070
3167
|
hitEscapeToClose,
|
|
3071
3168
|
children: [
|
|
3072
|
-
/* @__PURE__ */ (0,
|
|
3073
|
-
/* @__PURE__ */ (0,
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Header2, {}),
|
|
3170
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3074
3171
|
CopilotChat,
|
|
3075
|
-
{
|
|
3172
|
+
__spreadProps(__spreadValues({}, props), {
|
|
3076
3173
|
instructions,
|
|
3077
3174
|
onSubmitMessage,
|
|
3078
3175
|
onStopGeneration,
|
|
@@ -3086,8 +3183,9 @@ var CopilotModal = ({
|
|
|
3086
3183
|
onThumbsUp,
|
|
3087
3184
|
onThumbsDown,
|
|
3088
3185
|
onCopy,
|
|
3089
|
-
onRegenerate
|
|
3090
|
-
|
|
3186
|
+
onRegenerate,
|
|
3187
|
+
markdownTagRenderers
|
|
3188
|
+
})
|
|
3091
3189
|
)
|
|
3092
3190
|
]
|
|
3093
3191
|
}
|
|
@@ -3097,12 +3195,12 @@ var CopilotModal = ({
|
|
|
3097
3195
|
};
|
|
3098
3196
|
|
|
3099
3197
|
// src/components/chat/Popup.tsx
|
|
3100
|
-
var
|
|
3198
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3101
3199
|
function CopilotPopup(props) {
|
|
3102
3200
|
props = __spreadProps(__spreadValues({}, props), {
|
|
3103
3201
|
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
3104
3202
|
});
|
|
3105
|
-
return /* @__PURE__ */ (0,
|
|
3203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
|
|
3106
3204
|
}
|
|
3107
3205
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3108
3206
|
0 && (module.exports = {
|