@copilotkit/react-ui 1.3.0 → 1.3.1
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 +10 -0
- package/dist/chunk-54JAUBUJ.mjs +26 -0
- package/dist/chunk-54JAUBUJ.mjs.map +1 -0
- package/dist/chunk-5HHVL5WK.mjs +29 -0
- package/dist/chunk-5HHVL5WK.mjs.map +1 -0
- package/dist/chunk-B2KQEX2R.mjs +91 -0
- package/dist/chunk-B2KQEX2R.mjs.map +1 -0
- package/dist/chunk-BJPGMY3I.mjs +70 -0
- package/dist/chunk-BJPGMY3I.mjs.map +1 -0
- package/dist/chunk-EFZPSZWO.mjs +1 -0
- package/dist/chunk-EFZPSZWO.mjs.map +1 -0
- package/dist/chunk-FL4ETWFB.mjs +21 -0
- package/dist/chunk-FL4ETWFB.mjs.map +1 -0
- package/dist/chunk-FLV3J3VX.mjs +18 -0
- package/dist/chunk-FLV3J3VX.mjs.map +1 -0
- package/dist/chunk-FO7Z5LAL.mjs +118 -0
- package/dist/chunk-FO7Z5LAL.mjs.map +1 -0
- package/dist/chunk-FOZVHL73.mjs +171 -0
- package/dist/chunk-FOZVHL73.mjs.map +1 -0
- package/dist/chunk-FZC7X5PK.mjs +262 -0
- package/dist/chunk-FZC7X5PK.mjs.map +1 -0
- package/dist/chunk-H7TM5JE6.mjs +146 -0
- package/dist/chunk-H7TM5JE6.mjs.map +1 -0
- package/dist/chunk-HR36Y2FQ.mjs +167 -0
- package/dist/chunk-HR36Y2FQ.mjs.map +1 -0
- package/dist/chunk-I4QG2ZZU.mjs +220 -0
- package/dist/chunk-I4QG2ZZU.mjs.map +1 -0
- package/dist/chunk-IU3WTXLQ.mjs +1 -0
- package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
- package/dist/chunk-JD7BAH7U.mjs +1 -0
- package/dist/chunk-JD7BAH7U.mjs.map +1 -0
- package/dist/chunk-MRFF7GSQ.mjs +1 -0
- package/dist/chunk-MRFF7GSQ.mjs.map +1 -0
- package/dist/chunk-MRXNTQOX.mjs +59 -0
- package/dist/chunk-MRXNTQOX.mjs.map +1 -0
- package/dist/chunk-OTPAZXVR.mjs +92 -0
- package/dist/chunk-OTPAZXVR.mjs.map +1 -0
- package/dist/chunk-QOEAEMUQ.mjs +30 -0
- package/dist/chunk-QOEAEMUQ.mjs.map +1 -0
- package/dist/chunk-T26KLXLH.mjs +1 -0
- package/dist/chunk-T26KLXLH.mjs.map +1 -0
- package/dist/chunk-U6J5DGOE.mjs +83 -0
- package/dist/chunk-U6J5DGOE.mjs.map +1 -0
- package/dist/chunk-UPTB2MVO.mjs +395 -0
- package/dist/chunk-UPTB2MVO.mjs.map +1 -0
- package/dist/chunk-V7W6IM2V.mjs +1 -0
- package/dist/chunk-V7W6IM2V.mjs.map +1 -0
- package/dist/chunk-VOBX4JOA.mjs +138 -0
- package/dist/chunk-VOBX4JOA.mjs.map +1 -0
- package/dist/chunk-WB3YULQ4.mjs +1 -0
- package/dist/chunk-WB3YULQ4.mjs.map +1 -0
- package/dist/chunk-WCPLXRZX.mjs +106 -0
- package/dist/chunk-WCPLXRZX.mjs.map +1 -0
- package/dist/chunk-XSUSSWDS.mjs +18 -0
- package/dist/chunk-XSUSSWDS.mjs.map +1 -0
- package/dist/chunk-YOH25I6N.mjs +25 -0
- package/dist/chunk-YOH25I6N.mjs.map +1 -0
- package/dist/chunk-YQ3D5IQV.mjs +75 -0
- package/dist/chunk-YQ3D5IQV.mjs.map +1 -0
- package/dist/chunk-YQFVRDNC.mjs +53 -0
- package/dist/chunk-YQFVRDNC.mjs.map +1 -0
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +6 -30
- package/dist/components/chat/Button.mjs.map +1 -1
- package/dist/components/chat/Chat.d.ts +1 -1
- package/dist/components/chat/Chat.js +6 -3
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +20 -1851
- package/dist/components/chat/Chat.mjs.map +1 -1
- package/dist/components/chat/ChatContext.d.ts +1 -1
- package/dist/components/chat/ChatContext.mjs +7 -228
- package/dist/components/chat/ChatContext.mjs.map +1 -1
- package/dist/components/chat/CodeBlock.js +2 -1
- package/dist/components/chat/CodeBlock.js.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +8 -482
- package/dist/components/chat/CodeBlock.mjs.map +1 -1
- package/dist/components/chat/Header.mjs +6 -23
- package/dist/components/chat/Header.mjs.map +1 -1
- package/dist/components/chat/Icons.mjs +16 -271
- package/dist/components/chat/Icons.mjs.map +1 -1
- package/dist/components/chat/Input.js +4 -2
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +8 -255
- package/dist/components/chat/Input.mjs.map +1 -1
- package/dist/components/chat/Markdown.js +2 -1
- package/dist/components/chat/Markdown.js.map +1 -1
- package/dist/components/chat/Markdown.mjs +7 -546
- package/dist/components/chat/Markdown.mjs.map +1 -1
- package/dist/components/chat/Messages.js +2 -1
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +8 -723
- package/dist/components/chat/Messages.mjs.map +1 -1
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +6 -3
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +22 -2052
- package/dist/components/chat/Modal.mjs.map +1 -1
- package/dist/components/chat/Popup.js +6 -3
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +23 -2061
- package/dist/components/chat/Popup.mjs.map +1 -1
- package/dist/components/chat/Response.mjs +6 -23
- package/dist/components/chat/Response.mjs.map +1 -1
- package/dist/components/chat/Sidebar.js +6 -3
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +23 -2072
- package/dist/components/chat/Sidebar.mjs.map +1 -1
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +5 -152
- package/dist/components/chat/Suggestion.mjs.map +1 -1
- package/dist/components/chat/Textarea.js.map +1 -1
- package/dist/components/chat/Textarea.mjs +4 -48
- package/dist/components/chat/Textarea.mjs.map +1 -1
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +6 -125
- package/dist/components/chat/Window.mjs.map +1 -1
- package/dist/components/chat/index.js +6 -3
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +31 -2078
- package/dist/components/chat/index.mjs.map +1 -1
- package/dist/components/chat/props.d.ts +1 -1
- package/dist/components/chat/props.mjs +1 -0
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +8 -478
- package/dist/components/dev-console/console.mjs.map +1 -1
- package/dist/components/dev-console/icons.mjs +8 -83
- package/dist/components/dev-console/icons.mjs.map +1 -1
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +10 -476
- package/dist/components/dev-console/index.mjs.map +1 -1
- package/dist/components/dev-console/types.d.ts +1 -1
- package/dist/components/dev-console/utils.js.map +1 -1
- package/dist/components/dev-console/utils.mjs +8 -154
- package/dist/components/dev-console/utils.mjs.map +1 -1
- package/dist/components/index.js +6 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +32 -2078
- package/dist/components/index.mjs.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.mjs +1 -0
- package/dist/hooks/index.mjs +5 -24
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/use-copilot-chat-suggestions.mjs +4 -24
- package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +4 -21
- package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -1
- package/dist/hooks/use-push-to-talk.d.ts +1 -1
- package/dist/hooks/use-push-to-talk.js.map +1 -1
- package/dist/hooks/use-push-to-talk.mjs +6 -148
- package/dist/hooks/use-push-to-talk.mjs.map +1 -1
- package/dist/index.css +747 -1
- package/dist/index.css.map +1 -0
- package/dist/index.js +6 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -2110
- package/dist/index.mjs.map +1 -1
- package/dist/lib/utils.mjs +3 -20
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.d.ts +1 -1
- package/dist/types/css.d.ts +1 -1
- package/dist/types/index.mjs +1 -0
- package/dist/types/suggestions.d.ts +1 -1
- package/package.json +11 -19
- package/src/components/chat/Chat.tsx +4 -1
- package/src/components/chat/Popup.tsx +4 -1
- package/src/components/chat/Sidebar.tsx +3 -1
- package/tsup.config.ts +15 -59
- package/dist/components/chat/Button.d.mts +0 -7
- package/dist/components/chat/Chat.d.mts +0 -87
- package/dist/components/chat/ChatContext.d.mts +0 -105
- package/dist/components/chat/CodeBlock.d.mts +0 -14
- package/dist/components/chat/Header.d.mts +0 -7
- package/dist/components/chat/Icons.d.mts +0 -18
- package/dist/components/chat/Input.d.mts +0 -7
- package/dist/components/chat/Markdown.d.mts +0 -8
- package/dist/components/chat/Messages.d.mts +0 -7
- package/dist/components/chat/Modal.d.mts +0 -51
- package/dist/components/chat/Popup.d.mts +0 -13
- package/dist/components/chat/Response.d.mts +0 -7
- package/dist/components/chat/Sidebar.d.mts +0 -13
- package/dist/components/chat/Suggestion.d.mts +0 -14
- package/dist/components/chat/Textarea.d.mts +0 -13
- package/dist/components/chat/Window.d.mts +0 -7
- package/dist/components/chat/index.d.mts +0 -11
- package/dist/components/chat/props.d.mts +0 -35
- package/dist/components/dev-console/console.d.mts +0 -10
- package/dist/components/dev-console/icons.d.mts +0 -9
- package/dist/components/dev-console/index.d.mts +0 -5
- package/dist/components/dev-console/types.d.mts +0 -9
- package/dist/components/dev-console/utils.d.mts +0 -10
- package/dist/components/index.d.mts +0 -11
- package/dist/context/index.d.mts +0 -2
- package/dist/hooks/index.d.mts +0 -1
- package/dist/hooks/use-copilot-chat-suggestions.d.mts +0 -83
- package/dist/hooks/use-copy-to-clipboard.d.mts +0 -9
- package/dist/hooks/use-push-to-talk.d.mts +0 -19
- package/dist/index.d.mts +0 -13
- package/dist/lib/utils.d.mts +0 -4
- package/dist/lib/utils.test.d.mts +0 -2
- package/dist/types/css.d.mts +0 -16
- package/dist/types/index.d.mts +0 -2
- package/dist/types/suggestions.d.mts +0 -8
|
@@ -1,727 +1,12 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/components/chat/Messages.tsx
|
|
34
|
-
import React3, { useEffect, useMemo as useMemo2 } from "react";
|
|
35
|
-
|
|
36
|
-
// src/components/chat/ChatContext.tsx
|
|
37
|
-
import React from "react";
|
|
38
|
-
|
|
39
|
-
// src/components/chat/Icons.tsx
|
|
40
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
41
|
-
function CheckIcon(_a) {
|
|
42
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
43
|
-
return /* @__PURE__ */ jsx(
|
|
44
|
-
"svg",
|
|
45
|
-
__spreadProps(__spreadValues({
|
|
46
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
-
viewBox: "0 0 256 256",
|
|
48
|
-
fill: "currentColor",
|
|
49
|
-
style: { height: "1rem", width: "1rem" },
|
|
50
|
-
className
|
|
51
|
-
}, props), {
|
|
52
|
-
children: /* @__PURE__ */ jsx("path", { d: "m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z" })
|
|
53
|
-
})
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
function DownloadIcon(_a) {
|
|
57
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
58
|
-
return /* @__PURE__ */ jsx(
|
|
59
|
-
"svg",
|
|
60
|
-
__spreadProps(__spreadValues({
|
|
61
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
62
|
-
viewBox: "0 0 256 256",
|
|
63
|
-
fill: "currentColor",
|
|
64
|
-
style: { height: "1rem", width: "1rem" },
|
|
65
|
-
className
|
|
66
|
-
}, props), {
|
|
67
|
-
children: /* @__PURE__ */ jsx("path", { d: "M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z" })
|
|
68
|
-
})
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
function CopyIcon(_a) {
|
|
72
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
73
|
-
return /* @__PURE__ */ jsx(
|
|
74
|
-
"svg",
|
|
75
|
-
__spreadProps(__spreadValues({
|
|
76
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
77
|
-
viewBox: "0 0 256 256",
|
|
78
|
-
fill: "currentColor",
|
|
79
|
-
style: { height: "1rem", width: "1rem" },
|
|
80
|
-
className
|
|
81
|
-
}, props), {
|
|
82
|
-
children: /* @__PURE__ */ jsx("path", { d: "M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z" })
|
|
83
|
-
})
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/components/chat/ChatContext.tsx
|
|
88
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
89
|
-
var ChatContext = React.createContext(void 0);
|
|
90
|
-
function useChatContext() {
|
|
91
|
-
const context = React.useContext(ChatContext);
|
|
92
|
-
if (context === void 0) {
|
|
93
|
-
throw new Error(
|
|
94
|
-
"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
return context;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// src/components/chat/Markdown.tsx
|
|
101
|
-
import { memo as memo2 } from "react";
|
|
102
|
-
import ReactMarkdown from "react-markdown";
|
|
103
|
-
|
|
104
|
-
// src/components/chat/CodeBlock.tsx
|
|
105
|
-
import { memo } from "react";
|
|
106
|
-
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
107
|
-
|
|
108
|
-
// src/hooks/use-copy-to-clipboard.tsx
|
|
109
|
-
import * as React2 from "react";
|
|
110
|
-
function useCopyToClipboard({ timeout = 2e3 }) {
|
|
111
|
-
const [isCopied, setIsCopied] = React2.useState(false);
|
|
112
|
-
const copyToClipboard = (value) => {
|
|
113
|
-
var _a;
|
|
114
|
-
if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (!value) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
navigator.clipboard.writeText(value).then(() => {
|
|
121
|
-
setIsCopied(true);
|
|
122
|
-
setTimeout(() => {
|
|
123
|
-
setIsCopied(false);
|
|
124
|
-
}, timeout);
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
return { isCopied, copyToClipboard };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// src/components/chat/CodeBlock.tsx
|
|
131
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
132
|
-
var programmingLanguages = {
|
|
133
|
-
javascript: ".js",
|
|
134
|
-
python: ".py",
|
|
135
|
-
java: ".java",
|
|
136
|
-
c: ".c",
|
|
137
|
-
cpp: ".cpp",
|
|
138
|
-
"c++": ".cpp",
|
|
139
|
-
"c#": ".cs",
|
|
140
|
-
ruby: ".rb",
|
|
141
|
-
php: ".php",
|
|
142
|
-
swift: ".swift",
|
|
143
|
-
"objective-c": ".m",
|
|
144
|
-
kotlin: ".kt",
|
|
145
|
-
typescript: ".ts",
|
|
146
|
-
go: ".go",
|
|
147
|
-
perl: ".pl",
|
|
148
|
-
rust: ".rs",
|
|
149
|
-
scala: ".scala",
|
|
150
|
-
haskell: ".hs",
|
|
151
|
-
lua: ".lua",
|
|
152
|
-
shell: ".sh",
|
|
153
|
-
sql: ".sql",
|
|
154
|
-
html: ".html",
|
|
155
|
-
css: ".css"
|
|
156
|
-
// add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
|
|
157
|
-
};
|
|
158
|
-
var generateRandomString = (length, lowercase = false) => {
|
|
159
|
-
const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
|
|
160
|
-
let result = "";
|
|
161
|
-
for (let i = 0; i < length; i++) {
|
|
162
|
-
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
163
|
-
}
|
|
164
|
-
return lowercase ? result.toLowerCase() : result;
|
|
165
|
-
};
|
|
166
|
-
var CodeBlock = memo(({ language, value }) => {
|
|
167
|
-
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
168
|
-
const downloadAsFile = () => {
|
|
169
|
-
if (typeof window === "undefined") {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
const fileExtension = programmingLanguages[language] || ".file";
|
|
173
|
-
const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
|
|
174
|
-
const fileName = window.prompt("Enter file name", suggestedFileName);
|
|
175
|
-
if (!fileName) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
const blob = new Blob([value], { type: "text/plain" });
|
|
179
|
-
const url = URL.createObjectURL(blob);
|
|
180
|
-
const link = document.createElement("a");
|
|
181
|
-
link.download = fileName;
|
|
182
|
-
link.href = url;
|
|
183
|
-
link.style.display = "none";
|
|
184
|
-
document.body.appendChild(link);
|
|
185
|
-
link.click();
|
|
186
|
-
document.body.removeChild(link);
|
|
187
|
-
URL.revokeObjectURL(url);
|
|
188
|
-
};
|
|
189
|
-
const onCopy = () => {
|
|
190
|
-
if (isCopied) return;
|
|
191
|
-
copyToClipboard(value);
|
|
192
|
-
};
|
|
193
|
-
return /* @__PURE__ */ jsxs2("div", { className: "copilotKitCodeBlock", children: [
|
|
194
|
-
/* @__PURE__ */ jsxs2("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
195
|
-
/* @__PURE__ */ jsx3("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
196
|
-
/* @__PURE__ */ jsxs2("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
197
|
-
/* @__PURE__ */ jsxs2("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: [
|
|
198
|
-
/* @__PURE__ */ jsx3(DownloadIcon, {}),
|
|
199
|
-
/* @__PURE__ */ jsx3("span", { className: "sr-only", children: "Download" })
|
|
200
|
-
] }),
|
|
201
|
-
/* @__PURE__ */ jsxs2("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: [
|
|
202
|
-
isCopied ? /* @__PURE__ */ jsx3(CheckIcon, {}) : /* @__PURE__ */ jsx3(CopyIcon, {}),
|
|
203
|
-
/* @__PURE__ */ jsx3("span", { className: "sr-only", children: "Copy code" })
|
|
204
|
-
] })
|
|
205
|
-
] })
|
|
206
|
-
] }),
|
|
207
|
-
/* @__PURE__ */ jsx3(
|
|
208
|
-
SyntaxHighlighter,
|
|
209
|
-
{
|
|
210
|
-
language,
|
|
211
|
-
style: highlightStyle,
|
|
212
|
-
PreTag: "div",
|
|
213
|
-
customStyle: {
|
|
214
|
-
margin: 0,
|
|
215
|
-
borderBottomLeftRadius: "0.375rem",
|
|
216
|
-
borderBottomRightRadius: "0.375rem"
|
|
217
|
-
},
|
|
218
|
-
children: value
|
|
219
|
-
}
|
|
220
|
-
)
|
|
221
|
-
] });
|
|
222
|
-
});
|
|
223
|
-
CodeBlock.displayName = "CodeBlock";
|
|
224
|
-
var highlightStyle = {
|
|
225
|
-
'pre[class*="language-"]': {
|
|
226
|
-
color: "#d4d4d4",
|
|
227
|
-
fontSize: "13px",
|
|
228
|
-
textShadow: "none",
|
|
229
|
-
fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
|
|
230
|
-
direction: "ltr",
|
|
231
|
-
textAlign: "left",
|
|
232
|
-
whiteSpace: "pre",
|
|
233
|
-
wordSpacing: "normal",
|
|
234
|
-
wordBreak: "normal",
|
|
235
|
-
lineHeight: "1.5",
|
|
236
|
-
MozTabSize: "4",
|
|
237
|
-
OTabSize: "4",
|
|
238
|
-
tabSize: "4",
|
|
239
|
-
WebkitHyphens: "none",
|
|
240
|
-
MozHyphens: "none",
|
|
241
|
-
msHyphens: "none",
|
|
242
|
-
hyphens: "none",
|
|
243
|
-
padding: "1em",
|
|
244
|
-
margin: ".5em 0",
|
|
245
|
-
overflow: "auto",
|
|
246
|
-
background: "#1e1e1e"
|
|
247
|
-
},
|
|
248
|
-
'code[class*="language-"]': {
|
|
249
|
-
color: "#d4d4d4",
|
|
250
|
-
fontSize: "13px",
|
|
251
|
-
textShadow: "none",
|
|
252
|
-
fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
|
|
253
|
-
direction: "ltr",
|
|
254
|
-
textAlign: "left",
|
|
255
|
-
whiteSpace: "pre",
|
|
256
|
-
wordSpacing: "normal",
|
|
257
|
-
wordBreak: "normal",
|
|
258
|
-
lineHeight: "1.5",
|
|
259
|
-
MozTabSize: "4",
|
|
260
|
-
OTabSize: "4",
|
|
261
|
-
tabSize: "4",
|
|
262
|
-
WebkitHyphens: "none",
|
|
263
|
-
MozHyphens: "none",
|
|
264
|
-
msHyphens: "none",
|
|
265
|
-
hyphens: "none"
|
|
266
|
-
},
|
|
267
|
-
'pre[class*="language-"]::selection': {
|
|
268
|
-
textShadow: "none",
|
|
269
|
-
background: "#264F78"
|
|
270
|
-
},
|
|
271
|
-
'code[class*="language-"]::selection': {
|
|
272
|
-
textShadow: "none",
|
|
273
|
-
background: "#264F78"
|
|
274
|
-
},
|
|
275
|
-
'pre[class*="language-"] *::selection': {
|
|
276
|
-
textShadow: "none",
|
|
277
|
-
background: "#264F78"
|
|
278
|
-
},
|
|
279
|
-
'code[class*="language-"] *::selection': {
|
|
280
|
-
textShadow: "none",
|
|
281
|
-
background: "#264F78"
|
|
282
|
-
},
|
|
283
|
-
':not(pre) > code[class*="language-"]': {
|
|
284
|
-
padding: ".1em .3em",
|
|
285
|
-
borderRadius: ".3em",
|
|
286
|
-
color: "#db4c69",
|
|
287
|
-
background: "#1e1e1e"
|
|
288
|
-
},
|
|
289
|
-
".namespace": {
|
|
290
|
-
Opacity: ".7"
|
|
291
|
-
},
|
|
292
|
-
"doctype.doctype-tag": {
|
|
293
|
-
color: "#569CD6"
|
|
294
|
-
},
|
|
295
|
-
"doctype.name": {
|
|
296
|
-
color: "#9cdcfe"
|
|
297
|
-
},
|
|
298
|
-
comment: {
|
|
299
|
-
color: "#6a9955"
|
|
300
|
-
},
|
|
301
|
-
prolog: {
|
|
302
|
-
color: "#6a9955"
|
|
303
|
-
},
|
|
304
|
-
punctuation: {
|
|
305
|
-
color: "#d4d4d4"
|
|
306
|
-
},
|
|
307
|
-
".language-html .language-css .token.punctuation": {
|
|
308
|
-
color: "#d4d4d4"
|
|
309
|
-
},
|
|
310
|
-
".language-html .language-javascript .token.punctuation": {
|
|
311
|
-
color: "#d4d4d4"
|
|
312
|
-
},
|
|
313
|
-
property: {
|
|
314
|
-
color: "#9cdcfe"
|
|
315
|
-
},
|
|
316
|
-
tag: {
|
|
317
|
-
color: "#569cd6"
|
|
318
|
-
},
|
|
319
|
-
boolean: {
|
|
320
|
-
color: "#569cd6"
|
|
321
|
-
},
|
|
322
|
-
number: {
|
|
323
|
-
color: "#b5cea8"
|
|
324
|
-
},
|
|
325
|
-
constant: {
|
|
326
|
-
color: "#9cdcfe"
|
|
327
|
-
},
|
|
328
|
-
symbol: {
|
|
329
|
-
color: "#b5cea8"
|
|
330
|
-
},
|
|
331
|
-
inserted: {
|
|
332
|
-
color: "#b5cea8"
|
|
333
|
-
},
|
|
334
|
-
unit: {
|
|
335
|
-
color: "#b5cea8"
|
|
336
|
-
},
|
|
337
|
-
selector: {
|
|
338
|
-
color: "#d7ba7d"
|
|
339
|
-
},
|
|
340
|
-
"attr-name": {
|
|
341
|
-
color: "#9cdcfe"
|
|
342
|
-
},
|
|
343
|
-
string: {
|
|
344
|
-
color: "#ce9178"
|
|
345
|
-
},
|
|
346
|
-
char: {
|
|
347
|
-
color: "#ce9178"
|
|
348
|
-
},
|
|
349
|
-
builtin: {
|
|
350
|
-
color: "#ce9178"
|
|
351
|
-
},
|
|
352
|
-
deleted: {
|
|
353
|
-
color: "#ce9178"
|
|
354
|
-
},
|
|
355
|
-
".language-css .token.string.url": {
|
|
356
|
-
textDecoration: "underline"
|
|
357
|
-
},
|
|
358
|
-
operator: {
|
|
359
|
-
color: "#d4d4d4"
|
|
360
|
-
},
|
|
361
|
-
entity: {
|
|
362
|
-
color: "#569cd6"
|
|
363
|
-
},
|
|
364
|
-
"operator.arrow": {
|
|
365
|
-
color: "#569CD6"
|
|
366
|
-
},
|
|
367
|
-
atrule: {
|
|
368
|
-
color: "#ce9178"
|
|
369
|
-
},
|
|
370
|
-
"atrule.rule": {
|
|
371
|
-
color: "#c586c0"
|
|
372
|
-
},
|
|
373
|
-
"atrule.url": {
|
|
374
|
-
color: "#9cdcfe"
|
|
375
|
-
},
|
|
376
|
-
"atrule.url.function": {
|
|
377
|
-
color: "#dcdcaa"
|
|
378
|
-
},
|
|
379
|
-
"atrule.url.punctuation": {
|
|
380
|
-
color: "#d4d4d4"
|
|
381
|
-
},
|
|
382
|
-
keyword: {
|
|
383
|
-
color: "#569CD6"
|
|
384
|
-
},
|
|
385
|
-
"keyword.module": {
|
|
386
|
-
color: "#c586c0"
|
|
387
|
-
},
|
|
388
|
-
"keyword.control-flow": {
|
|
389
|
-
color: "#c586c0"
|
|
390
|
-
},
|
|
391
|
-
function: {
|
|
392
|
-
color: "#dcdcaa"
|
|
393
|
-
},
|
|
394
|
-
"function.maybe-class-name": {
|
|
395
|
-
color: "#dcdcaa"
|
|
396
|
-
},
|
|
397
|
-
regex: {
|
|
398
|
-
color: "#d16969"
|
|
399
|
-
},
|
|
400
|
-
important: {
|
|
401
|
-
color: "#569cd6"
|
|
402
|
-
},
|
|
403
|
-
italic: {
|
|
404
|
-
fontStyle: "italic"
|
|
405
|
-
},
|
|
406
|
-
"class-name": {
|
|
407
|
-
color: "#4ec9b0"
|
|
408
|
-
},
|
|
409
|
-
"maybe-class-name": {
|
|
410
|
-
color: "#4ec9b0"
|
|
411
|
-
},
|
|
412
|
-
console: {
|
|
413
|
-
color: "#9cdcfe"
|
|
414
|
-
},
|
|
415
|
-
parameter: {
|
|
416
|
-
color: "#9cdcfe"
|
|
417
|
-
},
|
|
418
|
-
interpolation: {
|
|
419
|
-
color: "#9cdcfe"
|
|
420
|
-
},
|
|
421
|
-
"punctuation.interpolation-punctuation": {
|
|
422
|
-
color: "#569cd6"
|
|
423
|
-
},
|
|
424
|
-
variable: {
|
|
425
|
-
color: "#9cdcfe"
|
|
426
|
-
},
|
|
427
|
-
"imports.maybe-class-name": {
|
|
428
|
-
color: "#9cdcfe"
|
|
429
|
-
},
|
|
430
|
-
"exports.maybe-class-name": {
|
|
431
|
-
color: "#9cdcfe"
|
|
432
|
-
},
|
|
433
|
-
escape: {
|
|
434
|
-
color: "#d7ba7d"
|
|
435
|
-
},
|
|
436
|
-
"tag.punctuation": {
|
|
437
|
-
color: "#808080"
|
|
438
|
-
},
|
|
439
|
-
cdata: {
|
|
440
|
-
color: "#808080"
|
|
441
|
-
},
|
|
442
|
-
"attr-value": {
|
|
443
|
-
color: "#ce9178"
|
|
444
|
-
},
|
|
445
|
-
"attr-value.punctuation": {
|
|
446
|
-
color: "#ce9178"
|
|
447
|
-
},
|
|
448
|
-
"attr-value.punctuation.attr-equals": {
|
|
449
|
-
color: "#d4d4d4"
|
|
450
|
-
},
|
|
451
|
-
namespace: {
|
|
452
|
-
color: "#4ec9b0"
|
|
453
|
-
},
|
|
454
|
-
'pre[class*="language-javascript"]': {
|
|
455
|
-
color: "#9cdcfe"
|
|
456
|
-
},
|
|
457
|
-
'code[class*="language-javascript"]': {
|
|
458
|
-
color: "#9cdcfe"
|
|
459
|
-
},
|
|
460
|
-
'pre[class*="language-jsx"]': {
|
|
461
|
-
color: "#9cdcfe"
|
|
462
|
-
},
|
|
463
|
-
'code[class*="language-jsx"]': {
|
|
464
|
-
color: "#9cdcfe"
|
|
465
|
-
},
|
|
466
|
-
'pre[class*="language-typescript"]': {
|
|
467
|
-
color: "#9cdcfe"
|
|
468
|
-
},
|
|
469
|
-
'code[class*="language-typescript"]': {
|
|
470
|
-
color: "#9cdcfe"
|
|
471
|
-
},
|
|
472
|
-
'pre[class*="language-tsx"]': {
|
|
473
|
-
color: "#9cdcfe"
|
|
474
|
-
},
|
|
475
|
-
'code[class*="language-tsx"]': {
|
|
476
|
-
color: "#9cdcfe"
|
|
477
|
-
},
|
|
478
|
-
'pre[class*="language-css"]': {
|
|
479
|
-
color: "#ce9178"
|
|
480
|
-
},
|
|
481
|
-
'code[class*="language-css"]': {
|
|
482
|
-
color: "#ce9178"
|
|
483
|
-
},
|
|
484
|
-
'pre[class*="language-html"]': {
|
|
485
|
-
color: "#d4d4d4"
|
|
486
|
-
},
|
|
487
|
-
'code[class*="language-html"]': {
|
|
488
|
-
color: "#d4d4d4"
|
|
489
|
-
},
|
|
490
|
-
".language-regex .token.anchor": {
|
|
491
|
-
color: "#dcdcaa"
|
|
492
|
-
},
|
|
493
|
-
".language-html .token.punctuation": {
|
|
494
|
-
color: "#808080"
|
|
495
|
-
},
|
|
496
|
-
'pre[class*="language-"] > code[class*="language-"]': {
|
|
497
|
-
position: "relative",
|
|
498
|
-
zIndex: "1"
|
|
499
|
-
},
|
|
500
|
-
".line-highlight.line-highlight": {
|
|
501
|
-
background: "#f7ebc6",
|
|
502
|
-
boxShadow: "inset 5px 0 0 #f7d87c",
|
|
503
|
-
zIndex: "0"
|
|
504
|
-
}
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
// src/components/chat/Markdown.tsx
|
|
508
|
-
import remarkGfm from "remark-gfm";
|
|
509
|
-
import remarkMath from "remark-math";
|
|
510
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
511
|
-
var MemoizedReactMarkdown = memo2(
|
|
512
|
-
ReactMarkdown,
|
|
513
|
-
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
514
|
-
);
|
|
515
|
-
var Markdown = ({ content }) => {
|
|
516
|
-
return /* @__PURE__ */ jsx4("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ jsx4(MemoizedReactMarkdown, { components, remarkPlugins: [remarkGfm, remarkMath], children: content }) });
|
|
517
|
-
};
|
|
518
|
-
var components = {
|
|
519
|
-
p({ children }) {
|
|
520
|
-
return /* @__PURE__ */ jsx4("p", { children });
|
|
521
|
-
},
|
|
522
|
-
a(_a) {
|
|
523
|
-
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
524
|
-
return /* @__PURE__ */ jsx4(
|
|
525
|
-
"a",
|
|
526
|
-
__spreadProps(__spreadValues({
|
|
527
|
-
style: { color: "blue", textDecoration: "underline" }
|
|
528
|
-
}, props), {
|
|
529
|
-
target: "_blank",
|
|
530
|
-
rel: "noopener noreferrer",
|
|
531
|
-
children
|
|
532
|
-
})
|
|
533
|
-
);
|
|
534
|
-
},
|
|
535
|
-
code(_c) {
|
|
536
|
-
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
537
|
-
if (children.length) {
|
|
538
|
-
if (children[0] == "\u258D") {
|
|
539
|
-
return /* @__PURE__ */ jsx4(
|
|
540
|
-
"span",
|
|
541
|
-
{
|
|
542
|
-
style: {
|
|
543
|
-
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
544
|
-
marginTop: "0.25rem"
|
|
545
|
-
},
|
|
546
|
-
children: "\u258D"
|
|
547
|
-
}
|
|
548
|
-
);
|
|
549
|
-
}
|
|
550
|
-
children[0] = children[0].replace("`\u258D`", "\u258D");
|
|
551
|
-
}
|
|
552
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
553
|
-
if (inline) {
|
|
554
|
-
return /* @__PURE__ */ jsx4("code", __spreadProps(__spreadValues({ className }, props), { children }));
|
|
555
|
-
}
|
|
556
|
-
return /* @__PURE__ */ jsx4(
|
|
557
|
-
CodeBlock,
|
|
558
|
-
__spreadValues({
|
|
559
|
-
language: match && match[1] || "",
|
|
560
|
-
value: String(children).replace(/\n$/, "")
|
|
561
|
-
}, props),
|
|
562
|
-
Math.random()
|
|
563
|
-
);
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
// src/components/chat/Messages.tsx
|
|
568
|
-
import { useCopilotContext } from "@copilotkit/react-core";
|
|
569
1
|
import {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
import
|
|
578
|
-
var Messages = ({ messages, inProgress, children }) => {
|
|
579
|
-
const { chatComponentsCache } = useCopilotContext();
|
|
580
|
-
const context = useChatContext();
|
|
581
|
-
const initialMessages = useMemo2(
|
|
582
|
-
() => makeInitialMessages(context.labels.initial),
|
|
583
|
-
[context.labels.initial]
|
|
584
|
-
);
|
|
585
|
-
messages = [...initialMessages, ...messages];
|
|
586
|
-
const functionResults = {};
|
|
587
|
-
for (let i = 0; i < messages.length; i++) {
|
|
588
|
-
if (messages[i] instanceof ActionExecutionMessage) {
|
|
589
|
-
const id = messages[i].id;
|
|
590
|
-
const resultMessage = messages.find(
|
|
591
|
-
(message) => message instanceof ResultMessage && message.actionExecutionId === id
|
|
592
|
-
);
|
|
593
|
-
if (resultMessage) {
|
|
594
|
-
functionResults[id] = ResultMessage.decodeResult(resultMessage.result || "");
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
const messagesEndRef = React3.useRef(null);
|
|
599
|
-
const scrollToBottom = () => {
|
|
600
|
-
if (messagesEndRef.current) {
|
|
601
|
-
messagesEndRef.current.scrollIntoView({
|
|
602
|
-
behavior: "auto"
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
useEffect(() => {
|
|
607
|
-
scrollToBottom();
|
|
608
|
-
}, [messages]);
|
|
609
|
-
return /* @__PURE__ */ jsxs3("div", { className: "copilotKitMessages", children: [
|
|
610
|
-
messages.map((message, index) => {
|
|
611
|
-
const isCurrentMessage = index === messages.length - 1;
|
|
612
|
-
if (message instanceof TextMessage && message.role === "user") {
|
|
613
|
-
return /* @__PURE__ */ jsx5("div", { className: "copilotKitMessage copilotKitUserMessage", children: message.content }, index);
|
|
614
|
-
} else if (message instanceof TextMessage && message.role == "assistant") {
|
|
615
|
-
return /* @__PURE__ */ jsx5("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: isCurrentMessage && inProgress && !message.content ? context.icons.spinnerIcon : /* @__PURE__ */ jsx5(Markdown, { content: message.content }) }, index);
|
|
616
|
-
} else if (message instanceof ActionExecutionMessage) {
|
|
617
|
-
if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {
|
|
618
|
-
const render = chatComponentsCache.current.actions[message.name];
|
|
619
|
-
if (typeof render === "string") {
|
|
620
|
-
if (isCurrentMessage && inProgress) {
|
|
621
|
-
return /* @__PURE__ */ jsxs3("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
622
|
-
context.icons.spinnerIcon,
|
|
623
|
-
" ",
|
|
624
|
-
/* @__PURE__ */ jsx5("span", { className: "inProgressLabel", children: render })
|
|
625
|
-
] }, index);
|
|
626
|
-
} else {
|
|
627
|
-
return null;
|
|
628
|
-
}
|
|
629
|
-
} else {
|
|
630
|
-
const args = message.arguments;
|
|
631
|
-
let status = "inProgress";
|
|
632
|
-
if (functionResults[message.id] !== void 0) {
|
|
633
|
-
status = "complete";
|
|
634
|
-
} else if (message.status.code !== MessageStatusCode.Pending) {
|
|
635
|
-
status = "executing";
|
|
636
|
-
}
|
|
637
|
-
const toRender = render({
|
|
638
|
-
status,
|
|
639
|
-
args,
|
|
640
|
-
result: functionResults[message.id]
|
|
641
|
-
});
|
|
642
|
-
if (!toRender && status === "complete") {
|
|
643
|
-
return null;
|
|
644
|
-
}
|
|
645
|
-
if (typeof toRender === "string") {
|
|
646
|
-
return /* @__PURE__ */ jsxs3("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
647
|
-
isCurrentMessage && inProgress && context.icons.spinnerIcon,
|
|
648
|
-
" ",
|
|
649
|
-
toRender
|
|
650
|
-
] }, index);
|
|
651
|
-
} else {
|
|
652
|
-
return /* @__PURE__ */ jsx5("div", { className: "copilotKitCustomAssistantMessage", children: toRender }, index);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
} else if (!inProgress || !isCurrentMessage) {
|
|
656
|
-
return null;
|
|
657
|
-
} else {
|
|
658
|
-
return /* @__PURE__ */ jsx5("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
|
|
659
|
-
}
|
|
660
|
-
} else if (message instanceof AgentStateMessage) {
|
|
661
|
-
let render;
|
|
662
|
-
if (chatComponentsCache.current !== null) {
|
|
663
|
-
render = chatComponentsCache.current.coagentActions[`${message.agentName}-${message.nodeName}`] || chatComponentsCache.current.coagentActions[`${message.agentName}-global`];
|
|
664
|
-
}
|
|
665
|
-
if (render) {
|
|
666
|
-
if (typeof render === "string") {
|
|
667
|
-
if (isCurrentMessage && inProgress) {
|
|
668
|
-
return /* @__PURE__ */ jsxs3("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
669
|
-
context.icons.spinnerIcon,
|
|
670
|
-
" ",
|
|
671
|
-
/* @__PURE__ */ jsx5("span", { className: "inProgressLabel", children: render })
|
|
672
|
-
] }, index);
|
|
673
|
-
} else {
|
|
674
|
-
return null;
|
|
675
|
-
}
|
|
676
|
-
} else {
|
|
677
|
-
const state = message.state;
|
|
678
|
-
let status = message.active ? "inProgress" : "complete";
|
|
679
|
-
const toRender = render({
|
|
680
|
-
status,
|
|
681
|
-
state,
|
|
682
|
-
nodeName: message.nodeName
|
|
683
|
-
});
|
|
684
|
-
if (!toRender && status === "complete") {
|
|
685
|
-
return null;
|
|
686
|
-
}
|
|
687
|
-
if (typeof toRender === "string") {
|
|
688
|
-
return /* @__PURE__ */ jsxs3("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
689
|
-
isCurrentMessage && inProgress && context.icons.spinnerIcon,
|
|
690
|
-
" ",
|
|
691
|
-
toRender
|
|
692
|
-
] }, index);
|
|
693
|
-
} else {
|
|
694
|
-
return /* @__PURE__ */ jsx5("div", { className: "copilotKitCustomAssistantMessage", children: toRender }, index);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
} else if (!inProgress || !isCurrentMessage) {
|
|
698
|
-
return null;
|
|
699
|
-
} else {
|
|
700
|
-
return /* @__PURE__ */ jsx5("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
|
|
701
|
-
}
|
|
702
|
-
} else if (message instanceof ResultMessage && inProgress && isCurrentMessage) {
|
|
703
|
-
return /* @__PURE__ */ jsx5("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
|
|
704
|
-
}
|
|
705
|
-
}),
|
|
706
|
-
/* @__PURE__ */ jsx5("footer", { ref: messagesEndRef, children })
|
|
707
|
-
] });
|
|
708
|
-
};
|
|
709
|
-
function makeInitialMessages(initial) {
|
|
710
|
-
let initialArray = [];
|
|
711
|
-
if (initial) {
|
|
712
|
-
if (Array.isArray(initial)) {
|
|
713
|
-
initialArray.push(...initial);
|
|
714
|
-
} else {
|
|
715
|
-
initialArray.push(initial);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
return initialArray.map(
|
|
719
|
-
(message) => new TextMessage({
|
|
720
|
-
role: Role.Assistant,
|
|
721
|
-
content: message
|
|
722
|
-
})
|
|
723
|
-
);
|
|
724
|
-
}
|
|
2
|
+
Messages
|
|
3
|
+
} from "../../chunk-FOZVHL73.mjs";
|
|
4
|
+
import "../../chunk-YQ3D5IQV.mjs";
|
|
5
|
+
import "../../chunk-BJPGMY3I.mjs";
|
|
6
|
+
import "../../chunk-UPTB2MVO.mjs";
|
|
7
|
+
import "../../chunk-FZC7X5PK.mjs";
|
|
8
|
+
import "../../chunk-54JAUBUJ.mjs";
|
|
9
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
725
10
|
export {
|
|
726
11
|
Messages
|
|
727
12
|
};
|