@copilotkit/react-ui 1.8.12-next.4 → 1.8.12-next.6
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 +18 -0
- package/dist/chunk-CGEAG65D.mjs +27 -0
- package/dist/chunk-CGEAG65D.mjs.map +1 -0
- package/dist/{chunk-SJWVHGKD.mjs → chunk-ECCHEFQV.mjs} +2 -2
- package/dist/chunk-EMIYIMQ6.mjs +110 -0
- package/dist/chunk-EMIYIMQ6.mjs.map +1 -0
- package/dist/{chunk-QXWJ7HYU.mjs → chunk-JZAMNIUD.mjs} +8 -8
- package/dist/{chunk-QXWJ7HYU.mjs.map → chunk-JZAMNIUD.mjs.map} +1 -1
- package/dist/{chunk-T5637OOY.mjs → chunk-KCV67665.mjs} +2 -2
- package/dist/{chunk-SLTG4L62.mjs → chunk-LUPGADWY.mjs} +4 -4
- package/dist/{chunk-POWCBXRY.mjs → chunk-RVLCPPEL.mjs} +4 -4
- package/dist/{chunk-Q2NFQTCQ.mjs → chunk-TIDV74OE.mjs} +7 -33
- package/dist/chunk-TIDV74OE.mjs.map +1 -0
- package/dist/{chunk-W2OWARTP.mjs → chunk-WN46UIN3.mjs} +7 -7
- package/dist/components/chat/Chat.js +151 -118
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +7 -5
- package/dist/components/chat/Input.js +79 -46
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +3 -1
- package/dist/components/chat/Modal.js +163 -162
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +8 -7
- package/dist/components/chat/Popup.js +165 -164
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +9 -8
- package/dist/components/chat/PoweredByTag.d.ts +7 -0
- package/dist/components/chat/PoweredByTag.js +56 -0
- package/dist/components/chat/PoweredByTag.js.map +1 -0
- package/dist/components/chat/PoweredByTag.mjs +9 -0
- package/dist/components/chat/PoweredByTag.mjs.map +1 -0
- package/dist/components/chat/Sidebar.js +165 -164
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +9 -8
- package/dist/components/chat/Window.js +5 -37
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +1 -2
- package/dist/components/chat/index.js +167 -166
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +12 -11
- package/dist/components/chat/messages/RenderImageMessage.mjs +2 -2
- package/dist/components/chat/messages/RenderTextMessage.mjs +2 -2
- package/dist/components/index.js +167 -166
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +12 -11
- package/dist/index.css +23 -26
- package/dist/index.css.map +1 -1
- package/dist/index.js +167 -166
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -11
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +1 -1
- package/src/components/chat/Input.tsx +6 -2
- package/src/components/chat/PoweredByTag.tsx +29 -0
- package/src/components/chat/Window.tsx +1 -24
- package/src/css/input.css +27 -0
- package/src/css/window.css +0 -29
- package/dist/chunk-IWBARPUZ.mjs +0 -102
- package/dist/chunk-IWBARPUZ.mjs.map +0 -1
- package/dist/chunk-Q2NFQTCQ.mjs.map +0 -1
- /package/dist/{chunk-SJWVHGKD.mjs.map → chunk-ECCHEFQV.mjs.map} +0 -0
- /package/dist/{chunk-T5637OOY.mjs.map → chunk-KCV67665.mjs.map} +0 -0
- /package/dist/{chunk-SLTG4L62.mjs.map → chunk-LUPGADWY.mjs.map} +0 -0
- /package/dist/{chunk-POWCBXRY.mjs.map → chunk-RVLCPPEL.mjs.map} +0 -0
- /package/dist/{chunk-W2OWARTP.mjs.map → chunk-WN46UIN3.mjs.map} +0 -0
|
@@ -396,15 +396,6 @@ var ChatContextProvider = ({
|
|
|
396
396
|
// src/components/chat/Window.tsx
|
|
397
397
|
var import_react2 = __toESM(require("react"));
|
|
398
398
|
var import_react_core = require("@copilotkit/react-core");
|
|
399
|
-
|
|
400
|
-
// src/hooks/use-dark-mode.ts
|
|
401
|
-
var useDarkMode = () => {
|
|
402
|
-
if (typeof window === "undefined")
|
|
403
|
-
return false;
|
|
404
|
-
return document.documentElement.classList.contains("dark") || document.body.classList.contains("dark") || document.documentElement.getAttribute("data-theme") === "dark" || document.body.getAttribute("data-theme") === "dark" || window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
// src/components/chat/Window.tsx
|
|
408
399
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
409
400
|
var Window = ({
|
|
410
401
|
children,
|
|
@@ -412,17 +403,16 @@ var Window = ({
|
|
|
412
403
|
shortcut,
|
|
413
404
|
hitEscapeToClose
|
|
414
405
|
}) => {
|
|
415
|
-
var _a;
|
|
416
406
|
const windowRef = import_react2.default.useRef(null);
|
|
417
407
|
const context = (0, import_react_core.useCopilotContext)();
|
|
418
408
|
const { open, setOpen } = useChatContext();
|
|
419
409
|
const handleClickOutside = (0, import_react2.useCallback)(
|
|
420
410
|
(event) => {
|
|
421
|
-
var
|
|
411
|
+
var _a;
|
|
422
412
|
if (!clickOutsideToClose) {
|
|
423
413
|
return;
|
|
424
414
|
}
|
|
425
|
-
const parentElement = (
|
|
415
|
+
const parentElement = (_a = windowRef.current) == null ? void 0 : _a.parentElement;
|
|
426
416
|
let className = "";
|
|
427
417
|
if (event.target instanceof HTMLElement) {
|
|
428
418
|
className = event.target.className;
|
|
@@ -436,10 +426,10 @@ var Window = ({
|
|
|
436
426
|
);
|
|
437
427
|
const handleKeyDown = (0, import_react2.useCallback)(
|
|
438
428
|
(event) => {
|
|
439
|
-
var
|
|
429
|
+
var _a;
|
|
440
430
|
const target = event.target;
|
|
441
431
|
const isInput = target.tagName === "INPUT" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.isContentEditable;
|
|
442
|
-
const isDescendantOfWrapper = (
|
|
432
|
+
const isDescendantOfWrapper = (_a = windowRef.current) == null ? void 0 : _a.contains(target);
|
|
443
433
|
if (open && event.key === "Escape" && (!isInput || isDescendantOfWrapper) && hitEscapeToClose) {
|
|
444
434
|
setOpen(false);
|
|
445
435
|
} else if (event.key === shortcut && (isMacOS() && event.metaKey || !isMacOS() && event.ctrlKey) && (!isInput || isDescendantOfWrapper)) {
|
|
@@ -494,29 +484,7 @@ var Window = ({
|
|
|
494
484
|
}
|
|
495
485
|
};
|
|
496
486
|
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
497
|
-
|
|
498
|
-
const showPoweredBy = !((_a = context.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
499
|
-
const poweredByStyle = {
|
|
500
|
-
visibility: "visible",
|
|
501
|
-
display: "block",
|
|
502
|
-
position: "static",
|
|
503
|
-
textAlign: "center",
|
|
504
|
-
fontSize: "12px",
|
|
505
|
-
padding: "3px 0",
|
|
506
|
-
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
507
|
-
};
|
|
508
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
509
|
-
"div",
|
|
510
|
-
{
|
|
511
|
-
className: `copilotKitWindow ${showPoweredBy ? " poweredByContainer" : ""} ${open ? " open" : ""}`,
|
|
512
|
-
ref: windowRef,
|
|
513
|
-
children: [
|
|
514
|
-
children,
|
|
515
|
-
showPoweredBy && // @ts-expect-error -- expecting position not to be a string, but it can be.
|
|
516
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" })
|
|
517
|
-
]
|
|
518
|
-
}
|
|
519
|
-
);
|
|
487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `copilotKitWindow ${open ? " open" : ""}`, ref: windowRef, children });
|
|
520
488
|
};
|
|
521
489
|
var preventScroll = (event) => {
|
|
522
490
|
let targetElement = event.target;
|
|
@@ -1427,30 +1395,60 @@ var usePushToTalk = ({
|
|
|
1427
1395
|
|
|
1428
1396
|
// src/components/chat/Input.tsx
|
|
1429
1397
|
var import_react_core6 = require("@copilotkit/react-core");
|
|
1398
|
+
|
|
1399
|
+
// src/hooks/use-dark-mode.ts
|
|
1400
|
+
var useDarkMode = () => {
|
|
1401
|
+
if (typeof window === "undefined")
|
|
1402
|
+
return false;
|
|
1403
|
+
return document.documentElement.classList.contains("dark") || document.body.classList.contains("dark") || document.documentElement.getAttribute("data-theme") === "dark" || document.body.getAttribute("data-theme") === "dark" || window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
// src/components/chat/PoweredByTag.tsx
|
|
1430
1407
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1408
|
+
function PoweredByTag({ showPoweredBy = true }) {
|
|
1409
|
+
const isDark = useDarkMode();
|
|
1410
|
+
if (!showPoweredBy) {
|
|
1411
|
+
return null;
|
|
1412
|
+
}
|
|
1413
|
+
const poweredByStyle = {
|
|
1414
|
+
visibility: "visible",
|
|
1415
|
+
display: "block",
|
|
1416
|
+
position: "static",
|
|
1417
|
+
textAlign: "center",
|
|
1418
|
+
fontSize: "12px",
|
|
1419
|
+
padding: "3px 0",
|
|
1420
|
+
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
1421
|
+
};
|
|
1422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" }) });
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
// src/components/chat/Input.tsx
|
|
1426
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1431
1427
|
var MAX_NEWLINES = 6;
|
|
1432
1428
|
var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
1429
|
+
var _a;
|
|
1433
1430
|
const context = useChatContext();
|
|
1434
1431
|
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1432
|
+
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
1435
1433
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
1436
1434
|
const textareaRef = (0, import_react9.useRef)(null);
|
|
1437
1435
|
const handleDivClick = (event) => {
|
|
1438
|
-
var
|
|
1436
|
+
var _a2;
|
|
1439
1437
|
const target = event.target;
|
|
1440
1438
|
if (target.closest("button"))
|
|
1441
1439
|
return;
|
|
1442
1440
|
if (target.tagName === "TEXTAREA")
|
|
1443
1441
|
return;
|
|
1444
|
-
(
|
|
1442
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
1445
1443
|
};
|
|
1446
1444
|
const [text, setText] = (0, import_react9.useState)("");
|
|
1447
1445
|
const send = () => {
|
|
1448
|
-
var
|
|
1446
|
+
var _a2;
|
|
1449
1447
|
if (inProgress)
|
|
1450
1448
|
return;
|
|
1451
1449
|
onSend(text);
|
|
1452
1450
|
setText("");
|
|
1453
|
-
(
|
|
1451
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
1454
1452
|
};
|
|
1455
1453
|
const { pushToTalkState, setPushToTalkState } = usePushToTalk({
|
|
1456
1454
|
sendFunction: onSend,
|
|
@@ -1460,62 +1458,65 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1460
1458
|
const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1461
1459
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1462
1460
|
const canSend = () => {
|
|
1463
|
-
var
|
|
1464
|
-
const interruptEvent = (
|
|
1461
|
+
var _a2;
|
|
1462
|
+
const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
|
|
1465
1463
|
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
1466
1464
|
return (isInProgress || !isInProgress && text.trim().length > 0) && pushToTalkState === "idle" && !interruptInProgress;
|
|
1467
1465
|
};
|
|
1468
1466
|
const sendDisabled = !canSend();
|
|
1469
|
-
return /* @__PURE__ */ (0,
|
|
1470
|
-
/* @__PURE__ */ (0,
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
event.
|
|
1482
|
-
|
|
1483
|
-
|
|
1467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1469
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1470
|
+
Textarea_default,
|
|
1471
|
+
{
|
|
1472
|
+
ref: textareaRef,
|
|
1473
|
+
placeholder: context.labels.placeholder,
|
|
1474
|
+
autoFocus: false,
|
|
1475
|
+
maxRows: MAX_NEWLINES,
|
|
1476
|
+
value: text,
|
|
1477
|
+
onChange: (event) => setText(event.target.value),
|
|
1478
|
+
onKeyDown: (event) => {
|
|
1479
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1480
|
+
event.preventDefault();
|
|
1481
|
+
if (canSend()) {
|
|
1482
|
+
send();
|
|
1483
|
+
}
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
|
-
}
|
|
1488
|
-
),
|
|
1489
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
1490
|
-
onUpload && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
1491
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { flexGrow: 1 } }),
|
|
1492
|
-
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1493
|
-
"button",
|
|
1494
|
-
{
|
|
1495
|
-
onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
|
|
1496
|
-
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
1497
|
-
children: context.icons.pushToTalkIcon
|
|
1498
|
-
}
|
|
1499
1487
|
),
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
"button",
|
|
1502
|
-
{
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
1489
|
+
onUpload && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { flexGrow: 1 } }),
|
|
1491
|
+
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1492
|
+
"button",
|
|
1493
|
+
{
|
|
1494
|
+
onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
|
|
1495
|
+
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
1496
|
+
children: context.icons.pushToTalkIcon
|
|
1497
|
+
}
|
|
1498
|
+
),
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1500
|
+
"button",
|
|
1501
|
+
{
|
|
1502
|
+
disabled: sendDisabled,
|
|
1503
|
+
onClick: isInProgress ? onStop : send,
|
|
1504
|
+
"data-copilotkit-in-progress": inProgress,
|
|
1505
|
+
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1506
|
+
className: "copilotKitInputControlButton",
|
|
1507
|
+
children: buttonIcon
|
|
1508
|
+
}
|
|
1509
|
+
)
|
|
1510
|
+
] })
|
|
1511
|
+
] }),
|
|
1512
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PoweredByTag, { showPoweredBy })
|
|
1513
|
+
] });
|
|
1513
1514
|
};
|
|
1514
1515
|
|
|
1515
1516
|
// src/components/chat/messages/UserMessage.tsx
|
|
1516
|
-
var
|
|
1517
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1517
1518
|
var UserMessage = (props) => {
|
|
1518
|
-
return /* @__PURE__ */ (0,
|
|
1519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.subComponent || props.message });
|
|
1519
1520
|
};
|
|
1520
1521
|
|
|
1521
1522
|
// src/components/chat/Markdown.tsx
|
|
@@ -1549,7 +1550,7 @@ function useCopyToClipboard({ timeout = 2e3 }) {
|
|
|
1549
1550
|
}
|
|
1550
1551
|
|
|
1551
1552
|
// src/components/chat/CodeBlock.tsx
|
|
1552
|
-
var
|
|
1553
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1553
1554
|
var programmingLanguages = {
|
|
1554
1555
|
javascript: ".js",
|
|
1555
1556
|
python: ".py",
|
|
@@ -1612,15 +1613,15 @@ var CodeBlock = (0, import_react10.memo)(({ language, value }) => {
|
|
|
1612
1613
|
return;
|
|
1613
1614
|
copyToClipboard(value);
|
|
1614
1615
|
};
|
|
1615
|
-
return /* @__PURE__ */ (0,
|
|
1616
|
-
/* @__PURE__ */ (0,
|
|
1617
|
-
/* @__PURE__ */ (0,
|
|
1618
|
-
/* @__PURE__ */ (0,
|
|
1619
|
-
/* @__PURE__ */ (0,
|
|
1620
|
-
/* @__PURE__ */ (0,
|
|
1616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitCodeBlock", children: [
|
|
1617
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1621
1622
|
] })
|
|
1622
1623
|
] }),
|
|
1623
|
-
/* @__PURE__ */ (0,
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1624
1625
|
import_react_syntax_highlighter.Prism,
|
|
1625
1626
|
{
|
|
1626
1627
|
language,
|
|
@@ -1923,18 +1924,18 @@ var highlightStyle = {
|
|
|
1923
1924
|
// src/components/chat/Markdown.tsx
|
|
1924
1925
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
1925
1926
|
var import_remark_math = __toESM(require("remark-math"));
|
|
1926
|
-
var
|
|
1927
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1927
1928
|
var MemoizedReactMarkdown = (0, import_react11.memo)(
|
|
1928
1929
|
import_react_markdown.default,
|
|
1929
1930
|
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
1930
1931
|
);
|
|
1931
1932
|
var Markdown = ({ content }) => {
|
|
1932
|
-
return /* @__PURE__ */ (0,
|
|
1933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedReactMarkdown, { components, remarkPlugins: [import_remark_gfm.default, import_remark_math.default], children: content }) });
|
|
1933
1934
|
};
|
|
1934
1935
|
var components = {
|
|
1935
1936
|
a(_a) {
|
|
1936
1937
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1937
|
-
return /* @__PURE__ */ (0,
|
|
1938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1938
1939
|
"a",
|
|
1939
1940
|
__spreadProps(__spreadValues({
|
|
1940
1941
|
style: { color: "blue", textDecoration: "underline" }
|
|
@@ -1949,7 +1950,7 @@ var components = {
|
|
|
1949
1950
|
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
1950
1951
|
if (children.length) {
|
|
1951
1952
|
if (children[0] == "\u258D") {
|
|
1952
|
-
return /* @__PURE__ */ (0,
|
|
1953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1953
1954
|
"span",
|
|
1954
1955
|
{
|
|
1955
1956
|
style: {
|
|
@@ -1964,9 +1965,9 @@ var components = {
|
|
|
1964
1965
|
}
|
|
1965
1966
|
const match = /language-(\w+)/.exec(className || "");
|
|
1966
1967
|
if (inline) {
|
|
1967
|
-
return /* @__PURE__ */ (0,
|
|
1968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
|
|
1968
1969
|
}
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
1970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1970
1971
|
CodeBlock,
|
|
1971
1972
|
__spreadValues({
|
|
1972
1973
|
language: match && match[1] || "",
|
|
@@ -1979,7 +1980,7 @@ var components = {
|
|
|
1979
1980
|
|
|
1980
1981
|
// src/components/chat/messages/AssistantMessage.tsx
|
|
1981
1982
|
var import_react12 = require("react");
|
|
1982
|
-
var
|
|
1983
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1983
1984
|
var AssistantMessage = (props) => {
|
|
1984
1985
|
const { icons, labels } = useChatContext();
|
|
1985
1986
|
const {
|
|
@@ -2020,17 +2021,17 @@ var AssistantMessage = (props) => {
|
|
|
2020
2021
|
onThumbsDown(message);
|
|
2021
2022
|
}
|
|
2022
2023
|
};
|
|
2023
|
-
const LoadingIcon = () => /* @__PURE__ */ (0,
|
|
2024
|
-
return /* @__PURE__ */ (0,
|
|
2025
|
-
(message || isLoading) && /* @__PURE__ */ (0,
|
|
2026
|
-
message && /* @__PURE__ */ (0,
|
|
2027
|
-
isLoading && /* @__PURE__ */ (0,
|
|
2028
|
-
message && !isLoading && /* @__PURE__ */ (0,
|
|
2024
|
+
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: icons.activityIcon });
|
|
2025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2026
|
+
(message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2027
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Markdown, { content: message || "" }),
|
|
2028
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingIcon, {}),
|
|
2029
|
+
message && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2029
2030
|
"div",
|
|
2030
2031
|
{
|
|
2031
2032
|
className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
|
|
2032
2033
|
children: [
|
|
2033
|
-
/* @__PURE__ */ (0,
|
|
2034
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2034
2035
|
"button",
|
|
2035
2036
|
{
|
|
2036
2037
|
className: "copilotKitMessageControlButton",
|
|
@@ -2040,17 +2041,17 @@ var AssistantMessage = (props) => {
|
|
|
2040
2041
|
children: icons.regenerateIcon
|
|
2041
2042
|
}
|
|
2042
2043
|
),
|
|
2043
|
-
/* @__PURE__ */ (0,
|
|
2044
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2044
2045
|
"button",
|
|
2045
2046
|
{
|
|
2046
2047
|
className: "copilotKitMessageControlButton",
|
|
2047
2048
|
onClick: handleCopy,
|
|
2048
2049
|
"aria-label": labels.copyToClipboard,
|
|
2049
2050
|
title: labels.copyToClipboard,
|
|
2050
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
2051
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
|
|
2051
2052
|
}
|
|
2052
2053
|
),
|
|
2053
|
-
onThumbsUp && /* @__PURE__ */ (0,
|
|
2054
|
+
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2054
2055
|
"button",
|
|
2055
2056
|
{
|
|
2056
2057
|
className: "copilotKitMessageControlButton",
|
|
@@ -2060,7 +2061,7 @@ var AssistantMessage = (props) => {
|
|
|
2060
2061
|
children: icons.thumbsUpIcon
|
|
2061
2062
|
}
|
|
2062
2063
|
),
|
|
2063
|
-
onThumbsDown && /* @__PURE__ */ (0,
|
|
2064
|
+
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2064
2065
|
"button",
|
|
2065
2066
|
{
|
|
2066
2067
|
className: "copilotKitMessageControlButton",
|
|
@@ -2074,12 +2075,12 @@ var AssistantMessage = (props) => {
|
|
|
2074
2075
|
}
|
|
2075
2076
|
)
|
|
2076
2077
|
] }),
|
|
2077
|
-
/* @__PURE__ */ (0,
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
|
|
2078
2079
|
] });
|
|
2079
2080
|
};
|
|
2080
2081
|
|
|
2081
2082
|
// src/components/chat/messages/RenderTextMessage.tsx
|
|
2082
|
-
var
|
|
2083
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2083
2084
|
function RenderTextMessage(_a) {
|
|
2084
2085
|
var _b = _a, {
|
|
2085
2086
|
UserMessage: UserMessage2 = UserMessage,
|
|
@@ -2100,7 +2101,7 @@ function RenderTextMessage(_a) {
|
|
|
2100
2101
|
} = props;
|
|
2101
2102
|
if (message.isTextMessage()) {
|
|
2102
2103
|
if (message.role === "user") {
|
|
2103
|
-
return /* @__PURE__ */ (0,
|
|
2104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2104
2105
|
UserMessage2,
|
|
2105
2106
|
{
|
|
2106
2107
|
"data-message-role": "user",
|
|
@@ -2110,7 +2111,7 @@ function RenderTextMessage(_a) {
|
|
|
2110
2111
|
index
|
|
2111
2112
|
);
|
|
2112
2113
|
} else if (message.role == "assistant") {
|
|
2113
|
-
return /* @__PURE__ */ (0,
|
|
2114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2114
2115
|
AssistantMessage2,
|
|
2115
2116
|
{
|
|
2116
2117
|
"data-message-role": "assistant",
|
|
@@ -2133,7 +2134,7 @@ function RenderTextMessage(_a) {
|
|
|
2133
2134
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
2134
2135
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
2135
2136
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
2136
|
-
var
|
|
2137
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2137
2138
|
function RenderActionExecutionMessage(_a) {
|
|
2138
2139
|
var _b = _a, {
|
|
2139
2140
|
AssistantMessage: AssistantMessage2 = AssistantMessage
|
|
@@ -2147,7 +2148,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2147
2148
|
const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
|
|
2148
2149
|
if (typeof render === "string") {
|
|
2149
2150
|
if (isCurrentMessage && inProgress) {
|
|
2150
|
-
return /* @__PURE__ */ (0,
|
|
2151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2151
2152
|
AssistantMessage2,
|
|
2152
2153
|
{
|
|
2153
2154
|
rawData: message,
|
|
@@ -2180,7 +2181,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2180
2181
|
return null;
|
|
2181
2182
|
}
|
|
2182
2183
|
if (typeof toRender === "string") {
|
|
2183
|
-
return /* @__PURE__ */ (0,
|
|
2184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2184
2185
|
AssistantMessage2,
|
|
2185
2186
|
{
|
|
2186
2187
|
rawData: message,
|
|
@@ -2192,7 +2193,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2192
2193
|
index
|
|
2193
2194
|
);
|
|
2194
2195
|
} else {
|
|
2195
|
-
return /* @__PURE__ */ (0,
|
|
2196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2196
2197
|
AssistantMessage2,
|
|
2197
2198
|
{
|
|
2198
2199
|
rawData: message,
|
|
@@ -2206,20 +2207,20 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2206
2207
|
}
|
|
2207
2208
|
} catch (e) {
|
|
2208
2209
|
console.error(`Error executing render function for action ${message.name}: ${e}`);
|
|
2209
|
-
return /* @__PURE__ */ (0,
|
|
2210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2210
2211
|
AssistantMessage2,
|
|
2211
2212
|
{
|
|
2212
2213
|
rawData: message,
|
|
2213
2214
|
"data-message-role": "assistant",
|
|
2214
2215
|
isLoading: false,
|
|
2215
2216
|
isGenerating: false,
|
|
2216
|
-
subComponent: /* @__PURE__ */ (0,
|
|
2217
|
-
/* @__PURE__ */ (0,
|
|
2217
|
+
subComponent: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2218
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("b", { children: [
|
|
2218
2219
|
"\u274C Error executing render function for action ",
|
|
2219
2220
|
message.name,
|
|
2220
2221
|
":"
|
|
2221
2222
|
] }),
|
|
2222
|
-
/* @__PURE__ */ (0,
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
|
|
2223
2224
|
] })
|
|
2224
2225
|
},
|
|
2225
2226
|
index
|
|
@@ -2229,7 +2230,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2229
2230
|
} else if (!inProgress || !isCurrentMessage) {
|
|
2230
2231
|
return null;
|
|
2231
2232
|
} else {
|
|
2232
|
-
return /* @__PURE__ */ (0,
|
|
2233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2233
2234
|
AssistantMessage2,
|
|
2234
2235
|
{
|
|
2235
2236
|
rawData: message,
|
|
@@ -2244,7 +2245,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2244
2245
|
}
|
|
2245
2246
|
|
|
2246
2247
|
// src/components/chat/messages/RenderResultMessage.tsx
|
|
2247
|
-
var
|
|
2248
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2248
2249
|
function RenderResultMessage(_a) {
|
|
2249
2250
|
var _b = _a, {
|
|
2250
2251
|
AssistantMessage: AssistantMessage2 = AssistantMessage
|
|
@@ -2253,7 +2254,7 @@ function RenderResultMessage(_a) {
|
|
|
2253
2254
|
]);
|
|
2254
2255
|
const { message, inProgress, index, isCurrentMessage } = props;
|
|
2255
2256
|
if (message.isResultMessage() && inProgress && isCurrentMessage) {
|
|
2256
|
-
return /* @__PURE__ */ (0,
|
|
2257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2257
2258
|
AssistantMessage2,
|
|
2258
2259
|
{
|
|
2259
2260
|
"data-message-role": "assistant",
|
|
@@ -2270,7 +2271,7 @@ function RenderResultMessage(_a) {
|
|
|
2270
2271
|
|
|
2271
2272
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
2272
2273
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
2273
|
-
var
|
|
2274
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2274
2275
|
function RenderAgentStateMessage(_a) {
|
|
2275
2276
|
var _b = _a, {
|
|
2276
2277
|
AssistantMessage: AssistantMessage2 = AssistantMessage
|
|
@@ -2287,7 +2288,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2287
2288
|
if (render) {
|
|
2288
2289
|
if (typeof render === "string") {
|
|
2289
2290
|
if (isCurrentMessage && inProgress) {
|
|
2290
|
-
return /* @__PURE__ */ (0,
|
|
2291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2291
2292
|
AssistantMessage2,
|
|
2292
2293
|
{
|
|
2293
2294
|
rawData: message,
|
|
@@ -2313,7 +2314,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2313
2314
|
return null;
|
|
2314
2315
|
}
|
|
2315
2316
|
if (!toRender && isCurrentMessage && inProgress) {
|
|
2316
|
-
return /* @__PURE__ */ (0,
|
|
2317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2317
2318
|
AssistantMessage2,
|
|
2318
2319
|
{
|
|
2319
2320
|
"data-message-role": "assistant",
|
|
@@ -2327,7 +2328,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2327
2328
|
return null;
|
|
2328
2329
|
}
|
|
2329
2330
|
if (typeof toRender === "string") {
|
|
2330
|
-
return /* @__PURE__ */ (0,
|
|
2331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2331
2332
|
AssistantMessage2,
|
|
2332
2333
|
{
|
|
2333
2334
|
rawData: message,
|
|
@@ -2339,7 +2340,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2339
2340
|
index
|
|
2340
2341
|
);
|
|
2341
2342
|
} else {
|
|
2342
|
-
return /* @__PURE__ */ (0,
|
|
2343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2343
2344
|
AssistantMessage2,
|
|
2344
2345
|
{
|
|
2345
2346
|
rawData: message,
|
|
@@ -2355,7 +2356,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2355
2356
|
} else if (!inProgress || !isCurrentMessage) {
|
|
2356
2357
|
return null;
|
|
2357
2358
|
} else {
|
|
2358
|
-
return /* @__PURE__ */ (0,
|
|
2359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2359
2360
|
AssistantMessage2,
|
|
2360
2361
|
{
|
|
2361
2362
|
rawData: message,
|
|
@@ -2370,7 +2371,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2370
2371
|
}
|
|
2371
2372
|
|
|
2372
2373
|
// src/components/chat/messages/RenderImageMessage.tsx
|
|
2373
|
-
var
|
|
2374
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2374
2375
|
function RenderImageMessage(_a) {
|
|
2375
2376
|
var _b = _a, {
|
|
2376
2377
|
UserMessage: UserMessage2 = UserMessage,
|
|
@@ -2391,7 +2392,7 @@ function RenderImageMessage(_a) {
|
|
|
2391
2392
|
} = props;
|
|
2392
2393
|
if (message.isImageMessage()) {
|
|
2393
2394
|
const imageData = `data:${message.format};base64,${message.bytes}`;
|
|
2394
|
-
const imageComponent = /* @__PURE__ */ (0,
|
|
2395
|
+
const imageComponent = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "copilotKitImage", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2395
2396
|
"img",
|
|
2396
2397
|
{
|
|
2397
2398
|
src: imageData,
|
|
@@ -2400,7 +2401,7 @@ function RenderImageMessage(_a) {
|
|
|
2400
2401
|
}
|
|
2401
2402
|
) });
|
|
2402
2403
|
if (message.role === "user") {
|
|
2403
|
-
return /* @__PURE__ */ (0,
|
|
2404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2404
2405
|
UserMessage2,
|
|
2405
2406
|
{
|
|
2406
2407
|
"data-message-role": "user",
|
|
@@ -2411,7 +2412,7 @@ function RenderImageMessage(_a) {
|
|
|
2411
2412
|
index
|
|
2412
2413
|
);
|
|
2413
2414
|
} else if (message.role === "assistant") {
|
|
2414
|
-
return /* @__PURE__ */ (0,
|
|
2415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2415
2416
|
AssistantMessage2,
|
|
2416
2417
|
{
|
|
2417
2418
|
"data-message-role": "assistant",
|
|
@@ -2437,9 +2438,9 @@ function RenderImageMessage(_a) {
|
|
|
2437
2438
|
var import_react_core9 = require("@copilotkit/react-core");
|
|
2438
2439
|
var import_shared2 = require("@copilotkit/shared");
|
|
2439
2440
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2440
|
-
var
|
|
2441
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2441
2442
|
function Suggestion({ title, message, onClick, partial, className }) {
|
|
2442
|
-
return /* @__PURE__ */ (0,
|
|
2443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2443
2444
|
"button",
|
|
2444
2445
|
{
|
|
2445
2446
|
disabled: partial,
|
|
@@ -2449,7 +2450,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
|
|
|
2449
2450
|
},
|
|
2450
2451
|
className: className || (partial ? "suggestion loading" : "suggestion"),
|
|
2451
2452
|
"data-test-id": "suggestion",
|
|
2452
|
-
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0,
|
|
2453
|
+
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: title })
|
|
2453
2454
|
}
|
|
2454
2455
|
);
|
|
2455
2456
|
}
|
|
@@ -2531,7 +2532,7 @@ var import_shared3 = require("@copilotkit/shared");
|
|
|
2531
2532
|
var import_react_core11 = require("@copilotkit/react-core");
|
|
2532
2533
|
|
|
2533
2534
|
// src/components/chat/ImageUploadQueue.tsx
|
|
2534
|
-
var
|
|
2535
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2535
2536
|
var ImageUploadQueue = ({
|
|
2536
2537
|
images,
|
|
2537
2538
|
onRemoveImage,
|
|
@@ -2539,7 +2540,7 @@ var ImageUploadQueue = ({
|
|
|
2539
2540
|
}) => {
|
|
2540
2541
|
if (images.length === 0)
|
|
2541
2542
|
return null;
|
|
2542
|
-
return /* @__PURE__ */ (0,
|
|
2543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2543
2544
|
"div",
|
|
2544
2545
|
{
|
|
2545
2546
|
className: `copilotKitImageUploadQueue ${className}`,
|
|
@@ -2550,7 +2551,7 @@ var ImageUploadQueue = ({
|
|
|
2550
2551
|
margin: "8px",
|
|
2551
2552
|
padding: "8px"
|
|
2552
2553
|
},
|
|
2553
|
-
children: images.map((image, index) => /* @__PURE__ */ (0,
|
|
2554
|
+
children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2554
2555
|
"div",
|
|
2555
2556
|
{
|
|
2556
2557
|
className: "copilotKitImageUploadQueueItem",
|
|
@@ -2563,7 +2564,7 @@ var ImageUploadQueue = ({
|
|
|
2563
2564
|
overflow: "hidden"
|
|
2564
2565
|
},
|
|
2565
2566
|
children: [
|
|
2566
|
-
/* @__PURE__ */ (0,
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2567
2568
|
"img",
|
|
2568
2569
|
{
|
|
2569
2570
|
src: `data:${image.contentType};base64,${image.bytes}`,
|
|
@@ -2575,7 +2576,7 @@ var ImageUploadQueue = ({
|
|
|
2575
2576
|
}
|
|
2576
2577
|
}
|
|
2577
2578
|
),
|
|
2578
|
-
/* @__PURE__ */ (0,
|
|
2579
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2579
2580
|
"button",
|
|
2580
2581
|
{
|
|
2581
2582
|
onClick: () => onRemoveImage(index),
|
|
@@ -2609,7 +2610,7 @@ var ImageUploadQueue = ({
|
|
|
2609
2610
|
};
|
|
2610
2611
|
|
|
2611
2612
|
// src/components/chat/Chat.tsx
|
|
2612
|
-
var
|
|
2613
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2613
2614
|
function CopilotChat({
|
|
2614
2615
|
instructions,
|
|
2615
2616
|
onSubmitMessage,
|
|
@@ -2766,8 +2767,8 @@ function CopilotChat({
|
|
|
2766
2767
|
const removeSelectedImage = (index) => {
|
|
2767
2768
|
setSelectedImages((prev) => prev.filter((_, i) => i !== index));
|
|
2768
2769
|
};
|
|
2769
|
-
return /* @__PURE__ */ (0,
|
|
2770
|
-
/* @__PURE__ */ (0,
|
|
2770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2771
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2771
2772
|
Messages2,
|
|
2772
2773
|
{
|
|
2773
2774
|
AssistantMessage: AssistantMessage2,
|
|
@@ -2783,7 +2784,7 @@ function CopilotChat({
|
|
|
2783
2784
|
onCopy: handleCopy,
|
|
2784
2785
|
onThumbsUp,
|
|
2785
2786
|
onThumbsDown,
|
|
2786
|
-
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2787
|
+
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2787
2788
|
Suggestion,
|
|
2788
2789
|
{
|
|
2789
2790
|
title: suggestion.title,
|
|
@@ -2796,9 +2797,9 @@ function CopilotChat({
|
|
|
2796
2797
|
)) })
|
|
2797
2798
|
}
|
|
2798
2799
|
),
|
|
2799
|
-
imageUploadsEnabled && /* @__PURE__ */ (0,
|
|
2800
|
-
/* @__PURE__ */ (0,
|
|
2801
|
-
/* @__PURE__ */ (0,
|
|
2800
|
+
imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2801
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
|
|
2802
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2802
2803
|
"input",
|
|
2803
2804
|
{
|
|
2804
2805
|
type: "file",
|
|
@@ -2810,7 +2811,7 @@ function CopilotChat({
|
|
|
2810
2811
|
}
|
|
2811
2812
|
)
|
|
2812
2813
|
] }),
|
|
2813
|
-
/* @__PURE__ */ (0,
|
|
2814
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2814
2815
|
Input2,
|
|
2815
2816
|
{
|
|
2816
2817
|
inProgress: isLoading,
|
|
@@ -2833,10 +2834,10 @@ function WrappedCopilotChat({
|
|
|
2833
2834
|
}) {
|
|
2834
2835
|
const chatContext = import_react13.default.useContext(ChatContext);
|
|
2835
2836
|
if (!chatContext) {
|
|
2836
|
-
return /* @__PURE__ */ (0,
|
|
2837
|
-
}, children: /* @__PURE__ */ (0,
|
|
2837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2838
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
|
|
2838
2839
|
}
|
|
2839
|
-
return /* @__PURE__ */ (0,
|
|
2840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children });
|
|
2840
2841
|
}
|
|
2841
2842
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2842
2843
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
@@ -3021,7 +3022,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
3021
3022
|
};
|
|
3022
3023
|
|
|
3023
3024
|
// src/components/chat/Modal.tsx
|
|
3024
|
-
var
|
|
3025
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3025
3026
|
var CopilotModal = ({
|
|
3026
3027
|
instructions,
|
|
3027
3028
|
defaultOpen = false,
|
|
@@ -3055,19 +3056,19 @@ var CopilotModal = ({
|
|
|
3055
3056
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3056
3057
|
setOpenState(open);
|
|
3057
3058
|
};
|
|
3058
|
-
return /* @__PURE__ */ (0,
|
|
3059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
3059
3060
|
children,
|
|
3060
|
-
/* @__PURE__ */ (0,
|
|
3061
|
-
/* @__PURE__ */ (0,
|
|
3062
|
-
/* @__PURE__ */ (0,
|
|
3061
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className, children: [
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button2, {}),
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3063
3064
|
Window2,
|
|
3064
3065
|
{
|
|
3065
3066
|
clickOutsideToClose,
|
|
3066
3067
|
shortcut,
|
|
3067
3068
|
hitEscapeToClose,
|
|
3068
3069
|
children: [
|
|
3069
|
-
/* @__PURE__ */ (0,
|
|
3070
|
-
/* @__PURE__ */ (0,
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Header2, {}),
|
|
3071
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3071
3072
|
CopilotChat,
|
|
3072
3073
|
{
|
|
3073
3074
|
instructions,
|