@copilotkit/react-ui 1.7.2-next.2 → 1.8.0-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 +12 -0
- package/dist/{chunk-QXTRFMPM.mjs → chunk-2LRE4W6A.mjs} +13 -11
- package/dist/chunk-2LRE4W6A.mjs.map +1 -0
- package/dist/{chunk-QXQDIFOC.mjs → chunk-5GNYGURH.mjs} +48 -37
- package/dist/chunk-5GNYGURH.mjs.map +1 -0
- package/dist/{chunk-CBBFRI3Q.mjs → chunk-5JY5QJ2W.mjs} +9 -5
- package/dist/chunk-5JY5QJ2W.mjs.map +1 -0
- package/dist/{chunk-OFYI4UU4.mjs → chunk-7RIBDD4K.mjs} +19 -3
- package/dist/chunk-7RIBDD4K.mjs.map +1 -0
- package/dist/{chunk-YAGE7RCE.mjs → chunk-CGVOCLHN.mjs} +2 -2
- package/dist/chunk-FBYETUFL.mjs +118 -0
- package/dist/chunk-FBYETUFL.mjs.map +1 -0
- package/dist/chunk-GDJAAFIK.mjs +24 -0
- package/dist/chunk-GDJAAFIK.mjs.map +1 -0
- package/dist/{chunk-6FTRYYR5.mjs → chunk-GJME6MK4.mjs} +72 -62
- package/dist/chunk-GJME6MK4.mjs.map +1 -0
- package/dist/{chunk-AELKLZSG.mjs → chunk-KG6DW6R2.mjs} +10 -10
- package/dist/{chunk-DLG7BZTA.mjs → chunk-LKCAF2HG.mjs} +2 -2
- package/dist/{chunk-R2O33F44.mjs → chunk-LXCH2BIB.mjs} +2 -2
- package/dist/chunk-ORSMX3SE.mjs +244 -0
- package/dist/chunk-ORSMX3SE.mjs.map +1 -0
- package/dist/{chunk-UPTB2MVO.mjs → chunk-PCTCOQK2.mjs} +4 -10
- package/dist/chunk-PCTCOQK2.mjs.map +1 -0
- package/dist/{chunk-ZIF5JJCH.mjs → chunk-QGK5GOSC.mjs} +24 -53
- package/dist/chunk-QGK5GOSC.mjs.map +1 -0
- package/dist/{chunk-WGAZXTUA.mjs → chunk-TOQ7P4DO.mjs} +6 -9
- package/dist/chunk-TOQ7P4DO.mjs.map +1 -0
- package/dist/{chunk-3XAXY2Z3.mjs → chunk-UZTZXMYS.mjs} +2 -2
- package/dist/{chunk-RQNJNK2W.mjs → chunk-VC4NO5QZ.mjs} +2 -2
- package/dist/{chunk-YQ3D5IQV.mjs → chunk-XNQO5AZZ.mjs} +2 -5
- package/dist/chunk-XNQO5AZZ.mjs.map +1 -0
- package/dist/chunk-YC4NBUGE.mjs +97 -0
- package/dist/chunk-YC4NBUGE.mjs.map +1 -0
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +3 -3
- package/dist/components/chat/Chat.d.ts +17 -1
- package/dist/components/chat/Chat.js +378 -905
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +11 -18
- package/dist/components/chat/ChatContext.d.ts +20 -0
- package/dist/components/chat/ChatContext.js +44 -74
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +2 -2
- package/dist/components/chat/CodeBlock.js +58 -82
- package/dist/components/chat/CodeBlock.js.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +2 -2
- package/dist/components/chat/Header.js +516 -4
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +10 -3
- package/dist/components/chat/Icons.d.ts +10 -9
- package/dist/components/chat/Icons.js +125 -164
- package/dist/components/chat/Icons.js.map +1 -1
- package/dist/components/chat/Icons.mjs +9 -5
- package/dist/components/chat/Input.d.ts +1 -1
- package/dist/components/chat/Input.js +11 -9
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +3 -3
- package/dist/components/chat/Markdown.js +58 -56
- package/dist/components/chat/Markdown.js.map +1 -1
- package/dist/components/chat/Markdown.mjs +3 -3
- package/dist/components/chat/Messages.d.ts +1 -1
- package/dist/components/chat/Messages.js +70 -60
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +3 -3
- package/dist/components/chat/Modal.js +1708 -1749
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +21 -21
- package/dist/components/chat/Popup.js +1708 -1749
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +22 -22
- package/dist/components/chat/Response.js.map +1 -1
- package/dist/components/chat/Response.mjs +3 -3
- package/dist/components/chat/Sidebar.js +1710 -1751
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +22 -22
- package/dist/components/chat/Suggestion.js +4 -40
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +2 -2
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +3 -3
- package/dist/components/chat/index.js +1710 -1751
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +24 -24
- package/dist/components/chat/messages/AssistantMessage.js +211 -59
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderTextMessage.js +18 -2
- package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
- package/dist/components/chat/props.d.ts +53 -0
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/dev-console/console.js +51 -233
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +3 -3
- package/dist/components/dev-console/index.js +51 -233
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +3 -3
- package/dist/components/help-modal/index.js +29 -147
- package/dist/components/help-modal/index.js.map +1 -1
- package/dist/components/help-modal/index.mjs +1 -1
- package/dist/components/help-modal/modal.js +29 -147
- package/dist/components/help-modal/modal.js.map +1 -1
- package/dist/components/help-modal/modal.mjs +1 -1
- package/dist/components/index.js +1683 -1724
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +28 -28
- package/dist/index.css +254 -90
- package/dist/index.css.map +1 -1
- package/dist/index.js +1692 -1733
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -28
- package/dist/types/css.d.ts +7 -1
- package/dist/types/css.js.map +1 -1
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +59 -22
- package/src/components/chat/ChatContext.tsx +29 -1
- package/src/components/chat/CodeBlock.tsx +2 -4
- package/src/components/chat/Header.tsx +8 -3
- package/src/components/chat/Icons.tsx +108 -108
- package/src/components/chat/Input.tsx +42 -38
- package/src/components/chat/Markdown.tsx +0 -3
- package/src/components/chat/Messages.tsx +68 -56
- package/src/components/chat/Suggestion.tsx +2 -3
- package/src/components/chat/messages/AssistantMessage.tsx +95 -3
- package/src/components/chat/messages/RenderTextMessage.tsx +17 -1
- package/src/components/chat/props.ts +66 -0
- package/src/components/dev-console/console.tsx +16 -54
- package/src/components/help-modal/modal.tsx +38 -101
- package/src/css/button.css +15 -4
- package/src/css/colors.css +27 -6
- package/src/css/console.css +46 -39
- package/src/css/header.css +22 -5
- package/src/css/input.css +24 -17
- package/src/css/markdown.css +2 -1
- package/src/css/messages.css +125 -15
- package/src/css/panel.css +1 -0
- package/src/css/suggestions.css +14 -6
- package/src/types/css.ts +7 -1
- package/dist/chunk-3VNMQWGT.mjs +0 -25
- package/dist/chunk-3VNMQWGT.mjs.map +0 -1
- package/dist/chunk-6FTRYYR5.mjs.map +0 -1
- package/dist/chunk-CBBFRI3Q.mjs.map +0 -1
- package/dist/chunk-FZC7X5PK.mjs +0 -262
- package/dist/chunk-FZC7X5PK.mjs.map +0 -1
- package/dist/chunk-OFYI4UU4.mjs.map +0 -1
- package/dist/chunk-QXQDIFOC.mjs.map +0 -1
- package/dist/chunk-QXTRFMPM.mjs.map +0 -1
- package/dist/chunk-TI7SY2RI.mjs +0 -164
- package/dist/chunk-TI7SY2RI.mjs.map +0 -1
- package/dist/chunk-UPTB2MVO.mjs.map +0 -1
- package/dist/chunk-VEC45H6Q.mjs +0 -18
- package/dist/chunk-VEC45H6Q.mjs.map +0 -1
- package/dist/chunk-WGAZXTUA.mjs.map +0 -1
- package/dist/chunk-YQ3D5IQV.mjs.map +0 -1
- package/dist/chunk-ZIF5JJCH.mjs.map +0 -1
- /package/dist/{chunk-YAGE7RCE.mjs.map → chunk-CGVOCLHN.mjs.map} +0 -0
- /package/dist/{chunk-AELKLZSG.mjs.map → chunk-KG6DW6R2.mjs.map} +0 -0
- /package/dist/{chunk-DLG7BZTA.mjs.map → chunk-LKCAF2HG.mjs.map} +0 -0
- /package/dist/{chunk-R2O33F44.mjs.map → chunk-LXCH2BIB.mjs.map} +0 -0
- /package/dist/{chunk-3XAXY2Z3.mjs.map → chunk-UZTZXMYS.mjs.map} +0 -0
- /package/dist/{chunk-RQNJNK2W.mjs.map → chunk-VC4NO5QZ.mjs.map} +0 -0
|
@@ -82,10 +82,10 @@ __export(Sidebar_exports, {
|
|
|
82
82
|
CopilotSidebar: () => CopilotSidebar
|
|
83
83
|
});
|
|
84
84
|
module.exports = __toCommonJS(Sidebar_exports);
|
|
85
|
-
var
|
|
85
|
+
var import_react15 = require("react");
|
|
86
86
|
|
|
87
87
|
// src/components/chat/Modal.tsx
|
|
88
|
-
var
|
|
88
|
+
var import_react14 = __toESM(require("react"));
|
|
89
89
|
|
|
90
90
|
// src/components/chat/ChatContext.tsx
|
|
91
91
|
var import_react = __toESM(require("react"));
|
|
@@ -142,7 +142,20 @@ var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
142
142
|
xmlns: "http://www.w3.org/2000/svg",
|
|
143
143
|
fill: "none",
|
|
144
144
|
viewBox: "0 0 24 24",
|
|
145
|
-
strokeWidth: 1.5,
|
|
145
|
+
strokeWidth: "1.5",
|
|
146
|
+
stroke: "currentColor",
|
|
147
|
+
width: "24",
|
|
148
|
+
height: "24",
|
|
149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 19V5m0 0l-7 7m7-7l7 7" })
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
var MicrophoneIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
153
|
+
"svg",
|
|
154
|
+
{
|
|
155
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
156
|
+
fill: "none",
|
|
157
|
+
viewBox: "0 0 24 24",
|
|
158
|
+
strokeWidth: "1.5",
|
|
146
159
|
stroke: "currentColor",
|
|
147
160
|
width: "24",
|
|
148
161
|
height: "24",
|
|
@@ -151,184 +164,157 @@ var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
151
164
|
{
|
|
152
165
|
strokeLinecap: "round",
|
|
153
166
|
strokeLinejoin: "round",
|
|
154
|
-
d: "
|
|
167
|
+
d: "M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"
|
|
155
168
|
}
|
|
156
169
|
)
|
|
157
170
|
}
|
|
158
171
|
);
|
|
159
|
-
var
|
|
172
|
+
var StopIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
160
173
|
"svg",
|
|
161
174
|
{
|
|
162
|
-
style: {
|
|
163
|
-
animation: "copilotKitSpinAnimation 1s linear infinite",
|
|
164
|
-
color: "rgb(107 114 128)"
|
|
165
|
-
},
|
|
166
|
-
width: "24",
|
|
167
|
-
height: "24",
|
|
168
175
|
xmlns: "http://www.w3.org/2000/svg",
|
|
169
176
|
fill: "none",
|
|
170
177
|
viewBox: "0 0 24 24",
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
184
|
-
"path",
|
|
185
|
-
{
|
|
186
|
-
style: { opacity: 0.75 },
|
|
187
|
-
fill: "currentColor",
|
|
188
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
189
|
-
}
|
|
190
|
-
)
|
|
191
|
-
]
|
|
178
|
+
strokeWidth: "1.5",
|
|
179
|
+
stroke: "currentColor",
|
|
180
|
+
width: "24",
|
|
181
|
+
height: "24",
|
|
182
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
183
|
+
"path",
|
|
184
|
+
{
|
|
185
|
+
strokeLinecap: "round",
|
|
186
|
+
strokeLinejoin: "round",
|
|
187
|
+
d: "M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"
|
|
188
|
+
}
|
|
189
|
+
)
|
|
192
190
|
}
|
|
193
191
|
);
|
|
194
|
-
var
|
|
192
|
+
var RegenerateIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
193
|
"svg",
|
|
196
194
|
{
|
|
197
|
-
style: {
|
|
198
|
-
animation: "copilotKitSpinAnimation 1s linear infinite"
|
|
199
|
-
},
|
|
200
|
-
width: "13",
|
|
201
|
-
height: "13",
|
|
202
195
|
xmlns: "http://www.w3.org/2000/svg",
|
|
203
196
|
fill: "none",
|
|
204
197
|
viewBox: "0 0 24 24",
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
"path",
|
|
219
|
-
{
|
|
220
|
-
style: { opacity: 0.75 },
|
|
221
|
-
fill: "currentColor",
|
|
222
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
223
|
-
}
|
|
224
|
-
)
|
|
225
|
-
]
|
|
198
|
+
strokeWidth: "2",
|
|
199
|
+
stroke: "currentColor",
|
|
200
|
+
width: "16",
|
|
201
|
+
height: "16",
|
|
202
|
+
style: { minWidth: "16px", minHeight: "16px" },
|
|
203
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
204
|
+
"path",
|
|
205
|
+
{
|
|
206
|
+
strokeLinecap: "round",
|
|
207
|
+
strokeLinejoin: "round",
|
|
208
|
+
d: "M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"
|
|
209
|
+
}
|
|
210
|
+
)
|
|
226
211
|
}
|
|
227
212
|
);
|
|
228
|
-
var
|
|
213
|
+
var CopyIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
229
214
|
"svg",
|
|
230
215
|
{
|
|
231
|
-
style: {
|
|
232
|
-
display: "inline-block",
|
|
233
|
-
marginLeft: "0.25rem",
|
|
234
|
-
marginRight: "0.25rem"
|
|
235
|
-
},
|
|
236
|
-
height: "24",
|
|
237
|
-
width: "24",
|
|
238
|
-
viewBox: "0 0 27 27",
|
|
239
216
|
xmlns: "http://www.w3.org/2000/svg",
|
|
240
|
-
fill: "
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
217
|
+
fill: "none",
|
|
218
|
+
viewBox: "0 0 24 24",
|
|
219
|
+
strokeWidth: "2",
|
|
220
|
+
stroke: "currentColor",
|
|
221
|
+
width: "16",
|
|
222
|
+
height: "16",
|
|
223
|
+
style: { minWidth: "16px", minHeight: "16px" },
|
|
224
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
225
|
+
"path",
|
|
226
|
+
{
|
|
227
|
+
strokeLinecap: "round",
|
|
228
|
+
strokeLinejoin: "round",
|
|
229
|
+
d: "M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75"
|
|
230
|
+
}
|
|
231
|
+
)
|
|
246
232
|
}
|
|
247
233
|
);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
style: { height: "1rem", width: "1rem" },
|
|
257
|
-
className
|
|
258
|
-
}, props), {
|
|
259
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.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" })
|
|
260
|
-
})
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
function DownloadIcon(_a) {
|
|
264
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
265
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
266
|
-
"svg",
|
|
267
|
-
__spreadProps(__spreadValues({
|
|
268
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
269
|
-
viewBox: "0 0 256 256",
|
|
270
|
-
fill: "currentColor",
|
|
271
|
-
style: { height: "1rem", width: "1rem" },
|
|
272
|
-
className
|
|
273
|
-
}, props), {
|
|
274
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.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" })
|
|
275
|
-
})
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
function CopyIcon(_a) {
|
|
279
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
280
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
281
|
-
"svg",
|
|
282
|
-
__spreadProps(__spreadValues({
|
|
283
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
284
|
-
viewBox: "0 0 256 256",
|
|
285
|
-
fill: "currentColor",
|
|
286
|
-
style: { height: "1rem", width: "1rem" },
|
|
287
|
-
className
|
|
288
|
-
}, props), {
|
|
289
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.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" })
|
|
290
|
-
})
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
var StopIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
234
|
+
var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "13px", height: "13px" } });
|
|
235
|
+
var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "24px", height: "24px" } });
|
|
236
|
+
var ActivityIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
237
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0s" } }),
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0.2s" } }),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitActivityDot", style: { animationDelay: "0.4s" } })
|
|
240
|
+
] });
|
|
241
|
+
var ThumbsUpIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
294
242
|
"svg",
|
|
295
243
|
{
|
|
296
244
|
xmlns: "http://www.w3.org/2000/svg",
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
245
|
+
fill: "none",
|
|
246
|
+
viewBox: "0 0 24 24",
|
|
247
|
+
strokeWidth: "2",
|
|
248
|
+
stroke: "currentColor",
|
|
249
|
+
width: "16",
|
|
250
|
+
height: "16",
|
|
251
|
+
style: { minWidth: "16px", minHeight: "16px" },
|
|
252
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
253
|
+
"path",
|
|
254
|
+
{
|
|
255
|
+
strokeLinecap: "round",
|
|
256
|
+
strokeLinejoin: "round",
|
|
257
|
+
d: "M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 00-1.423-.23H5.904M14.25 9h2.25M5.904 18.75c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 10.203 4.167 9.75 5 9.75h1.053c.472 0 .745.556.5.96a8.958 8.958 0 00-1.302 4.665c0 1.194.232 2.333.654 3.375z"
|
|
258
|
+
}
|
|
259
|
+
)
|
|
301
260
|
}
|
|
302
261
|
);
|
|
303
|
-
var
|
|
262
|
+
var ThumbsDownIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
304
263
|
"svg",
|
|
305
264
|
{
|
|
306
265
|
xmlns: "http://www.w3.org/2000/svg",
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
266
|
+
fill: "none",
|
|
267
|
+
viewBox: "0 0 24 24",
|
|
268
|
+
strokeWidth: "2",
|
|
269
|
+
stroke: "currentColor",
|
|
270
|
+
width: "16",
|
|
271
|
+
height: "16",
|
|
272
|
+
style: { minWidth: "16px", minHeight: "16px" },
|
|
273
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
274
|
+
"path",
|
|
275
|
+
{
|
|
276
|
+
strokeLinecap: "round",
|
|
277
|
+
strokeLinejoin: "round",
|
|
278
|
+
d: "M7.5 15h2.25m8.024-9.75c.011.05.028.1.052.148.591 1.2.924 2.55.924 3.977a8.96 8.96 0 01-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398C20.613 14.547 19.833 15 19 15h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 00.303-.54m.023-8.25H16.48a4.5 4.5 0 01-1.423-.23l-3.114-1.04a4.5 4.5 0 00-1.423-.23H6.504c-.618 0-1.217.247-1.605.729A11.95 11.95 0 002.25 12c0 .434.023.863.068 1.285C2.427 14.306 3.346 15 4.372 15h3.126c.618 0 .991.724.725 1.282A7.471 7.471 0 007.5 19.5a2.25 2.25 0 002.25 2.25.75.75 0 00.75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 002.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384"
|
|
279
|
+
}
|
|
280
|
+
)
|
|
311
281
|
}
|
|
312
282
|
);
|
|
313
|
-
var
|
|
283
|
+
var DownloadIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
314
284
|
"svg",
|
|
315
285
|
{
|
|
316
286
|
xmlns: "http://www.w3.org/2000/svg",
|
|
317
287
|
fill: "none",
|
|
318
288
|
viewBox: "0 0 24 24",
|
|
319
|
-
strokeWidth:
|
|
289
|
+
strokeWidth: "2",
|
|
320
290
|
stroke: "currentColor",
|
|
321
|
-
|
|
291
|
+
width: "16",
|
|
292
|
+
height: "16",
|
|
293
|
+
style: { minWidth: "16px", minHeight: "16px" },
|
|
322
294
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
323
295
|
"path",
|
|
324
296
|
{
|
|
325
297
|
strokeLinecap: "round",
|
|
326
298
|
strokeLinejoin: "round",
|
|
327
|
-
d: "
|
|
299
|
+
d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"
|
|
328
300
|
}
|
|
329
301
|
)
|
|
330
302
|
}
|
|
331
303
|
);
|
|
304
|
+
var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
305
|
+
"svg",
|
|
306
|
+
{
|
|
307
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
308
|
+
fill: "none",
|
|
309
|
+
viewBox: "0 0 24 24",
|
|
310
|
+
strokeWidth: "2",
|
|
311
|
+
stroke: "currentColor",
|
|
312
|
+
width: "16",
|
|
313
|
+
height: "16",
|
|
314
|
+
style: { minWidth: "16px", minHeight: "16px" },
|
|
315
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" })
|
|
316
|
+
}
|
|
317
|
+
);
|
|
332
318
|
|
|
333
319
|
// src/components/chat/ChatContext.tsx
|
|
334
320
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -359,7 +345,11 @@ var ChatContextProvider = ({
|
|
|
359
345
|
placeholder: "Type a message...",
|
|
360
346
|
error: "\u274C An error occurred. Please try again.",
|
|
361
347
|
stopGenerating: "Stop generating",
|
|
362
|
-
regenerateResponse: "Regenerate response"
|
|
348
|
+
regenerateResponse: "Regenerate response",
|
|
349
|
+
copyToClipboard: "Copy to clipboard",
|
|
350
|
+
thumbsUp: "Thumbs up",
|
|
351
|
+
thumbsDown: "Thumbs down",
|
|
352
|
+
copied: "Copied!"
|
|
363
353
|
}), labels),
|
|
364
354
|
[labels]
|
|
365
355
|
);
|
|
@@ -373,7 +363,7 @@ var ChatContextProvider = ({
|
|
|
373
363
|
spinnerIcon: SpinnerIcon,
|
|
374
364
|
stopIcon: StopIcon,
|
|
375
365
|
regenerateIcon: RegenerateIcon,
|
|
376
|
-
pushToTalkIcon:
|
|
366
|
+
pushToTalkIcon: MicrophoneIcon
|
|
377
367
|
}), icons),
|
|
378
368
|
[icons]
|
|
379
369
|
);
|
|
@@ -516,846 +506,1354 @@ var Button = ({}) => {
|
|
|
516
506
|
) });
|
|
517
507
|
};
|
|
518
508
|
|
|
519
|
-
// src/components/
|
|
520
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
521
|
-
var Header = ({}) => {
|
|
522
|
-
const { setOpen, icons, labels } = useChatContext();
|
|
523
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "copilotKitHeader", children: [
|
|
524
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: labels.title }),
|
|
525
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => setOpen(false), "aria-label": "Close", children: icons.headerCloseIcon })
|
|
526
|
-
] });
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
// src/components/chat/Messages.tsx
|
|
530
|
-
var import_react3 = require("react");
|
|
531
|
-
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
509
|
+
// src/components/dev-console/utils.ts
|
|
532
510
|
var import_react_core = require("@copilotkit/react-core");
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
inProgress,
|
|
537
|
-
children,
|
|
538
|
-
RenderTextMessage: RenderTextMessage2,
|
|
539
|
-
RenderActionExecutionMessage: RenderActionExecutionMessage2,
|
|
540
|
-
RenderAgentStateMessage: RenderAgentStateMessage2,
|
|
541
|
-
RenderResultMessage: RenderResultMessage2,
|
|
542
|
-
AssistantMessage: AssistantMessage2,
|
|
543
|
-
UserMessage: UserMessage2
|
|
544
|
-
}) => {
|
|
545
|
-
const context = useChatContext();
|
|
546
|
-
const initialMessages = (0, import_react3.useMemo)(
|
|
547
|
-
() => makeInitialMessages(context.labels.initial),
|
|
548
|
-
[context.labels.initial]
|
|
549
|
-
);
|
|
550
|
-
messages = [...initialMessages, ...messages];
|
|
551
|
-
const actionResults = {};
|
|
552
|
-
for (let i = 0; i < messages.length; i++) {
|
|
553
|
-
if (messages[i].isActionExecutionMessage()) {
|
|
554
|
-
const id = messages[i].id;
|
|
555
|
-
const resultMessage = messages.find(
|
|
556
|
-
(message) => message.isResultMessage() && message.actionExecutionId === id
|
|
557
|
-
);
|
|
558
|
-
if (resultMessage) {
|
|
559
|
-
actionResults[id] = import_runtime_client_gql.ResultMessage.decodeResult(resultMessage.result || "");
|
|
560
|
-
}
|
|
561
|
-
}
|
|
511
|
+
function shouldShowDevConsole(showDevConsole) {
|
|
512
|
+
if (typeof showDevConsole === "boolean") {
|
|
513
|
+
return showDevConsole;
|
|
562
514
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
if (message.isTextMessage()) {
|
|
569
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
570
|
-
RenderTextMessage2,
|
|
571
|
-
{
|
|
572
|
-
message,
|
|
573
|
-
inProgress,
|
|
574
|
-
index,
|
|
575
|
-
isCurrentMessage,
|
|
576
|
-
AssistantMessage: AssistantMessage2,
|
|
577
|
-
UserMessage: UserMessage2
|
|
578
|
-
},
|
|
579
|
-
index
|
|
580
|
-
);
|
|
581
|
-
} else if (message.isActionExecutionMessage()) {
|
|
582
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
583
|
-
RenderActionExecutionMessage2,
|
|
584
|
-
{
|
|
585
|
-
message,
|
|
586
|
-
inProgress,
|
|
587
|
-
index,
|
|
588
|
-
isCurrentMessage,
|
|
589
|
-
actionResult: actionResults[message.id],
|
|
590
|
-
AssistantMessage: AssistantMessage2,
|
|
591
|
-
UserMessage: UserMessage2
|
|
592
|
-
},
|
|
593
|
-
index
|
|
594
|
-
);
|
|
595
|
-
} else if (message.isAgentStateMessage()) {
|
|
596
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
597
|
-
RenderAgentStateMessage2,
|
|
598
|
-
{
|
|
599
|
-
message,
|
|
600
|
-
inProgress,
|
|
601
|
-
index,
|
|
602
|
-
isCurrentMessage,
|
|
603
|
-
AssistantMessage: AssistantMessage2,
|
|
604
|
-
UserMessage: UserMessage2
|
|
605
|
-
},
|
|
606
|
-
index
|
|
607
|
-
);
|
|
608
|
-
} else if (message.isResultMessage()) {
|
|
609
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
610
|
-
RenderResultMessage2,
|
|
611
|
-
{
|
|
612
|
-
message,
|
|
613
|
-
inProgress,
|
|
614
|
-
index,
|
|
615
|
-
isCurrentMessage,
|
|
616
|
-
AssistantMessage: AssistantMessage2,
|
|
617
|
-
UserMessage: UserMessage2
|
|
618
|
-
},
|
|
619
|
-
index
|
|
620
|
-
);
|
|
621
|
-
}
|
|
622
|
-
}),
|
|
623
|
-
interrupt,
|
|
624
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("footer", { ref: messagesEndRef, children })
|
|
625
|
-
] });
|
|
626
|
-
};
|
|
627
|
-
function makeInitialMessages(initial) {
|
|
628
|
-
let initialArray = [];
|
|
629
|
-
if (initial) {
|
|
630
|
-
if (Array.isArray(initial)) {
|
|
631
|
-
initialArray.push(...initial);
|
|
632
|
-
} else {
|
|
633
|
-
initialArray.push(initial);
|
|
634
|
-
}
|
|
515
|
+
return getHostname() === "localhost" || getHostname() === "127.0.0.1" || getHostname() === "0.0.0.0" || getHostname() === "::1";
|
|
516
|
+
}
|
|
517
|
+
function getHostname() {
|
|
518
|
+
if (typeof window !== "undefined" && window.location) {
|
|
519
|
+
return window.location.hostname;
|
|
635
520
|
}
|
|
636
|
-
return
|
|
637
|
-
(message) => new import_runtime_client_gql.TextMessage({
|
|
638
|
-
role: import_runtime_client_gql.Role.Assistant,
|
|
639
|
-
content: message
|
|
640
|
-
})
|
|
641
|
-
);
|
|
521
|
+
return "";
|
|
642
522
|
}
|
|
643
|
-
function
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
if (isProgrammaticScrollRef.current) {
|
|
658
|
-
isProgrammaticScrollRef.current = false;
|
|
659
|
-
return;
|
|
660
|
-
}
|
|
661
|
-
if (messagesContainerRef.current) {
|
|
662
|
-
const { scrollTop, scrollHeight, clientHeight } = messagesContainerRef.current;
|
|
663
|
-
isUserScrollUpRef.current = scrollTop + clientHeight < scrollHeight;
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
(0, import_react3.useEffect)(() => {
|
|
667
|
-
const container = messagesContainerRef.current;
|
|
668
|
-
if (container) {
|
|
669
|
-
container.addEventListener("scroll", handleScroll);
|
|
670
|
-
}
|
|
671
|
-
return () => {
|
|
672
|
-
if (container) {
|
|
673
|
-
container.removeEventListener("scroll", handleScroll);
|
|
523
|
+
function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
524
|
+
return __async(this, null, function* () {
|
|
525
|
+
const LOCAL_STORAGE_KEY = "__copilotkit_version_check__";
|
|
526
|
+
const serializedVersion = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
527
|
+
if (serializedVersion && !forceCheck) {
|
|
528
|
+
try {
|
|
529
|
+
const parsedVersion = JSON.parse(serializedVersion);
|
|
530
|
+
const oneHour = 60 * 60 * 1e3;
|
|
531
|
+
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
532
|
+
if (parsedVersion.current === current && now - new Date(parsedVersion.lastChecked).getTime() < oneHour) {
|
|
533
|
+
return parsedVersion;
|
|
534
|
+
}
|
|
535
|
+
} catch (error) {
|
|
536
|
+
console.error("Failed to parse CopilotKitVersion from localStorage", error);
|
|
674
537
|
}
|
|
675
|
-
};
|
|
676
|
-
}, []);
|
|
677
|
-
(0, import_react3.useEffect)(() => {
|
|
678
|
-
const container = messagesContainerRef.current;
|
|
679
|
-
if (!container) {
|
|
680
|
-
return;
|
|
681
538
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
539
|
+
try {
|
|
540
|
+
const response = yield fetch("https://api.cloud.copilotkit.ai/check-for-updates", {
|
|
541
|
+
method: "POST",
|
|
542
|
+
headers: {
|
|
543
|
+
"Content-Type": "application/json"
|
|
544
|
+
},
|
|
545
|
+
body: JSON.stringify({
|
|
546
|
+
packages: [
|
|
547
|
+
{
|
|
548
|
+
packageName: "@copilotkit/shared",
|
|
549
|
+
packageVersion: current
|
|
550
|
+
}
|
|
551
|
+
]
|
|
552
|
+
})
|
|
553
|
+
});
|
|
554
|
+
const data = yield response.json();
|
|
555
|
+
const version = {
|
|
556
|
+
current,
|
|
557
|
+
lastChecked: (/* @__PURE__ */ new Date()).getTime(),
|
|
558
|
+
latest: data.packages[0].latestVersion,
|
|
559
|
+
severity: data.packages[0].severity,
|
|
560
|
+
advisory: data.packages[0].advisory || null
|
|
561
|
+
};
|
|
562
|
+
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(version));
|
|
563
|
+
return version;
|
|
564
|
+
} catch (error) {
|
|
565
|
+
console.error("Failed to check for updates", error);
|
|
566
|
+
throw error;
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
function logReadables(context) {
|
|
571
|
+
console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
|
|
572
|
+
const readables = context.getContextString([], import_react_core.defaultCopilotContextCategories).trim();
|
|
573
|
+
if (readables.length === 0) {
|
|
574
|
+
console.log("No readables found");
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
console.log(readables);
|
|
578
|
+
}
|
|
579
|
+
function logActions(context) {
|
|
580
|
+
console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
|
|
581
|
+
if (Object.values(context.actions).length === 0) {
|
|
582
|
+
console.log("No actions found");
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
for (const action of Object.values(context.actions)) {
|
|
586
|
+
console.group(action.name);
|
|
587
|
+
console.log("name", action.name);
|
|
588
|
+
console.log("description", action.description);
|
|
589
|
+
console.log("parameters", action.parameters);
|
|
590
|
+
console.groupEnd();
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function logMessages(context) {
|
|
594
|
+
console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
|
|
595
|
+
if (context.messages.length === 0) {
|
|
596
|
+
console.log("No messages found");
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
const tableData = context.messages.map((message) => {
|
|
600
|
+
if (message.isTextMessage()) {
|
|
601
|
+
return {
|
|
602
|
+
id: message.id,
|
|
603
|
+
type: "TextMessage",
|
|
604
|
+
role: message.role,
|
|
605
|
+
name: void 0,
|
|
606
|
+
scope: void 0,
|
|
607
|
+
content: message.content
|
|
608
|
+
};
|
|
609
|
+
} else if (message.isActionExecutionMessage()) {
|
|
610
|
+
return {
|
|
611
|
+
id: message.id,
|
|
612
|
+
type: "ActionExecutionMessage",
|
|
613
|
+
role: void 0,
|
|
614
|
+
name: message.name,
|
|
615
|
+
scope: message.parentMessageId,
|
|
616
|
+
content: message.arguments
|
|
617
|
+
};
|
|
618
|
+
} else if (message.isResultMessage()) {
|
|
619
|
+
return {
|
|
620
|
+
id: message.id,
|
|
621
|
+
type: "ResultMessage",
|
|
622
|
+
role: void 0,
|
|
623
|
+
name: message.actionName,
|
|
624
|
+
scope: message.actionExecutionId,
|
|
625
|
+
content: message.result
|
|
626
|
+
};
|
|
627
|
+
} else if (message.isAgentStateMessage()) {
|
|
628
|
+
return {
|
|
629
|
+
id: message.id,
|
|
630
|
+
type: `AgentStateMessage (running: ${message.running})`,
|
|
631
|
+
role: message.role,
|
|
632
|
+
name: void 0,
|
|
633
|
+
scope: message.threadId,
|
|
634
|
+
content: message.state
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
console.table(tableData);
|
|
639
|
+
}
|
|
705
640
|
|
|
706
|
-
// src/components/
|
|
641
|
+
// src/components/dev-console/console.tsx
|
|
642
|
+
var import_react_core2 = require("@copilotkit/react-core");
|
|
707
643
|
var import_react4 = require("react");
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
calculateMaxHeight();
|
|
727
|
-
}, [maxRows]);
|
|
728
|
-
(0, import_react4.useEffect)(() => {
|
|
729
|
-
const textarea = internalTextareaRef.current;
|
|
730
|
-
if (textarea) {
|
|
731
|
-
textarea.style.height = "auto";
|
|
732
|
-
textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
|
|
644
|
+
|
|
645
|
+
// src/components/dev-console/icons.tsx
|
|
646
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
647
|
+
var ExclamationMarkTriangleIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
648
|
+
"svg",
|
|
649
|
+
{
|
|
650
|
+
width: "13.3967723px",
|
|
651
|
+
height: "12px",
|
|
652
|
+
viewBox: "0 0 13.3967723 12",
|
|
653
|
+
version: "1.1",
|
|
654
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
655
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "exclamation-triangle", fill: "#CD2121", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
656
|
+
"path",
|
|
657
|
+
{
|
|
658
|
+
d: "M5.39935802,0.75 C5.97670802,-0.25 7.42007802,-0.25 7.99742802,0.75 L13.193588,9.75 C13.770888,10.75 13.049288,12 11.894588,12 L1.50223802,12 C0.34753802,12 -0.37414898,10.75 0.20319802,9.75 L5.39935802,0.75 Z M6.69838802,2.5 C7.11260802,2.5 7.44838802,2.83579 7.44838802,3.25 L7.44838802,6.25 C7.44838802,6.66421 7.11260802,7 6.69838802,7 C6.28417802,7 5.94838802,6.66421 5.94838802,6.25 L5.94838802,3.25 C5.94838802,2.83579 6.28417802,2.5 6.69838802,2.5 Z M6.69838802,10.5 C7.25067802,10.5 7.69838802,10.0523 7.69838802,9.5 C7.69838802,8.9477 7.25067802,8.5 6.69838802,8.5 C6.14610802,8.5 5.69838802,8.9477 5.69838802,9.5 C5.69838802,10.0523 6.14610802,10.5 6.69838802,10.5 Z",
|
|
659
|
+
id: "Shape"
|
|
733
660
|
}
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
|
|
661
|
+
) }) })
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
var ExclamationMarkIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
665
|
+
"svg",
|
|
666
|
+
{
|
|
667
|
+
width: "14px",
|
|
668
|
+
height: "14px",
|
|
669
|
+
viewBox: "0 0 14 14",
|
|
670
|
+
version: "1.1",
|
|
671
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
672
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "exclamation-circle", fill: "#EC662C", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
673
|
+
"path",
|
|
737
674
|
{
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
onChange,
|
|
741
|
-
onKeyDown,
|
|
742
|
-
placeholder,
|
|
743
|
-
style: {
|
|
744
|
-
overflow: "auto",
|
|
745
|
-
resize: "none",
|
|
746
|
-
maxHeight: `${maxHeight}px`
|
|
747
|
-
},
|
|
748
|
-
rows: 1
|
|
675
|
+
d: "M7,14 C10.866,14 14,10.866 14,7 C14,3.13401 10.866,0 7,0 C3.13401,0 0,3.13401 0,7 C0,10.866 3.13401,14 7,14 Z M7,3 C7.41421,3 7.75,3.33579 7.75,3.75 L7.75,6.75 C7.75,7.16421 7.41421,7.5 7,7.5 C6.58579,7.5 6.25,7.16421 6.25,6.75 L6.25,3.75 C6.25,3.33579 6.58579,3 7,3 Z M7,11 C7.55228,11 8,10.5523 8,10 C8,9.4477 7.55228,9 7,9 C6.44772,9 6,9.4477 6,10 C6,10.5523 6.44772,11 7,11 Z",
|
|
676
|
+
id: "Shape"
|
|
749
677
|
}
|
|
750
|
-
)
|
|
678
|
+
) }) })
|
|
751
679
|
}
|
|
752
680
|
);
|
|
753
|
-
var
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
759
|
-
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
760
|
-
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({ audio: true });
|
|
761
|
-
audioContextRef.current = new window.AudioContext();
|
|
762
|
-
yield audioContextRef.current.resume();
|
|
681
|
+
var ChevronDownIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "7px", height: "4px", viewBox: "0 0 7 4", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group", fill: "#000000", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
682
|
+
"path",
|
|
683
|
+
{
|
|
684
|
+
d: "M3.71690723,3.90271086 C3.59268176,4.03242971 3.39143629,4.03242971 3.26721082,3.90271086 L0.0853966595,0.57605615 C-0.0314221035,0.444981627 -0.0279751448,0.240725043 0.0931934622,0.114040675 C0.214362069,-0.0126436935 0.409725445,-0.0162475626 0.535093061,0.105888951 L3.49205902,3.19746006 L6.44902499,0.105888951 C6.52834574,0.0168884389 6.64780588,-0.0197473458 6.7605411,0.0103538404 C6.87327633,0.0404550266 6.96130636,0.132492308 6.99009696,0.250359396 C7.01888756,0.368226483 6.98384687,0.493124608 6.89872139,0.57605615 L3.71690723,3.90271086 Z",
|
|
685
|
+
id: "Path"
|
|
763
686
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
687
|
+
) }) }) });
|
|
688
|
+
var CheckIcon2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
689
|
+
"svg",
|
|
690
|
+
{
|
|
691
|
+
width: "14px",
|
|
692
|
+
height: "14px",
|
|
693
|
+
viewBox: "0 0 14 14",
|
|
694
|
+
version: "1.1",
|
|
695
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
696
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group-2", transform: "translate(-118, 0)", fill: "#1BC030", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
697
|
+
"path",
|
|
698
|
+
{
|
|
699
|
+
d: "M0,7 C0,3.13384615 3.13384615,0 7,0 C10.8661538,0 14,3.13384615 14,7 C14,10.8661538 10.8661538,14 7,14 C3.13384615,14 0,10.8661538 0,7 Z M9.59179487,5.69764103 C9.70905818,5.54139023 9.73249341,5.33388318 9.65303227,5.15541491 C9.57357113,4.97694665 9.40367989,4.85551619 9.20909814,4.83811118 C9.01451638,4.82070616 8.82577109,4.91005717 8.71589744,5.07158974 L6.39261538,8.32389744 L5.22666667,7.15794872 C5.01450582,6.96025518 4.68389046,6.9660885 4.47883563,7.17114332 C4.27378081,7.37619815 4.26794748,7.70681351 4.46564103,7.91897436 L6.08102564,9.53435897 C6.19289944,9.64614839 6.3482622,9.70310251 6.50588106,9.69010587 C6.66349993,9.67710922 6.80743532,9.59547613 6.89948718,9.46687179 L9.59179487,5.69764103 L9.59179487,5.69764103 Z",
|
|
700
|
+
id: "Shape"
|
|
701
|
+
}
|
|
702
|
+
) }) }) })
|
|
774
703
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
704
|
+
);
|
|
705
|
+
|
|
706
|
+
// src/components/dev-console/console.tsx
|
|
707
|
+
var import_react5 = require("@headlessui/react");
|
|
708
|
+
var import_shared = require("@copilotkit/shared");
|
|
709
|
+
|
|
710
|
+
// src/components/help-modal/modal.tsx
|
|
711
|
+
var import_react3 = require("react");
|
|
712
|
+
|
|
713
|
+
// src/components/help-modal/icons.tsx
|
|
714
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
715
|
+
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
716
|
+
"svg",
|
|
717
|
+
{
|
|
718
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
719
|
+
fill: "none",
|
|
720
|
+
viewBox: "0 0 24 24",
|
|
721
|
+
strokeWidth: "1.5",
|
|
722
|
+
stroke: "currentColor",
|
|
723
|
+
width: "20",
|
|
724
|
+
height: "20",
|
|
725
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
786
726
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
var
|
|
791
|
-
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
console.error("Error with decoding audio data", error);
|
|
800
|
-
});
|
|
801
|
-
};
|
|
802
|
-
var usePushToTalk = ({
|
|
803
|
-
sendFunction,
|
|
804
|
-
inProgress
|
|
805
|
-
}) => {
|
|
806
|
-
const [pushToTalkState, setPushToTalkState] = (0, import_react5.useState)("idle");
|
|
807
|
-
const mediaStreamRef = (0, import_react5.useRef)(null);
|
|
808
|
-
const audioContextRef = (0, import_react5.useRef)(null);
|
|
809
|
-
const mediaRecorderRef = (0, import_react5.useRef)(null);
|
|
810
|
-
const recordedChunks = (0, import_react5.useRef)([]);
|
|
811
|
-
const generalContext = (0, import_react_core2.useCopilotContext)();
|
|
812
|
-
const messagesContext = (0, import_react_core2.useCopilotMessagesContext)();
|
|
813
|
-
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
814
|
-
const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react5.useState)(null);
|
|
815
|
-
(0, import_react5.useEffect)(() => {
|
|
816
|
-
if (pushToTalkState === "recording") {
|
|
817
|
-
startRecording(
|
|
818
|
-
mediaStreamRef,
|
|
819
|
-
mediaRecorderRef,
|
|
820
|
-
audioContextRef,
|
|
821
|
-
recordedChunks.current,
|
|
822
|
-
() => {
|
|
823
|
-
setPushToTalkState("transcribing");
|
|
824
|
-
}
|
|
825
|
-
);
|
|
826
|
-
} else {
|
|
827
|
-
stopRecording(mediaRecorderRef);
|
|
828
|
-
if (pushToTalkState === "transcribing") {
|
|
829
|
-
transcribeAudio(recordedChunks.current, context.copilotApiConfig.transcribeAudioUrl).then(
|
|
830
|
-
(transcription) => __async(void 0, null, function* () {
|
|
831
|
-
recordedChunks.current = [];
|
|
832
|
-
setPushToTalkState("idle");
|
|
833
|
-
const message = yield sendFunction(transcription);
|
|
834
|
-
setStartReadingFromMessageId(message.id);
|
|
835
|
-
})
|
|
836
|
-
);
|
|
727
|
+
);
|
|
728
|
+
|
|
729
|
+
// src/components/help-modal/modal.tsx
|
|
730
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
731
|
+
function CopilotKitHelpModal() {
|
|
732
|
+
const [showHelpModal, setShowHelpModal] = (0, import_react3.useState)(false);
|
|
733
|
+
const buttonRef = (0, import_react3.useRef)(null);
|
|
734
|
+
const popoverRef = (0, import_react3.useRef)(null);
|
|
735
|
+
(0, import_react3.useEffect)(() => {
|
|
736
|
+
const handleClickOutside = (event) => {
|
|
737
|
+
if (popoverRef.current && !popoverRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
738
|
+
setShowHelpModal(false);
|
|
837
739
|
}
|
|
740
|
+
};
|
|
741
|
+
if (showHelpModal) {
|
|
742
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
838
743
|
}
|
|
839
744
|
return () => {
|
|
840
|
-
|
|
745
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
841
746
|
};
|
|
842
|
-
}, [
|
|
843
|
-
(0,
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
)
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
const text = messagesAfterLast.map((message) => message.content).join("\n");
|
|
852
|
-
playAudioResponse(text, context.copilotApiConfig.textToSpeechUrl, audioContextRef.current);
|
|
853
|
-
setStartReadingFromMessageId(null);
|
|
747
|
+
}, [showHelpModal]);
|
|
748
|
+
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
749
|
+
"button",
|
|
750
|
+
{
|
|
751
|
+
ref: buttonRef,
|
|
752
|
+
onClick: () => setShowHelpModal(!showHelpModal),
|
|
753
|
+
className: "copilotKitDebugMenuTriggerButton relative",
|
|
754
|
+
"aria-label": "Open Help",
|
|
755
|
+
children: "Help"
|
|
854
756
|
}
|
|
855
|
-
|
|
856
|
-
return {
|
|
857
|
-
}
|
|
757
|
+
);
|
|
758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", children: [
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HelpButton, {}),
|
|
760
|
+
showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
761
|
+
"div",
|
|
762
|
+
{
|
|
763
|
+
ref: popoverRef,
|
|
764
|
+
className: "absolute mt-2 z-50",
|
|
765
|
+
style: {
|
|
766
|
+
top: "100%",
|
|
767
|
+
right: "-120px",
|
|
768
|
+
width: "380px"
|
|
769
|
+
},
|
|
770
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "bg-white rounded-lg shadow-xl w-full p-4 flex-col relative", children: [
|
|
771
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
772
|
+
"button",
|
|
773
|
+
{
|
|
774
|
+
className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
775
|
+
style: { top: "10px", right: "10px" },
|
|
776
|
+
onClick: () => setShowHelpModal(false),
|
|
777
|
+
"aria-label": "Close",
|
|
778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon2, {})
|
|
779
|
+
}
|
|
780
|
+
),
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
|
|
782
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
783
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
784
|
+
"a",
|
|
785
|
+
{
|
|
786
|
+
href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
|
|
787
|
+
target: "_blank",
|
|
788
|
+
rel: "noopener noreferrer",
|
|
789
|
+
children: "Visit the Troubleshooting and FAQ section in the docs"
|
|
790
|
+
}
|
|
791
|
+
) }),
|
|
792
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
793
|
+
"a",
|
|
794
|
+
{
|
|
795
|
+
href: "https://go.copilotkit.ai/dev-console-support-discord",
|
|
796
|
+
target: "_blank",
|
|
797
|
+
rel: "noopener noreferrer",
|
|
798
|
+
children: "Go to Discord Support Channel (Community Support)"
|
|
799
|
+
}
|
|
800
|
+
) }),
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitHelpItemButton", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
802
|
+
"a",
|
|
803
|
+
{
|
|
804
|
+
href: "https://go.copilotkit.ai/dev-console-support-slack",
|
|
805
|
+
target: "_blank",
|
|
806
|
+
rel: "noopener noreferrer",
|
|
807
|
+
children: "Apply for Priority Direct Slack Support"
|
|
808
|
+
}
|
|
809
|
+
) })
|
|
810
|
+
] })
|
|
811
|
+
] })
|
|
812
|
+
}
|
|
813
|
+
)
|
|
814
|
+
] });
|
|
815
|
+
}
|
|
858
816
|
|
|
859
|
-
// src/components/
|
|
860
|
-
var import_react_core3 = require("@copilotkit/react-core");
|
|
817
|
+
// src/components/dev-console/console.tsx
|
|
861
818
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
862
|
-
|
|
863
|
-
const
|
|
864
|
-
const
|
|
865
|
-
const
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
819
|
+
function CopilotDevConsole() {
|
|
820
|
+
const currentVersion = import_shared.COPILOTKIT_VERSION;
|
|
821
|
+
const context = (0, import_react_core2.useCopilotContext)();
|
|
822
|
+
const [showDevConsole, setShowDevConsole] = (0, import_react4.useState)(false);
|
|
823
|
+
(0, import_react4.useEffect)(() => {
|
|
824
|
+
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
825
|
+
}, [context.showDevConsole]);
|
|
826
|
+
const dontRunTwiceInDevMode = (0, import_react4.useRef)(false);
|
|
827
|
+
const [versionStatus, setVersionStatus] = (0, import_react4.useState)("unknown");
|
|
828
|
+
const [latestVersion, setLatestVersion] = (0, import_react4.useState)("");
|
|
829
|
+
const consoleRef = (0, import_react4.useRef)(null);
|
|
830
|
+
const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)("full");
|
|
831
|
+
const checkForUpdates = (force = false) => {
|
|
832
|
+
setVersionStatus("checking");
|
|
833
|
+
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
834
|
+
setLatestVersion(v.latest);
|
|
835
|
+
let versionOk = false;
|
|
836
|
+
if (v.current === v.latest) {
|
|
837
|
+
versionOk = true;
|
|
838
|
+
} else if (/[a-zA-Z]/.test(v.current)) {
|
|
839
|
+
versionOk = true;
|
|
840
|
+
}
|
|
841
|
+
if (versionOk) {
|
|
842
|
+
setVersionStatus("latest");
|
|
843
|
+
} else if (v.severity !== "low") {
|
|
844
|
+
setVersionStatus("outdated");
|
|
845
|
+
} else {
|
|
846
|
+
setVersionStatus("update-available");
|
|
847
|
+
}
|
|
848
|
+
}).catch((e) => {
|
|
849
|
+
console.error(e);
|
|
850
|
+
setVersionStatus("unknown");
|
|
851
|
+
});
|
|
872
852
|
};
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
var _a;
|
|
876
|
-
if (inProgress)
|
|
853
|
+
(0, import_react4.useEffect)(() => {
|
|
854
|
+
if (dontRunTwiceInDevMode.current === true) {
|
|
877
855
|
return;
|
|
878
|
-
onSend(text);
|
|
879
|
-
setText("");
|
|
880
|
-
(_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
881
|
-
};
|
|
882
|
-
(0, import_react6.useEffect)(() => {
|
|
883
|
-
var _a;
|
|
884
|
-
if (isVisible) {
|
|
885
|
-
(_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
886
856
|
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
857
|
+
dontRunTwiceInDevMode.current = true;
|
|
858
|
+
checkForUpdates();
|
|
859
|
+
}, []);
|
|
860
|
+
if (!showDevConsole) {
|
|
861
|
+
return null;
|
|
862
|
+
}
|
|
863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
864
|
+
"div",
|
|
865
|
+
{
|
|
866
|
+
ref: consoleRef,
|
|
867
|
+
className: "copilotKitDevConsole " + (versionStatus === "update-available" ? "copilotKitDevConsoleUpgrade" : "") + (versionStatus === "outdated" ? "copilotKitDevConsoleWarnOutdated" : ""),
|
|
868
|
+
children: [
|
|
869
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
870
|
+
VersionInfo,
|
|
871
|
+
{
|
|
872
|
+
showDevConsole: context.showDevConsole,
|
|
873
|
+
versionStatus,
|
|
874
|
+
currentVersion,
|
|
875
|
+
latestVersion
|
|
876
|
+
}
|
|
877
|
+
),
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopilotKitHelpModal, {}),
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
880
|
+
DebugMenuButton,
|
|
881
|
+
{
|
|
882
|
+
setShowDevConsole,
|
|
883
|
+
checkForUpdates,
|
|
884
|
+
mode: debugButtonMode
|
|
885
|
+
}
|
|
886
|
+
)
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
function VersionInfo({
|
|
892
|
+
showDevConsole,
|
|
893
|
+
versionStatus,
|
|
894
|
+
currentVersion,
|
|
895
|
+
latestVersion
|
|
896
|
+
}) {
|
|
897
|
+
const [copyStatus, setCopyStatus] = (0, import_react4.useState)("");
|
|
898
|
+
let versionLabel = "";
|
|
899
|
+
let versionIcon = "";
|
|
900
|
+
let currentVersionLabel = currentVersion;
|
|
901
|
+
if (versionStatus === "latest") {
|
|
902
|
+
versionLabel = "latest";
|
|
903
|
+
versionIcon = CheckIcon2;
|
|
904
|
+
} else if (versionStatus === "checking") {
|
|
905
|
+
versionLabel = "checking";
|
|
906
|
+
versionIcon = SmallSpinnerIcon;
|
|
907
|
+
} else if (versionStatus === "update-available") {
|
|
908
|
+
versionLabel = "update available";
|
|
909
|
+
versionIcon = ExclamationMarkIcon;
|
|
910
|
+
currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
|
|
911
|
+
} else if (versionStatus === "outdated") {
|
|
912
|
+
versionLabel = "outdated";
|
|
913
|
+
versionIcon = ExclamationMarkTriangleIcon;
|
|
914
|
+
currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
|
|
915
|
+
}
|
|
916
|
+
let asideLabel = "";
|
|
917
|
+
if (showDevConsole === "auto") {
|
|
918
|
+
asideLabel = "(localhost only)";
|
|
919
|
+
} else if (showDevConsole === true) {
|
|
920
|
+
asideLabel = "(always on)";
|
|
921
|
+
}
|
|
922
|
+
const installCommand = [
|
|
923
|
+
`npm install`,
|
|
924
|
+
`@copilotkit/react-core@${latestVersion}`,
|
|
925
|
+
`@copilotkit/react-ui@${latestVersion}`,
|
|
926
|
+
`@copilotkit/react-textarea@${latestVersion}`,
|
|
927
|
+
`&& npm install @copilotkit/runtime@${latestVersion}`
|
|
928
|
+
].join(" ");
|
|
929
|
+
const handleCopyClick = () => {
|
|
930
|
+
navigator.clipboard.writeText(installCommand.trim()).then(() => {
|
|
931
|
+
setCopyStatus("Command copied to clipboard!");
|
|
932
|
+
setTimeout(() => setCopyStatus(""), 1e3);
|
|
933
|
+
});
|
|
899
934
|
};
|
|
900
|
-
|
|
901
|
-
|
|
935
|
+
if (versionStatus === "update-available" || versionStatus === "outdated") {
|
|
936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "copilotKitVersionInfo", children: [
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { children: [
|
|
938
|
+
currentVersionLabel,
|
|
939
|
+
" ",
|
|
940
|
+
versionIcon
|
|
941
|
+
] }),
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand })
|
|
943
|
+
] });
|
|
944
|
+
}
|
|
945
|
+
return null;
|
|
946
|
+
}
|
|
947
|
+
function DebugMenuButton({
|
|
948
|
+
setShowDevConsole,
|
|
949
|
+
checkForUpdates,
|
|
950
|
+
mode
|
|
951
|
+
}) {
|
|
952
|
+
const context = (0, import_react_core2.useCopilotContext)();
|
|
953
|
+
const messagesContext = (0, import_react_core2.useCopilotMessagesContext)();
|
|
954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "bg-black top-24 w-52 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react5.Menu, { children: [
|
|
902
955
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
903
|
-
|
|
956
|
+
import_react5.MenuButton,
|
|
904
957
|
{
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
onChange: (event) => setText(event.target.value),
|
|
911
|
-
onKeyDown: (event) => {
|
|
912
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
913
|
-
event.preventDefault();
|
|
914
|
-
if (canSend()) {
|
|
915
|
-
send();
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
}
|
|
958
|
+
className: `copilotKitDebugMenuTriggerButton ${mode === "compact" ? "compact" : ""}`,
|
|
959
|
+
children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
960
|
+
"Debug ",
|
|
961
|
+
ChevronDownIcon
|
|
962
|
+
] })
|
|
919
963
|
}
|
|
920
964
|
),
|
|
921
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
965
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
966
|
+
import_react5.MenuItems,
|
|
967
|
+
{
|
|
968
|
+
transition: true,
|
|
969
|
+
anchor: "bottom end",
|
|
970
|
+
className: "copilotKitDebugMenu",
|
|
971
|
+
style: { zIndex: 40 },
|
|
972
|
+
children: [
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
className: "copilotKitDebugMenuItem",
|
|
979
|
+
onClick: () => logMessages(messagesContext),
|
|
980
|
+
children: "Log Messages"
|
|
981
|
+
}
|
|
982
|
+
) }),
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", {}),
|
|
985
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
|
|
986
|
+
]
|
|
987
|
+
}
|
|
988
|
+
)
|
|
989
|
+
] }) });
|
|
990
|
+
}
|
|
943
991
|
|
|
944
|
-
// src/components/chat/
|
|
992
|
+
// src/components/chat/Header.tsx
|
|
945
993
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
946
|
-
var
|
|
947
|
-
const
|
|
948
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("
|
|
949
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("
|
|
950
|
-
|
|
994
|
+
var Header = ({}) => {
|
|
995
|
+
const { setOpen, icons, labels } = useChatContext();
|
|
996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "copilotKitHeader", children: [
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: labels.title }),
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "copilotKitHeaderControls", children: [
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CopilotDevConsole, {}),
|
|
1000
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { onClick: () => setOpen(false), "aria-label": "Close", children: icons.headerCloseIcon })
|
|
1001
|
+
] })
|
|
951
1002
|
] });
|
|
952
1003
|
};
|
|
953
1004
|
|
|
954
|
-
// src/components/chat/
|
|
1005
|
+
// src/components/chat/Messages.tsx
|
|
1006
|
+
var import_react6 = require("react");
|
|
1007
|
+
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
1008
|
+
var import_react_core3 = require("@copilotkit/react-core");
|
|
955
1009
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1010
|
+
var Messages = ({
|
|
1011
|
+
messages,
|
|
1012
|
+
inProgress,
|
|
1013
|
+
children,
|
|
1014
|
+
RenderTextMessage: RenderTextMessage2,
|
|
1015
|
+
RenderActionExecutionMessage: RenderActionExecutionMessage2,
|
|
1016
|
+
RenderAgentStateMessage: RenderAgentStateMessage2,
|
|
1017
|
+
RenderResultMessage: RenderResultMessage2,
|
|
1018
|
+
AssistantMessage: AssistantMessage2,
|
|
1019
|
+
UserMessage: UserMessage2,
|
|
1020
|
+
onRegenerate,
|
|
1021
|
+
onCopy,
|
|
1022
|
+
onThumbsUp,
|
|
1023
|
+
onThumbsDown
|
|
1024
|
+
}) => {
|
|
1025
|
+
const context = useChatContext();
|
|
1026
|
+
const initialMessages = (0, import_react6.useMemo)(
|
|
1027
|
+
() => makeInitialMessages(context.labels.initial),
|
|
1028
|
+
[context.labels.initial]
|
|
1029
|
+
);
|
|
1030
|
+
messages = [...initialMessages, ...messages];
|
|
1031
|
+
const actionResults = {};
|
|
1032
|
+
for (let i = 0; i < messages.length; i++) {
|
|
1033
|
+
if (messages[i].isActionExecutionMessage()) {
|
|
1034
|
+
const id = messages[i].id;
|
|
1035
|
+
const resultMessage = messages.find(
|
|
1036
|
+
(message) => message.isResultMessage() && message.actionExecutionId === id
|
|
980
1037
|
);
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
986
|
-
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
987
|
-
var import_react_core4 = require("@copilotkit/react-core");
|
|
988
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
989
|
-
function RenderActionExecutionMessage(props) {
|
|
990
|
-
const { chatComponentsCache } = (0, import_react_core4.useCopilotContext)();
|
|
991
|
-
const { message, inProgress, index, isCurrentMessage, actionResult, AssistantMessage: AssistantMessage2 } = props;
|
|
992
|
-
if (message.isActionExecutionMessage()) {
|
|
993
|
-
if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
|
|
994
|
-
const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
|
|
995
|
-
if (typeof render === "string") {
|
|
996
|
-
if (isCurrentMessage && inProgress) {
|
|
997
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
998
|
-
AssistantMessage2,
|
|
999
|
-
{
|
|
1000
|
-
rawData: message,
|
|
1001
|
-
"data-message-role": "assistant",
|
|
1002
|
-
isLoading: false,
|
|
1003
|
-
isGenerating: true,
|
|
1004
|
-
message: render
|
|
1005
|
-
},
|
|
1006
|
-
index
|
|
1007
|
-
);
|
|
1008
|
-
} else {
|
|
1009
|
-
return null;
|
|
1010
|
-
}
|
|
1011
|
-
} else {
|
|
1012
|
-
const args = message.arguments;
|
|
1013
|
-
let status = "inProgress";
|
|
1014
|
-
if (actionResult !== void 0) {
|
|
1015
|
-
status = "complete";
|
|
1016
|
-
} else if (message.status.code !== import_runtime_client_gql2.MessageStatusCode.Pending) {
|
|
1017
|
-
status = "executing";
|
|
1018
|
-
}
|
|
1019
|
-
try {
|
|
1020
|
-
const toRender = render({
|
|
1021
|
-
status,
|
|
1022
|
-
args,
|
|
1023
|
-
result: actionResult,
|
|
1024
|
-
name: message.name
|
|
1025
|
-
});
|
|
1026
|
-
if (!toRender && status === "complete") {
|
|
1027
|
-
return null;
|
|
1028
|
-
}
|
|
1029
|
-
if (typeof toRender === "string") {
|
|
1030
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1031
|
-
AssistantMessage2,
|
|
1032
|
-
{
|
|
1033
|
-
rawData: message,
|
|
1034
|
-
"data-message-role": "assistant",
|
|
1035
|
-
isLoading: false,
|
|
1036
|
-
isGenerating: false,
|
|
1037
|
-
message: toRender
|
|
1038
|
-
},
|
|
1039
|
-
index
|
|
1040
|
-
);
|
|
1041
|
-
} else {
|
|
1042
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1043
|
-
AssistantMessage2,
|
|
1044
|
-
{
|
|
1045
|
-
rawData: message,
|
|
1046
|
-
"data-message-role": "action-render",
|
|
1047
|
-
isLoading: false,
|
|
1048
|
-
isGenerating: false,
|
|
1049
|
-
subComponent: toRender
|
|
1050
|
-
},
|
|
1051
|
-
index
|
|
1052
|
-
);
|
|
1053
|
-
}
|
|
1054
|
-
} catch (e) {
|
|
1055
|
-
console.error(`Error executing render function for action ${message.name}: ${e}`);
|
|
1056
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1057
|
-
AssistantMessage2,
|
|
1058
|
-
{
|
|
1059
|
-
rawData: message,
|
|
1060
|
-
"data-message-role": "assistant",
|
|
1061
|
-
isLoading: false,
|
|
1062
|
-
isGenerating: false,
|
|
1063
|
-
subComponent: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
1064
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("b", { children: [
|
|
1065
|
-
"\u274C Error executing render function for action ",
|
|
1066
|
-
message.name,
|
|
1067
|
-
":"
|
|
1068
|
-
] }),
|
|
1069
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
|
|
1070
|
-
] })
|
|
1071
|
-
},
|
|
1072
|
-
index
|
|
1073
|
-
);
|
|
1074
|
-
}
|
|
1038
|
+
if (resultMessage) {
|
|
1039
|
+
actionResults[id] = import_runtime_client_gql.ResultMessage.decodeResult(resultMessage.result || "");
|
|
1075
1040
|
}
|
|
1076
|
-
} else if (!inProgress || !isCurrentMessage) {
|
|
1077
|
-
return null;
|
|
1078
|
-
} else {
|
|
1079
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1080
|
-
AssistantMessage2,
|
|
1081
|
-
{
|
|
1082
|
-
rawData: message,
|
|
1083
|
-
"data-message-role": "assistant",
|
|
1084
|
-
isLoading: true,
|
|
1085
|
-
isGenerating: true
|
|
1086
|
-
},
|
|
1087
|
-
index
|
|
1088
|
-
);
|
|
1089
1041
|
}
|
|
1090
1042
|
}
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
{
|
|
1101
|
-
"data-message-role": "assistant",
|
|
1102
|
-
rawData: message,
|
|
1103
|
-
isLoading: true,
|
|
1104
|
-
isGenerating: true
|
|
1105
|
-
},
|
|
1106
|
-
index
|
|
1107
|
-
);
|
|
1108
|
-
} else {
|
|
1109
|
-
return null;
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
1114
|
-
var import_react_core5 = require("@copilotkit/react-core");
|
|
1115
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1116
|
-
function RenderAgentStateMessage(props) {
|
|
1117
|
-
const { chatComponentsCache } = (0, import_react_core5.useCopilotContext)();
|
|
1118
|
-
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
1119
|
-
if (message.isAgentStateMessage()) {
|
|
1120
|
-
let render;
|
|
1121
|
-
if (chatComponentsCache.current !== null) {
|
|
1122
|
-
render = chatComponentsCache.current.coAgentStateRenders[`${message.agentName}-${message.nodeName}`] || chatComponentsCache.current.coAgentStateRenders[`${message.agentName}-global`];
|
|
1123
|
-
}
|
|
1124
|
-
if (render) {
|
|
1125
|
-
if (typeof render === "string") {
|
|
1126
|
-
if (isCurrentMessage && inProgress) {
|
|
1127
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1128
|
-
AssistantMessage2,
|
|
1043
|
+
const { messagesEndRef, messagesContainerRef } = useScrollToBottom(messages);
|
|
1044
|
+
const interrupt = (0, import_react_core3.useLangGraphInterruptRender)();
|
|
1045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessages", ref: messagesContainerRef, children: [
|
|
1046
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessagesContainer", children: [
|
|
1047
|
+
messages.map((message, index) => {
|
|
1048
|
+
const isCurrentMessage = index === messages.length - 1;
|
|
1049
|
+
if (message.isTextMessage()) {
|
|
1050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1051
|
+
RenderTextMessage2,
|
|
1129
1052
|
{
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1053
|
+
message,
|
|
1054
|
+
inProgress,
|
|
1055
|
+
index,
|
|
1056
|
+
isCurrentMessage,
|
|
1057
|
+
AssistantMessage: AssistantMessage2,
|
|
1058
|
+
UserMessage: UserMessage2,
|
|
1059
|
+
onRegenerate,
|
|
1060
|
+
onCopy,
|
|
1061
|
+
onThumbsUp,
|
|
1062
|
+
onThumbsDown
|
|
1135
1063
|
},
|
|
1136
1064
|
index
|
|
1137
1065
|
);
|
|
1138
|
-
} else {
|
|
1139
|
-
return
|
|
1140
|
-
|
|
1141
|
-
} else {
|
|
1142
|
-
const state = message.state;
|
|
1143
|
-
let status = message.active ? "inProgress" : "complete";
|
|
1144
|
-
const toRender = render({
|
|
1145
|
-
status,
|
|
1146
|
-
state,
|
|
1147
|
-
nodeName: message.nodeName
|
|
1148
|
-
});
|
|
1149
|
-
if (!toRender && status === "complete") {
|
|
1150
|
-
return null;
|
|
1151
|
-
}
|
|
1152
|
-
if (!toRender && isCurrentMessage && inProgress) {
|
|
1153
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1154
|
-
AssistantMessage2,
|
|
1066
|
+
} else if (message.isActionExecutionMessage()) {
|
|
1067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1068
|
+
RenderActionExecutionMessage2,
|
|
1155
1069
|
{
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1070
|
+
message,
|
|
1071
|
+
inProgress,
|
|
1072
|
+
index,
|
|
1073
|
+
isCurrentMessage,
|
|
1074
|
+
actionResult: actionResults[message.id],
|
|
1075
|
+
AssistantMessage: AssistantMessage2,
|
|
1076
|
+
UserMessage: UserMessage2
|
|
1160
1077
|
},
|
|
1161
1078
|
index
|
|
1162
1079
|
);
|
|
1163
|
-
} else if (
|
|
1164
|
-
return
|
|
1165
|
-
|
|
1166
|
-
if (typeof toRender === "string") {
|
|
1167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1168
|
-
AssistantMessage2,
|
|
1080
|
+
} else if (message.isAgentStateMessage()) {
|
|
1081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1082
|
+
RenderAgentStateMessage2,
|
|
1169
1083
|
{
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1084
|
+
message,
|
|
1085
|
+
inProgress,
|
|
1086
|
+
index,
|
|
1087
|
+
isCurrentMessage,
|
|
1088
|
+
AssistantMessage: AssistantMessage2,
|
|
1089
|
+
UserMessage: UserMessage2
|
|
1175
1090
|
},
|
|
1176
1091
|
index
|
|
1177
1092
|
);
|
|
1178
|
-
} else {
|
|
1179
|
-
return /* @__PURE__ */ (0,
|
|
1180
|
-
|
|
1093
|
+
} else if (message.isResultMessage()) {
|
|
1094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1095
|
+
RenderResultMessage2,
|
|
1181
1096
|
{
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1097
|
+
message,
|
|
1098
|
+
inProgress,
|
|
1099
|
+
index,
|
|
1100
|
+
isCurrentMessage,
|
|
1101
|
+
AssistantMessage: AssistantMessage2,
|
|
1102
|
+
UserMessage: UserMessage2
|
|
1187
1103
|
},
|
|
1188
1104
|
index
|
|
1189
1105
|
);
|
|
1190
1106
|
}
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
|
|
1107
|
+
}),
|
|
1108
|
+
interrupt
|
|
1109
|
+
] }),
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("footer", { className: "copilotKitMessagesFooter", ref: messagesEndRef, children })
|
|
1111
|
+
] });
|
|
1112
|
+
};
|
|
1113
|
+
function makeInitialMessages(initial) {
|
|
1114
|
+
let initialArray = [];
|
|
1115
|
+
if (initial) {
|
|
1116
|
+
if (Array.isArray(initial)) {
|
|
1117
|
+
initialArray.push(...initial);
|
|
1194
1118
|
} else {
|
|
1195
|
-
|
|
1196
|
-
AssistantMessage2,
|
|
1197
|
-
{
|
|
1198
|
-
rawData: message,
|
|
1199
|
-
isLoading: true,
|
|
1200
|
-
isGenerating: true,
|
|
1201
|
-
"data-message-role": "assistant"
|
|
1202
|
-
},
|
|
1203
|
-
index
|
|
1204
|
-
);
|
|
1119
|
+
initialArray.push(initial);
|
|
1205
1120
|
}
|
|
1206
1121
|
}
|
|
1122
|
+
return initialArray.map(
|
|
1123
|
+
(message) => new import_runtime_client_gql.TextMessage({
|
|
1124
|
+
role: import_runtime_client_gql.Role.Assistant,
|
|
1125
|
+
content: message
|
|
1126
|
+
})
|
|
1127
|
+
);
|
|
1207
1128
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
function useCopyToClipboard({ timeout = 2e3 }) {
|
|
1220
|
-
const [isCopied, setIsCopied] = React5.useState(false);
|
|
1221
|
-
const copyToClipboard = (value) => {
|
|
1222
|
-
var _a;
|
|
1223
|
-
if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
1224
|
-
return;
|
|
1225
|
-
}
|
|
1226
|
-
if (!value) {
|
|
1227
|
-
return;
|
|
1129
|
+
function useScrollToBottom(messages) {
|
|
1130
|
+
const messagesEndRef = (0, import_react6.useRef)(null);
|
|
1131
|
+
const messagesContainerRef = (0, import_react6.useRef)(null);
|
|
1132
|
+
const isProgrammaticScrollRef = (0, import_react6.useRef)(false);
|
|
1133
|
+
const isUserScrollUpRef = (0, import_react6.useRef)(false);
|
|
1134
|
+
const scrollToBottom = () => {
|
|
1135
|
+
if (messagesEndRef.current) {
|
|
1136
|
+
isProgrammaticScrollRef.current = true;
|
|
1137
|
+
messagesEndRef.current.scrollIntoView({
|
|
1138
|
+
behavior: "auto"
|
|
1139
|
+
});
|
|
1228
1140
|
}
|
|
1229
|
-
navigator.clipboard.writeText(value).then(() => {
|
|
1230
|
-
setIsCopied(true);
|
|
1231
|
-
setTimeout(() => {
|
|
1232
|
-
setIsCopied(false);
|
|
1233
|
-
}, timeout);
|
|
1234
|
-
});
|
|
1235
1141
|
};
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
// src/components/chat/CodeBlock.tsx
|
|
1240
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1241
|
-
var programmingLanguages = {
|
|
1242
|
-
javascript: ".js",
|
|
1243
|
-
python: ".py",
|
|
1244
|
-
java: ".java",
|
|
1245
|
-
c: ".c",
|
|
1246
|
-
cpp: ".cpp",
|
|
1247
|
-
"c++": ".cpp",
|
|
1248
|
-
"c#": ".cs",
|
|
1249
|
-
ruby: ".rb",
|
|
1250
|
-
php: ".php",
|
|
1251
|
-
swift: ".swift",
|
|
1252
|
-
"objective-c": ".m",
|
|
1253
|
-
kotlin: ".kt",
|
|
1254
|
-
typescript: ".ts",
|
|
1255
|
-
go: ".go",
|
|
1256
|
-
perl: ".pl",
|
|
1257
|
-
rust: ".rs",
|
|
1258
|
-
scala: ".scala",
|
|
1259
|
-
haskell: ".hs",
|
|
1260
|
-
lua: ".lua",
|
|
1261
|
-
shell: ".sh",
|
|
1262
|
-
sql: ".sql",
|
|
1263
|
-
html: ".html",
|
|
1264
|
-
css: ".css"
|
|
1265
|
-
// add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
|
|
1266
|
-
};
|
|
1267
|
-
var generateRandomString = (length, lowercase = false) => {
|
|
1268
|
-
const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
|
|
1269
|
-
let result = "";
|
|
1270
|
-
for (let i = 0; i < length; i++) {
|
|
1271
|
-
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1272
|
-
}
|
|
1273
|
-
return lowercase ? result.toLowerCase() : result;
|
|
1274
|
-
};
|
|
1275
|
-
var CodeBlock = (0, import_react7.memo)(({ language, value }) => {
|
|
1276
|
-
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
1277
|
-
const downloadAsFile = () => {
|
|
1278
|
-
if (typeof window === "undefined") {
|
|
1142
|
+
const handleScroll = () => {
|
|
1143
|
+
if (isProgrammaticScrollRef.current) {
|
|
1144
|
+
isProgrammaticScrollRef.current = false;
|
|
1279
1145
|
return;
|
|
1280
1146
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
if (!fileName) {
|
|
1285
|
-
return;
|
|
1147
|
+
if (messagesContainerRef.current) {
|
|
1148
|
+
const { scrollTop, scrollHeight, clientHeight } = messagesContainerRef.current;
|
|
1149
|
+
isUserScrollUpRef.current = scrollTop + clientHeight < scrollHeight;
|
|
1286
1150
|
}
|
|
1287
|
-
const blob = new Blob([value], { type: "text/plain" });
|
|
1288
|
-
const url = URL.createObjectURL(blob);
|
|
1289
|
-
const link = document.createElement("a");
|
|
1290
|
-
link.download = fileName;
|
|
1291
|
-
link.href = url;
|
|
1292
|
-
link.style.display = "none";
|
|
1293
|
-
document.body.appendChild(link);
|
|
1294
|
-
link.click();
|
|
1295
|
-
document.body.removeChild(link);
|
|
1296
|
-
URL.revokeObjectURL(url);
|
|
1297
1151
|
};
|
|
1298
|
-
|
|
1299
|
-
|
|
1152
|
+
(0, import_react6.useEffect)(() => {
|
|
1153
|
+
const container = messagesContainerRef.current;
|
|
1154
|
+
if (container) {
|
|
1155
|
+
container.addEventListener("scroll", handleScroll);
|
|
1156
|
+
}
|
|
1157
|
+
return () => {
|
|
1158
|
+
if (container) {
|
|
1159
|
+
container.removeEventListener("scroll", handleScroll);
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
}, []);
|
|
1163
|
+
(0, import_react6.useEffect)(() => {
|
|
1164
|
+
const container = messagesContainerRef.current;
|
|
1165
|
+
if (!container) {
|
|
1300
1166
|
return;
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1167
|
+
}
|
|
1168
|
+
const mutationObserver = new MutationObserver(() => {
|
|
1169
|
+
if (!isUserScrollUpRef.current) {
|
|
1170
|
+
scrollToBottom();
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
mutationObserver.observe(container, {
|
|
1174
|
+
childList: true,
|
|
1175
|
+
subtree: true,
|
|
1176
|
+
characterData: true
|
|
1177
|
+
});
|
|
1178
|
+
return () => {
|
|
1179
|
+
mutationObserver.disconnect();
|
|
1180
|
+
};
|
|
1181
|
+
}, []);
|
|
1182
|
+
(0, import_react6.useEffect)(() => {
|
|
1183
|
+
isUserScrollUpRef.current = false;
|
|
1184
|
+
scrollToBottom();
|
|
1185
|
+
}, [messages.filter((m) => m.isTextMessage() && m.role === import_runtime_client_gql.Role.User).length]);
|
|
1186
|
+
return { messagesEndRef, messagesContainerRef };
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
// src/components/chat/Input.tsx
|
|
1190
|
+
var import_react9 = require("react");
|
|
1191
|
+
|
|
1192
|
+
// src/components/chat/Textarea.tsx
|
|
1193
|
+
var import_react7 = require("react");
|
|
1194
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1195
|
+
var AutoResizingTextarea = (0, import_react7.forwardRef)(
|
|
1196
|
+
({ maxRows = 1, placeholder, value, onChange, onKeyDown, autoFocus }, ref) => {
|
|
1197
|
+
const internalTextareaRef = (0, import_react7.useRef)(null);
|
|
1198
|
+
const [maxHeight, setMaxHeight] = (0, import_react7.useState)(0);
|
|
1199
|
+
(0, import_react7.useImperativeHandle)(ref, () => internalTextareaRef.current);
|
|
1200
|
+
(0, import_react7.useEffect)(() => {
|
|
1201
|
+
const calculateMaxHeight = () => {
|
|
1202
|
+
const textarea = internalTextareaRef.current;
|
|
1203
|
+
if (textarea) {
|
|
1204
|
+
textarea.style.height = "auto";
|
|
1205
|
+
const singleRowHeight = textarea.scrollHeight;
|
|
1206
|
+
setMaxHeight(singleRowHeight * maxRows);
|
|
1207
|
+
if (autoFocus) {
|
|
1208
|
+
textarea.focus();
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
calculateMaxHeight();
|
|
1213
|
+
}, [maxRows]);
|
|
1214
|
+
(0, import_react7.useEffect)(() => {
|
|
1215
|
+
const textarea = internalTextareaRef.current;
|
|
1216
|
+
if (textarea) {
|
|
1217
|
+
textarea.style.height = "auto";
|
|
1218
|
+
textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
|
|
1219
|
+
}
|
|
1220
|
+
}, [value, maxHeight]);
|
|
1221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1222
|
+
"textarea",
|
|
1319
1223
|
{
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1224
|
+
ref: internalTextareaRef,
|
|
1225
|
+
value,
|
|
1226
|
+
onChange,
|
|
1227
|
+
onKeyDown,
|
|
1228
|
+
placeholder,
|
|
1229
|
+
style: {
|
|
1230
|
+
overflow: "auto",
|
|
1231
|
+
resize: "none",
|
|
1232
|
+
maxHeight: `${maxHeight}px`
|
|
1327
1233
|
},
|
|
1328
|
-
|
|
1234
|
+
rows: 1
|
|
1329
1235
|
}
|
|
1330
|
-
)
|
|
1331
|
-
|
|
1236
|
+
);
|
|
1237
|
+
}
|
|
1238
|
+
);
|
|
1239
|
+
var Textarea_default = AutoResizingTextarea;
|
|
1240
|
+
|
|
1241
|
+
// src/hooks/use-push-to-talk.tsx
|
|
1242
|
+
var import_react_core4 = require("@copilotkit/react-core");
|
|
1243
|
+
var import_react8 = require("react");
|
|
1244
|
+
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
1245
|
+
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
1246
|
+
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({ audio: true });
|
|
1247
|
+
audioContextRef.current = new window.AudioContext();
|
|
1248
|
+
yield audioContextRef.current.resume();
|
|
1249
|
+
}
|
|
1250
|
+
mediaRecorderRef.current = new MediaRecorder(mediaStreamRef.current);
|
|
1251
|
+
mediaRecorderRef.current.start(1e3);
|
|
1252
|
+
mediaRecorderRef.current.ondataavailable = (event) => {
|
|
1253
|
+
recordedChunks.push(event.data);
|
|
1254
|
+
};
|
|
1255
|
+
mediaRecorderRef.current.onstop = onStop;
|
|
1332
1256
|
});
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1257
|
+
var stopRecording = (mediaRecorderRef) => {
|
|
1258
|
+
if (mediaRecorderRef.current && mediaRecorderRef.current.state !== "inactive") {
|
|
1259
|
+
mediaRecorderRef.current.stop();
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
var transcribeAudio = (recordedChunks, transcribeAudioUrl) => __async(void 0, null, function* () {
|
|
1263
|
+
const completeBlob = new Blob(recordedChunks, { type: "audio/mp4" });
|
|
1264
|
+
const formData = new FormData();
|
|
1265
|
+
formData.append("file", completeBlob, "recording.mp4");
|
|
1266
|
+
const response = yield fetch(transcribeAudioUrl, {
|
|
1267
|
+
method: "POST",
|
|
1268
|
+
body: formData
|
|
1269
|
+
});
|
|
1270
|
+
if (!response.ok) {
|
|
1271
|
+
throw new Error(`Error: ${response.statusText}`);
|
|
1272
|
+
}
|
|
1273
|
+
const transcription = yield response.json();
|
|
1274
|
+
return transcription.text;
|
|
1275
|
+
});
|
|
1276
|
+
var playAudioResponse = (text, textToSpeechUrl, audioContext) => {
|
|
1277
|
+
const encodedText = encodeURIComponent(text);
|
|
1278
|
+
const url = `${textToSpeechUrl}?text=${encodedText}`;
|
|
1279
|
+
fetch(url).then((response) => response.arrayBuffer()).then((arrayBuffer) => audioContext.decodeAudioData(arrayBuffer)).then((audioBuffer) => {
|
|
1280
|
+
const source = audioContext.createBufferSource();
|
|
1281
|
+
source.buffer = audioBuffer;
|
|
1282
|
+
source.connect(audioContext.destination);
|
|
1283
|
+
source.start(0);
|
|
1284
|
+
}).catch((error) => {
|
|
1285
|
+
console.error("Error with decoding audio data", error);
|
|
1286
|
+
});
|
|
1287
|
+
};
|
|
1288
|
+
var usePushToTalk = ({
|
|
1289
|
+
sendFunction,
|
|
1290
|
+
inProgress
|
|
1291
|
+
}) => {
|
|
1292
|
+
const [pushToTalkState, setPushToTalkState] = (0, import_react8.useState)("idle");
|
|
1293
|
+
const mediaStreamRef = (0, import_react8.useRef)(null);
|
|
1294
|
+
const audioContextRef = (0, import_react8.useRef)(null);
|
|
1295
|
+
const mediaRecorderRef = (0, import_react8.useRef)(null);
|
|
1296
|
+
const recordedChunks = (0, import_react8.useRef)([]);
|
|
1297
|
+
const generalContext = (0, import_react_core4.useCopilotContext)();
|
|
1298
|
+
const messagesContext = (0, import_react_core4.useCopilotMessagesContext)();
|
|
1299
|
+
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
1300
|
+
const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react8.useState)(null);
|
|
1301
|
+
(0, import_react8.useEffect)(() => {
|
|
1302
|
+
if (pushToTalkState === "recording") {
|
|
1303
|
+
startRecording(
|
|
1304
|
+
mediaStreamRef,
|
|
1305
|
+
mediaRecorderRef,
|
|
1306
|
+
audioContextRef,
|
|
1307
|
+
recordedChunks.current,
|
|
1308
|
+
() => {
|
|
1309
|
+
setPushToTalkState("transcribing");
|
|
1310
|
+
}
|
|
1311
|
+
);
|
|
1312
|
+
} else {
|
|
1313
|
+
stopRecording(mediaRecorderRef);
|
|
1314
|
+
if (pushToTalkState === "transcribing") {
|
|
1315
|
+
transcribeAudio(recordedChunks.current, context.copilotApiConfig.transcribeAudioUrl).then(
|
|
1316
|
+
(transcription) => __async(void 0, null, function* () {
|
|
1317
|
+
recordedChunks.current = [];
|
|
1318
|
+
setPushToTalkState("idle");
|
|
1319
|
+
const message = yield sendFunction(transcription);
|
|
1320
|
+
setStartReadingFromMessageId(message.id);
|
|
1321
|
+
})
|
|
1322
|
+
);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
return () => {
|
|
1326
|
+
stopRecording(mediaRecorderRef);
|
|
1327
|
+
};
|
|
1328
|
+
}, [pushToTalkState]);
|
|
1329
|
+
(0, import_react8.useEffect)(() => {
|
|
1330
|
+
if (inProgress === false && startReadingFromMessageId) {
|
|
1331
|
+
const lastMessageIndex = context.messages.findIndex(
|
|
1332
|
+
(message) => message.id === startReadingFromMessageId
|
|
1333
|
+
);
|
|
1334
|
+
const messagesAfterLast = context.messages.slice(lastMessageIndex + 1).filter(
|
|
1335
|
+
(message) => message.isTextMessage() && message.role === "assistant"
|
|
1336
|
+
);
|
|
1337
|
+
const text = messagesAfterLast.map((message) => message.content).join("\n");
|
|
1338
|
+
playAudioResponse(text, context.copilotApiConfig.textToSpeechUrl, audioContextRef.current);
|
|
1339
|
+
setStartReadingFromMessageId(null);
|
|
1340
|
+
}
|
|
1341
|
+
}, [startReadingFromMessageId, inProgress]);
|
|
1342
|
+
return { pushToTalkState, setPushToTalkState };
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
// src/components/chat/Input.tsx
|
|
1346
|
+
var import_react_core5 = require("@copilotkit/react-core");
|
|
1347
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1348
|
+
var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
1349
|
+
const context = useChatContext();
|
|
1350
|
+
const copilotContext = (0, import_react_core5.useCopilotContext)();
|
|
1351
|
+
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
1352
|
+
const textareaRef = (0, import_react9.useRef)(null);
|
|
1353
|
+
const handleDivClick = (event) => {
|
|
1354
|
+
var _a;
|
|
1355
|
+
if (event.target !== event.currentTarget)
|
|
1356
|
+
return;
|
|
1357
|
+
(_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
1358
|
+
};
|
|
1359
|
+
const [text, setText] = (0, import_react9.useState)("");
|
|
1360
|
+
const send = () => {
|
|
1361
|
+
var _a;
|
|
1362
|
+
if (inProgress)
|
|
1363
|
+
return;
|
|
1364
|
+
onSend(text);
|
|
1365
|
+
setText("");
|
|
1366
|
+
(_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
1367
|
+
};
|
|
1368
|
+
(0, import_react9.useEffect)(() => {
|
|
1369
|
+
var _a;
|
|
1370
|
+
if (isVisible) {
|
|
1371
|
+
(_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
1372
|
+
}
|
|
1373
|
+
}, [isVisible]);
|
|
1374
|
+
const { pushToTalkState, setPushToTalkState } = usePushToTalk({
|
|
1375
|
+
sendFunction: onSend,
|
|
1376
|
+
inProgress
|
|
1377
|
+
});
|
|
1378
|
+
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
1379
|
+
const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1380
|
+
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1381
|
+
const canSend = () => {
|
|
1382
|
+
var _a;
|
|
1383
|
+
const interruptEvent = (_a = copilotContext.langGraphInterruptAction) == null ? void 0 : _a.event;
|
|
1384
|
+
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
1385
|
+
return (isInProgress || !isInProgress && text.trim().length > 0) && pushToTalkState === "idle" && !interruptInProgress;
|
|
1386
|
+
};
|
|
1387
|
+
const sendDisabled = !canSend();
|
|
1388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "copilotKitInputContainer", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1390
|
+
Textarea_default,
|
|
1391
|
+
{
|
|
1392
|
+
ref: textareaRef,
|
|
1393
|
+
placeholder: context.labels.placeholder,
|
|
1394
|
+
autoFocus: true,
|
|
1395
|
+
maxRows: 5,
|
|
1396
|
+
value: text,
|
|
1397
|
+
onChange: (event) => setText(event.target.value),
|
|
1398
|
+
onKeyDown: (event) => {
|
|
1399
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1400
|
+
event.preventDefault();
|
|
1401
|
+
if (canSend()) {
|
|
1402
|
+
send();
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
),
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
1409
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { flexGrow: 1 } }),
|
|
1410
|
+
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1411
|
+
"button",
|
|
1412
|
+
{
|
|
1413
|
+
onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
|
|
1414
|
+
className: pushToTalkState === "recording" ? "copilotKitPushToTalkRecording" : "",
|
|
1415
|
+
children: context.icons.pushToTalkIcon
|
|
1416
|
+
}
|
|
1417
|
+
),
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1419
|
+
"button",
|
|
1420
|
+
{
|
|
1421
|
+
disabled: sendDisabled,
|
|
1422
|
+
onClick: isInProgress ? onStop : send,
|
|
1423
|
+
"data-copilotkit-in-progress": inProgress,
|
|
1424
|
+
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1425
|
+
children: buttonIcon
|
|
1426
|
+
}
|
|
1427
|
+
)
|
|
1428
|
+
] })
|
|
1429
|
+
] }) });
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
// src/components/chat/Response.tsx
|
|
1433
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1434
|
+
var ResponseButton = ({ onClick, inProgress }) => {
|
|
1435
|
+
const context = useChatContext();
|
|
1436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { onClick, className: "copilotKitResponseButton", children: [
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: inProgress ? context.icons.stopIcon : context.icons.regenerateIcon }),
|
|
1438
|
+
inProgress ? context.labels.stopGenerating : context.labels.regenerateResponse
|
|
1439
|
+
] });
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
// src/components/chat/messages/RenderTextMessage.tsx
|
|
1443
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1444
|
+
function RenderTextMessage(props) {
|
|
1445
|
+
const {
|
|
1446
|
+
message,
|
|
1447
|
+
inProgress,
|
|
1448
|
+
index,
|
|
1449
|
+
isCurrentMessage,
|
|
1450
|
+
UserMessage: UserMessage2,
|
|
1451
|
+
AssistantMessage: AssistantMessage2,
|
|
1452
|
+
onRegenerate,
|
|
1453
|
+
onCopy,
|
|
1454
|
+
onThumbsUp,
|
|
1455
|
+
onThumbsDown
|
|
1456
|
+
} = props;
|
|
1457
|
+
if (message.isTextMessage()) {
|
|
1458
|
+
if (message.role === "user") {
|
|
1459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1460
|
+
UserMessage2,
|
|
1461
|
+
{
|
|
1462
|
+
"data-message-role": "user",
|
|
1463
|
+
message: message.content,
|
|
1464
|
+
rawData: message
|
|
1465
|
+
},
|
|
1466
|
+
index
|
|
1467
|
+
);
|
|
1468
|
+
} else if (message.role == "assistant") {
|
|
1469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1470
|
+
AssistantMessage2,
|
|
1471
|
+
{
|
|
1472
|
+
"data-message-role": "assistant",
|
|
1473
|
+
message: message.content,
|
|
1474
|
+
rawData: message,
|
|
1475
|
+
isLoading: inProgress && isCurrentMessage && !message.content,
|
|
1476
|
+
isGenerating: inProgress && isCurrentMessage && !!message.content,
|
|
1477
|
+
isCurrentMessage,
|
|
1478
|
+
onRegenerate,
|
|
1479
|
+
onCopy,
|
|
1480
|
+
onThumbsUp,
|
|
1481
|
+
onThumbsDown
|
|
1482
|
+
},
|
|
1483
|
+
index
|
|
1484
|
+
);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
1490
|
+
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
1491
|
+
var import_react_core6 = require("@copilotkit/react-core");
|
|
1492
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1493
|
+
function RenderActionExecutionMessage(props) {
|
|
1494
|
+
const { chatComponentsCache } = (0, import_react_core6.useCopilotContext)();
|
|
1495
|
+
const { message, inProgress, index, isCurrentMessage, actionResult, AssistantMessage: AssistantMessage2 } = props;
|
|
1496
|
+
if (message.isActionExecutionMessage()) {
|
|
1497
|
+
if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
|
|
1498
|
+
const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
|
|
1499
|
+
if (typeof render === "string") {
|
|
1500
|
+
if (isCurrentMessage && inProgress) {
|
|
1501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1502
|
+
AssistantMessage2,
|
|
1503
|
+
{
|
|
1504
|
+
rawData: message,
|
|
1505
|
+
"data-message-role": "assistant",
|
|
1506
|
+
isLoading: false,
|
|
1507
|
+
isGenerating: true,
|
|
1508
|
+
message: render
|
|
1509
|
+
},
|
|
1510
|
+
index
|
|
1511
|
+
);
|
|
1512
|
+
} else {
|
|
1513
|
+
return null;
|
|
1514
|
+
}
|
|
1515
|
+
} else {
|
|
1516
|
+
const args = message.arguments;
|
|
1517
|
+
let status = "inProgress";
|
|
1518
|
+
if (actionResult !== void 0) {
|
|
1519
|
+
status = "complete";
|
|
1520
|
+
} else if (message.status.code !== import_runtime_client_gql2.MessageStatusCode.Pending) {
|
|
1521
|
+
status = "executing";
|
|
1522
|
+
}
|
|
1523
|
+
try {
|
|
1524
|
+
const toRender = render({
|
|
1525
|
+
status,
|
|
1526
|
+
args,
|
|
1527
|
+
result: actionResult,
|
|
1528
|
+
name: message.name
|
|
1529
|
+
});
|
|
1530
|
+
if (!toRender && status === "complete") {
|
|
1531
|
+
return null;
|
|
1532
|
+
}
|
|
1533
|
+
if (typeof toRender === "string") {
|
|
1534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1535
|
+
AssistantMessage2,
|
|
1536
|
+
{
|
|
1537
|
+
rawData: message,
|
|
1538
|
+
"data-message-role": "assistant",
|
|
1539
|
+
isLoading: false,
|
|
1540
|
+
isGenerating: false,
|
|
1541
|
+
message: toRender
|
|
1542
|
+
},
|
|
1543
|
+
index
|
|
1544
|
+
);
|
|
1545
|
+
} else {
|
|
1546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1547
|
+
AssistantMessage2,
|
|
1548
|
+
{
|
|
1549
|
+
rawData: message,
|
|
1550
|
+
"data-message-role": "action-render",
|
|
1551
|
+
isLoading: false,
|
|
1552
|
+
isGenerating: false,
|
|
1553
|
+
subComponent: toRender
|
|
1554
|
+
},
|
|
1555
|
+
index
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1558
|
+
} catch (e) {
|
|
1559
|
+
console.error(`Error executing render function for action ${message.name}: ${e}`);
|
|
1560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1561
|
+
AssistantMessage2,
|
|
1562
|
+
{
|
|
1563
|
+
rawData: message,
|
|
1564
|
+
"data-message-role": "assistant",
|
|
1565
|
+
isLoading: false,
|
|
1566
|
+
isGenerating: false,
|
|
1567
|
+
subComponent: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
1568
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("b", { children: [
|
|
1569
|
+
"\u274C Error executing render function for action ",
|
|
1570
|
+
message.name,
|
|
1571
|
+
":"
|
|
1572
|
+
] }),
|
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
|
|
1574
|
+
] })
|
|
1575
|
+
},
|
|
1576
|
+
index
|
|
1577
|
+
);
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
} else if (!inProgress || !isCurrentMessage) {
|
|
1581
|
+
return null;
|
|
1582
|
+
} else {
|
|
1583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1584
|
+
AssistantMessage2,
|
|
1585
|
+
{
|
|
1586
|
+
rawData: message,
|
|
1587
|
+
"data-message-role": "assistant",
|
|
1588
|
+
isLoading: true,
|
|
1589
|
+
isGenerating: true
|
|
1590
|
+
},
|
|
1591
|
+
index
|
|
1592
|
+
);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
// src/components/chat/messages/RenderResultMessage.tsx
|
|
1598
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1599
|
+
function RenderResultMessage(props) {
|
|
1600
|
+
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
1601
|
+
if (message.isResultMessage() && inProgress && isCurrentMessage) {
|
|
1602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1603
|
+
AssistantMessage2,
|
|
1604
|
+
{
|
|
1605
|
+
"data-message-role": "assistant",
|
|
1606
|
+
rawData: message,
|
|
1607
|
+
isLoading: true,
|
|
1608
|
+
isGenerating: true
|
|
1609
|
+
},
|
|
1610
|
+
index
|
|
1611
|
+
);
|
|
1612
|
+
} else {
|
|
1613
|
+
return null;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
1618
|
+
var import_react_core7 = require("@copilotkit/react-core");
|
|
1619
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1620
|
+
function RenderAgentStateMessage(props) {
|
|
1621
|
+
const { chatComponentsCache } = (0, import_react_core7.useCopilotContext)();
|
|
1622
|
+
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
1623
|
+
if (message.isAgentStateMessage()) {
|
|
1624
|
+
let render;
|
|
1625
|
+
if (chatComponentsCache.current !== null) {
|
|
1626
|
+
render = chatComponentsCache.current.coAgentStateRenders[`${message.agentName}-${message.nodeName}`] || chatComponentsCache.current.coAgentStateRenders[`${message.agentName}-global`];
|
|
1627
|
+
}
|
|
1628
|
+
if (render) {
|
|
1629
|
+
if (typeof render === "string") {
|
|
1630
|
+
if (isCurrentMessage && inProgress) {
|
|
1631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1632
|
+
AssistantMessage2,
|
|
1633
|
+
{
|
|
1634
|
+
rawData: message,
|
|
1635
|
+
message: render,
|
|
1636
|
+
"data-message-role": "assistant",
|
|
1637
|
+
isLoading: true,
|
|
1638
|
+
isGenerating: true
|
|
1639
|
+
},
|
|
1640
|
+
index
|
|
1641
|
+
);
|
|
1642
|
+
} else {
|
|
1643
|
+
return null;
|
|
1644
|
+
}
|
|
1645
|
+
} else {
|
|
1646
|
+
const state = message.state;
|
|
1647
|
+
let status = message.active ? "inProgress" : "complete";
|
|
1648
|
+
const toRender = render({
|
|
1649
|
+
status,
|
|
1650
|
+
state,
|
|
1651
|
+
nodeName: message.nodeName
|
|
1652
|
+
});
|
|
1653
|
+
if (!toRender && status === "complete") {
|
|
1654
|
+
return null;
|
|
1655
|
+
}
|
|
1656
|
+
if (!toRender && isCurrentMessage && inProgress) {
|
|
1657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1658
|
+
AssistantMessage2,
|
|
1659
|
+
{
|
|
1660
|
+
"data-message-role": "assistant",
|
|
1661
|
+
rawData: message,
|
|
1662
|
+
isLoading: true,
|
|
1663
|
+
isGenerating: true
|
|
1664
|
+
},
|
|
1665
|
+
index
|
|
1666
|
+
);
|
|
1667
|
+
} else if (!toRender) {
|
|
1668
|
+
return null;
|
|
1669
|
+
}
|
|
1670
|
+
if (typeof toRender === "string") {
|
|
1671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1672
|
+
AssistantMessage2,
|
|
1673
|
+
{
|
|
1674
|
+
rawData: message,
|
|
1675
|
+
message: toRender,
|
|
1676
|
+
isLoading: true,
|
|
1677
|
+
isGenerating: true,
|
|
1678
|
+
"data-message-role": "assistant"
|
|
1679
|
+
},
|
|
1680
|
+
index
|
|
1681
|
+
);
|
|
1682
|
+
} else {
|
|
1683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1684
|
+
AssistantMessage2,
|
|
1685
|
+
{
|
|
1686
|
+
rawData: message,
|
|
1687
|
+
"data-message-role": "agent-state-render",
|
|
1688
|
+
isLoading: false,
|
|
1689
|
+
isGenerating: false,
|
|
1690
|
+
subComponent: toRender
|
|
1691
|
+
},
|
|
1692
|
+
index
|
|
1693
|
+
);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
} else if (!inProgress || !isCurrentMessage) {
|
|
1697
|
+
return null;
|
|
1698
|
+
} else {
|
|
1699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1700
|
+
AssistantMessage2,
|
|
1701
|
+
{
|
|
1702
|
+
rawData: message,
|
|
1703
|
+
isLoading: true,
|
|
1704
|
+
isGenerating: true,
|
|
1705
|
+
"data-message-role": "assistant"
|
|
1706
|
+
},
|
|
1707
|
+
index
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
// src/components/chat/Markdown.tsx
|
|
1714
|
+
var import_react11 = require("react");
|
|
1715
|
+
var import_react_markdown = __toESM(require("react-markdown"));
|
|
1716
|
+
|
|
1717
|
+
// src/components/chat/CodeBlock.tsx
|
|
1718
|
+
var import_react10 = require("react");
|
|
1719
|
+
var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
1720
|
+
|
|
1721
|
+
// src/hooks/use-copy-to-clipboard.tsx
|
|
1722
|
+
var React7 = __toESM(require("react"));
|
|
1723
|
+
function useCopyToClipboard({ timeout = 2e3 }) {
|
|
1724
|
+
const [isCopied, setIsCopied] = React7.useState(false);
|
|
1725
|
+
const copyToClipboard = (value) => {
|
|
1726
|
+
var _a;
|
|
1727
|
+
if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
1728
|
+
return;
|
|
1729
|
+
}
|
|
1730
|
+
if (!value) {
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
navigator.clipboard.writeText(value).then(() => {
|
|
1734
|
+
setIsCopied(true);
|
|
1735
|
+
setTimeout(() => {
|
|
1736
|
+
setIsCopied(false);
|
|
1737
|
+
}, timeout);
|
|
1738
|
+
});
|
|
1739
|
+
};
|
|
1740
|
+
return { isCopied, copyToClipboard };
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
// src/components/chat/CodeBlock.tsx
|
|
1744
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1745
|
+
var programmingLanguages = {
|
|
1746
|
+
javascript: ".js",
|
|
1747
|
+
python: ".py",
|
|
1748
|
+
java: ".java",
|
|
1749
|
+
c: ".c",
|
|
1750
|
+
cpp: ".cpp",
|
|
1751
|
+
"c++": ".cpp",
|
|
1752
|
+
"c#": ".cs",
|
|
1753
|
+
ruby: ".rb",
|
|
1754
|
+
php: ".php",
|
|
1755
|
+
swift: ".swift",
|
|
1756
|
+
"objective-c": ".m",
|
|
1757
|
+
kotlin: ".kt",
|
|
1758
|
+
typescript: ".ts",
|
|
1759
|
+
go: ".go",
|
|
1760
|
+
perl: ".pl",
|
|
1761
|
+
rust: ".rs",
|
|
1762
|
+
scala: ".scala",
|
|
1763
|
+
haskell: ".hs",
|
|
1764
|
+
lua: ".lua",
|
|
1765
|
+
shell: ".sh",
|
|
1766
|
+
sql: ".sql",
|
|
1767
|
+
html: ".html",
|
|
1768
|
+
css: ".css"
|
|
1769
|
+
// add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
|
|
1770
|
+
};
|
|
1771
|
+
var generateRandomString = (length, lowercase = false) => {
|
|
1772
|
+
const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
|
|
1773
|
+
let result = "";
|
|
1774
|
+
for (let i = 0; i < length; i++) {
|
|
1775
|
+
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
1776
|
+
}
|
|
1777
|
+
return lowercase ? result.toLowerCase() : result;
|
|
1778
|
+
};
|
|
1779
|
+
var CodeBlock = (0, import_react10.memo)(({ language, value }) => {
|
|
1780
|
+
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
1781
|
+
const downloadAsFile = () => {
|
|
1782
|
+
if (typeof window === "undefined") {
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
const fileExtension = programmingLanguages[language] || ".file";
|
|
1786
|
+
const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
|
|
1787
|
+
const fileName = window.prompt("Enter file name", suggestedFileName);
|
|
1788
|
+
if (!fileName) {
|
|
1789
|
+
return;
|
|
1790
|
+
}
|
|
1791
|
+
const blob = new Blob([value], { type: "text/plain" });
|
|
1792
|
+
const url = URL.createObjectURL(blob);
|
|
1793
|
+
const link = document.createElement("a");
|
|
1794
|
+
link.download = fileName;
|
|
1795
|
+
link.href = url;
|
|
1796
|
+
link.style.display = "none";
|
|
1797
|
+
document.body.appendChild(link);
|
|
1798
|
+
link.click();
|
|
1799
|
+
document.body.removeChild(link);
|
|
1800
|
+
URL.revokeObjectURL(url);
|
|
1801
|
+
};
|
|
1802
|
+
const onCopy = () => {
|
|
1803
|
+
if (isCopied)
|
|
1804
|
+
return;
|
|
1805
|
+
copyToClipboard(value);
|
|
1806
|
+
};
|
|
1807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "copilotKitCodeBlock", children: [
|
|
1808
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1813
|
+
] })
|
|
1814
|
+
] }),
|
|
1815
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1816
|
+
import_react_syntax_highlighter.Prism,
|
|
1817
|
+
{
|
|
1818
|
+
language,
|
|
1819
|
+
style: highlightStyle,
|
|
1820
|
+
PreTag: "div",
|
|
1821
|
+
customStyle: {
|
|
1822
|
+
margin: 0,
|
|
1823
|
+
borderBottomLeftRadius: "0.375rem",
|
|
1824
|
+
borderBottomRightRadius: "0.375rem"
|
|
1825
|
+
},
|
|
1826
|
+
children: value
|
|
1827
|
+
}
|
|
1828
|
+
)
|
|
1829
|
+
] });
|
|
1830
|
+
});
|
|
1831
|
+
CodeBlock.displayName = "CodeBlock";
|
|
1832
|
+
var highlightStyle = {
|
|
1833
|
+
'pre[class*="language-"]': {
|
|
1834
|
+
color: "#d4d4d4",
|
|
1835
|
+
fontSize: "13px",
|
|
1836
|
+
textShadow: "none",
|
|
1837
|
+
fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
|
|
1838
|
+
direction: "ltr",
|
|
1839
|
+
textAlign: "left",
|
|
1840
|
+
whiteSpace: "pre",
|
|
1841
|
+
wordSpacing: "normal",
|
|
1842
|
+
wordBreak: "normal",
|
|
1843
|
+
lineHeight: "1.5",
|
|
1844
|
+
MozTabSize: "4",
|
|
1845
|
+
OTabSize: "4",
|
|
1846
|
+
tabSize: "4",
|
|
1847
|
+
WebkitHyphens: "none",
|
|
1848
|
+
MozHyphens: "none",
|
|
1849
|
+
msHyphens: "none",
|
|
1850
|
+
hyphens: "none",
|
|
1851
|
+
padding: "1em",
|
|
1852
|
+
margin: ".5em 0",
|
|
1853
|
+
overflow: "auto",
|
|
1854
|
+
background: "#1e1e1e"
|
|
1855
|
+
},
|
|
1856
|
+
'code[class*="language-"]': {
|
|
1359
1857
|
color: "#d4d4d4",
|
|
1360
1858
|
fontSize: "13px",
|
|
1361
1859
|
textShadow: "none",
|
|
@@ -1577,855 +2075,302 @@ var highlightStyle = {
|
|
|
1577
2075
|
color: "#9cdcfe"
|
|
1578
2076
|
},
|
|
1579
2077
|
'code[class*="language-typescript"]': {
|
|
1580
|
-
color: "#9cdcfe"
|
|
1581
|
-
},
|
|
1582
|
-
'pre[class*="language-tsx"]': {
|
|
1583
|
-
color: "#9cdcfe"
|
|
1584
|
-
},
|
|
1585
|
-
'code[class*="language-tsx"]': {
|
|
1586
|
-
color: "#9cdcfe"
|
|
1587
|
-
},
|
|
1588
|
-
'pre[class*="language-css"]': {
|
|
1589
|
-
color: "#ce9178"
|
|
1590
|
-
},
|
|
1591
|
-
'code[class*="language-css"]': {
|
|
1592
|
-
color: "#ce9178"
|
|
1593
|
-
},
|
|
1594
|
-
'pre[class*="language-html"]': {
|
|
1595
|
-
color: "#d4d4d4"
|
|
1596
|
-
},
|
|
1597
|
-
'code[class*="language-html"]': {
|
|
1598
|
-
color: "#d4d4d4"
|
|
1599
|
-
},
|
|
1600
|
-
".language-regex .token.anchor": {
|
|
1601
|
-
color: "#dcdcaa"
|
|
1602
|
-
},
|
|
1603
|
-
".language-html .token.punctuation": {
|
|
1604
|
-
color: "#808080"
|
|
1605
|
-
},
|
|
1606
|
-
'pre[class*="language-"] > code[class*="language-"]': {
|
|
1607
|
-
position: "relative",
|
|
1608
|
-
zIndex: "1"
|
|
2078
|
+
color: "#9cdcfe"
|
|
1609
2079
|
},
|
|
1610
|
-
"
|
|
1611
|
-
|
|
1612
|
-
boxShadow: "inset 5px 0 0 #f7d87c",
|
|
1613
|
-
zIndex: "0"
|
|
1614
|
-
}
|
|
1615
|
-
};
|
|
1616
|
-
|
|
1617
|
-
// src/components/chat/Markdown.tsx
|
|
1618
|
-
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
1619
|
-
var import_remark_math = __toESM(require("remark-math"));
|
|
1620
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1621
|
-
var MemoizedReactMarkdown = (0, import_react8.memo)(
|
|
1622
|
-
import_react_markdown.default,
|
|
1623
|
-
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
1624
|
-
);
|
|
1625
|
-
var Markdown = ({ content }) => {
|
|
1626
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MemoizedReactMarkdown, { components, remarkPlugins: [import_remark_gfm.default, import_remark_math.default], children: content }) });
|
|
1627
|
-
};
|
|
1628
|
-
var components = {
|
|
1629
|
-
p({ children }) {
|
|
1630
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children });
|
|
2080
|
+
'pre[class*="language-tsx"]': {
|
|
2081
|
+
color: "#9cdcfe"
|
|
1631
2082
|
},
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1635
|
-
"a",
|
|
1636
|
-
__spreadProps(__spreadValues({
|
|
1637
|
-
style: { color: "blue", textDecoration: "underline" }
|
|
1638
|
-
}, props), {
|
|
1639
|
-
target: "_blank",
|
|
1640
|
-
rel: "noopener noreferrer",
|
|
1641
|
-
children
|
|
1642
|
-
})
|
|
1643
|
-
);
|
|
2083
|
+
'code[class*="language-tsx"]': {
|
|
2084
|
+
color: "#9cdcfe"
|
|
1644
2085
|
},
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
}, props),
|
|
1672
|
-
Math.random()
|
|
1673
|
-
);
|
|
1674
|
-
}
|
|
1675
|
-
};
|
|
1676
|
-
|
|
1677
|
-
// src/components/chat/messages/AssistantMessage.tsx
|
|
1678
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1679
|
-
var AssistantMessage = (props) => {
|
|
1680
|
-
const { icons } = useChatContext();
|
|
1681
|
-
const { message, isLoading, subComponent } = props;
|
|
1682
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1683
|
-
(message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
1684
|
-
message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Markdown, { content: message || "" }),
|
|
1685
|
-
isLoading && icons.spinnerIcon
|
|
1686
|
-
] }),
|
|
1687
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
|
|
1688
|
-
] });
|
|
1689
|
-
};
|
|
1690
|
-
|
|
1691
|
-
// src/components/chat/messages/UserMessage.tsx
|
|
1692
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1693
|
-
var UserMessage = (props) => {
|
|
1694
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.message });
|
|
1695
|
-
};
|
|
1696
|
-
|
|
1697
|
-
// src/components/chat/Suggestion.tsx
|
|
1698
|
-
var import_react_core6 = require("@copilotkit/react-core");
|
|
1699
|
-
var import_shared = require("@copilotkit/shared");
|
|
1700
|
-
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
1701
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1702
|
-
function Suggestion({ title, message, onClick, partial, className }) {
|
|
1703
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1704
|
-
"button",
|
|
1705
|
-
{
|
|
1706
|
-
disabled: partial,
|
|
1707
|
-
onClick: (e) => {
|
|
1708
|
-
e.preventDefault();
|
|
1709
|
-
onClick(message);
|
|
1710
|
-
},
|
|
1711
|
-
className: className || "suggestion",
|
|
1712
|
-
"data-test-id": "suggestion",
|
|
1713
|
-
children: [
|
|
1714
|
-
partial && SmallSpinnerIcon,
|
|
1715
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: title })
|
|
1716
|
-
]
|
|
1717
|
-
}
|
|
1718
|
-
);
|
|
1719
|
-
}
|
|
1720
|
-
var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggestions, abortControllerRef) => __async(void 0, null, function* () {
|
|
1721
|
-
const abortController = abortControllerRef.current;
|
|
1722
|
-
const tools = JSON.stringify(
|
|
1723
|
-
Object.values(context.actions).map((action) => ({
|
|
1724
|
-
name: action.name,
|
|
1725
|
-
description: action.description,
|
|
1726
|
-
jsonSchema: JSON.stringify((0, import_shared.actionParametersToJsonSchema)(action.parameters))
|
|
1727
|
-
}))
|
|
1728
|
-
);
|
|
1729
|
-
const allSuggestions = [];
|
|
1730
|
-
for (const config of Object.values(chatSuggestionConfiguration)) {
|
|
1731
|
-
try {
|
|
1732
|
-
const numOfSuggestionsInstructions = config.minSuggestions === 0 ? `Produce up to ${config.maxSuggestions} suggestions. If there are no highly relevant suggestions you can think of, provide an empty array.` : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;
|
|
1733
|
-
const result = yield (0, import_react_core6.extract)({
|
|
1734
|
-
context,
|
|
1735
|
-
instructions: "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
|
|
1736
|
-
data: config.instructions + "\n\n" + numOfSuggestionsInstructions + "\n\nAvailable tools: " + tools + "\n\n",
|
|
1737
|
-
requestType: import_runtime_client_gql3.CopilotRequestType.Task,
|
|
1738
|
-
parameters: [
|
|
1739
|
-
{
|
|
1740
|
-
name: "suggestions",
|
|
1741
|
-
type: "object[]",
|
|
1742
|
-
attributes: [
|
|
1743
|
-
{
|
|
1744
|
-
name: "title",
|
|
1745
|
-
description: "The title of the suggestion. This is shown as a button and should be short.",
|
|
1746
|
-
type: "string"
|
|
1747
|
-
},
|
|
1748
|
-
{
|
|
1749
|
-
name: "message",
|
|
1750
|
-
description: "The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.",
|
|
1751
|
-
type: "string"
|
|
1752
|
-
}
|
|
1753
|
-
]
|
|
1754
|
-
}
|
|
1755
|
-
],
|
|
1756
|
-
include: {
|
|
1757
|
-
messages: true,
|
|
1758
|
-
readable: true
|
|
1759
|
-
},
|
|
1760
|
-
abortSignal: abortController == null ? void 0 : abortController.signal,
|
|
1761
|
-
stream: ({ status, args }) => {
|
|
1762
|
-
const suggestions = args.suggestions || [];
|
|
1763
|
-
const newSuggestions = [];
|
|
1764
|
-
for (let i = 0; i < suggestions.length; i++) {
|
|
1765
|
-
if (config.maxSuggestions !== void 0 && i >= config.maxSuggestions) {
|
|
1766
|
-
break;
|
|
1767
|
-
}
|
|
1768
|
-
const { title, message } = suggestions[i];
|
|
1769
|
-
const partial = i == suggestions.length - 1 && status !== "complete";
|
|
1770
|
-
newSuggestions.push({
|
|
1771
|
-
title,
|
|
1772
|
-
message,
|
|
1773
|
-
partial,
|
|
1774
|
-
className: config.className
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
setCurrentSuggestions([...allSuggestions, ...newSuggestions]);
|
|
1778
|
-
}
|
|
1779
|
-
});
|
|
1780
|
-
allSuggestions.push(...result.suggestions);
|
|
1781
|
-
} catch (error) {
|
|
1782
|
-
console.error("Error loading suggestions", error);
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
if (abortControllerRef.current === abortController) {
|
|
1786
|
-
abortControllerRef.current = null;
|
|
1787
|
-
}
|
|
1788
|
-
});
|
|
1789
|
-
|
|
1790
|
-
// src/components/chat/Chat.tsx
|
|
1791
|
-
var import_react12 = __toESM(require("react"));
|
|
1792
|
-
var import_react_core9 = require("@copilotkit/react-core");
|
|
1793
|
-
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1794
|
-
var import_shared3 = require("@copilotkit/shared");
|
|
1795
|
-
|
|
1796
|
-
// src/components/dev-console/utils.ts
|
|
1797
|
-
var import_react_core7 = require("@copilotkit/react-core");
|
|
1798
|
-
function shouldShowDevConsole(showDevConsole) {
|
|
1799
|
-
if (typeof showDevConsole === "boolean") {
|
|
1800
|
-
return showDevConsole;
|
|
1801
|
-
}
|
|
1802
|
-
return getHostname() === "localhost" || getHostname() === "127.0.0.1" || getHostname() === "0.0.0.0" || getHostname() === "::1";
|
|
1803
|
-
}
|
|
1804
|
-
function getHostname() {
|
|
1805
|
-
if (typeof window !== "undefined" && window.location) {
|
|
1806
|
-
return window.location.hostname;
|
|
1807
|
-
}
|
|
1808
|
-
return "";
|
|
1809
|
-
}
|
|
1810
|
-
function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
1811
|
-
return __async(this, null, function* () {
|
|
1812
|
-
const LOCAL_STORAGE_KEY = "__copilotkit_version_check__";
|
|
1813
|
-
const serializedVersion = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
1814
|
-
if (serializedVersion && !forceCheck) {
|
|
1815
|
-
try {
|
|
1816
|
-
const parsedVersion = JSON.parse(serializedVersion);
|
|
1817
|
-
const oneHour = 60 * 60 * 1e3;
|
|
1818
|
-
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
1819
|
-
if (parsedVersion.current === current && now - new Date(parsedVersion.lastChecked).getTime() < oneHour) {
|
|
1820
|
-
return parsedVersion;
|
|
1821
|
-
}
|
|
1822
|
-
} catch (error) {
|
|
1823
|
-
console.error("Failed to parse CopilotKitVersion from localStorage", error);
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
try {
|
|
1827
|
-
const response = yield fetch("https://api.cloud.copilotkit.ai/check-for-updates", {
|
|
1828
|
-
method: "POST",
|
|
1829
|
-
headers: {
|
|
1830
|
-
"Content-Type": "application/json"
|
|
1831
|
-
},
|
|
1832
|
-
body: JSON.stringify({
|
|
1833
|
-
packages: [
|
|
1834
|
-
{
|
|
1835
|
-
packageName: "@copilotkit/shared",
|
|
1836
|
-
packageVersion: current
|
|
1837
|
-
}
|
|
1838
|
-
]
|
|
1839
|
-
})
|
|
1840
|
-
});
|
|
1841
|
-
const data = yield response.json();
|
|
1842
|
-
const version = {
|
|
1843
|
-
current,
|
|
1844
|
-
lastChecked: (/* @__PURE__ */ new Date()).getTime(),
|
|
1845
|
-
latest: data.packages[0].latestVersion,
|
|
1846
|
-
severity: data.packages[0].severity,
|
|
1847
|
-
advisory: data.packages[0].advisory || null
|
|
1848
|
-
};
|
|
1849
|
-
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(version));
|
|
1850
|
-
return version;
|
|
1851
|
-
} catch (error) {
|
|
1852
|
-
console.error("Failed to check for updates", error);
|
|
1853
|
-
throw error;
|
|
1854
|
-
}
|
|
1855
|
-
});
|
|
1856
|
-
}
|
|
1857
|
-
function logReadables(context) {
|
|
1858
|
-
console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
|
|
1859
|
-
const readables = context.getContextString([], import_react_core7.defaultCopilotContextCategories).trim();
|
|
1860
|
-
if (readables.length === 0) {
|
|
1861
|
-
console.log("No readables found");
|
|
1862
|
-
return;
|
|
1863
|
-
}
|
|
1864
|
-
console.log(readables);
|
|
1865
|
-
}
|
|
1866
|
-
function logActions(context) {
|
|
1867
|
-
console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
|
|
1868
|
-
if (Object.values(context.actions).length === 0) {
|
|
1869
|
-
console.log("No actions found");
|
|
1870
|
-
return;
|
|
1871
|
-
}
|
|
1872
|
-
for (const action of Object.values(context.actions)) {
|
|
1873
|
-
console.group(action.name);
|
|
1874
|
-
console.log("name", action.name);
|
|
1875
|
-
console.log("description", action.description);
|
|
1876
|
-
console.log("parameters", action.parameters);
|
|
1877
|
-
console.groupEnd();
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
function logMessages(context) {
|
|
1881
|
-
console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
|
|
1882
|
-
if (context.messages.length === 0) {
|
|
1883
|
-
console.log("No messages found");
|
|
1884
|
-
return;
|
|
2086
|
+
'pre[class*="language-css"]': {
|
|
2087
|
+
color: "#ce9178"
|
|
2088
|
+
},
|
|
2089
|
+
'code[class*="language-css"]': {
|
|
2090
|
+
color: "#ce9178"
|
|
2091
|
+
},
|
|
2092
|
+
'pre[class*="language-html"]': {
|
|
2093
|
+
color: "#d4d4d4"
|
|
2094
|
+
},
|
|
2095
|
+
'code[class*="language-html"]': {
|
|
2096
|
+
color: "#d4d4d4"
|
|
2097
|
+
},
|
|
2098
|
+
".language-regex .token.anchor": {
|
|
2099
|
+
color: "#dcdcaa"
|
|
2100
|
+
},
|
|
2101
|
+
".language-html .token.punctuation": {
|
|
2102
|
+
color: "#808080"
|
|
2103
|
+
},
|
|
2104
|
+
'pre[class*="language-"] > code[class*="language-"]': {
|
|
2105
|
+
position: "relative",
|
|
2106
|
+
zIndex: "1"
|
|
2107
|
+
},
|
|
2108
|
+
".line-highlight.line-highlight": {
|
|
2109
|
+
background: "#f7ebc6",
|
|
2110
|
+
boxShadow: "inset 5px 0 0 #f7d87c",
|
|
2111
|
+
zIndex: "0"
|
|
1885
2112
|
}
|
|
1886
|
-
|
|
1887
|
-
if (message.isTextMessage()) {
|
|
1888
|
-
return {
|
|
1889
|
-
id: message.id,
|
|
1890
|
-
type: "TextMessage",
|
|
1891
|
-
role: message.role,
|
|
1892
|
-
name: void 0,
|
|
1893
|
-
scope: void 0,
|
|
1894
|
-
content: message.content
|
|
1895
|
-
};
|
|
1896
|
-
} else if (message.isActionExecutionMessage()) {
|
|
1897
|
-
return {
|
|
1898
|
-
id: message.id,
|
|
1899
|
-
type: "ActionExecutionMessage",
|
|
1900
|
-
role: void 0,
|
|
1901
|
-
name: message.name,
|
|
1902
|
-
scope: message.parentMessageId,
|
|
1903
|
-
content: message.arguments
|
|
1904
|
-
};
|
|
1905
|
-
} else if (message.isResultMessage()) {
|
|
1906
|
-
return {
|
|
1907
|
-
id: message.id,
|
|
1908
|
-
type: "ResultMessage",
|
|
1909
|
-
role: void 0,
|
|
1910
|
-
name: message.actionName,
|
|
1911
|
-
scope: message.actionExecutionId,
|
|
1912
|
-
content: message.result
|
|
1913
|
-
};
|
|
1914
|
-
} else if (message.isAgentStateMessage()) {
|
|
1915
|
-
return {
|
|
1916
|
-
id: message.id,
|
|
1917
|
-
type: `AgentStateMessage (running: ${message.running})`,
|
|
1918
|
-
role: message.role,
|
|
1919
|
-
name: void 0,
|
|
1920
|
-
scope: message.threadId,
|
|
1921
|
-
content: message.state
|
|
1922
|
-
};
|
|
1923
|
-
}
|
|
1924
|
-
});
|
|
1925
|
-
console.table(tableData);
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
// src/components/dev-console/console.tsx
|
|
1929
|
-
var import_react_core8 = require("@copilotkit/react-core");
|
|
1930
|
-
var import_react10 = require("react");
|
|
2113
|
+
};
|
|
1931
2114
|
|
|
1932
|
-
// src/components/
|
|
2115
|
+
// src/components/chat/Markdown.tsx
|
|
2116
|
+
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
2117
|
+
var import_remark_math = __toESM(require("remark-math"));
|
|
1933
2118
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1934
|
-
var
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
width: "13.3967723px",
|
|
1938
|
-
height: "12px",
|
|
1939
|
-
viewBox: "0 0 13.3967723 12",
|
|
1940
|
-
version: "1.1",
|
|
1941
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1942
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "exclamation-triangle", fill: "#CD2121", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1943
|
-
"path",
|
|
1944
|
-
{
|
|
1945
|
-
d: "M5.39935802,0.75 C5.97670802,-0.25 7.42007802,-0.25 7.99742802,0.75 L13.193588,9.75 C13.770888,10.75 13.049288,12 11.894588,12 L1.50223802,12 C0.34753802,12 -0.37414898,10.75 0.20319802,9.75 L5.39935802,0.75 Z M6.69838802,2.5 C7.11260802,2.5 7.44838802,2.83579 7.44838802,3.25 L7.44838802,6.25 C7.44838802,6.66421 7.11260802,7 6.69838802,7 C6.28417802,7 5.94838802,6.66421 5.94838802,6.25 L5.94838802,3.25 C5.94838802,2.83579 6.28417802,2.5 6.69838802,2.5 Z M6.69838802,10.5 C7.25067802,10.5 7.69838802,10.0523 7.69838802,9.5 C7.69838802,8.9477 7.25067802,8.5 6.69838802,8.5 C6.14610802,8.5 5.69838802,8.9477 5.69838802,9.5 C5.69838802,10.0523 6.14610802,10.5 6.69838802,10.5 Z",
|
|
1946
|
-
id: "Shape"
|
|
1947
|
-
}
|
|
1948
|
-
) }) })
|
|
1949
|
-
}
|
|
1950
|
-
);
|
|
1951
|
-
var ExclamationMarkIcon = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1952
|
-
"svg",
|
|
1953
|
-
{
|
|
1954
|
-
width: "14px",
|
|
1955
|
-
height: "14px",
|
|
1956
|
-
viewBox: "0 0 14 14",
|
|
1957
|
-
version: "1.1",
|
|
1958
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1959
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { id: "exclamation-circle", fill: "#EC662C", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1960
|
-
"path",
|
|
1961
|
-
{
|
|
1962
|
-
d: "M7,14 C10.866,14 14,10.866 14,7 C14,3.13401 10.866,0 7,0 C3.13401,0 0,3.13401 0,7 C0,10.866 3.13401,14 7,14 Z M7,3 C7.41421,3 7.75,3.33579 7.75,3.75 L7.75,6.75 C7.75,7.16421 7.41421,7.5 7,7.5 C6.58579,7.5 6.25,7.16421 6.25,6.75 L6.25,3.75 C6.25,3.33579 6.58579,3 7,3 Z M7,11 C7.55228,11 8,10.5523 8,10 C8,9.4477 7.55228,9 7,9 C6.44772,9 6,9.4477 6,10 C6,10.5523 6.44772,11 7,11 Z",
|
|
1963
|
-
id: "Shape"
|
|
1964
|
-
}
|
|
1965
|
-
) }) })
|
|
1966
|
-
}
|
|
2119
|
+
var MemoizedReactMarkdown = (0, import_react11.memo)(
|
|
2120
|
+
import_react_markdown.default,
|
|
2121
|
+
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
1967
2122
|
);
|
|
1968
|
-
var
|
|
1969
|
-
"
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2123
|
+
var Markdown = ({ content }) => {
|
|
2124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MemoizedReactMarkdown, { components, remarkPlugins: [import_remark_gfm.default, import_remark_math.default], children: content }) });
|
|
2125
|
+
};
|
|
2126
|
+
var components = {
|
|
2127
|
+
a(_a) {
|
|
2128
|
+
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
2129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2130
|
+
"a",
|
|
2131
|
+
__spreadProps(__spreadValues({
|
|
2132
|
+
style: { color: "blue", textDecoration: "underline" }
|
|
2133
|
+
}, props), {
|
|
2134
|
+
target: "_blank",
|
|
2135
|
+
rel: "noopener noreferrer",
|
|
2136
|
+
children
|
|
2137
|
+
})
|
|
2138
|
+
);
|
|
2139
|
+
},
|
|
2140
|
+
code(_c) {
|
|
2141
|
+
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
2142
|
+
if (children.length) {
|
|
2143
|
+
if (children[0] == "\u258D") {
|
|
2144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2145
|
+
"span",
|
|
2146
|
+
{
|
|
2147
|
+
style: {
|
|
2148
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
2149
|
+
marginTop: "0.25rem"
|
|
2150
|
+
},
|
|
2151
|
+
children: "\u258D"
|
|
2152
|
+
}
|
|
2153
|
+
);
|
|
1988
2154
|
}
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
);
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
"image",
|
|
2004
|
-
{
|
|
2005
|
-
x: "0",
|
|
2006
|
-
y: "0",
|
|
2007
|
-
width: "33",
|
|
2008
|
-
height: "35",
|
|
2009
|
-
xlinkHref: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI0AAACXCAYAAAAoE9hYAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAjaADAAQAAAABAAAAlwAAAACI8Oz3AABAAElEQVR4Ae2dCYAlVXnvv6q79d7TMz37sIMgKKBCkLhkSKK4xJUMQVzAqJBgNDGJa2LsvJfERI0aiEbwRXnoQ2VYRASiQUFRUGQm7DAwzDBbT+/rvbfvXu/3P1V1+84CzEw3MNPD6a579nOqzvev73znO0t59rzZbQu88sXndp2w4gVLp5oG+6+47ivDu010kAb6B+lzP+Vjr1zZk0xV/ddMVIufap/34g+e+s9rX9351U1dT5npIIpMHkTPusePmto+tKhctVWPDW1/c27hIVNbCsFbCpa7/aR/f/SWFV2ZX974zsNG97iwOZjwedDshqiZlL3AD9JH9Y8PpTYMPJEuLj7+pclE5vBquXZ6MV/56Zu/ueGnmWpqzer3HzKym+xzPsib80+4lw/Y09Pjr7lm9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5qEm7j2cibbT6cN/i+7qOMAxDzejA38hdiu6CKYDYBLVWolRQh9bMzZYOcdHtQqHErYEQHEmqgMWk3TeFgDzU5jKf9v3znv02X+guVVjEsFXH+A6kcdaD1Aub29v//VzChi1b49X4vdRhLr11vsHN1pz7Qj8bDKrLULpdyJzKocw1OwCKBm2zYKPCh1PiQ87sujILdnw1gKQrQiMDNmTj5nP0P2F714fHlStCp43M2kBT2t9EXjfBlBydEu37Pfn+J7/zXkIt50IxO3oK1rgKgEaU5YYAJhaUOCLawjufOW8i0Pnlm1/bo/7mAll9uO8/x9teQya14m6TgAAAABJRU5ErkJggg=="
|
|
2010
|
-
}
|
|
2011
|
-
) })
|
|
2012
|
-
]
|
|
2155
|
+
children[0] = children[0].replace("`\u258D`", "\u258D");
|
|
2156
|
+
}
|
|
2157
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
2158
|
+
if (inline) {
|
|
2159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
|
|
2160
|
+
}
|
|
2161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2162
|
+
CodeBlock,
|
|
2163
|
+
__spreadValues({
|
|
2164
|
+
language: match && match[1] || "",
|
|
2165
|
+
value: String(children).replace(/\n$/, "")
|
|
2166
|
+
}, props),
|
|
2167
|
+
Math.random()
|
|
2168
|
+
);
|
|
2013
2169
|
}
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
// src/components/dev-console/console.tsx
|
|
2017
|
-
var import_react11 = require("@headlessui/react");
|
|
2018
|
-
var import_shared2 = require("@copilotkit/shared");
|
|
2019
|
-
|
|
2020
|
-
// src/components/help-modal/modal.tsx
|
|
2021
|
-
var import_react9 = require("react");
|
|
2170
|
+
};
|
|
2022
2171
|
|
|
2023
|
-
// src/components/
|
|
2172
|
+
// src/components/chat/messages/AssistantMessage.tsx
|
|
2173
|
+
var import_react12 = require("react");
|
|
2024
2174
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2025
|
-
var
|
|
2026
|
-
|
|
2027
|
-
{
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
}
|
|
2037
|
-
);
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
viewBox: "0 0 24 24",
|
|
2050
|
-
children: [
|
|
2051
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2052
|
-
"circle",
|
|
2053
|
-
{
|
|
2054
|
-
style: { opacity: 0.25 },
|
|
2055
|
-
cx: "12",
|
|
2056
|
-
cy: "12",
|
|
2057
|
-
r: "10",
|
|
2058
|
-
stroke: "currentColor",
|
|
2059
|
-
strokeWidth: "4"
|
|
2060
|
-
}
|
|
2061
|
-
),
|
|
2062
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2063
|
-
"path",
|
|
2064
|
-
{
|
|
2065
|
-
style: { opacity: 0.75 },
|
|
2066
|
-
fill: "currentColor",
|
|
2067
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
2068
|
-
}
|
|
2069
|
-
)
|
|
2070
|
-
]
|
|
2071
|
-
}
|
|
2072
|
-
);
|
|
2073
|
-
|
|
2074
|
-
// src/components/help-modal/modal.tsx
|
|
2075
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2076
|
-
function CopilotKitHelpModal() {
|
|
2077
|
-
const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
|
|
2078
|
-
const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
|
|
2079
|
-
const [email, setEmail] = (0, import_react9.useState)("");
|
|
2080
|
-
const [emailError, setEmailError] = (0, import_react9.useState)("");
|
|
2081
|
-
const [submitting, setSubmitting] = (0, import_react9.useState)(false);
|
|
2082
|
-
const validateEmail = (email2) => {
|
|
2083
|
-
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
2084
|
-
return re.test(email2);
|
|
2175
|
+
var AssistantMessage = (props) => {
|
|
2176
|
+
const { icons, labels } = useChatContext();
|
|
2177
|
+
const {
|
|
2178
|
+
message,
|
|
2179
|
+
isLoading,
|
|
2180
|
+
subComponent,
|
|
2181
|
+
onRegenerate,
|
|
2182
|
+
onCopy,
|
|
2183
|
+
onThumbsUp,
|
|
2184
|
+
onThumbsDown,
|
|
2185
|
+
isCurrentMessage
|
|
2186
|
+
} = props;
|
|
2187
|
+
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
2188
|
+
const handleCopy = () => {
|
|
2189
|
+
if (message && onCopy) {
|
|
2190
|
+
navigator.clipboard.writeText(message);
|
|
2191
|
+
setCopied(true);
|
|
2192
|
+
onCopy(message);
|
|
2193
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
2194
|
+
} else if (message) {
|
|
2195
|
+
navigator.clipboard.writeText(message);
|
|
2196
|
+
setCopied(true);
|
|
2197
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
2198
|
+
}
|
|
2085
2199
|
};
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
setEmailError("Please enter a valid email address");
|
|
2090
|
-
return;
|
|
2200
|
+
const handleRegenerate = () => {
|
|
2201
|
+
if (onRegenerate) {
|
|
2202
|
+
onRegenerate();
|
|
2091
2203
|
}
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
"Content-Type": "application/json"
|
|
2097
|
-
},
|
|
2098
|
-
body: JSON.stringify({
|
|
2099
|
-
event: "oss.dev-console.help",
|
|
2100
|
-
anonymousId: window.crypto.randomUUID(),
|
|
2101
|
-
properties: { email, text: issueDescription },
|
|
2102
|
-
writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
|
|
2103
|
-
})
|
|
2104
|
-
});
|
|
2105
|
-
setEmailError("");
|
|
2106
|
-
setEmail("");
|
|
2107
|
-
setIssueDescription("");
|
|
2108
|
-
setSubmitting(false);
|
|
2109
|
-
setShowHelpModal(false);
|
|
2110
|
-
});
|
|
2111
|
-
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2112
|
-
"button",
|
|
2113
|
-
{
|
|
2114
|
-
onClick: () => setShowHelpModal(true),
|
|
2115
|
-
style: { width: "50px", height: "30px", marginRight: "0.25rem" },
|
|
2116
|
-
className: "text-sm p-0 bg-transparent rounded border border-blue-500",
|
|
2117
|
-
"aria-label": "Open Help",
|
|
2118
|
-
children: "Help"
|
|
2204
|
+
};
|
|
2205
|
+
const handleThumbsUp = () => {
|
|
2206
|
+
if (onThumbsUp && message) {
|
|
2207
|
+
onThumbsUp(message);
|
|
2119
2208
|
}
|
|
2120
|
-
|
|
2121
|
-
const
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
{
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
onClick: () => setShowHelpModal(false),
|
|
2139
|
-
"aria-label": "Close",
|
|
2140
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CloseIcon2, {})
|
|
2141
|
-
}
|
|
2142
|
-
),
|
|
2143
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
|
|
2144
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
2145
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2146
|
-
"a",
|
|
2209
|
+
};
|
|
2210
|
+
const handleThumbsDown = () => {
|
|
2211
|
+
if (onThumbsDown && message) {
|
|
2212
|
+
onThumbsDown(message);
|
|
2213
|
+
}
|
|
2214
|
+
};
|
|
2215
|
+
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: icons.activityIcon });
|
|
2216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2217
|
+
(message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2218
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Markdown, { content: message || "" }),
|
|
2219
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LoadingIcon, {}),
|
|
2220
|
+
message && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2221
|
+
"div",
|
|
2222
|
+
{
|
|
2223
|
+
className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
|
|
2224
|
+
children: [
|
|
2225
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2226
|
+
"button",
|
|
2147
2227
|
{
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2228
|
+
className: "copilotKitMessageControlButton",
|
|
2229
|
+
onClick: handleRegenerate,
|
|
2230
|
+
"aria-label": labels.regenerateResponse,
|
|
2231
|
+
title: labels.regenerateResponse,
|
|
2232
|
+
children: RegenerateIcon
|
|
2152
2233
|
}
|
|
2153
|
-
)
|
|
2154
|
-
/* @__PURE__ */ (0,
|
|
2155
|
-
"
|
|
2234
|
+
),
|
|
2235
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2236
|
+
"button",
|
|
2156
2237
|
{
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2238
|
+
className: "copilotKitMessageControlButton",
|
|
2239
|
+
onClick: handleCopy,
|
|
2240
|
+
"aria-label": labels.copyToClipboard,
|
|
2241
|
+
title: labels.copyToClipboard,
|
|
2242
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : CopyIcon
|
|
2161
2243
|
}
|
|
2162
|
-
)
|
|
2163
|
-
|
|
2164
|
-
"
|
|
2244
|
+
),
|
|
2245
|
+
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2246
|
+
"button",
|
|
2165
2247
|
{
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2248
|
+
className: "copilotKitMessageControlButton",
|
|
2249
|
+
onClick: handleThumbsUp,
|
|
2250
|
+
"aria-label": labels.thumbsUp,
|
|
2251
|
+
title: labels.thumbsUp,
|
|
2252
|
+
children: ThumbsUpIcon
|
|
2170
2253
|
}
|
|
2171
|
-
)
|
|
2172
|
-
|
|
2173
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
|
|
2174
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2175
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { htmlFor: "feedback", className: "block text-sm font-medium text-gray-700 mb-1", children: "Let us know what your issue is:" }),
|
|
2176
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2177
|
-
"textarea",
|
|
2178
|
-
{
|
|
2179
|
-
id: "feedback",
|
|
2180
|
-
rows: 4,
|
|
2181
|
-
className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
|
|
2182
|
-
placeholder: "A Loom link / screen recording is always great!",
|
|
2183
|
-
onChange: (e) => setIssueDescription(e.target.value),
|
|
2184
|
-
value: issueDescription,
|
|
2185
|
-
required: true
|
|
2186
|
-
}
|
|
2187
|
-
)
|
|
2188
|
-
] }),
|
|
2189
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2190
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
|
|
2191
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2192
|
-
"input",
|
|
2193
|
-
{
|
|
2194
|
-
type: "email",
|
|
2195
|
-
id: "email",
|
|
2196
|
-
className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
|
|
2197
|
-
placeholder: "Enter your email for follow-up",
|
|
2198
|
-
onChange: (e) => {
|
|
2199
|
-
setEmail(e.target.value);
|
|
2200
|
-
setEmailError("");
|
|
2201
|
-
},
|
|
2202
|
-
value: email
|
|
2203
|
-
}
|
|
2204
|
-
),
|
|
2205
|
-
emailError && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-red-500 text-sm mt-1", children: emailError })
|
|
2206
|
-
] }),
|
|
2207
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2254
|
+
),
|
|
2255
|
+
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2208
2256
|
"button",
|
|
2209
2257
|
{
|
|
2210
|
-
|
|
2211
|
-
onClick:
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LoadingSpinnerIcon, { color: "white" }) : "Submit"
|
|
2258
|
+
className: "copilotKitMessageControlButton",
|
|
2259
|
+
onClick: handleThumbsDown,
|
|
2260
|
+
"aria-label": labels.thumbsDown,
|
|
2261
|
+
title: labels.thumbsDown,
|
|
2262
|
+
children: ThumbsDownIcon
|
|
2216
2263
|
}
|
|
2217
|
-
)
|
|
2218
|
-
]
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
)
|
|
2264
|
+
)
|
|
2265
|
+
]
|
|
2266
|
+
}
|
|
2267
|
+
)
|
|
2268
|
+
] }),
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
|
|
2222
2270
|
] });
|
|
2223
|
-
}
|
|
2271
|
+
};
|
|
2224
2272
|
|
|
2225
|
-
// src/components/
|
|
2273
|
+
// src/components/chat/messages/UserMessage.tsx
|
|
2274
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2275
|
+
var UserMessage = (props) => {
|
|
2276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.message });
|
|
2277
|
+
};
|
|
2278
|
+
|
|
2279
|
+
// src/components/chat/Suggestion.tsx
|
|
2280
|
+
var import_react_core8 = require("@copilotkit/react-core");
|
|
2281
|
+
var import_shared2 = require("@copilotkit/shared");
|
|
2282
|
+
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2226
2283
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2227
|
-
function
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
const [showDevConsole, setShowDevConsole] = (0, import_react10.useState)(false);
|
|
2231
|
-
(0, import_react10.useEffect)(() => {
|
|
2232
|
-
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
2233
|
-
}, [context.showDevConsole]);
|
|
2234
|
-
const dontRunTwiceInDevMode = (0, import_react10.useRef)(false);
|
|
2235
|
-
const [versionStatus, setVersionStatus] = (0, import_react10.useState)("unknown");
|
|
2236
|
-
const [latestVersion, setLatestVersion] = (0, import_react10.useState)("");
|
|
2237
|
-
const consoleRef = (0, import_react10.useRef)(null);
|
|
2238
|
-
const [debugButtonMode, setDebugButtonMode] = (0, import_react10.useState)("full");
|
|
2239
|
-
const checkForUpdates = (force = false) => {
|
|
2240
|
-
setVersionStatus("checking");
|
|
2241
|
-
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
2242
|
-
setLatestVersion(v.latest);
|
|
2243
|
-
let versionOk = false;
|
|
2244
|
-
if (v.current === v.latest) {
|
|
2245
|
-
versionOk = true;
|
|
2246
|
-
} else if (/[a-zA-Z]/.test(v.current)) {
|
|
2247
|
-
versionOk = true;
|
|
2248
|
-
}
|
|
2249
|
-
if (versionOk) {
|
|
2250
|
-
setVersionStatus("latest");
|
|
2251
|
-
} else if (v.severity !== "low") {
|
|
2252
|
-
setVersionStatus("outdated");
|
|
2253
|
-
} else {
|
|
2254
|
-
setVersionStatus("update-available");
|
|
2255
|
-
}
|
|
2256
|
-
}).catch((e) => {
|
|
2257
|
-
console.error(e);
|
|
2258
|
-
setVersionStatus("unknown");
|
|
2259
|
-
});
|
|
2260
|
-
};
|
|
2261
|
-
(0, import_react10.useEffect)(() => {
|
|
2262
|
-
if (dontRunTwiceInDevMode.current === true) {
|
|
2263
|
-
return;
|
|
2264
|
-
}
|
|
2265
|
-
dontRunTwiceInDevMode.current = true;
|
|
2266
|
-
checkForUpdates();
|
|
2267
|
-
}, []);
|
|
2268
|
-
(0, import_react10.useEffect)(() => {
|
|
2269
|
-
const handleResize = (entries) => {
|
|
2270
|
-
for (let entry of entries) {
|
|
2271
|
-
if (entry.target === consoleRef.current) {
|
|
2272
|
-
const width = entry.contentRect.width;
|
|
2273
|
-
if (width < 400) {
|
|
2274
|
-
setDebugButtonMode("compact");
|
|
2275
|
-
} else {
|
|
2276
|
-
setDebugButtonMode("full");
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
};
|
|
2281
|
-
const observer = new ResizeObserver(handleResize);
|
|
2282
|
-
if (consoleRef.current) {
|
|
2283
|
-
observer.observe(consoleRef.current);
|
|
2284
|
-
const initialWidth = consoleRef.current.getBoundingClientRect().width;
|
|
2285
|
-
if (initialWidth < 400) {
|
|
2286
|
-
setDebugButtonMode("compact");
|
|
2287
|
-
} else {
|
|
2288
|
-
setDebugButtonMode("full");
|
|
2289
|
-
}
|
|
2290
|
-
}
|
|
2291
|
-
return () => {
|
|
2292
|
-
if (consoleRef.current) {
|
|
2293
|
-
observer.unobserve(consoleRef.current);
|
|
2294
|
-
}
|
|
2295
|
-
};
|
|
2296
|
-
}, [consoleRef.current]);
|
|
2297
|
-
if (!showDevConsole) {
|
|
2298
|
-
return null;
|
|
2299
|
-
}
|
|
2300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2301
|
-
"div",
|
|
2284
|
+
function Suggestion({ title, message, onClick, partial, className }) {
|
|
2285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2286
|
+
"button",
|
|
2302
2287
|
{
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2288
|
+
disabled: partial,
|
|
2289
|
+
onClick: (e) => {
|
|
2290
|
+
e.preventDefault();
|
|
2291
|
+
onClick(message);
|
|
2292
|
+
},
|
|
2293
|
+
className: className || (partial ? "suggestion loading" : "suggestion"),
|
|
2294
|
+
"data-test-id": "suggestion",
|
|
2295
|
+
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: title })
|
|
2296
|
+
}
|
|
2297
|
+
);
|
|
2298
|
+
}
|
|
2299
|
+
var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggestions, abortControllerRef) => __async(void 0, null, function* () {
|
|
2300
|
+
const abortController = abortControllerRef.current;
|
|
2301
|
+
const tools = JSON.stringify(
|
|
2302
|
+
Object.values(context.actions).map((action) => ({
|
|
2303
|
+
name: action.name,
|
|
2304
|
+
description: action.description,
|
|
2305
|
+
jsonSchema: JSON.stringify((0, import_shared2.actionParametersToJsonSchema)(action.parameters))
|
|
2306
|
+
}))
|
|
2307
|
+
);
|
|
2308
|
+
const allSuggestions = [];
|
|
2309
|
+
for (const config of Object.values(chatSuggestionConfiguration)) {
|
|
2310
|
+
try {
|
|
2311
|
+
const numOfSuggestionsInstructions = config.minSuggestions === 0 ? `Produce up to ${config.maxSuggestions} suggestions. If there are no highly relevant suggestions you can think of, provide an empty array.` : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;
|
|
2312
|
+
const result = yield (0, import_react_core8.extract)({
|
|
2313
|
+
context,
|
|
2314
|
+
instructions: "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
|
|
2315
|
+
data: config.instructions + "\n\n" + numOfSuggestionsInstructions + "\n\nAvailable tools: " + tools + "\n\n",
|
|
2316
|
+
requestType: import_runtime_client_gql3.CopilotRequestType.Task,
|
|
2317
|
+
parameters: [
|
|
2309
2318
|
{
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2319
|
+
name: "suggestions",
|
|
2320
|
+
type: "object[]",
|
|
2321
|
+
attributes: [
|
|
2322
|
+
{
|
|
2323
|
+
name: "title",
|
|
2324
|
+
description: "The title of the suggestion. This is shown as a button and should be short.",
|
|
2325
|
+
type: "string"
|
|
2326
|
+
},
|
|
2327
|
+
{
|
|
2328
|
+
name: "message",
|
|
2329
|
+
description: "The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.",
|
|
2330
|
+
type: "string"
|
|
2331
|
+
}
|
|
2332
|
+
]
|
|
2314
2333
|
}
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2334
|
+
],
|
|
2335
|
+
include: {
|
|
2336
|
+
messages: true,
|
|
2337
|
+
readable: true
|
|
2338
|
+
},
|
|
2339
|
+
abortSignal: abortController == null ? void 0 : abortController.signal,
|
|
2340
|
+
stream: ({ status, args }) => {
|
|
2341
|
+
const suggestions = args.suggestions || [];
|
|
2342
|
+
const newSuggestions = [];
|
|
2343
|
+
for (let i = 0; i < suggestions.length; i++) {
|
|
2344
|
+
if (config.maxSuggestions !== void 0 && i >= config.maxSuggestions) {
|
|
2345
|
+
break;
|
|
2346
|
+
}
|
|
2347
|
+
const { title, message } = suggestions[i];
|
|
2348
|
+
const partial = i == suggestions.length - 1 && status !== "complete";
|
|
2349
|
+
newSuggestions.push({
|
|
2350
|
+
title,
|
|
2351
|
+
message,
|
|
2352
|
+
partial,
|
|
2353
|
+
className: config.className
|
|
2354
|
+
});
|
|
2323
2355
|
}
|
|
2324
|
-
|
|
2325
|
-
|
|
2356
|
+
setCurrentSuggestions([...allSuggestions, ...newSuggestions]);
|
|
2357
|
+
}
|
|
2358
|
+
});
|
|
2359
|
+
allSuggestions.push(...result.suggestions);
|
|
2360
|
+
} catch (error) {
|
|
2361
|
+
console.error("Error loading suggestions", error);
|
|
2326
2362
|
}
|
|
2327
|
-
);
|
|
2328
|
-
}
|
|
2329
|
-
function VersionInfo({
|
|
2330
|
-
showDevConsole,
|
|
2331
|
-
versionStatus,
|
|
2332
|
-
currentVersion,
|
|
2333
|
-
latestVersion
|
|
2334
|
-
}) {
|
|
2335
|
-
const [copyStatus, setCopyStatus] = (0, import_react10.useState)("");
|
|
2336
|
-
let versionLabel = "";
|
|
2337
|
-
let versionIcon = "";
|
|
2338
|
-
let currentVersionLabel = currentVersion;
|
|
2339
|
-
if (versionStatus === "latest") {
|
|
2340
|
-
versionLabel = "latest";
|
|
2341
|
-
versionIcon = CheckIcon2;
|
|
2342
|
-
} else if (versionStatus === "checking") {
|
|
2343
|
-
versionLabel = "checking";
|
|
2344
|
-
versionIcon = SmallSpinnerIcon;
|
|
2345
|
-
} else if (versionStatus === "update-available") {
|
|
2346
|
-
versionLabel = "update available";
|
|
2347
|
-
versionIcon = ExclamationMarkIcon;
|
|
2348
|
-
currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
|
|
2349
|
-
} else if (versionStatus === "outdated") {
|
|
2350
|
-
versionLabel = "outdated";
|
|
2351
|
-
versionIcon = ExclamationMarkTriangleIcon;
|
|
2352
|
-
currentVersionLabel = `${currentVersion} \u2192 ${latestVersion}`;
|
|
2353
2363
|
}
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
asideLabel = "(localhost only)";
|
|
2357
|
-
} else if (showDevConsole === true) {
|
|
2358
|
-
asideLabel = "(always on)";
|
|
2364
|
+
if (abortControllerRef.current === abortController) {
|
|
2365
|
+
abortControllerRef.current = null;
|
|
2359
2366
|
}
|
|
2360
|
-
|
|
2361
|
-
`npm install`,
|
|
2362
|
-
`@copilotkit/react-core@${latestVersion}`,
|
|
2363
|
-
`@copilotkit/react-ui@${latestVersion}`,
|
|
2364
|
-
`@copilotkit/react-textarea@${latestVersion}`,
|
|
2365
|
-
`&& npm install @copilotkit/runtime@${latestVersion}`
|
|
2366
|
-
].join(" ");
|
|
2367
|
-
const handleCopyClick = () => {
|
|
2368
|
-
navigator.clipboard.writeText(installCommand.trim()).then(() => {
|
|
2369
|
-
setCopyStatus("Command copied to clipboard!");
|
|
2370
|
-
setTimeout(() => setCopyStatus(""), 1e3);
|
|
2371
|
-
});
|
|
2372
|
-
};
|
|
2373
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "copilotKitVersionInfo", children: [
|
|
2374
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("header", { children: [
|
|
2375
|
-
"COPILOTKIT DEV CONSOLE",
|
|
2376
|
-
showDevConsole === "auto" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("aside", { children: asideLabel })
|
|
2377
|
-
] }),
|
|
2378
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("section", { children: [
|
|
2379
|
-
"Version: ",
|
|
2380
|
-
versionLabel,
|
|
2381
|
-
" (",
|
|
2382
|
-
currentVersionLabel,
|
|
2383
|
-
") ",
|
|
2384
|
-
versionIcon
|
|
2385
|
-
] }),
|
|
2386
|
-
(versionStatus === "update-available" || versionStatus === "outdated") && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("footer", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { onClick: handleCopyClick, children: copyStatus || installCommand }) })
|
|
2387
|
-
] });
|
|
2388
|
-
}
|
|
2389
|
-
function DebugMenuButton({
|
|
2390
|
-
setShowDevConsole,
|
|
2391
|
-
checkForUpdates,
|
|
2392
|
-
mode
|
|
2393
|
-
}) {
|
|
2394
|
-
const context = (0, import_react_core8.useCopilotContext)();
|
|
2395
|
-
const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
|
|
2396
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "bg-black top-24 w-52 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react11.Menu, { children: [
|
|
2397
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuButton, { className: `copilotKitDebugMenuButton ${mode === "compact" ? "compact" : ""}`, children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
2398
|
-
"Debug ",
|
|
2399
|
-
ChevronDownIcon
|
|
2400
|
-
] }) }),
|
|
2401
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2402
|
-
import_react11.MenuItems,
|
|
2403
|
-
{
|
|
2404
|
-
transition: true,
|
|
2405
|
-
anchor: "bottom end",
|
|
2406
|
-
className: "copilotKitDebugMenu",
|
|
2407
|
-
style: { zIndex: 40 },
|
|
2408
|
-
children: [
|
|
2409
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
|
|
2410
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
|
|
2411
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2412
|
-
"button",
|
|
2413
|
-
{
|
|
2414
|
-
className: "copilotKitDebugMenuItem",
|
|
2415
|
-
onClick: () => logMessages(messagesContext),
|
|
2416
|
-
children: "Log Messages"
|
|
2417
|
-
}
|
|
2418
|
-
) }),
|
|
2419
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
|
|
2420
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("hr", {}),
|
|
2421
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
|
|
2422
|
-
]
|
|
2423
|
-
}
|
|
2424
|
-
)
|
|
2425
|
-
] }) });
|
|
2426
|
-
}
|
|
2367
|
+
});
|
|
2427
2368
|
|
|
2428
2369
|
// src/components/chat/Chat.tsx
|
|
2370
|
+
var import_react13 = __toESM(require("react"));
|
|
2371
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2372
|
+
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
2373
|
+
var import_shared3 = require("@copilotkit/shared");
|
|
2429
2374
|
var import_react_core10 = require("@copilotkit/react-core");
|
|
2430
2375
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2431
2376
|
function CopilotChat({
|
|
@@ -2436,6 +2381,10 @@ function CopilotChat({
|
|
|
2436
2381
|
onInProgress,
|
|
2437
2382
|
onStopGeneration,
|
|
2438
2383
|
onReloadMessages,
|
|
2384
|
+
onRegenerate,
|
|
2385
|
+
onCopy,
|
|
2386
|
+
onThumbsUp,
|
|
2387
|
+
onThumbsDown,
|
|
2439
2388
|
Messages: Messages2 = Messages,
|
|
2440
2389
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
2441
2390
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -2450,7 +2399,7 @@ function CopilotChat({
|
|
|
2450
2399
|
UserMessage: UserMessage2 = UserMessage
|
|
2451
2400
|
}) {
|
|
2452
2401
|
const { additionalInstructions, setChatInstructions } = (0, import_react_core9.useCopilotContext)();
|
|
2453
|
-
(0,
|
|
2402
|
+
(0, import_react13.useEffect)(() => {
|
|
2454
2403
|
if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
|
|
2455
2404
|
setChatInstructions(instructions || "");
|
|
2456
2405
|
return;
|
|
@@ -2477,11 +2426,21 @@ function CopilotChat({
|
|
|
2477
2426
|
onStopGeneration,
|
|
2478
2427
|
onReloadMessages
|
|
2479
2428
|
);
|
|
2480
|
-
const chatContext =
|
|
2429
|
+
const chatContext = import_react13.default.useContext(ChatContext);
|
|
2481
2430
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2431
|
+
const handleRegenerate = () => {
|
|
2432
|
+
if (onRegenerate) {
|
|
2433
|
+
onRegenerate();
|
|
2434
|
+
}
|
|
2435
|
+
reloadMessages();
|
|
2436
|
+
};
|
|
2437
|
+
const handleCopy = (message) => {
|
|
2438
|
+
if (onCopy) {
|
|
2439
|
+
onCopy(message);
|
|
2440
|
+
}
|
|
2441
|
+
};
|
|
2482
2442
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2483
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2484
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2485
2444
|
Messages2,
|
|
2486
2445
|
{
|
|
2487
2446
|
AssistantMessage: AssistantMessage2,
|
|
@@ -2492,32 +2451,32 @@ function CopilotChat({
|
|
|
2492
2451
|
RenderResultMessage: RenderResultMessage2,
|
|
2493
2452
|
messages: visibleMessages,
|
|
2494
2453
|
inProgress: isLoading,
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2511
|
-
ResponseButton2,
|
|
2512
|
-
{
|
|
2513
|
-
onClick: isLoading ? stopGeneration : reloadMessages,
|
|
2514
|
-
inProgress: isLoading
|
|
2515
|
-
}
|
|
2516
|
-
)
|
|
2517
|
-
]
|
|
2454
|
+
onRegenerate: handleRegenerate,
|
|
2455
|
+
onCopy: handleCopy,
|
|
2456
|
+
onThumbsUp,
|
|
2457
|
+
onThumbsDown,
|
|
2458
|
+
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2459
|
+
Suggestion,
|
|
2460
|
+
{
|
|
2461
|
+
title: suggestion.title,
|
|
2462
|
+
message: suggestion.message,
|
|
2463
|
+
partial: suggestion.partial,
|
|
2464
|
+
className: suggestion.className,
|
|
2465
|
+
onClick: (message) => sendMessage(message)
|
|
2466
|
+
},
|
|
2467
|
+
index
|
|
2468
|
+
)) })
|
|
2518
2469
|
}
|
|
2519
2470
|
),
|
|
2520
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2471
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2472
|
+
Input2,
|
|
2473
|
+
{
|
|
2474
|
+
inProgress: isLoading,
|
|
2475
|
+
onSend: sendMessage,
|
|
2476
|
+
isVisible,
|
|
2477
|
+
onStop: stopGeneration
|
|
2478
|
+
}
|
|
2479
|
+
)
|
|
2521
2480
|
] });
|
|
2522
2481
|
}
|
|
2523
2482
|
function WrappedCopilotChat({
|
|
@@ -2526,7 +2485,7 @@ function WrappedCopilotChat({
|
|
|
2526
2485
|
labels,
|
|
2527
2486
|
className
|
|
2528
2487
|
}) {
|
|
2529
|
-
const chatContext =
|
|
2488
|
+
const chatContext = import_react13.default.useContext(ChatContext);
|
|
2530
2489
|
if (!chatContext) {
|
|
2531
2490
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2532
2491
|
}, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
@@ -2547,9 +2506,9 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2547
2506
|
id: (0, import_shared3.randomId)(),
|
|
2548
2507
|
makeSystemMessage
|
|
2549
2508
|
});
|
|
2550
|
-
const [currentSuggestions, setCurrentSuggestions] = (0,
|
|
2551
|
-
const suggestionsAbortControllerRef = (0,
|
|
2552
|
-
const debounceTimerRef = (0,
|
|
2509
|
+
const [currentSuggestions, setCurrentSuggestions] = (0, import_react13.useState)([]);
|
|
2510
|
+
const suggestionsAbortControllerRef = (0, import_react13.useRef)(null);
|
|
2511
|
+
const debounceTimerRef = (0, import_react13.useRef)();
|
|
2553
2512
|
const abortSuggestions = () => {
|
|
2554
2513
|
var _a2;
|
|
2555
2514
|
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
@@ -2558,7 +2517,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2558
2517
|
const generalContext = (0, import_react_core9.useCopilotContext)();
|
|
2559
2518
|
const messagesContext = (0, import_react_core9.useCopilotMessagesContext)();
|
|
2560
2519
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2561
|
-
(0,
|
|
2520
|
+
(0, import_react13.useEffect)(() => {
|
|
2562
2521
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
2563
2522
|
abortSuggestions();
|
|
2564
2523
|
debounceTimerRef.current = setTimeout(
|
|
@@ -2719,7 +2678,7 @@ var CopilotModal = ({
|
|
|
2719
2678
|
className,
|
|
2720
2679
|
children
|
|
2721
2680
|
}) => {
|
|
2722
|
-
const [openState, setOpenState] =
|
|
2681
|
+
const [openState, setOpenState] = import_react14.default.useState(defaultOpen);
|
|
2723
2682
|
const setOpen = (open) => {
|
|
2724
2683
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
2725
2684
|
setOpenState(open);
|
|
@@ -2766,7 +2725,7 @@ function CopilotSidebar(props) {
|
|
|
2766
2725
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2767
2726
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
2768
2727
|
});
|
|
2769
|
-
const [expandedClassName, setExpandedClassName] = (0,
|
|
2728
|
+
const [expandedClassName, setExpandedClassName] = (0, import_react15.useState)(
|
|
2770
2729
|
props.defaultOpen ? "sidebarExpanded" : ""
|
|
2771
2730
|
);
|
|
2772
2731
|
const onSetOpen = (open) => {
|