@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
|
@@ -120,7 +120,14 @@ var CloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
120
120
|
stroke: "currentColor",
|
|
121
121
|
width: "24",
|
|
122
122
|
height: "24",
|
|
123
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
123
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
+
"path",
|
|
125
|
+
{
|
|
126
|
+
strokeLinecap: "round",
|
|
127
|
+
strokeLinejoin: "round",
|
|
128
|
+
d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
129
|
+
}
|
|
130
|
+
)
|
|
124
131
|
}
|
|
125
132
|
);
|
|
126
133
|
var HeaderCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -133,7 +140,14 @@ var HeaderCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
133
140
|
stroke: "currentColor",
|
|
134
141
|
width: "24",
|
|
135
142
|
height: "24",
|
|
136
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
+
"path",
|
|
145
|
+
{
|
|
146
|
+
strokeLinecap: "round",
|
|
147
|
+
strokeLinejoin: "round",
|
|
148
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
149
|
+
}
|
|
150
|
+
)
|
|
137
151
|
}
|
|
138
152
|
);
|
|
139
153
|
var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -146,7 +160,14 @@ var SendIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
146
160
|
stroke: "currentColor",
|
|
147
161
|
width: "24",
|
|
148
162
|
height: "24",
|
|
149
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
163
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
+
"path",
|
|
165
|
+
{
|
|
166
|
+
strokeLinecap: "round",
|
|
167
|
+
strokeLinejoin: "round",
|
|
168
|
+
d: "M12 19V5m0 0l-7 7m7-7l7 7"
|
|
169
|
+
}
|
|
170
|
+
)
|
|
150
171
|
}
|
|
151
172
|
);
|
|
152
173
|
var MicrophoneIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -231,12 +252,42 @@ var CopyIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
231
252
|
)
|
|
232
253
|
}
|
|
233
254
|
);
|
|
234
|
-
var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
235
|
-
|
|
255
|
+
var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
256
|
+
"span",
|
|
257
|
+
{
|
|
258
|
+
className: "copilotKitSpinner",
|
|
259
|
+
style: { width: "13px", height: "13px" }
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
var SpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
263
|
+
"span",
|
|
264
|
+
{
|
|
265
|
+
className: "copilotKitSpinner",
|
|
266
|
+
style: { width: "24px", height: "24px" }
|
|
267
|
+
}
|
|
268
|
+
);
|
|
236
269
|
var ActivityIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
237
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
238
|
-
|
|
239
|
-
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
271
|
+
"span",
|
|
272
|
+
{
|
|
273
|
+
className: "copilotKitActivityDot",
|
|
274
|
+
style: { animationDelay: "0s" }
|
|
275
|
+
}
|
|
276
|
+
),
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
278
|
+
"span",
|
|
279
|
+
{
|
|
280
|
+
className: "copilotKitActivityDot",
|
|
281
|
+
style: { animationDelay: "0.2s" }
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
285
|
+
"span",
|
|
286
|
+
{
|
|
287
|
+
className: "copilotKitActivityDot",
|
|
288
|
+
style: { animationDelay: "0.4s" }
|
|
289
|
+
}
|
|
290
|
+
)
|
|
240
291
|
] });
|
|
241
292
|
var ThumbsUpIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
242
293
|
"svg",
|
|
@@ -311,7 +362,14 @@ var UploadIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
311
362
|
stroke: "currentColor",
|
|
312
363
|
width: "24",
|
|
313
364
|
height: "24",
|
|
314
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
365
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
366
|
+
"path",
|
|
367
|
+
{
|
|
368
|
+
strokeLinecap: "round",
|
|
369
|
+
strokeLinejoin: "round",
|
|
370
|
+
d: "M12 4.5v15m7.5-7.5h-15"
|
|
371
|
+
}
|
|
372
|
+
)
|
|
315
373
|
}
|
|
316
374
|
);
|
|
317
375
|
var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -325,13 +383,22 @@ var CheckIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
325
383
|
width: "16",
|
|
326
384
|
height: "16",
|
|
327
385
|
style: { minWidth: "16px", minHeight: "16px" },
|
|
328
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
386
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
387
|
+
"path",
|
|
388
|
+
{
|
|
389
|
+
strokeLinecap: "round",
|
|
390
|
+
strokeLinejoin: "round",
|
|
391
|
+
d: "M4.5 12.75l6 6 9-13.5"
|
|
392
|
+
}
|
|
393
|
+
)
|
|
329
394
|
}
|
|
330
395
|
);
|
|
331
396
|
|
|
332
397
|
// src/components/chat/ChatContext.tsx
|
|
333
398
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
334
|
-
var ChatContext = import_react.default.createContext(
|
|
399
|
+
var ChatContext = import_react.default.createContext(
|
|
400
|
+
void 0
|
|
401
|
+
);
|
|
335
402
|
function useChatContext() {
|
|
336
403
|
const context = import_react.default.useContext(ChatContext);
|
|
337
404
|
if (context === void 0) {
|
|
@@ -539,24 +606,30 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
|
539
606
|
return parsedVersion;
|
|
540
607
|
}
|
|
541
608
|
} catch (error) {
|
|
542
|
-
console.error(
|
|
609
|
+
console.error(
|
|
610
|
+
"Failed to parse CopilotKitVersion from localStorage",
|
|
611
|
+
error
|
|
612
|
+
);
|
|
543
613
|
}
|
|
544
614
|
}
|
|
545
615
|
try {
|
|
546
|
-
const response = yield fetch(
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
616
|
+
const response = yield fetch(
|
|
617
|
+
"https://api.cloud.copilotkit.ai/check-for-updates",
|
|
618
|
+
{
|
|
619
|
+
method: "POST",
|
|
620
|
+
headers: {
|
|
621
|
+
"Content-Type": "application/json"
|
|
622
|
+
},
|
|
623
|
+
body: JSON.stringify({
|
|
624
|
+
packages: [
|
|
625
|
+
{
|
|
626
|
+
packageName: "@copilotkit/shared",
|
|
627
|
+
packageVersion: current
|
|
628
|
+
}
|
|
629
|
+
]
|
|
630
|
+
})
|
|
631
|
+
}
|
|
632
|
+
);
|
|
560
633
|
const data = yield response.json();
|
|
561
634
|
const version = {
|
|
562
635
|
current,
|
|
@@ -710,13 +783,22 @@ var CheckIcon2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
|
710
783
|
viewBox: "0 0 14 14",
|
|
711
784
|
version: "1.1",
|
|
712
785
|
xmlns: "http://www.w3.org/2000/svg",
|
|
713
|
-
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)(
|
|
714
|
-
"
|
|
786
|
+
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)(
|
|
787
|
+
"g",
|
|
715
788
|
{
|
|
716
|
-
|
|
717
|
-
|
|
789
|
+
id: "Group-2",
|
|
790
|
+
transform: "translate(-118, 0)",
|
|
791
|
+
fill: "#1BC030",
|
|
792
|
+
fillRule: "nonzero",
|
|
793
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { id: "Group", transform: "translate(118, 0)", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
794
|
+
"path",
|
|
795
|
+
{
|
|
796
|
+
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",
|
|
797
|
+
id: "Shape"
|
|
798
|
+
}
|
|
799
|
+
) })
|
|
718
800
|
}
|
|
719
|
-
) })
|
|
801
|
+
) })
|
|
720
802
|
}
|
|
721
803
|
);
|
|
722
804
|
|
|
@@ -739,7 +821,14 @@ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
|
739
821
|
stroke: "currentColor",
|
|
740
822
|
width: "20",
|
|
741
823
|
height: "20",
|
|
742
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
824
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
825
|
+
"path",
|
|
826
|
+
{
|
|
827
|
+
strokeLinecap: "round",
|
|
828
|
+
strokeLinejoin: "round",
|
|
829
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
830
|
+
}
|
|
831
|
+
)
|
|
743
832
|
}
|
|
744
833
|
);
|
|
745
834
|
|
|
@@ -844,7 +933,9 @@ function CopilotDevConsole() {
|
|
|
844
933
|
const [versionStatus, setVersionStatus] = (0, import_react4.useState)("unknown");
|
|
845
934
|
const [latestVersion, setLatestVersion] = (0, import_react4.useState)("");
|
|
846
935
|
const consoleRef = (0, import_react4.useRef)(null);
|
|
847
|
-
const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)(
|
|
936
|
+
const [debugButtonMode, setDebugButtonMode] = (0, import_react4.useState)(
|
|
937
|
+
"full"
|
|
938
|
+
);
|
|
848
939
|
const checkForUpdates = (force = false) => {
|
|
849
940
|
setVersionStatus("checking");
|
|
850
941
|
getPublishedCopilotKitVersion(currentVersion, force).then((v) => {
|
|
@@ -985,8 +1076,22 @@ function DebugMenuButton({
|
|
|
985
1076
|
className: "copilotKitDebugMenu",
|
|
986
1077
|
style: { zIndex: 40 },
|
|
987
1078
|
children: [
|
|
988
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
989
|
-
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1080
|
+
"button",
|
|
1081
|
+
{
|
|
1082
|
+
className: "copilotKitDebugMenuItem",
|
|
1083
|
+
onClick: () => logReadables(context),
|
|
1084
|
+
children: "Log Readables"
|
|
1085
|
+
}
|
|
1086
|
+
) }),
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1088
|
+
"button",
|
|
1089
|
+
{
|
|
1090
|
+
className: "copilotKitDebugMenuItem",
|
|
1091
|
+
onClick: () => logActions(context),
|
|
1092
|
+
children: "Log Actions"
|
|
1093
|
+
}
|
|
1094
|
+
) }),
|
|
990
1095
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
991
1096
|
"button",
|
|
992
1097
|
{
|
|
@@ -995,9 +1100,23 @@ function DebugMenuButton({
|
|
|
995
1100
|
children: "Log Messages"
|
|
996
1101
|
}
|
|
997
1102
|
) }),
|
|
998
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1103
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1104
|
+
"button",
|
|
1105
|
+
{
|
|
1106
|
+
className: "copilotKitDebugMenuItem",
|
|
1107
|
+
onClick: () => checkForUpdates(true),
|
|
1108
|
+
children: "Check for Updates"
|
|
1109
|
+
}
|
|
1110
|
+
) }),
|
|
999
1111
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", {}),
|
|
1000
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1113
|
+
"button",
|
|
1114
|
+
{
|
|
1115
|
+
className: "copilotKitDebugMenuItem",
|
|
1116
|
+
onClick: () => setShowDevConsole(false),
|
|
1117
|
+
children: "Hide Dev Console"
|
|
1118
|
+
}
|
|
1119
|
+
) })
|
|
1001
1120
|
]
|
|
1002
1121
|
}
|
|
1003
1122
|
)
|
|
@@ -1043,7 +1162,9 @@ var getTextContent = (content) => {
|
|
|
1043
1162
|
return part.text;
|
|
1044
1163
|
}
|
|
1045
1164
|
return void 0;
|
|
1046
|
-
}).filter(
|
|
1165
|
+
}).filter(
|
|
1166
|
+
(value) => typeof value === "string" && value.length > 0
|
|
1167
|
+
).join(" ").trim() || void 0;
|
|
1047
1168
|
};
|
|
1048
1169
|
var UserMessage = (props) => {
|
|
1049
1170
|
const { message, ImageRenderer: ImageRenderer2 } = props;
|
|
@@ -1067,7 +1188,9 @@ var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
|
1067
1188
|
|
|
1068
1189
|
// src/hooks/use-copy-to-clipboard.tsx
|
|
1069
1190
|
var React5 = __toESM(require("react"));
|
|
1070
|
-
function useCopyToClipboard({
|
|
1191
|
+
function useCopyToClipboard({
|
|
1192
|
+
timeout = 2e3
|
|
1193
|
+
}) {
|
|
1071
1194
|
const [isCopied, setIsCopied] = React5.useState(false);
|
|
1072
1195
|
const copyToClipboard = (value) => {
|
|
1073
1196
|
var _a;
|
|
@@ -1125,9 +1248,7 @@ var generateRandomString = (length, lowercase = false) => {
|
|
|
1125
1248
|
};
|
|
1126
1249
|
var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
|
|
1127
1250
|
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
1128
|
-
const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react6.useState)(
|
|
1129
|
-
() => import_react_syntax_highlighter.Light
|
|
1130
|
-
);
|
|
1251
|
+
const [SyntaxHighlighter, setSyntaxHighlighter] = (0, import_react6.useState)(() => import_react_syntax_highlighter.Light);
|
|
1131
1252
|
(0, import_react6.useEffect)(() => {
|
|
1132
1253
|
try {
|
|
1133
1254
|
new RegExp("(?<=#)\\w+");
|
|
@@ -1166,7 +1287,14 @@ var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
|
|
|
1166
1287
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1167
1288
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1168
1289
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1169
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1290
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1291
|
+
"button",
|
|
1292
|
+
{
|
|
1293
|
+
className: "copilotKitCodeBlockToolbarButton",
|
|
1294
|
+
onClick: downloadAsFile,
|
|
1295
|
+
children: DownloadIcon
|
|
1296
|
+
}
|
|
1297
|
+
),
|
|
1170
1298
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1171
1299
|
] })
|
|
1172
1300
|
] }),
|
|
@@ -1478,7 +1606,16 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
|
1478
1606
|
var defaultComponents = {
|
|
1479
1607
|
a(_a) {
|
|
1480
1608
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1481
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1610
|
+
"a",
|
|
1611
|
+
__spreadProps(__spreadValues({
|
|
1612
|
+
className: "copilotKitMarkdownElement"
|
|
1613
|
+
}, props), {
|
|
1614
|
+
target: "_blank",
|
|
1615
|
+
rel: "noopener noreferrer",
|
|
1616
|
+
children
|
|
1617
|
+
})
|
|
1618
|
+
);
|
|
1482
1619
|
},
|
|
1483
1620
|
// @ts-expect-error -- inline
|
|
1484
1621
|
code(_c) {
|
|
@@ -1576,7 +1713,10 @@ var Markdown = ({ content, components }) => {
|
|
|
1576
1713
|
MemoizedReactMarkdown,
|
|
1577
1714
|
{
|
|
1578
1715
|
components: __spreadValues(__spreadValues({}, defaultComponents), components),
|
|
1579
|
-
remarkPlugins: [
|
|
1716
|
+
remarkPlugins: [
|
|
1717
|
+
import_remark_gfm.default,
|
|
1718
|
+
[import_remark_math.default, { singleDollarTextMath: false }]
|
|
1719
|
+
],
|
|
1580
1720
|
rehypePlugins: [import_rehype_raw.default],
|
|
1581
1721
|
children: content
|
|
1582
1722
|
}
|
|
@@ -1695,7 +1835,11 @@ var AssistantMessage = (props) => {
|
|
|
1695
1835
|
// src/components/chat/messages/ImageRenderer.tsx
|
|
1696
1836
|
var import_react9 = require("react");
|
|
1697
1837
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1698
|
-
var ImageRenderer = ({
|
|
1838
|
+
var ImageRenderer = ({
|
|
1839
|
+
image,
|
|
1840
|
+
content,
|
|
1841
|
+
className = ""
|
|
1842
|
+
}) => {
|
|
1699
1843
|
const [imageError, setImageError] = (0, import_react9.useState)(false);
|
|
1700
1844
|
const imageSrc = `data:image/${image.format};base64,${image.bytes}`;
|
|
1701
1845
|
const altText = content || "User uploaded image";
|
|
@@ -1703,10 +1847,16 @@ var ImageRenderer = ({ image, content, className = "" }) => {
|
|
|
1703
1847
|
setImageError(true);
|
|
1704
1848
|
};
|
|
1705
1849
|
if (imageError) {
|
|
1706
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1851
|
+
"div",
|
|
1852
|
+
{
|
|
1853
|
+
className: `copilotKitImageRendering copilotKitImageRenderingError ${className}`,
|
|
1854
|
+
children: [
|
|
1855
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingErrorMessage", children: "Failed to load image" }),
|
|
1856
|
+
content && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitImageRenderingContent", children: content })
|
|
1857
|
+
]
|
|
1858
|
+
}
|
|
1859
|
+
);
|
|
1710
1860
|
}
|
|
1711
1861
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `copilotKitImageRendering ${className}`, children: [
|
|
1712
1862
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -1939,7 +2089,10 @@ var Messages = ({
|
|
|
1939
2089
|
var _a;
|
|
1940
2090
|
const { labels, icons } = useChatContext();
|
|
1941
2091
|
const { messages: visibleMessages, interrupt } = (0, import_react_core5.useCopilotChatInternal)();
|
|
1942
|
-
const initialMessages = (0, import_react10.useMemo)(
|
|
2092
|
+
const initialMessages = (0, import_react10.useMemo)(
|
|
2093
|
+
() => makeInitialMessages(labels.initial),
|
|
2094
|
+
[labels.initial]
|
|
2095
|
+
);
|
|
1943
2096
|
const messages = [...initialMessages, ...visibleMessages];
|
|
1944
2097
|
const { messagesContainerRef, messagesEndRef } = useScrollToBottom(messages);
|
|
1945
2098
|
const hasLegacyProps = !!(RenderTextMessage || RenderActionExecutionMessage || RenderAgentStateMessage || RenderResultMessage || RenderImageMessage);
|
|
@@ -2097,7 +2250,10 @@ var AutoResizingTextarea = (0, import_react11.forwardRef)(
|
|
|
2097
2250
|
}, ref) => {
|
|
2098
2251
|
const internalTextareaRef = (0, import_react11.useRef)(null);
|
|
2099
2252
|
const [maxHeight, setMaxHeight] = (0, import_react11.useState)(0);
|
|
2100
|
-
(0, import_react11.useImperativeHandle)(
|
|
2253
|
+
(0, import_react11.useImperativeHandle)(
|
|
2254
|
+
ref,
|
|
2255
|
+
() => internalTextareaRef.current
|
|
2256
|
+
);
|
|
2101
2257
|
(0, import_react11.useEffect)(() => {
|
|
2102
2258
|
const calculateMaxHeight = () => {
|
|
2103
2259
|
const textarea = internalTextareaRef.current;
|
|
@@ -2147,7 +2303,9 @@ var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
|
2147
2303
|
var import_react12 = require("react");
|
|
2148
2304
|
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
2149
2305
|
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
2150
|
-
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
|
|
2306
|
+
mediaStreamRef.current = yield navigator.mediaDevices.getUserMedia({
|
|
2307
|
+
audio: true
|
|
2308
|
+
});
|
|
2151
2309
|
audioContextRef.current = new window.AudioContext();
|
|
2152
2310
|
yield audioContextRef.current.resume();
|
|
2153
2311
|
}
|
|
@@ -2216,14 +2374,15 @@ var usePushToTalk = ({
|
|
|
2216
2374
|
} else {
|
|
2217
2375
|
stopRecording(mediaRecorderRef);
|
|
2218
2376
|
if (pushToTalkState === "transcribing") {
|
|
2219
|
-
transcribeAudio(
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2377
|
+
transcribeAudio(
|
|
2378
|
+
recordedChunks.current,
|
|
2379
|
+
context.copilotApiConfig.transcribeAudioUrl
|
|
2380
|
+
).then((transcription) => __async(void 0, null, function* () {
|
|
2381
|
+
recordedChunks.current = [];
|
|
2382
|
+
setPushToTalkState("idle");
|
|
2383
|
+
const message = yield sendFunction(transcription);
|
|
2384
|
+
setStartReadingFromMessageId(message.id);
|
|
2385
|
+
}));
|
|
2227
2386
|
}
|
|
2228
2387
|
}
|
|
2229
2388
|
return () => {
|
|
@@ -2238,7 +2397,11 @@ var usePushToTalk = ({
|
|
|
2238
2397
|
const aguiMessages = (0, import_runtime_client_gql2.gqlToAGUI)(context.messages);
|
|
2239
2398
|
const messagesAfterLast = aguiMessages.slice(lastMessageIndex + 1).filter((message) => message.role === "assistant");
|
|
2240
2399
|
const text = messagesAfterLast.map((message) => message.content).join("\n");
|
|
2241
|
-
playAudioResponse(
|
|
2400
|
+
playAudioResponse(
|
|
2401
|
+
text,
|
|
2402
|
+
context.copilotApiConfig.textToSpeechUrl,
|
|
2403
|
+
audioContextRef.current
|
|
2404
|
+
);
|
|
2242
2405
|
setStartReadingFromMessageId(null);
|
|
2243
2406
|
}
|
|
2244
2407
|
}, [startReadingFromMessageId, inProgress]);
|
|
@@ -2260,7 +2423,9 @@ var useDarkMode = () => {
|
|
|
2260
2423
|
|
|
2261
2424
|
// src/components/chat/PoweredByTag.tsx
|
|
2262
2425
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2263
|
-
function PoweredByTag({
|
|
2426
|
+
function PoweredByTag({
|
|
2427
|
+
showPoweredBy = true
|
|
2428
|
+
}) {
|
|
2264
2429
|
const [mounted, setMounted] = (0, import_react13.useState)(false);
|
|
2265
2430
|
const isDark = useDarkMode();
|
|
2266
2431
|
(0, import_react13.useEffect)(() => {
|
|
@@ -2326,7 +2491,13 @@ var Input = ({
|
|
|
2326
2491
|
if (!chatReady)
|
|
2327
2492
|
return { buttonIcon: context.icons.spinnerIcon, buttonAlt: "Loading" };
|
|
2328
2493
|
return isInProgress && !hideStopButton && chatReady ? { buttonIcon: context.icons.stopIcon, buttonAlt: "Stop" } : { buttonIcon: context.icons.sendIcon, buttonAlt: "Send" };
|
|
2329
|
-
}, [
|
|
2494
|
+
}, [
|
|
2495
|
+
isInProgress,
|
|
2496
|
+
chatReady,
|
|
2497
|
+
hideStopButton,
|
|
2498
|
+
context.icons.stopIcon,
|
|
2499
|
+
context.icons.sendIcon
|
|
2500
|
+
]);
|
|
2330
2501
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
2331
2502
|
const { interrupt } = (0, import_react_core7.useCopilotChatInternal)();
|
|
2332
2503
|
const canSend = (0, import_react14.useMemo)(() => {
|
|
@@ -2336,56 +2507,64 @@ var Input = ({
|
|
|
2336
2507
|
return isInProgress && !hideStopButton;
|
|
2337
2508
|
}, [isInProgress, hideStopButton]);
|
|
2338
2509
|
const sendDisabled = !canSend && !canStop;
|
|
2339
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2511
|
+
"div",
|
|
2512
|
+
{
|
|
2513
|
+
className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`,
|
|
2514
|
+
children: [
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
2516
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2517
|
+
Textarea_default,
|
|
2518
|
+
{
|
|
2519
|
+
ref: textareaRef,
|
|
2520
|
+
placeholder: context.labels.placeholder,
|
|
2521
|
+
autoFocus: false,
|
|
2522
|
+
maxRows: MAX_NEWLINES,
|
|
2523
|
+
value: text,
|
|
2524
|
+
onChange: (event) => setText(event.target.value),
|
|
2525
|
+
onCompositionStart: () => setIsComposing(true),
|
|
2526
|
+
onCompositionEnd: () => setIsComposing(false),
|
|
2527
|
+
onKeyDown: (event) => {
|
|
2528
|
+
if (event.key === "Enter" && !event.shiftKey && !isComposing) {
|
|
2529
|
+
event.preventDefault();
|
|
2530
|
+
if (canSend) {
|
|
2531
|
+
send();
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2357
2534
|
}
|
|
2358
2535
|
}
|
|
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
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2536
|
+
),
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
2538
|
+
onUpload && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { flexGrow: 1 } }),
|
|
2540
|
+
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2541
|
+
"button",
|
|
2542
|
+
{
|
|
2543
|
+
onClick: () => setPushToTalkState(
|
|
2544
|
+
pushToTalkState === "idle" ? "recording" : "transcribing"
|
|
2545
|
+
),
|
|
2546
|
+
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
2547
|
+
children: context.icons.pushToTalkIcon
|
|
2548
|
+
}
|
|
2549
|
+
),
|
|
2550
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2551
|
+
"button",
|
|
2552
|
+
{
|
|
2553
|
+
disabled: sendDisabled,
|
|
2554
|
+
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
2555
|
+
"data-copilotkit-in-progress": inProgress,
|
|
2556
|
+
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
2557
|
+
className: "copilotKitInputControlButton",
|
|
2558
|
+
"aria-label": buttonAlt,
|
|
2559
|
+
children: buttonIcon
|
|
2560
|
+
}
|
|
2561
|
+
)
|
|
2562
|
+
] })
|
|
2563
|
+
] }),
|
|
2564
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PoweredByTag, { showPoweredBy })
|
|
2565
|
+
]
|
|
2566
|
+
}
|
|
2567
|
+
);
|
|
2389
2568
|
};
|
|
2390
2569
|
|
|
2391
2570
|
// src/components/chat/Chat.tsx
|
|
@@ -2474,7 +2653,12 @@ var ImageUploadQueue = ({
|
|
|
2474
2653
|
// src/components/chat/Suggestion.tsx
|
|
2475
2654
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
2476
2655
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2477
|
-
function Suggestion({
|
|
2656
|
+
function Suggestion({
|
|
2657
|
+
title,
|
|
2658
|
+
onClick,
|
|
2659
|
+
partial,
|
|
2660
|
+
className
|
|
2661
|
+
}) {
|
|
2478
2662
|
const { isLoading } = (0, import_react_core8.useCopilotChatInternal)();
|
|
2479
2663
|
if (!title)
|
|
2480
2664
|
return null;
|
|
@@ -2568,9 +2752,7 @@ function CopilotChat({
|
|
|
2568
2752
|
const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
|
|
2569
2753
|
const [selectedImages, setSelectedImages] = (0, import_react15.useState)([]);
|
|
2570
2754
|
const [chatError, setChatError] = (0, import_react15.useState)(null);
|
|
2571
|
-
const [messageFeedback, setMessageFeedback] = (0, import_react15.useState)(
|
|
2572
|
-
{}
|
|
2573
|
-
);
|
|
2755
|
+
const [messageFeedback, setMessageFeedback] = (0, import_react15.useState)({});
|
|
2574
2756
|
const fileInputRef = (0, import_react15.useRef)(null);
|
|
2575
2757
|
const triggerObservabilityHook = (0, import_react15.useCallback)(
|
|
2576
2758
|
(hookName, ...args) => {
|
|
@@ -2663,30 +2845,34 @@ function CopilotChat({
|
|
|
2663
2845
|
if (imageItems.length === 0)
|
|
2664
2846
|
return;
|
|
2665
2847
|
e.preventDefault();
|
|
2666
|
-
const imagePromises = imageItems.map(
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2848
|
+
const imagePromises = imageItems.map(
|
|
2849
|
+
(item) => {
|
|
2850
|
+
const file = item.getAsFile();
|
|
2851
|
+
if (!file)
|
|
2852
|
+
return Promise.resolve(null);
|
|
2853
|
+
return new Promise((resolve, reject) => {
|
|
2854
|
+
const reader = new FileReader();
|
|
2855
|
+
reader.onload = (e2) => {
|
|
2856
|
+
var _a2, _b2;
|
|
2857
|
+
const base64String = (_b2 = (_a2 = e2.target) == null ? void 0 : _a2.result) == null ? void 0 : _b2.split(",")[1];
|
|
2858
|
+
if (base64String) {
|
|
2859
|
+
resolve({
|
|
2860
|
+
contentType: file.type,
|
|
2861
|
+
bytes: base64String
|
|
2862
|
+
});
|
|
2863
|
+
} else {
|
|
2864
|
+
resolve(null);
|
|
2865
|
+
}
|
|
2866
|
+
};
|
|
2867
|
+
reader.onerror = reject;
|
|
2868
|
+
reader.readAsDataURL(file);
|
|
2869
|
+
});
|
|
2870
|
+
}
|
|
2871
|
+
);
|
|
2688
2872
|
try {
|
|
2689
|
-
const loadedImages = (yield Promise.all(imagePromises)).filter(
|
|
2873
|
+
const loadedImages = (yield Promise.all(imagePromises)).filter(
|
|
2874
|
+
(img) => img !== null
|
|
2875
|
+
);
|
|
2690
2876
|
setSelectedImages((prev) => [...prev, ...loadedImages]);
|
|
2691
2877
|
} catch (error) {
|
|
2692
2878
|
triggerChatError(error, "processClipboardImages", error);
|
|
@@ -2767,25 +2953,29 @@ function CopilotChat({
|
|
|
2767
2953
|
if (!event.target.files || event.target.files.length === 0) {
|
|
2768
2954
|
return;
|
|
2769
2955
|
}
|
|
2770
|
-
const files = Array.from(event.target.files).filter(
|
|
2956
|
+
const files = Array.from(event.target.files).filter(
|
|
2957
|
+
(file) => file.type.startsWith("image/")
|
|
2958
|
+
);
|
|
2771
2959
|
if (files.length === 0)
|
|
2772
2960
|
return;
|
|
2773
2961
|
const fileReadPromises = files.map((file) => {
|
|
2774
|
-
return new Promise(
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2962
|
+
return new Promise(
|
|
2963
|
+
(resolve, reject) => {
|
|
2964
|
+
const reader = new FileReader();
|
|
2965
|
+
reader.onload = (e) => {
|
|
2966
|
+
var _a, _b;
|
|
2967
|
+
const base64String = ((_b = (_a = e.target) == null ? void 0 : _a.result) == null ? void 0 : _b.split(",")[1]) || "";
|
|
2968
|
+
if (base64String) {
|
|
2969
|
+
resolve({
|
|
2970
|
+
contentType: file.type,
|
|
2971
|
+
bytes: base64String
|
|
2972
|
+
});
|
|
2973
|
+
}
|
|
2974
|
+
};
|
|
2975
|
+
reader.onerror = reject;
|
|
2976
|
+
reader.readAsDataURL(file);
|
|
2977
|
+
}
|
|
2978
|
+
);
|
|
2789
2979
|
});
|
|
2790
2980
|
try {
|
|
2791
2981
|
const loadedImages = yield Promise.all(fileReadPromises);
|
|
@@ -2856,7 +3046,13 @@ function CopilotChat({
|
|
|
2856
3046
|
}
|
|
2857
3047
|
),
|
|
2858
3048
|
imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2859
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3049
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3050
|
+
ImageUploadQueue,
|
|
3051
|
+
{
|
|
3052
|
+
images: selectedImages,
|
|
3053
|
+
onRemoveImage: removeSelectedImage
|
|
3054
|
+
}
|
|
3055
|
+
),
|
|
2860
3056
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2861
3057
|
"input",
|
|
2862
3058
|
{
|
|
@@ -2894,8 +3090,17 @@ function WrappedCopilotChat({
|
|
|
2894
3090
|
}) {
|
|
2895
3091
|
const chatContext = import_react15.default.useContext(ChatContext);
|
|
2896
3092
|
if (!chatContext) {
|
|
2897
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2898
|
-
|
|
3093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3094
|
+
ChatContextProvider,
|
|
3095
|
+
{
|
|
3096
|
+
icons,
|
|
3097
|
+
labels,
|
|
3098
|
+
open: true,
|
|
3099
|
+
setOpen: () => {
|
|
3100
|
+
},
|
|
3101
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children })
|
|
3102
|
+
}
|
|
3103
|
+
);
|
|
2899
3104
|
}
|
|
2900
3105
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children });
|
|
2901
3106
|
}
|
|
@@ -3044,37 +3249,46 @@ var CopilotModal = (_a) => {
|
|
|
3044
3249
|
"observabilityHooks"
|
|
3045
3250
|
]);
|
|
3046
3251
|
const [openState, setOpenState] = import_react16.default.useState(defaultOpen);
|
|
3047
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
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
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3253
|
+
ChatContextProvider,
|
|
3254
|
+
{
|
|
3255
|
+
icons,
|
|
3256
|
+
labels,
|
|
3257
|
+
open: openState,
|
|
3258
|
+
setOpen: setOpenState,
|
|
3259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3260
|
+
CopilotModalInner,
|
|
3261
|
+
__spreadProps(__spreadValues({
|
|
3262
|
+
observabilityHooks,
|
|
3263
|
+
onSetOpen,
|
|
3264
|
+
clickOutsideToClose: clickOutsideToClose != null ? clickOutsideToClose : true,
|
|
3265
|
+
hitEscapeToClose: hitEscapeToClose != null ? hitEscapeToClose : true,
|
|
3266
|
+
shortcut: shortcut != null ? shortcut : "/",
|
|
3267
|
+
className,
|
|
3268
|
+
Window: Window2,
|
|
3269
|
+
Button: Button2,
|
|
3270
|
+
Header: Header2,
|
|
3271
|
+
instructions,
|
|
3272
|
+
onSubmitMessage,
|
|
3273
|
+
onStopGeneration,
|
|
3274
|
+
onReloadMessages,
|
|
3275
|
+
makeSystemMessage,
|
|
3276
|
+
onInProgress,
|
|
3277
|
+
Messages: Messages2,
|
|
3278
|
+
Input: Input2,
|
|
3279
|
+
AssistantMessage: AssistantMessage2,
|
|
3280
|
+
UserMessage: UserMessage2,
|
|
3281
|
+
onThumbsUp,
|
|
3282
|
+
onThumbsDown,
|
|
3283
|
+
onCopy,
|
|
3284
|
+
onRegenerate,
|
|
3285
|
+
markdownTagRenderers
|
|
3286
|
+
}, props), {
|
|
3287
|
+
children
|
|
3288
|
+
})
|
|
3289
|
+
)
|
|
3290
|
+
}
|
|
3291
|
+
);
|
|
3078
3292
|
};
|
|
3079
3293
|
|
|
3080
3294
|
// src/components/chat/Sidebar.tsx
|