@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) {
|
|
@@ -411,7 +478,9 @@ var getTextContent = (content) => {
|
|
|
411
478
|
return part.text;
|
|
412
479
|
}
|
|
413
480
|
return void 0;
|
|
414
|
-
}).filter(
|
|
481
|
+
}).filter(
|
|
482
|
+
(value) => typeof value === "string" && value.length > 0
|
|
483
|
+
).join(" ").trim() || void 0;
|
|
415
484
|
};
|
|
416
485
|
var UserMessage = (props) => {
|
|
417
486
|
const { message, ImageRenderer: ImageRenderer2 } = props;
|
|
@@ -435,7 +504,9 @@ var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
|
435
504
|
|
|
436
505
|
// src/hooks/use-copy-to-clipboard.tsx
|
|
437
506
|
var React2 = __toESM(require("react"));
|
|
438
|
-
function useCopyToClipboard({
|
|
507
|
+
function useCopyToClipboard({
|
|
508
|
+
timeout = 2e3
|
|
509
|
+
}) {
|
|
439
510
|
const [isCopied, setIsCopied] = React2.useState(false);
|
|
440
511
|
const copyToClipboard = (value) => {
|
|
441
512
|
var _a;
|
|
@@ -493,9 +564,7 @@ var generateRandomString = (length, lowercase = false) => {
|
|
|
493
564
|
};
|
|
494
565
|
var CodeBlock = (0, import_react2.memo)(({ language, value }) => {
|
|
495
566
|
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
496
|
-
const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react2.useState)(
|
|
497
|
-
() => import_react_syntax_highlighter.Light
|
|
498
|
-
);
|
|
567
|
+
const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react2.useState)(() => import_react_syntax_highlighter.Light);
|
|
499
568
|
(0, import_react2.useEffect)(() => {
|
|
500
569
|
try {
|
|
501
570
|
new RegExp("(?<=#)\\w+");
|
|
@@ -534,7 +603,14 @@ var CodeBlock = (0, import_react2.memo)(({ language, value }) => {
|
|
|
534
603
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
535
604
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
536
605
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
537
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
607
|
+
"button",
|
|
608
|
+
{
|
|
609
|
+
className: "copilotKitCodeBlockToolbarButton",
|
|
610
|
+
onClick: downloadAsFile,
|
|
611
|
+
children: DownloadIcon
|
|
612
|
+
}
|
|
613
|
+
),
|
|
538
614
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
539
615
|
] })
|
|
540
616
|
] }),
|
|
@@ -846,7 +922,16 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
|
846
922
|
var defaultComponents = {
|
|
847
923
|
a(_a) {
|
|
848
924
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
849
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
926
|
+
"a",
|
|
927
|
+
__spreadProps(__spreadValues({
|
|
928
|
+
className: "copilotKitMarkdownElement"
|
|
929
|
+
}, props), {
|
|
930
|
+
target: "_blank",
|
|
931
|
+
rel: "noopener noreferrer",
|
|
932
|
+
children
|
|
933
|
+
})
|
|
934
|
+
);
|
|
850
935
|
},
|
|
851
936
|
// @ts-expect-error -- inline
|
|
852
937
|
code(_c) {
|
|
@@ -944,7 +1029,10 @@ var Markdown = ({ content, components }) => {
|
|
|
944
1029
|
MemoizedReactMarkdown,
|
|
945
1030
|
{
|
|
946
1031
|
components: __spreadValues(__spreadValues({}, defaultComponents), components),
|
|
947
|
-
remarkPlugins: [
|
|
1032
|
+
remarkPlugins: [
|
|
1033
|
+
import_remark_gfm.default,
|
|
1034
|
+
[import_remark_math.default, { singleDollarTextMath: false }]
|
|
1035
|
+
],
|
|
948
1036
|
rehypePlugins: [import_rehype_raw.default],
|
|
949
1037
|
children: content
|
|
950
1038
|
}
|
|
@@ -1063,7 +1151,11 @@ var AssistantMessage = (props) => {
|
|
|
1063
1151
|
// src/components/chat/messages/ImageRenderer.tsx
|
|
1064
1152
|
var import_react5 = require("react");
|
|
1065
1153
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1066
|
-
var ImageRenderer = ({
|
|
1154
|
+
var ImageRenderer = ({
|
|
1155
|
+
image,
|
|
1156
|
+
content,
|
|
1157
|
+
className = ""
|
|
1158
|
+
}) => {
|
|
1067
1159
|
const [imageError, setImageError] = (0, import_react5.useState)(false);
|
|
1068
1160
|
const imageSrc = `data:image/${image.format};base64,${image.bytes}`;
|
|
1069
1161
|
const altText = content || "User uploaded image";
|
|
@@ -1071,10 +1163,16 @@ var ImageRenderer = ({ image, content, className = "" }) => {
|
|
|
1071
1163
|
setImageError(true);
|
|
1072
1164
|
};
|
|
1073
1165
|
if (imageError) {
|
|
1074
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1167
|
+
"div",
|
|
1168
|
+
{
|
|
1169
|
+
className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`,
|
|
1170
|
+
children: [
|
|
1171
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
|
|
1172
|
+
content && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
|
|
1173
|
+
]
|
|
1174
|
+
}
|
|
1175
|
+
);
|
|
1078
1176
|
}
|
|
1079
1177
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `copilotKitImageRendering ${className}`, children: [
|
|
1080
1178
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -1307,7 +1405,10 @@ var Messages = ({
|
|
|
1307
1405
|
var _a;
|
|
1308
1406
|
const { labels, icons } = useChatContext();
|
|
1309
1407
|
const { messages: visibleMessages, interrupt } = (0, import_react_core.useCopilotChatInternal)();
|
|
1310
|
-
const initialMessages = (0, import_react6.useMemo)(
|
|
1408
|
+
const initialMessages = (0, import_react6.useMemo)(
|
|
1409
|
+
() => makeInitialMessages(labels.initial),
|
|
1410
|
+
[labels.initial]
|
|
1411
|
+
);
|
|
1311
1412
|
const messages = [...initialMessages, ...visibleMessages];
|
|
1312
1413
|
const { messagesContainerRef, messagesEndRef } = useScrollToBottom(messages);
|
|
1313
1414
|
const hasLegacyProps = !!(RenderTextMessage || RenderActionExecutionMessage || RenderAgentStateMessage || RenderResultMessage || RenderImageMessage);
|
|
@@ -1465,7 +1566,10 @@ var AutoResizingTextarea = (0, import_react7.forwardRef)(
|
|
|
1465
1566
|
}, ref) => {
|
|
1466
1567
|
const internalTextareaRef = (0, import_react7.useRef)(null);
|
|
1467
1568
|
const [maxHeight, setMaxHeight] = (0, import_react7.useState)(0);
|
|
1468
|
-
(0, import_react7.useImperativeHandle)(
|
|
1569
|
+
(0, import_react7.useImperativeHandle)(
|
|
1570
|
+
ref,
|
|
1571
|
+
() => internalTextareaRef.current
|
|
1572
|
+
);
|
|
1469
1573
|
(0, import_react7.useEffect)(() => {
|
|
1470
1574
|
const calculateMaxHeight = () => {
|
|
1471
1575
|
const textarea = internalTextareaRef.current;
|
|
@@ -1515,7 +1619,9 @@ var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
|
1515
1619
|
var import_react8 = require("react");
|
|
1516
1620
|
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
1517
1621
|
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
1518
|
-
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
|
|
1622
|
+
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
|
|
1623
|
+
audio: true
|
|
1624
|
+
});
|
|
1519
1625
|
audioContextRef.current = new window.AudioContext();
|
|
1520
1626
|
yield audioContextRef.current.resume();
|
|
1521
1627
|
}
|
|
@@ -1584,14 +1690,15 @@ var usePushToTalk = ({
|
|
|
1584
1690
|
} else {
|
|
1585
1691
|
stopRecording(mediaRecorderRef);
|
|
1586
1692
|
if (pushToTalkState === "transcribing") {
|
|
1587
|
-
transcribeAudio(
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1693
|
+
transcribeAudio(
|
|
1694
|
+
recordedChunks.current,
|
|
1695
|
+
context.copilotApiConfig.transcribeAudioUrl
|
|
1696
|
+
).then((transcription) => __async(void 0, null, function* () {
|
|
1697
|
+
recordedChunks.current = [];
|
|
1698
|
+
setPushToTalkState("idle");
|
|
1699
|
+
const message = yield sendFunction(transcription);
|
|
1700
|
+
setStartReadingFromMessageId(message.id);
|
|
1701
|
+
}));
|
|
1595
1702
|
}
|
|
1596
1703
|
}
|
|
1597
1704
|
return () => {
|
|
@@ -1606,7 +1713,11 @@ var usePushToTalk = ({
|
|
|
1606
1713
|
const aguiMessages = (0, import_runtime_client_gql2.gqlToAGUI)(context.messages);
|
|
1607
1714
|
const messagesAfterLast = aguiMessages.slice(lastMessageIndex + 1).filter((message) => message.role === "assistant");
|
|
1608
1715
|
const text = messagesAfterLast.map((message) => message.content).join("\n");
|
|
1609
|
-
playAudioResponse(
|
|
1716
|
+
playAudioResponse(
|
|
1717
|
+
text,
|
|
1718
|
+
context.copilotApiConfig.textToSpeechUrl,
|
|
1719
|
+
audioContextRef.current
|
|
1720
|
+
);
|
|
1610
1721
|
setStartReadingFromMessageId(null);
|
|
1611
1722
|
}
|
|
1612
1723
|
}, [startReadingFromMessageId, inProgress]);
|
|
@@ -1628,7 +1739,9 @@ var useDarkMode = () => {
|
|
|
1628
1739
|
|
|
1629
1740
|
// src/components/chat/PoweredByTag.tsx
|
|
1630
1741
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1631
|
-
function PoweredByTag({
|
|
1742
|
+
function PoweredByTag({
|
|
1743
|
+
showPoweredBy = true
|
|
1744
|
+
}) {
|
|
1632
1745
|
const [mounted, setMounted] = (0, import_react9.useState)(false);
|
|
1633
1746
|
const isDark = useDarkMode();
|
|
1634
1747
|
(0, import_react9.useEffect)(() => {
|
|
@@ -1694,7 +1807,13 @@ var Input = ({
|
|
|
1694
1807
|
if (!chatReady)
|
|
1695
1808
|
return { buttonIcon: context.icons.spinnerIcon, buttonAlt: "Loading" };
|
|
1696
1809
|
return isInProgress && !hideStopButton && chatReady ? { buttonIcon: context.icons.stopIcon, buttonAlt: "Stop" } : { buttonIcon: context.icons.sendIcon, buttonAlt: "Send" };
|
|
1697
|
-
}, [
|
|
1810
|
+
}, [
|
|
1811
|
+
isInProgress,
|
|
1812
|
+
chatReady,
|
|
1813
|
+
hideStopButton,
|
|
1814
|
+
context.icons.stopIcon,
|
|
1815
|
+
context.icons.sendIcon
|
|
1816
|
+
]);
|
|
1698
1817
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1699
1818
|
const { interrupt } = (0, import_react_core3.useCopilotChatInternal)();
|
|
1700
1819
|
const canSend = (0, import_react10.useMemo)(() => {
|
|
@@ -1704,56 +1823,64 @@ var Input = ({
|
|
|
1704
1823
|
return isInProgress && !hideStopButton;
|
|
1705
1824
|
}, [isInProgress, hideStopButton]);
|
|
1706
1825
|
const sendDisabled = !canSend && !canStop;
|
|
1707
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1827
|
+
"div",
|
|
1828
|
+
{
|
|
1829
|
+
className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`,
|
|
1830
|
+
children: [
|
|
1831
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1832
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1833
|
+
Textarea_default,
|
|
1834
|
+
{
|
|
1835
|
+
ref: textareaRef,
|
|
1836
|
+
placeholder: context.labels.placeholder,
|
|
1837
|
+
autoFocus: false,
|
|
1838
|
+
maxRows: MAX_NEWLINES,
|
|
1839
|
+
value: text,
|
|
1840
|
+
onChange: (event) => setText(event.target.value),
|
|
1841
|
+
onCompositionStart: () => setIsComposing(true),
|
|
1842
|
+
onCompositionEnd: () => setIsComposing(false),
|
|
1843
|
+
onKeyDown: (event) => {
|
|
1844
|
+
if (event.key === "Enter" && !event.shiftKey && !isComposing) {
|
|
1845
|
+
event.preventDefault();
|
|
1846
|
+
if (canSend) {
|
|
1847
|
+
send();
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1725
1850
|
}
|
|
1726
1851
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1852
|
+
),
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
1854
|
+
onUpload && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
1855
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { flexGrow: 1 } }),
|
|
1856
|
+
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1857
|
+
"button",
|
|
1858
|
+
{
|
|
1859
|
+
onClick: () => setPushToTalkState(
|
|
1860
|
+
pushToTalkState === "idle" ? "recording" : "transcribing"
|
|
1861
|
+
),
|
|
1862
|
+
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
1863
|
+
children: context.icons.pushToTalkIcon
|
|
1864
|
+
}
|
|
1865
|
+
),
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1867
|
+
"button",
|
|
1868
|
+
{
|
|
1869
|
+
disabled: sendDisabled,
|
|
1870
|
+
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
1871
|
+
"data-copilotkit-in-progress": inProgress,
|
|
1872
|
+
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1873
|
+
className: "copilotKitInputControlButton",
|
|
1874
|
+
"aria-label": buttonAlt,
|
|
1875
|
+
children: buttonIcon
|
|
1876
|
+
}
|
|
1877
|
+
)
|
|
1878
|
+
] })
|
|
1879
|
+
] }),
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PoweredByTag, { showPoweredBy })
|
|
1881
|
+
]
|
|
1882
|
+
}
|
|
1883
|
+
);
|
|
1757
1884
|
};
|
|
1758
1885
|
|
|
1759
1886
|
// src/components/chat/Chat.tsx
|
|
@@ -1842,7 +1969,12 @@ var ImageUploadQueue = ({
|
|
|
1842
1969
|
// src/components/chat/Suggestion.tsx
|
|
1843
1970
|
var import_react_core4 = require("@copilotkit/react-core");
|
|
1844
1971
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1845
|
-
function Suggestion({
|
|
1972
|
+
function Suggestion({
|
|
1973
|
+
title,
|
|
1974
|
+
onClick,
|
|
1975
|
+
partial,
|
|
1976
|
+
className
|
|
1977
|
+
}) {
|
|
1846
1978
|
const { isLoading } = (0, import_react_core4.useCopilotChatInternal)();
|
|
1847
1979
|
if (!title)
|
|
1848
1980
|
return null;
|
|
@@ -1936,9 +2068,7 @@ function CopilotChat({
|
|
|
1936
2068
|
const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
|
|
1937
2069
|
const [selectedImages, setSelectedImages] = (0, import_react11.useState)([]);
|
|
1938
2070
|
const [chatError, setChatError] = (0, import_react11.useState)(null);
|
|
1939
|
-
const [messageFeedback, setMessageFeedback] = (0, import_react11.useState)(
|
|
1940
|
-
{}
|
|
1941
|
-
);
|
|
2071
|
+
const [messageFeedback, setMessageFeedback] = (0, import_react11.useState)({});
|
|
1942
2072
|
const fileInputRef = (0, import_react11.useRef)(null);
|
|
1943
2073
|
const triggerObservabilityHook = (0, import_react11.useCallback)(
|
|
1944
2074
|
(hookName, ...args) => {
|
|
@@ -2031,30 +2161,34 @@ function CopilotChat({
|
|
|
2031
2161
|
if (imageItems.length === 0)
|
|
2032
2162
|
return;
|
|
2033
2163
|
e.preventDefault();
|
|
2034
|
-
const imagePromises = imageItems.map(
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2164
|
+
const imagePromises = imageItems.map(
|
|
2165
|
+
(item) => {
|
|
2166
|
+
const file = item.getAsFile();
|
|
2167
|
+
if (!file)
|
|
2168
|
+
return Promise.resolve(null);
|
|
2169
|
+
return new Promise((resolve, reject) => {
|
|
2170
|
+
const reader = new FileReader();
|
|
2171
|
+
reader.onload = (e2) => {
|
|
2172
|
+
var _a2, _b2;
|
|
2173
|
+
const base64String = (_b2 = (_a2 = e2.target) == null ? void 0 : _a2.result) == null ? void 0 : _b2.split(",")[1];
|
|
2174
|
+
if (base64String) {
|
|
2175
|
+
resolve({
|
|
2176
|
+
contentType: file.type,
|
|
2177
|
+
bytes: base64String
|
|
2178
|
+
});
|
|
2179
|
+
} else {
|
|
2180
|
+
resolve(null);
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
reader.onerror = reject;
|
|
2184
|
+
reader.readAsDataURL(file);
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2187
|
+
);
|
|
2056
2188
|
try {
|
|
2057
|
-
const loadedImages = (yield Promise.all(imagePromises)).filter(
|
|
2189
|
+
const loadedImages = (yield Promise.all(imagePromises)).filter(
|
|
2190
|
+
(img) => img !== null
|
|
2191
|
+
);
|
|
2058
2192
|
setSelectedImages((prev) => [...prev, ...loadedImages]);
|
|
2059
2193
|
} catch (error) {
|
|
2060
2194
|
triggerChatError(error, "processClipboardImages", error);
|
|
@@ -2135,25 +2269,29 @@ function CopilotChat({
|
|
|
2135
2269
|
if (!event.target.files || event.target.files.length === 0) {
|
|
2136
2270
|
return;
|
|
2137
2271
|
}
|
|
2138
|
-
const files = Array.from(event.target.files).filter(
|
|
2272
|
+
const files = Array.from(event.target.files).filter(
|
|
2273
|
+
(file) => file.type.startsWith("image/")
|
|
2274
|
+
);
|
|
2139
2275
|
if (files.length === 0)
|
|
2140
2276
|
return;
|
|
2141
2277
|
const fileReadPromises = files.map((file) => {
|
|
2142
|
-
return new Promise(
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2278
|
+
return new Promise(
|
|
2279
|
+
(resolve, reject) => {
|
|
2280
|
+
const reader = new FileReader();
|
|
2281
|
+
reader.onload = (e) => {
|
|
2282
|
+
var _a, _b;
|
|
2283
|
+
const base64String = ((_b = (_a = e.target) == null ? void 0 : _a.result) == null ? void 0 : _b.split(",")[1]) || "";
|
|
2284
|
+
if (base64String) {
|
|
2285
|
+
resolve({
|
|
2286
|
+
contentType: file.type,
|
|
2287
|
+
bytes: base64String
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2291
|
+
reader.onerror = reject;
|
|
2292
|
+
reader.readAsDataURL(file);
|
|
2293
|
+
}
|
|
2294
|
+
);
|
|
2157
2295
|
});
|
|
2158
2296
|
try {
|
|
2159
2297
|
const loadedImages = yield Promise.all(fileReadPromises);
|
|
@@ -2224,7 +2362,13 @@ function CopilotChat({
|
|
|
2224
2362
|
}
|
|
2225
2363
|
),
|
|
2226
2364
|
imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2227
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2365
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2366
|
+
ImageUploadQueue,
|
|
2367
|
+
{
|
|
2368
|
+
images: selectedImages,
|
|
2369
|
+
onRemoveImage: removeSelectedImage
|
|
2370
|
+
}
|
|
2371
|
+
),
|
|
2228
2372
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2229
2373
|
"input",
|
|
2230
2374
|
{
|
|
@@ -2262,8 +2406,17 @@ function WrappedCopilotChat({
|
|
|
2262
2406
|
}) {
|
|
2263
2407
|
const chatContext = import_react11.default.useContext(ChatContext);
|
|
2264
2408
|
if (!chatContext) {
|
|
2265
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2266
|
-
|
|
2409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2410
|
+
ChatContextProvider,
|
|
2411
|
+
{
|
|
2412
|
+
icons,
|
|
2413
|
+
labels,
|
|
2414
|
+
open: true,
|
|
2415
|
+
setOpen: () => {
|
|
2416
|
+
},
|
|
2417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children })
|
|
2418
|
+
}
|
|
2419
|
+
);
|
|
2267
2420
|
}
|
|
2268
2421
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children });
|
|
2269
2422
|
}
|