@copilotkit/react-ui 1.51.4-next.7 → 1.51.4-next.8
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 +9 -0
- package/README.md +18 -12
- package/dist/{chunk-O72ZB5V3.mjs → chunk-2QEDCM6H.mjs} +22 -12
- package/dist/chunk-2QEDCM6H.mjs.map +1 -0
- package/dist/{chunk-54JAUBUJ.mjs → chunk-6SMTHXVA.mjs} +4 -2
- package/dist/chunk-6SMTHXVA.mjs.map +1 -0
- package/dist/{chunk-IEMQ2SQW.mjs → chunk-6TLDRWAD.mjs} +5 -3
- package/dist/{chunk-IEMQ2SQW.mjs.map → chunk-6TLDRWAD.mjs.map} +1 -1
- package/dist/{chunk-UFN2VWSR.mjs → chunk-72FQQMQ2.mjs} +2 -2
- package/dist/chunk-72FQQMQ2.mjs.map +1 -0
- package/dist/{chunk-ELGRNEAO.mjs → chunk-AOUHT4JR.mjs} +4 -2
- package/dist/chunk-AOUHT4JR.mjs.map +1 -0
- package/dist/{chunk-C3GSYRC3.mjs → chunk-BNJX66OH.mjs} +2 -2
- package/dist/{chunk-NRA3CFEE.mjs → chunk-C27LZFA5.mjs} +2 -2
- package/dist/{chunk-FFJHOZX6.mjs → chunk-C7WM7GM3.mjs} +44 -11
- package/dist/chunk-C7WM7GM3.mjs.map +1 -0
- package/dist/{chunk-6TWQUA2Q.mjs → chunk-CNIC5HO5.mjs} +8 -3
- package/dist/chunk-CNIC5HO5.mjs.map +1 -0
- package/dist/chunk-CQCXH5LY.mjs +143 -0
- package/dist/chunk-CQCXH5LY.mjs.map +1 -0
- package/dist/{chunk-RYUCX3ZK.mjs → chunk-DM2V5WTG.mjs} +4 -2
- package/dist/chunk-DM2V5WTG.mjs.map +1 -0
- package/dist/{chunk-JZ3RFQQ6.mjs → chunk-DSHTRV2R.mjs} +16 -4
- package/dist/chunk-DSHTRV2R.mjs.map +1 -0
- package/dist/{chunk-GDSZGYCE.mjs → chunk-EACIYBQH.mjs} +3 -3
- package/dist/{chunk-XWG3L6QC.mjs → chunk-GBAPANZE.mjs} +76 -11
- package/dist/chunk-GBAPANZE.mjs.map +1 -0
- package/dist/{chunk-Q5V6S67N.mjs → chunk-GFE5ZSPV.mjs} +15 -6
- package/dist/chunk-GFE5ZSPV.mjs.map +1 -0
- package/dist/{chunk-VHKHX7GV.mjs → chunk-HHLX4MQN.mjs} +2 -2
- package/dist/{chunk-WNX755OE.mjs → chunk-ICA2EXIX.mjs} +7 -4
- package/dist/chunk-ICA2EXIX.mjs.map +1 -0
- package/dist/{chunk-QIOJXTIQ.mjs → chunk-IWOCQACI.mjs} +12 -3
- package/dist/chunk-IWOCQACI.mjs.map +1 -0
- package/dist/{chunk-BH6PCAAL.mjs → chunk-JYHRHKV5.mjs} +12 -3
- package/dist/chunk-JYHRHKV5.mjs.map +1 -0
- package/dist/{chunk-IK2BPURM.mjs → chunk-LIXN3OVQ.mjs} +12 -7
- package/dist/chunk-LIXN3OVQ.mjs.map +1 -0
- package/dist/{chunk-PD36EMOZ.mjs → chunk-MC6PY7XH.mjs} +75 -54
- package/dist/chunk-MC6PY7XH.mjs.map +1 -0
- package/dist/{chunk-LYYDXL2G.mjs → chunk-OQWEOBRX.mjs} +3 -3
- package/dist/chunk-OQWEOBRX.mjs.map +1 -0
- package/dist/{chunk-LBR23XXF.mjs → chunk-P34CL4LC.mjs} +4 -4
- package/dist/{chunk-F2CDEOFX.mjs → chunk-PF3QBO7V.mjs} +2 -2
- package/dist/chunk-PF3QBO7V.mjs.map +1 -0
- package/dist/{chunk-7CMZ7YPQ.mjs → chunk-PP2A5RP6.mjs} +2 -2
- package/dist/{chunk-7CMZ7YPQ.mjs.map → chunk-PP2A5RP6.mjs.map} +1 -1
- package/dist/{chunk-RKQM2AE5.mjs → chunk-Q64GLWPQ.mjs} +2 -2
- package/dist/{chunk-RKQM2AE5.mjs.map → chunk-Q64GLWPQ.mjs.map} +1 -1
- package/dist/{chunk-OHGUQZJT.mjs → chunk-T4NNQG6T.mjs} +50 -41
- package/dist/chunk-T4NNQG6T.mjs.map +1 -0
- package/dist/{chunk-DBKRAOH7.mjs → chunk-TGM5PKBF.mjs} +16 -6
- package/dist/chunk-TGM5PKBF.mjs.map +1 -0
- package/dist/{chunk-JY2CSDKN.mjs → chunk-YDJ4YUUF.mjs} +22 -16
- package/dist/chunk-YDJ4YUUF.mjs.map +1 -0
- package/dist/components/chat/Button.js +3 -1
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +3 -3
- package/dist/components/chat/Chat.js +285 -132
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +18 -18
- package/dist/components/chat/ChatContext.js +63 -9
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +2 -2
- package/dist/components/chat/CodeBlock.js +20 -6
- package/dist/components/chat/CodeBlock.js.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +3 -3
- package/dist/components/chat/Header.js +88 -28
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +8 -8
- package/dist/components/chat/Icons.js +75 -10
- package/dist/components/chat/Icons.js.map +1 -1
- package/dist/components/chat/Icons.mjs +1 -1
- package/dist/components/chat/Input.js +90 -62
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +6 -6
- package/dist/components/chat/Markdown.js +34 -8
- package/dist/components/chat/Markdown.js.map +1 -1
- package/dist/components/chat/Markdown.mjs +4 -4
- package/dist/components/chat/Messages.js +59 -16
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +11 -11
- package/dist/components/chat/Modal.js +403 -189
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +27 -27
- package/dist/components/chat/Popup.js +403 -189
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +28 -28
- package/dist/components/chat/PoweredByTag.d.ts +1 -1
- package/dist/components/chat/PoweredByTag.js +3 -1
- package/dist/components/chat/PoweredByTag.js.map +1 -1
- package/dist/components/chat/PoweredByTag.mjs +1 -1
- package/dist/components/chat/Sidebar.js +403 -189
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +28 -28
- package/dist/components/chat/Suggestion.d.ts +1 -1
- package/dist/components/chat/Suggestion.js +13 -2
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +2 -2
- package/dist/components/chat/Suggestions.js +13 -2
- package/dist/components/chat/Suggestions.js.map +1 -1
- package/dist/components/chat/Suggestions.mjs +3 -3
- package/dist/components/chat/Textarea.js +4 -1
- package/dist/components/chat/Textarea.js.map +1 -1
- package/dist/components/chat/Textarea.mjs +1 -1
- package/dist/components/chat/Window.js +3 -1
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +3 -3
- package/dist/components/chat/index.js +403 -189
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +29 -29
- package/dist/components/chat/messages/AssistantMessage.js +37 -9
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +6 -6
- package/dist/components/chat/messages/ErrorMessage.js +65 -31
- package/dist/components/chat/messages/ErrorMessage.js.map +1 -1
- package/dist/components/chat/messages/ErrorMessage.mjs +33 -27
- package/dist/components/chat/messages/ErrorMessage.mjs.map +1 -1
- package/dist/components/chat/messages/ImageRenderer.js +15 -5
- package/dist/components/chat/messages/ImageRenderer.js.map +1 -1
- package/dist/components/chat/messages/ImageRenderer.mjs +1 -1
- package/dist/components/chat/messages/LegacyRenderMessage.js +55 -15
- package/dist/components/chat/messages/LegacyRenderMessage.js.map +1 -1
- package/dist/components/chat/messages/LegacyRenderMessage.mjs +10 -10
- package/dist/components/chat/messages/RenderMessage.js +55 -15
- package/dist/components/chat/messages/RenderMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderMessage.mjs +9 -9
- package/dist/components/chat/messages/UserMessage.js +3 -1
- package/dist/components/chat/messages/UserMessage.js.map +1 -1
- package/dist/components/chat/messages/UserMessage.mjs +1 -1
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/dev-console/console.js +85 -27
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +6 -6
- package/dist/components/dev-console/icons.js +14 -5
- package/dist/components/dev-console/icons.js.map +1 -1
- package/dist/components/dev-console/icons.mjs +1 -1
- package/dist/components/dev-console/index.js +85 -27
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +6 -6
- package/dist/components/dev-console/utils.js +21 -15
- package/dist/components/dev-console/utils.js.map +1 -1
- package/dist/components/dev-console/utils.mjs +1 -1
- package/dist/components/help-modal/icons.d.ts +1 -1
- package/dist/components/help-modal/icons.js +11 -2
- package/dist/components/help-modal/icons.js.map +1 -1
- package/dist/components/help-modal/icons.mjs +1 -1
- package/dist/components/help-modal/index.js +8 -1
- package/dist/components/help-modal/index.js.map +1 -1
- package/dist/components/help-modal/index.mjs +2 -2
- package/dist/components/help-modal/modal.js +8 -1
- package/dist/components/help-modal/modal.js.map +1 -1
- package/dist/components/help-modal/modal.mjs +2 -2
- package/dist/components/index.js +403 -189
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +29 -29
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -1
- package/dist/hooks/use-copy-to-clipboard.js +3 -1
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +1 -1
- package/dist/hooks/use-push-to-talk.js +17 -10
- package/dist/hooks/use-push-to-talk.js.map +1 -1
- package/dist/hooks/use-push-to-talk.mjs +1 -1
- package/dist/index.js +403 -189
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -34
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/utils.mjs.map +1 -1
- package/package.json +4 -5
- package/src/components/chat/Button.tsx +6 -2
- package/src/components/chat/Chat.tsx +75 -48
- package/src/components/chat/ChatContext.tsx +6 -2
- package/src/components/chat/CodeBlock.tsx +11 -6
- package/src/components/chat/Icons.tsx +45 -10
- package/src/components/chat/Input.tsx +30 -7
- package/src/components/chat/Markdown.tsx +12 -3
- package/src/components/chat/Messages.tsx +24 -8
- package/src/components/chat/Modal.tsx +12 -2
- package/src/components/chat/Popup.tsx +3 -1
- package/src/components/chat/PoweredByTag.tsx +5 -1
- package/src/components/chat/Sidebar.tsx +3 -1
- package/src/components/chat/Suggestion.tsx +6 -1
- package/src/components/chat/Textarea.tsx +15 -3
- package/src/components/chat/messages/AssistantMessage.tsx +12 -4
- package/src/components/chat/messages/ErrorMessage.tsx +3 -1
- package/src/components/chat/messages/ImageRenderer.tsx +17 -5
- package/src/components/chat/messages/LegacyRenderMessage.tsx +4 -1
- package/src/components/chat/messages/UserMessage.tsx +12 -4
- package/src/components/chat/props.ts +13 -3
- package/src/components/dev-console/console.tsx +35 -9
- package/src/components/dev-console/icons.tsx +6 -1
- package/src/components/dev-console/utils.ts +23 -15
- package/src/components/help-modal/icons.tsx +10 -2
- package/src/hooks/use-copy-to-clipboard.tsx +3 -1
- package/src/hooks/use-push-to-talk.tsx +45 -18
- package/src/lib/utils.ts +4 -1
- package/tsconfig.json +1 -1
- package/tsup.config.ts +5 -1
- package/dist/chunk-3W6J75HS.mjs +0 -126
- package/dist/chunk-3W6J75HS.mjs.map +0 -1
- package/dist/chunk-54JAUBUJ.mjs.map +0 -1
- package/dist/chunk-6TWQUA2Q.mjs.map +0 -1
- package/dist/chunk-BH6PCAAL.mjs.map +0 -1
- package/dist/chunk-DBKRAOH7.mjs.map +0 -1
- package/dist/chunk-ELGRNEAO.mjs.map +0 -1
- package/dist/chunk-F2CDEOFX.mjs.map +0 -1
- package/dist/chunk-FFJHOZX6.mjs.map +0 -1
- package/dist/chunk-IK2BPURM.mjs.map +0 -1
- package/dist/chunk-JY2CSDKN.mjs.map +0 -1
- package/dist/chunk-JZ3RFQQ6.mjs.map +0 -1
- package/dist/chunk-LYYDXL2G.mjs.map +0 -1
- package/dist/chunk-O72ZB5V3.mjs.map +0 -1
- package/dist/chunk-OHGUQZJT.mjs.map +0 -1
- package/dist/chunk-PD36EMOZ.mjs.map +0 -1
- package/dist/chunk-Q5V6S67N.mjs.map +0 -1
- package/dist/chunk-QIOJXTIQ.mjs.map +0 -1
- package/dist/chunk-RYUCX3ZK.mjs.map +0 -1
- package/dist/chunk-UFN2VWSR.mjs.map +0 -1
- package/dist/chunk-WNX755OE.mjs.map +0 -1
- package/dist/chunk-XWG3L6QC.mjs.map +0 -1
- /package/dist/{chunk-C3GSYRC3.mjs.map → chunk-BNJX66OH.mjs.map} +0 -0
- /package/dist/{chunk-NRA3CFEE.mjs.map → chunk-C27LZFA5.mjs.map} +0 -0
- /package/dist/{chunk-GDSZGYCE.mjs.map → chunk-EACIYBQH.mjs.map} +0 -0
- /package/dist/{chunk-VHKHX7GV.mjs.map → chunk-HHLX4MQN.mjs.map} +0 -0
- /package/dist/{chunk-LBR23XXF.mjs.map → chunk-P34CL4LC.mjs.map} +0 -0
|
@@ -117,7 +117,14 @@ var CloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
117
117
|
stroke: "currentColor",
|
|
118
118
|
width: "24",
|
|
119
119
|
height: "24",
|
|
120
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
|
+
"path",
|
|
122
|
+
{
|
|
123
|
+
strokeLinecap: "round",
|
|
124
|
+
strokeLinejoin: "round",
|
|
125
|
+
d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
126
|
+
}
|
|
127
|
+
)
|
|
121
128
|
}
|
|
122
129
|
);
|
|
123
130
|
var HeaderCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -130,7 +137,14 @@ var HeaderCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
130
137
|
stroke: "currentColor",
|
|
131
138
|
width: "24",
|
|
132
139
|
height: "24",
|
|
133
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
|
+
"path",
|
|
142
|
+
{
|
|
143
|
+
strokeLinecap: "round",
|
|
144
|
+
strokeLinejoin: "round",
|
|
145
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
146
|
+
}
|
|
147
|
+
)
|
|
134
148
|
}
|
|
135
149
|
);
|
|
136
150
|
var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -143,7 +157,14 @@ var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
143
157
|
stroke: "currentColor",
|
|
144
158
|
width: "24",
|
|
145
159
|
height: "24",
|
|
146
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
160
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
161
|
+
"path",
|
|
162
|
+
{
|
|
163
|
+
strokeLinecap: "round",
|
|
164
|
+
strokeLinejoin: "round",
|
|
165
|
+
d: "M12 19V5m0 0l-7 7m7-7l7 7"
|
|
166
|
+
}
|
|
167
|
+
)
|
|
147
168
|
}
|
|
148
169
|
);
|
|
149
170
|
var MicrophoneIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -228,12 +249,42 @@ var CopyIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
228
249
|
)
|
|
229
250
|
}
|
|
230
251
|
);
|
|
231
|
-
var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
232
|
-
|
|
252
|
+
var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
253
|
+
"span",
|
|
254
|
+
{
|
|
255
|
+
className: "copilotKitSpinner",
|
|
256
|
+
style: { width: "13px", height: "13px" }
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
260
|
+
"span",
|
|
261
|
+
{
|
|
262
|
+
className: "copilotKitSpinner",
|
|
263
|
+
style: { width: "24px", height: "24px" }
|
|
264
|
+
}
|
|
265
|
+
);
|
|
233
266
|
var ActivityIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
234
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
235
|
-
|
|
236
|
-
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
268
|
+
"span",
|
|
269
|
+
{
|
|
270
|
+
className: "copilotKitActivityDot",
|
|
271
|
+
style: { animationDelay: "0s" }
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
275
|
+
"span",
|
|
276
|
+
{
|
|
277
|
+
className: "copilotKitActivityDot",
|
|
278
|
+
style: { animationDelay: "0.2s" }
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
282
|
+
"span",
|
|
283
|
+
{
|
|
284
|
+
className: "copilotKitActivityDot",
|
|
285
|
+
style: { animationDelay: "0.4s" }
|
|
286
|
+
}
|
|
287
|
+
)
|
|
237
288
|
] });
|
|
238
289
|
var ThumbsUpIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
239
290
|
"svg",
|
|
@@ -308,7 +359,14 @@ var UploadIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
308
359
|
stroke: "currentColor",
|
|
309
360
|
width: "24",
|
|
310
361
|
height: "24",
|
|
311
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
362
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
363
|
+
"path",
|
|
364
|
+
{
|
|
365
|
+
strokeLinecap: "round",
|
|
366
|
+
strokeLinejoin: "round",
|
|
367
|
+
d: "M12 4.5v15m7.5-7.5h-15"
|
|
368
|
+
}
|
|
369
|
+
)
|
|
312
370
|
}
|
|
313
371
|
);
|
|
314
372
|
var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -322,13 +380,22 @@ var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
322
380
|
width: "16",
|
|
323
381
|
height: "16",
|
|
324
382
|
style: { minWidth: "16px", minHeight: "16px" },
|
|
325
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
384
|
+
"path",
|
|
385
|
+
{
|
|
386
|
+
strokeLinecap: "round",
|
|
387
|
+
strokeLinejoin: "round",
|
|
388
|
+
d: "M4.5 12.75l6 6 9-13.5"
|
|
389
|
+
}
|
|
390
|
+
)
|
|
326
391
|
}
|
|
327
392
|
);
|
|
328
393
|
|
|
329
394
|
// src/components/chat/ChatContext.tsx
|
|
330
395
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
331
|
-
var ChatContext = import_react.default.createContext(
|
|
396
|
+
var ChatContext = import_react.default.createContext(
|
|
397
|
+
void 0
|
|
398
|
+
);
|
|
332
399
|
function useChatContext() {
|
|
333
400
|
const context = import_react.default.useContext(ChatContext);
|
|
334
401
|
if (context === void 0) {
|
|
@@ -536,24 +603,30 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
|
536
603
|
return parsedVersion;
|
|
537
604
|
}
|
|
538
605
|
} catch (error) {
|
|
539
|
-
console.error(
|
|
606
|
+
console.error(
|
|
607
|
+
"Failed to parse CopilotKitVersion from localStorage",
|
|
608
|
+
error
|
|
609
|
+
);
|
|
540
610
|
}
|
|
541
611
|
}
|
|
542
612
|
try {
|
|
543
|
-
const response = yield fetch(
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
613
|
+
const response = yield fetch(
|
|
614
|
+
"https://api.cloud.copilotkit.ai/check-for-updates",
|
|
615
|
+
{
|
|
616
|
+
method: "POST",
|
|
617
|
+
headers: {
|
|
618
|
+
"Content-Type": "application/json"
|
|
619
|
+
},
|
|
620
|
+
body: JSON.stringify({
|
|
621
|
+
packages: [
|
|
622
|
+
{
|
|
623
|
+
packageName: "@copilotkit/shared",
|
|
624
|
+
packageVersion: current
|
|
625
|
+
}
|
|
626
|
+
]
|
|
627
|
+
})
|
|
628
|
+
}
|
|
629
|
+
);
|
|
557
630
|
const data = yield response.json();
|
|
558
631
|
const version = {
|
|
559
632
|
current,
|
|
@@ -707,13 +780,22 @@ var CheckIcon2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
|
707
780
|
viewBox: "0 0 14 14",
|
|
708
781
|
version: "1.1",
|
|
709
782
|
xmlns: "http://www.w3.org/2000/svg",
|
|
710
|
-
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)(
|
|
711
|
-
"
|
|
783
|
+
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)(
|
|
784
|
+
"g",
|
|
712
785
|
{
|
|
713
|
-
|
|
714
|
-
|
|
786
|
+
id: "Group-2",
|
|
787
|
+
transform: "translate(-118, 0)",
|
|
788
|
+
fill: "#1BC030",
|
|
789
|
+
fillRule: "nonzero",
|
|
790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
791
|
+
"path",
|
|
792
|
+
{
|
|
793
|
+
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",
|
|
794
|
+
id: "Shape"
|
|
795
|
+
}
|
|
796
|
+
) })
|
|
715
797
|
}
|
|
716
|
-
) })
|
|
798
|
+
) })
|
|
717
799
|
}
|
|
718
800
|
);
|
|
719
801
|
|
|
@@ -736,7 +818,14 @@ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
|
736
818
|
stroke: "currentColor",
|
|
737
819
|
width: "20",
|
|
738
820
|
height: "20",
|
|
739
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
821
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
822
|
+
"path",
|
|
823
|
+
{
|
|
824
|
+
strokeLinecap: "round",
|
|
825
|
+
strokeLinejoin: "round",
|
|
826
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
827
|
+
}
|
|
828
|
+
)
|
|
740
829
|
}
|
|
741
830
|
);
|
|
742
831
|
|
|
@@ -841,7 +930,9 @@ function CopilotDevConsole() {
|
|
|
841
930
|
const [versionStatus, setVersionStatus] = (0, import_react4.useState)("unknown");
|
|
842
931
|
const [latestVersion, setLatestVersion] = (0, import_react4.useState)("");
|
|
843
932
|
const consoleRef = (0, import_react4.useRef)(null);
|
|
844
|
-
const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)(
|
|
933
|
+
const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)(
|
|
934
|
+
"full"
|
|
935
|
+
);
|
|
845
936
|
const checkForUpdates = (force = false) => {
|
|
846
937
|
setVersionStatus("checking");
|
|
847
938
|
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
@@ -982,8 +1073,22 @@ function DebugMenuButton({
|
|
|
982
1073
|
className: "copilotKitDebugMenu",
|
|
983
1074
|
style: { zIndex: 40 },
|
|
984
1075
|
children: [
|
|
985
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
986
|
-
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1077
|
+
"button",
|
|
1078
|
+
{
|
|
1079
|
+
className: "copilotKitDebugMenuItem",
|
|
1080
|
+
onClick: () => logReadables(context),
|
|
1081
|
+
children: "Log Readables"
|
|
1082
|
+
}
|
|
1083
|
+
) }),
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1085
|
+
"button",
|
|
1086
|
+
{
|
|
1087
|
+
className: "copilotKitDebugMenuItem",
|
|
1088
|
+
onClick: () => logActions(context),
|
|
1089
|
+
children: "Log Actions"
|
|
1090
|
+
}
|
|
1091
|
+
) }),
|
|
987
1092
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
988
1093
|
"button",
|
|
989
1094
|
{
|
|
@@ -992,9 +1097,23 @@ function DebugMenuButton({
|
|
|
992
1097
|
children: "Log Messages"
|
|
993
1098
|
}
|
|
994
1099
|
) }),
|
|
995
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1100
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1101
|
+
"button",
|
|
1102
|
+
{
|
|
1103
|
+
className: "copilotKitDebugMenuItem",
|
|
1104
|
+
onClick: () => checkForUpdates(true),
|
|
1105
|
+
children: "Check for Updates"
|
|
1106
|
+
}
|
|
1107
|
+
) }),
|
|
996
1108
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", {}),
|
|
997
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1110
|
+
"button",
|
|
1111
|
+
{
|
|
1112
|
+
className: "copilotKitDebugMenuItem",
|
|
1113
|
+
onClick: () => setShowDevConsole(false),
|
|
1114
|
+
children: "Hide Dev Console"
|
|
1115
|
+
}
|
|
1116
|
+
) })
|
|
998
1117
|
]
|
|
999
1118
|
}
|
|
1000
1119
|
)
|
|
@@ -1040,7 +1159,9 @@ var getTextContent = (content) => {
|
|
|
1040
1159
|
return part.text;
|
|
1041
1160
|
}
|
|
1042
1161
|
return void 0;
|
|
1043
|
-
}).filter(
|
|
1162
|
+
}).filter(
|
|
1163
|
+
(value) => typeof value === "string" && value.length > 0
|
|
1164
|
+
).join(" ").trim() || void 0;
|
|
1044
1165
|
};
|
|
1045
1166
|
var UserMessage = (props) => {
|
|
1046
1167
|
const { message, ImageRenderer: ImageRenderer2 } = props;
|
|
@@ -1064,7 +1185,9 @@ var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
|
1064
1185
|
|
|
1065
1186
|
// src/hooks/use-copy-to-clipboard.tsx
|
|
1066
1187
|
var React5 = __toESM(require("react"));
|
|
1067
|
-
function useCopyToClipboard({
|
|
1188
|
+
function useCopyToClipboard({
|
|
1189
|
+
timeout = 2e3
|
|
1190
|
+
}) {
|
|
1068
1191
|
const [isCopied, setIsCopied] = React5.useState(false);
|
|
1069
1192
|
const copyToClipboard = (value) => {
|
|
1070
1193
|
var _a;
|
|
@@ -1122,9 +1245,7 @@ var generateRandomString = (length, lowercase = false) => {
|
|
|
1122
1245
|
};
|
|
1123
1246
|
var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
|
|
1124
1247
|
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
1125
|
-
const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react6.useState)(
|
|
1126
|
-
() => import_react_syntax_highlighter.Light
|
|
1127
|
-
);
|
|
1248
|
+
const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react6.useState)(() => import_react_syntax_highlighter.Light);
|
|
1128
1249
|
(0, import_react6.useEffect)(() => {
|
|
1129
1250
|
try {
|
|
1130
1251
|
new RegExp("(?<=#)\\w+");
|
|
@@ -1163,7 +1284,14 @@ var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
|
|
|
1163
1284
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1164
1285
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1165
1286
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1166
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1287
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1288
|
+
"button",
|
|
1289
|
+
{
|
|
1290
|
+
className: "copilotKitCodeBlockToolbarButton",
|
|
1291
|
+
onClick: downloadAsFile,
|
|
1292
|
+
children: DownloadIcon
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1167
1295
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1168
1296
|
] })
|
|
1169
1297
|
] }),
|
|
@@ -1475,7 +1603,16 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
|
1475
1603
|
var defaultComponents = {
|
|
1476
1604
|
a(_a) {
|
|
1477
1605
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1478
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1607
|
+
"a",
|
|
1608
|
+
__spreadProps(__spreadValues({
|
|
1609
|
+
className: "copilotKitMarkdownElement"
|
|
1610
|
+
}, props), {
|
|
1611
|
+
target: "_blank",
|
|
1612
|
+
rel: "noopener noreferrer",
|
|
1613
|
+
children
|
|
1614
|
+
})
|
|
1615
|
+
);
|
|
1479
1616
|
},
|
|
1480
1617
|
// @ts-expect-error -- inline
|
|
1481
1618
|
code(_c) {
|
|
@@ -1573,7 +1710,10 @@ var Markdown = ({ content, components }) => {
|
|
|
1573
1710
|
MemoizedReactMarkdown,
|
|
1574
1711
|
{
|
|
1575
1712
|
components: __spreadValues(__spreadValues({}, defaultComponents), components),
|
|
1576
|
-
remarkPlugins: [
|
|
1713
|
+
remarkPlugins: [
|
|
1714
|
+
import_remark_gfm.default,
|
|
1715
|
+
[import_remark_math.default, { singleDollarTextMath: false }]
|
|
1716
|
+
],
|
|
1577
1717
|
rehypePlugins: [import_rehype_raw.default],
|
|
1578
1718
|
children: content
|
|
1579
1719
|
}
|
|
@@ -1692,7 +1832,11 @@ var AssistantMessage = (props) => {
|
|
|
1692
1832
|
// src/components/chat/messages/ImageRenderer.tsx
|
|
1693
1833
|
var import_react9 = require("react");
|
|
1694
1834
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1695
|
-
var ImageRenderer = ({
|
|
1835
|
+
var ImageRenderer = ({
|
|
1836
|
+
image,
|
|
1837
|
+
content,
|
|
1838
|
+
className = ""
|
|
1839
|
+
}) => {
|
|
1696
1840
|
const [imageError, setImageError] = (0, import_react9.useState)(false);
|
|
1697
1841
|
const imageSrc = `data:image/${image.format};base64,${image.bytes}`;
|
|
1698
1842
|
const altText = content || "User uploaded image";
|
|
@@ -1700,10 +1844,16 @@ var ImageRenderer = ({ image, content, className = "" }) => {
|
|
|
1700
1844
|
setImageError(true);
|
|
1701
1845
|
};
|
|
1702
1846
|
if (imageError) {
|
|
1703
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1848
|
+
"div",
|
|
1849
|
+
{
|
|
1850
|
+
className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`,
|
|
1851
|
+
children: [
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
|
|
1853
|
+
content && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
|
|
1854
|
+
]
|
|
1855
|
+
}
|
|
1856
|
+
);
|
|
1707
1857
|
}
|
|
1708
1858
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `copilotKitImageRendering ${className}`, children: [
|
|
1709
1859
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -1936,7 +2086,10 @@ var Messages = ({
|
|
|
1936
2086
|
var _a;
|
|
1937
2087
|
const { labels, icons } = useChatContext();
|
|
1938
2088
|
const { messages: visibleMessages, interrupt } = (0, import_react_core5.useCopilotChatInternal)();
|
|
1939
|
-
const initialMessages = (0, import_react10.useMemo)(
|
|
2089
|
+
const initialMessages = (0, import_react10.useMemo)(
|
|
2090
|
+
() => makeInitialMessages(labels.initial),
|
|
2091
|
+
[labels.initial]
|
|
2092
|
+
);
|
|
1940
2093
|
const messages = [...initialMessages, ...visibleMessages];
|
|
1941
2094
|
const { messagesContainerRef, messagesEndRef } = useScrollToBottom(messages);
|
|
1942
2095
|
const hasLegacyProps = !!(RenderTextMessage || RenderActionExecutionMessage || RenderAgentStateMessage || RenderResultMessage || RenderImageMessage);
|
|
@@ -2094,7 +2247,10 @@ var AutoResizingTextarea = (0, import_react11.forwardRef)(
|
|
|
2094
2247
|
}, ref) => {
|
|
2095
2248
|
const internalTextareaRef = (0, import_react11.useRef)(null);
|
|
2096
2249
|
const [maxHeight, setMaxHeight] = (0, import_react11.useState)(0);
|
|
2097
|
-
(0, import_react11.useImperativeHandle)(
|
|
2250
|
+
(0, import_react11.useImperativeHandle)(
|
|
2251
|
+
ref,
|
|
2252
|
+
() => internalTextareaRef.current
|
|
2253
|
+
);
|
|
2098
2254
|
(0, import_react11.useEffect)(() => {
|
|
2099
2255
|
const calculateMaxHeight = () => {
|
|
2100
2256
|
const textarea = internalTextareaRef.current;
|
|
@@ -2144,7 +2300,9 @@ var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
|
2144
2300
|
var import_react12 = require("react");
|
|
2145
2301
|
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
2146
2302
|
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
2147
|
-
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
|
|
2303
|
+
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
|
|
2304
|
+
audio: true
|
|
2305
|
+
});
|
|
2148
2306
|
audioContextRef.current = new window.AudioContext();
|
|
2149
2307
|
yield audioContextRef.current.resume();
|
|
2150
2308
|
}
|
|
@@ -2213,14 +2371,15 @@ var usePushToTalk = ({
|
|
|
2213
2371
|
} else {
|
|
2214
2372
|
stopRecording(mediaRecorderRef);
|
|
2215
2373
|
if (pushToTalkState === "transcribing") {
|
|
2216
|
-
transcribeAudio(
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2374
|
+
transcribeAudio(
|
|
2375
|
+
recordedChunks.current,
|
|
2376
|
+
context.copilotApiConfig.transcribeAudioUrl
|
|
2377
|
+
).then((transcription) => __async(void 0, null, function* () {
|
|
2378
|
+
recordedChunks.current = [];
|
|
2379
|
+
setPushToTalkState("idle");
|
|
2380
|
+
const message = yield sendFunction(transcription);
|
|
2381
|
+
setStartReadingFromMessageId(message.id);
|
|
2382
|
+
}));
|
|
2224
2383
|
}
|
|
2225
2384
|
}
|
|
2226
2385
|
return () => {
|
|
@@ -2235,7 +2394,11 @@ var usePushToTalk = ({
|
|
|
2235
2394
|
const aguiMessages = (0, import_runtime_client_gql2.gqlToAGUI)(context.messages);
|
|
2236
2395
|
const messagesAfterLast = aguiMessages.slice(lastMessageIndex + 1).filter((message) => message.role === "assistant");
|
|
2237
2396
|
const text = messagesAfterLast.map((message) => message.content).join("\n");
|
|
2238
|
-
playAudioResponse(
|
|
2397
|
+
playAudioResponse(
|
|
2398
|
+
text,
|
|
2399
|
+
context.copilotApiConfig.textToSpeechUrl,
|
|
2400
|
+
audioContextRef.current
|
|
2401
|
+
);
|
|
2239
2402
|
setStartReadingFromMessageId(null);
|
|
2240
2403
|
}
|
|
2241
2404
|
}, [startReadingFromMessageId, inProgress]);
|
|
@@ -2257,7 +2420,9 @@ var useDarkMode = () => {
|
|
|
2257
2420
|
|
|
2258
2421
|
// src/components/chat/PoweredByTag.tsx
|
|
2259
2422
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2260
|
-
function PoweredByTag({
|
|
2423
|
+
function PoweredByTag({
|
|
2424
|
+
showPoweredBy = true
|
|
2425
|
+
}) {
|
|
2261
2426
|
const [mounted, setMounted] = (0, import_react13.useState)(false);
|
|
2262
2427
|
const isDark = useDarkMode();
|
|
2263
2428
|
(0, import_react13.useEffect)(() => {
|
|
@@ -2323,7 +2488,13 @@ var Input = ({
|
|
|
2323
2488
|
if (!chatReady)
|
|
2324
2489
|
return { buttonIcon: context.icons.spinnerIcon, buttonAlt: "Loading" };
|
|
2325
2490
|
return isInProgress && !hideStopButton && chatReady ? { buttonIcon: context.icons.stopIcon, buttonAlt: "Stop" } : { buttonIcon: context.icons.sendIcon, buttonAlt: "Send" };
|
|
2326
|
-
}, [
|
|
2491
|
+
}, [
|
|
2492
|
+
isInProgress,
|
|
2493
|
+
chatReady,
|
|
2494
|
+
hideStopButton,
|
|
2495
|
+
context.icons.stopIcon,
|
|
2496
|
+
context.icons.sendIcon
|
|
2497
|
+
]);
|
|
2327
2498
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
2328
2499
|
const { interrupt } = (0, import_react_core7.useCopilotChatInternal)();
|
|
2329
2500
|
const canSend = (0, import_react14.useMemo)(() => {
|
|
@@ -2333,56 +2504,64 @@ var Input = ({
|
|
|
2333
2504
|
return isInProgress && !hideStopButton;
|
|
2334
2505
|
}, [isInProgress, hideStopButton]);
|
|
2335
2506
|
const sendDisabled = !canSend && !canStop;
|
|
2336
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2508
|
+
"div",
|
|
2509
|
+
{
|
|
2510
|
+
className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`,
|
|
2511
|
+
children: [
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2514
|
+
Textarea_default,
|
|
2515
|
+
{
|
|
2516
|
+
ref: textareaRef,
|
|
2517
|
+
placeholder: context.labels.placeholder,
|
|
2518
|
+
autoFocus: false,
|
|
2519
|
+
maxRows: MAX_NEWLINES,
|
|
2520
|
+
value: text,
|
|
2521
|
+
onChange: (event) => setText(event.target.value),
|
|
2522
|
+
onCompositionStart: () => setIsComposing(true),
|
|
2523
|
+
onCompositionEnd: () => setIsComposing(false),
|
|
2524
|
+
onKeyDown: (event) => {
|
|
2525
|
+
if (event.key === "Enter" && !event.shiftKey && !isComposing) {
|
|
2526
|
+
event.preventDefault();
|
|
2527
|
+
if (canSend) {
|
|
2528
|
+
send();
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2354
2531
|
}
|
|
2355
2532
|
}
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2533
|
+
),
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
2535
|
+
onUpload && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { flexGrow: 1 } }),
|
|
2537
|
+
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2538
|
+
"button",
|
|
2539
|
+
{
|
|
2540
|
+
onClick: () => setPushToTalkState(
|
|
2541
|
+
pushToTalkState === "idle" ? "recording" : "transcribing"
|
|
2542
|
+
),
|
|
2543
|
+
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
2544
|
+
children: context.icons.pushToTalkIcon
|
|
2545
|
+
}
|
|
2546
|
+
),
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2548
|
+
"button",
|
|
2549
|
+
{
|
|
2550
|
+
disabled: sendDisabled,
|
|
2551
|
+
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
2552
|
+
"data-copilotkit-in-progress": inProgress,
|
|
2553
|
+
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
2554
|
+
className: "copilotKitInputControlButton",
|
|
2555
|
+
"aria-label": buttonAlt,
|
|
2556
|
+
children: buttonIcon
|
|
2557
|
+
}
|
|
2558
|
+
)
|
|
2559
|
+
] })
|
|
2560
|
+
] }),
|
|
2561
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PoweredByTag, { showPoweredBy })
|
|
2562
|
+
]
|
|
2563
|
+
}
|
|
2564
|
+
);
|
|
2386
2565
|
};
|
|
2387
2566
|
|
|
2388
2567
|
// src/components/chat/Chat.tsx
|
|
@@ -2471,7 +2650,12 @@ var ImageUploadQueue = ({
|
|
|
2471
2650
|
// src/components/chat/Suggestion.tsx
|
|
2472
2651
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
2473
2652
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2474
|
-
function Suggestion({
|
|
2653
|
+
function Suggestion({
|
|
2654
|
+
title,
|
|
2655
|
+
onClick,
|
|
2656
|
+
partial,
|
|
2657
|
+
className
|
|
2658
|
+
}) {
|
|
2475
2659
|
const { isLoading } = (0, import_react_core8.useCopilotChatInternal)();
|
|
2476
2660
|
if (!title)
|
|
2477
2661
|
return null;
|
|
@@ -2565,9 +2749,7 @@ function CopilotChat({
|
|
|
2565
2749
|
const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
|
|
2566
2750
|
const [selectedImages, setSelectedImages] = (0, import_react15.useState)([]);
|
|
2567
2751
|
const [chatError, setChatError] = (0, import_react15.useState)(null);
|
|
2568
|
-
const [messageFeedback, setMessageFeedback] = (0, import_react15.useState)(
|
|
2569
|
-
{}
|
|
2570
|
-
);
|
|
2752
|
+
const [messageFeedback, setMessageFeedback] = (0, import_react15.useState)({});
|
|
2571
2753
|
const fileInputRef = (0, import_react15.useRef)(null);
|
|
2572
2754
|
const triggerObservabilityHook = (0, import_react15.useCallback)(
|
|
2573
2755
|
(hookName, ...args) => {
|
|
@@ -2660,30 +2842,34 @@ function CopilotChat({
|
|
|
2660
2842
|
if (imageItems.length === 0)
|
|
2661
2843
|
return;
|
|
2662
2844
|
e.preventDefault();
|
|
2663
|
-
const imagePromises = imageItems.map(
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2845
|
+
const imagePromises = imageItems.map(
|
|
2846
|
+
(item) => {
|
|
2847
|
+
const file = item.getAsFile();
|
|
2848
|
+
if (!file)
|
|
2849
|
+
return Promise.resolve(null);
|
|
2850
|
+
return new Promise((resolve, reject) => {
|
|
2851
|
+
const reader = new FileReader();
|
|
2852
|
+
reader.onload = (e2) => {
|
|
2853
|
+
var _a2, _b2;
|
|
2854
|
+
const base64String = (_b2 = (_a2 = e2.target) == null ? void 0 : _a2.result) == null ? void 0 : _b2.split(",")[1];
|
|
2855
|
+
if (base64String) {
|
|
2856
|
+
resolve({
|
|
2857
|
+
contentType: file.type,
|
|
2858
|
+
bytes: base64String
|
|
2859
|
+
});
|
|
2860
|
+
} else {
|
|
2861
|
+
resolve(null);
|
|
2862
|
+
}
|
|
2863
|
+
};
|
|
2864
|
+
reader.onerror = reject;
|
|
2865
|
+
reader.readAsDataURL(file);
|
|
2866
|
+
});
|
|
2867
|
+
}
|
|
2868
|
+
);
|
|
2685
2869
|
try {
|
|
2686
|
-
const loadedImages = (yield Promise.all(imagePromises)).filter(
|
|
2870
|
+
const loadedImages = (yield Promise.all(imagePromises)).filter(
|
|
2871
|
+
(img) => img !== null
|
|
2872
|
+
);
|
|
2687
2873
|
setSelectedImages((prev) => [...prev, ...loadedImages]);
|
|
2688
2874
|
} catch (error) {
|
|
2689
2875
|
triggerChatError(error, "processClipboardImages", error);
|
|
@@ -2764,25 +2950,29 @@ function CopilotChat({
|
|
|
2764
2950
|
if (!event.target.files || event.target.files.length === 0) {
|
|
2765
2951
|
return;
|
|
2766
2952
|
}
|
|
2767
|
-
const files = Array.from(event.target.files).filter(
|
|
2953
|
+
const files = Array.from(event.target.files).filter(
|
|
2954
|
+
(file) => file.type.startsWith("image/")
|
|
2955
|
+
);
|
|
2768
2956
|
if (files.length === 0)
|
|
2769
2957
|
return;
|
|
2770
2958
|
const fileReadPromises = files.map((file) => {
|
|
2771
|
-
return new Promise(
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2959
|
+
return new Promise(
|
|
2960
|
+
(resolve, reject) => {
|
|
2961
|
+
const reader = new FileReader();
|
|
2962
|
+
reader.onload = (e) => {
|
|
2963
|
+
var _a, _b;
|
|
2964
|
+
const base64String = ((_b = (_a = e.target) == null ? void 0 : _a.result) == null ? void 0 : _b.split(",")[1]) || "";
|
|
2965
|
+
if (base64String) {
|
|
2966
|
+
resolve({
|
|
2967
|
+
contentType: file.type,
|
|
2968
|
+
bytes: base64String
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2971
|
+
};
|
|
2972
|
+
reader.onerror = reject;
|
|
2973
|
+
reader.readAsDataURL(file);
|
|
2974
|
+
}
|
|
2975
|
+
);
|
|
2786
2976
|
});
|
|
2787
2977
|
try {
|
|
2788
2978
|
const loadedImages = yield Promise.all(fileReadPromises);
|
|
@@ -2853,7 +3043,13 @@ function CopilotChat({
|
|
|
2853
3043
|
}
|
|
2854
3044
|
),
|
|
2855
3045
|
imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2856
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3046
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3047
|
+
ImageUploadQueue,
|
|
3048
|
+
{
|
|
3049
|
+
images: selectedImages,
|
|
3050
|
+
onRemoveImage: removeSelectedImage
|
|
3051
|
+
}
|
|
3052
|
+
),
|
|
2857
3053
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2858
3054
|
"input",
|
|
2859
3055
|
{
|
|
@@ -2891,8 +3087,17 @@ function WrappedCopilotChat({
|
|
|
2891
3087
|
}) {
|
|
2892
3088
|
const chatContext = import_react15.default.useContext(ChatContext);
|
|
2893
3089
|
if (!chatContext) {
|
|
2894
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2895
|
-
|
|
3090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3091
|
+
ChatContextProvider,
|
|
3092
|
+
{
|
|
3093
|
+
icons,
|
|
3094
|
+
labels,
|
|
3095
|
+
open: true,
|
|
3096
|
+
setOpen: () => {
|
|
3097
|
+
},
|
|
3098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children })
|
|
3099
|
+
}
|
|
3100
|
+
);
|
|
2896
3101
|
}
|
|
2897
3102
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children });
|
|
2898
3103
|
}
|
|
@@ -3041,37 +3246,46 @@ var CopilotModal = (_a) => {
|
|
|
3041
3246
|
"observabilityHooks"
|
|
3042
3247
|
]);
|
|
3043
3248
|
const [openState, setOpenState] = import_react16.default.useState(defaultOpen);
|
|
3044
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3250
|
+
ChatContextProvider,
|
|
3251
|
+
{
|
|
3252
|
+
icons,
|
|
3253
|
+
labels,
|
|
3254
|
+
open: openState,
|
|
3255
|
+
setOpen: setOpenState,
|
|
3256
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3257
|
+
CopilotModalInner,
|
|
3258
|
+
__spreadProps(__spreadValues({
|
|
3259
|
+
observabilityHooks,
|
|
3260
|
+
onSetOpen,
|
|
3261
|
+
clickOutsideToClose: clickOutsideToClose != null ? clickOutsideToClose : true,
|
|
3262
|
+
hitEscapeToClose: hitEscapeToClose != null ? hitEscapeToClose : true,
|
|
3263
|
+
shortcut: shortcut != null ? shortcut : "/",
|
|
3264
|
+
className,
|
|
3265
|
+
Window: Window2,
|
|
3266
|
+
Button: Button2,
|
|
3267
|
+
Header: Header2,
|
|
3268
|
+
instructions,
|
|
3269
|
+
onSubmitMessage,
|
|
3270
|
+
onStopGeneration,
|
|
3271
|
+
onReloadMessages,
|
|
3272
|
+
makeSystemMessage,
|
|
3273
|
+
onInProgress,
|
|
3274
|
+
Messages: Messages2,
|
|
3275
|
+
Input: Input2,
|
|
3276
|
+
AssistantMessage: AssistantMessage2,
|
|
3277
|
+
UserMessage: UserMessage2,
|
|
3278
|
+
onThumbsUp,
|
|
3279
|
+
onThumbsDown,
|
|
3280
|
+
onCopy,
|
|
3281
|
+
onRegenerate,
|
|
3282
|
+
markdownTagRenderers
|
|
3283
|
+
}, props), {
|
|
3284
|
+
children
|
|
3285
|
+
})
|
|
3286
|
+
)
|
|
3287
|
+
}
|
|
3288
|
+
);
|
|
3075
3289
|
};
|
|
3076
3290
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3077
3291
|
0 && (module.exports = {
|