@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
|
@@ -405,15 +405,6 @@ var ChatContextProvider = ({
|
|
|
405
405
|
// src/components/chat/Window.tsx
|
|
406
406
|
var import_react2 = __toESM(require("react"));
|
|
407
407
|
var import_react_core = require("@copilotkit/react-core");
|
|
408
|
-
|
|
409
|
-
// src/hooks/use-dark-mode.ts
|
|
410
|
-
var useDarkMode = () => {
|
|
411
|
-
if (typeof window === "undefined")
|
|
412
|
-
return false;
|
|
413
|
-
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;
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
// src/components/chat/Window.tsx
|
|
417
408
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
418
409
|
var Window = ({
|
|
419
410
|
children,
|
|
@@ -421,17 +412,16 @@ var Window = ({
|
|
|
421
412
|
shortcut,
|
|
422
413
|
hitEscapeToClose
|
|
423
414
|
}) => {
|
|
424
|
-
var _a;
|
|
425
415
|
const windowRef = import_react2.default.useRef(null);
|
|
426
416
|
const context = (0, import_react_core.useCopilotContext)();
|
|
427
417
|
const { open, setOpen } = useChatContext();
|
|
428
418
|
const handleClickOutside = (0, import_react2.useCallback)(
|
|
429
419
|
(event) => {
|
|
430
|
-
var
|
|
420
|
+
var _a;
|
|
431
421
|
if (!clickOutsideToClose) {
|
|
432
422
|
return;
|
|
433
423
|
}
|
|
434
|
-
const parentElement = (
|
|
424
|
+
const parentElement = (_a = windowRef.current) == null ? void 0 : _a.parentElement;
|
|
435
425
|
let className = "";
|
|
436
426
|
if (event.target instanceof HTMLElement) {
|
|
437
427
|
className = event.target.className;
|
|
@@ -445,10 +435,10 @@ var Window = ({
|
|
|
445
435
|
);
|
|
446
436
|
const handleKeyDown = (0, import_react2.useCallback)(
|
|
447
437
|
(event) => {
|
|
448
|
-
var
|
|
438
|
+
var _a;
|
|
449
439
|
const target = event.target;
|
|
450
440
|
const isInput = target.tagName === "INPUT" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.isContentEditable;
|
|
451
|
-
const isDescendantOfWrapper = (
|
|
441
|
+
const isDescendantOfWrapper = (_a = windowRef.current) == null ? void 0 : _a.contains(target);
|
|
452
442
|
if (open && event.key === "Escape" && (!isInput || isDescendantOfWrapper) && hitEscapeToClose) {
|
|
453
443
|
setOpen(false);
|
|
454
444
|
} else if (event.key === shortcut && (isMacOS() && event.metaKey || !isMacOS() && event.ctrlKey) && (!isInput || isDescendantOfWrapper)) {
|
|
@@ -503,29 +493,7 @@ var Window = ({
|
|
|
503
493
|
}
|
|
504
494
|
};
|
|
505
495
|
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
506
|
-
|
|
507
|
-
const showPoweredBy = !((_a = context.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
508
|
-
const poweredByStyle = {
|
|
509
|
-
visibility: "visible",
|
|
510
|
-
display: "block",
|
|
511
|
-
position: "static",
|
|
512
|
-
textAlign: "center",
|
|
513
|
-
fontSize: "12px",
|
|
514
|
-
padding: "3px 0",
|
|
515
|
-
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
516
|
-
};
|
|
517
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
518
|
-
"div",
|
|
519
|
-
{
|
|
520
|
-
className: `copilotKitWindow ${showPoweredBy ? " poweredByContainer" : ""} ${open ? " open" : ""}`,
|
|
521
|
-
ref: windowRef,
|
|
522
|
-
children: [
|
|
523
|
-
children,
|
|
524
|
-
showPoweredBy && // @ts-expect-error -- expecting position not to be a string, but it can be.
|
|
525
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" })
|
|
526
|
-
]
|
|
527
|
-
}
|
|
528
|
-
);
|
|
496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `copilotKitWindow ${open ? " open" : ""}`, ref: windowRef, children });
|
|
529
497
|
};
|
|
530
498
|
var preventScroll = (event) => {
|
|
531
499
|
let targetElement = event.target;
|
|
@@ -1436,30 +1404,60 @@ var usePushToTalk = ({
|
|
|
1436
1404
|
|
|
1437
1405
|
// src/components/chat/Input.tsx
|
|
1438
1406
|
var import_react_core6 = require("@copilotkit/react-core");
|
|
1407
|
+
|
|
1408
|
+
// src/hooks/use-dark-mode.ts
|
|
1409
|
+
var useDarkMode = () => {
|
|
1410
|
+
if (typeof window === "undefined")
|
|
1411
|
+
return false;
|
|
1412
|
+
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;
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
// src/components/chat/PoweredByTag.tsx
|
|
1439
1416
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1417
|
+
function PoweredByTag({ showPoweredBy = true }) {
|
|
1418
|
+
const isDark = useDarkMode();
|
|
1419
|
+
if (!showPoweredBy) {
|
|
1420
|
+
return null;
|
|
1421
|
+
}
|
|
1422
|
+
const poweredByStyle = {
|
|
1423
|
+
visibility: "visible",
|
|
1424
|
+
display: "block",
|
|
1425
|
+
position: "static",
|
|
1426
|
+
textAlign: "center",
|
|
1427
|
+
fontSize: "12px",
|
|
1428
|
+
padding: "3px 0",
|
|
1429
|
+
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
1430
|
+
};
|
|
1431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" }) });
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
// src/components/chat/Input.tsx
|
|
1435
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1440
1436
|
var MAX_NEWLINES = 6;
|
|
1441
1437
|
var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
1438
|
+
var _a;
|
|
1442
1439
|
const context = useChatContext();
|
|
1443
1440
|
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1441
|
+
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
1444
1442
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
1445
1443
|
const textareaRef = (0, import_react9.useRef)(null);
|
|
1446
1444
|
const handleDivClick = (event) => {
|
|
1447
|
-
var
|
|
1445
|
+
var _a2;
|
|
1448
1446
|
const target = event.target;
|
|
1449
1447
|
if (target.closest("button"))
|
|
1450
1448
|
return;
|
|
1451
1449
|
if (target.tagName === "TEXTAREA")
|
|
1452
1450
|
return;
|
|
1453
|
-
(
|
|
1451
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
1454
1452
|
};
|
|
1455
1453
|
const [text, setText] = (0, import_react9.useState)("");
|
|
1456
1454
|
const send = () => {
|
|
1457
|
-
var
|
|
1455
|
+
var _a2;
|
|
1458
1456
|
if (inProgress)
|
|
1459
1457
|
return;
|
|
1460
1458
|
onSend(text);
|
|
1461
1459
|
setText("");
|
|
1462
|
-
(
|
|
1460
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
1463
1461
|
};
|
|
1464
1462
|
const { pushToTalkState, setPushToTalkState } = usePushToTalk({
|
|
1465
1463
|
sendFunction: onSend,
|
|
@@ -1469,62 +1467,65 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1469
1467
|
const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1470
1468
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1471
1469
|
const canSend = () => {
|
|
1472
|
-
var
|
|
1473
|
-
const interruptEvent = (
|
|
1470
|
+
var _a2;
|
|
1471
|
+
const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
|
|
1474
1472
|
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
1475
1473
|
return (isInProgress || !isInProgress && text.trim().length > 0) && pushToTalkState === "idle" && !interruptInProgress;
|
|
1476
1474
|
};
|
|
1477
1475
|
const sendDisabled = !canSend();
|
|
1478
|
-
return /* @__PURE__ */ (0,
|
|
1479
|
-
/* @__PURE__ */ (0,
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
event.
|
|
1491
|
-
|
|
1492
|
-
|
|
1476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
|
|
1477
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1478
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1479
|
+
Textarea_default,
|
|
1480
|
+
{
|
|
1481
|
+
ref: textareaRef,
|
|
1482
|
+
placeholder: context.labels.placeholder,
|
|
1483
|
+
autoFocus: false,
|
|
1484
|
+
maxRows: MAX_NEWLINES,
|
|
1485
|
+
value: text,
|
|
1486
|
+
onChange: (event) => setText(event.target.value),
|
|
1487
|
+
onKeyDown: (event) => {
|
|
1488
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1489
|
+
event.preventDefault();
|
|
1490
|
+
if (canSend()) {
|
|
1491
|
+
send();
|
|
1492
|
+
}
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
1495
|
}
|
|
1496
|
-
}
|
|
1497
|
-
),
|
|
1498
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
1499
|
-
onUpload && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
1500
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { flexGrow: 1 } }),
|
|
1501
|
-
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1502
|
-
"button",
|
|
1503
|
-
{
|
|
1504
|
-
onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
|
|
1505
|
-
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
1506
|
-
children: context.icons.pushToTalkIcon
|
|
1507
|
-
}
|
|
1508
1496
|
),
|
|
1509
|
-
/* @__PURE__ */ (0,
|
|
1510
|
-
"button",
|
|
1511
|
-
{
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1497
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
1498
|
+
onUpload && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { flexGrow: 1 } }),
|
|
1500
|
+
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1501
|
+
"button",
|
|
1502
|
+
{
|
|
1503
|
+
onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
|
|
1504
|
+
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
1505
|
+
children: context.icons.pushToTalkIcon
|
|
1506
|
+
}
|
|
1507
|
+
),
|
|
1508
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1509
|
+
"button",
|
|
1510
|
+
{
|
|
1511
|
+
disabled: sendDisabled,
|
|
1512
|
+
onClick: isInProgress ? onStop : send,
|
|
1513
|
+
"data-copilotkit-in-progress": inProgress,
|
|
1514
|
+
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1515
|
+
className: "copilotKitInputControlButton",
|
|
1516
|
+
children: buttonIcon
|
|
1517
|
+
}
|
|
1518
|
+
)
|
|
1519
|
+
] })
|
|
1520
|
+
] }),
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PoweredByTag, { showPoweredBy })
|
|
1522
|
+
] });
|
|
1522
1523
|
};
|
|
1523
1524
|
|
|
1524
1525
|
// src/components/chat/messages/UserMessage.tsx
|
|
1525
|
-
var
|
|
1526
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1526
1527
|
var UserMessage = (props) => {
|
|
1527
|
-
return /* @__PURE__ */ (0,
|
|
1528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.subComponent || props.message });
|
|
1528
1529
|
};
|
|
1529
1530
|
|
|
1530
1531
|
// src/components/chat/Markdown.tsx
|
|
@@ -1558,7 +1559,7 @@ function useCopyToClipboard({ timeout = 2e3 }) {
|
|
|
1558
1559
|
}
|
|
1559
1560
|
|
|
1560
1561
|
// src/components/chat/CodeBlock.tsx
|
|
1561
|
-
var
|
|
1562
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1562
1563
|
var programmingLanguages = {
|
|
1563
1564
|
javascript: ".js",
|
|
1564
1565
|
python: ".py",
|
|
@@ -1621,15 +1622,15 @@ var CodeBlock = (0, import_react10.memo)(({ language, value }) => {
|
|
|
1621
1622
|
return;
|
|
1622
1623
|
copyToClipboard(value);
|
|
1623
1624
|
};
|
|
1624
|
-
return /* @__PURE__ */ (0,
|
|
1625
|
-
/* @__PURE__ */ (0,
|
|
1626
|
-
/* @__PURE__ */ (0,
|
|
1627
|
-
/* @__PURE__ */ (0,
|
|
1628
|
-
/* @__PURE__ */ (0,
|
|
1629
|
-
/* @__PURE__ */ (0,
|
|
1625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitCodeBlock", children: [
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1630
1631
|
] })
|
|
1631
1632
|
] }),
|
|
1632
|
-
/* @__PURE__ */ (0,
|
|
1633
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1633
1634
|
import_react_syntax_highlighter.Prism,
|
|
1634
1635
|
{
|
|
1635
1636
|
language,
|
|
@@ -1932,18 +1933,18 @@ var highlightStyle = {
|
|
|
1932
1933
|
// src/components/chat/Markdown.tsx
|
|
1933
1934
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
1934
1935
|
var import_remark_math = __toESM(require("remark-math"));
|
|
1935
|
-
var
|
|
1936
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1936
1937
|
var MemoizedReactMarkdown = (0, import_react11.memo)(
|
|
1937
1938
|
import_react_markdown.default,
|
|
1938
1939
|
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
1939
1940
|
);
|
|
1940
1941
|
var Markdown = ({ content }) => {
|
|
1941
|
-
return /* @__PURE__ */ (0,
|
|
1942
|
+
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 }) });
|
|
1942
1943
|
};
|
|
1943
1944
|
var components = {
|
|
1944
1945
|
a(_a) {
|
|
1945
1946
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1946
|
-
return /* @__PURE__ */ (0,
|
|
1947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1947
1948
|
"a",
|
|
1948
1949
|
__spreadProps(__spreadValues({
|
|
1949
1950
|
style: { color: "blue", textDecoration: "underline" }
|
|
@@ -1958,7 +1959,7 @@ var components = {
|
|
|
1958
1959
|
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
1959
1960
|
if (children.length) {
|
|
1960
1961
|
if (children[0] == "\u258D") {
|
|
1961
|
-
return /* @__PURE__ */ (0,
|
|
1962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1962
1963
|
"span",
|
|
1963
1964
|
{
|
|
1964
1965
|
style: {
|
|
@@ -1973,9 +1974,9 @@ var components = {
|
|
|
1973
1974
|
}
|
|
1974
1975
|
const match = /language-(\w+)/.exec(className || "");
|
|
1975
1976
|
if (inline) {
|
|
1976
|
-
return /* @__PURE__ */ (0,
|
|
1977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
|
|
1977
1978
|
}
|
|
1978
|
-
return /* @__PURE__ */ (0,
|
|
1979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1979
1980
|
CodeBlock,
|
|
1980
1981
|
__spreadValues({
|
|
1981
1982
|
language: match && match[1] || "",
|
|
@@ -1988,7 +1989,7 @@ var components = {
|
|
|
1988
1989
|
|
|
1989
1990
|
// src/components/chat/messages/AssistantMessage.tsx
|
|
1990
1991
|
var import_react12 = require("react");
|
|
1991
|
-
var
|
|
1992
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1992
1993
|
var AssistantMessage = (props) => {
|
|
1993
1994
|
const { icons, labels } = useChatContext();
|
|
1994
1995
|
const {
|
|
@@ -2029,17 +2030,17 @@ var AssistantMessage = (props) => {
|
|
|
2029
2030
|
onThumbsDown(message);
|
|
2030
2031
|
}
|
|
2031
2032
|
};
|
|
2032
|
-
const LoadingIcon = () => /* @__PURE__ */ (0,
|
|
2033
|
-
return /* @__PURE__ */ (0,
|
|
2034
|
-
(message || isLoading) && /* @__PURE__ */ (0,
|
|
2035
|
-
message && /* @__PURE__ */ (0,
|
|
2036
|
-
isLoading && /* @__PURE__ */ (0,
|
|
2037
|
-
message && !isLoading && /* @__PURE__ */ (0,
|
|
2033
|
+
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: icons.activityIcon });
|
|
2034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2035
|
+
(message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2036
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Markdown, { content: message || "" }),
|
|
2037
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingIcon, {}),
|
|
2038
|
+
message && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2038
2039
|
"div",
|
|
2039
2040
|
{
|
|
2040
2041
|
className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
|
|
2041
2042
|
children: [
|
|
2042
|
-
/* @__PURE__ */ (0,
|
|
2043
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2043
2044
|
"button",
|
|
2044
2045
|
{
|
|
2045
2046
|
className: "copilotKitMessageControlButton",
|
|
@@ -2049,17 +2050,17 @@ var AssistantMessage = (props) => {
|
|
|
2049
2050
|
children: icons.regenerateIcon
|
|
2050
2051
|
}
|
|
2051
2052
|
),
|
|
2052
|
-
/* @__PURE__ */ (0,
|
|
2053
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2053
2054
|
"button",
|
|
2054
2055
|
{
|
|
2055
2056
|
className: "copilotKitMessageControlButton",
|
|
2056
2057
|
onClick: handleCopy,
|
|
2057
2058
|
"aria-label": labels.copyToClipboard,
|
|
2058
2059
|
title: labels.copyToClipboard,
|
|
2059
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
2060
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
|
|
2060
2061
|
}
|
|
2061
2062
|
),
|
|
2062
|
-
onThumbsUp && /* @__PURE__ */ (0,
|
|
2063
|
+
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2063
2064
|
"button",
|
|
2064
2065
|
{
|
|
2065
2066
|
className: "copilotKitMessageControlButton",
|
|
@@ -2069,7 +2070,7 @@ var AssistantMessage = (props) => {
|
|
|
2069
2070
|
children: icons.thumbsUpIcon
|
|
2070
2071
|
}
|
|
2071
2072
|
),
|
|
2072
|
-
onThumbsDown && /* @__PURE__ */ (0,
|
|
2073
|
+
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2073
2074
|
"button",
|
|
2074
2075
|
{
|
|
2075
2076
|
className: "copilotKitMessageControlButton",
|
|
@@ -2083,12 +2084,12 @@ var AssistantMessage = (props) => {
|
|
|
2083
2084
|
}
|
|
2084
2085
|
)
|
|
2085
2086
|
] }),
|
|
2086
|
-
/* @__PURE__ */ (0,
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
|
|
2087
2088
|
] });
|
|
2088
2089
|
};
|
|
2089
2090
|
|
|
2090
2091
|
// src/components/chat/messages/RenderTextMessage.tsx
|
|
2091
|
-
var
|
|
2092
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2092
2093
|
function RenderTextMessage(_a) {
|
|
2093
2094
|
var _b = _a, {
|
|
2094
2095
|
UserMessage: UserMessage2 = UserMessage,
|
|
@@ -2109,7 +2110,7 @@ function RenderTextMessage(_a) {
|
|
|
2109
2110
|
} = props;
|
|
2110
2111
|
if (message.isTextMessage()) {
|
|
2111
2112
|
if (message.role === "user") {
|
|
2112
|
-
return /* @__PURE__ */ (0,
|
|
2113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2113
2114
|
UserMessage2,
|
|
2114
2115
|
{
|
|
2115
2116
|
"data-message-role": "user",
|
|
@@ -2119,7 +2120,7 @@ function RenderTextMessage(_a) {
|
|
|
2119
2120
|
index
|
|
2120
2121
|
);
|
|
2121
2122
|
} else if (message.role == "assistant") {
|
|
2122
|
-
return /* @__PURE__ */ (0,
|
|
2123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2123
2124
|
AssistantMessage2,
|
|
2124
2125
|
{
|
|
2125
2126
|
"data-message-role": "assistant",
|
|
@@ -2142,7 +2143,7 @@ function RenderTextMessage(_a) {
|
|
|
2142
2143
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
2143
2144
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
2144
2145
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
2145
|
-
var
|
|
2146
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2146
2147
|
function RenderActionExecutionMessage(_a) {
|
|
2147
2148
|
var _b = _a, {
|
|
2148
2149
|
AssistantMessage: AssistantMessage2 = AssistantMessage
|
|
@@ -2156,7 +2157,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2156
2157
|
const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
|
|
2157
2158
|
if (typeof render === "string") {
|
|
2158
2159
|
if (isCurrentMessage && inProgress) {
|
|
2159
|
-
return /* @__PURE__ */ (0,
|
|
2160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2160
2161
|
AssistantMessage2,
|
|
2161
2162
|
{
|
|
2162
2163
|
rawData: message,
|
|
@@ -2189,7 +2190,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2189
2190
|
return null;
|
|
2190
2191
|
}
|
|
2191
2192
|
if (typeof toRender === "string") {
|
|
2192
|
-
return /* @__PURE__ */ (0,
|
|
2193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2193
2194
|
AssistantMessage2,
|
|
2194
2195
|
{
|
|
2195
2196
|
rawData: message,
|
|
@@ -2201,7 +2202,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2201
2202
|
index
|
|
2202
2203
|
);
|
|
2203
2204
|
} else {
|
|
2204
|
-
return /* @__PURE__ */ (0,
|
|
2205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2205
2206
|
AssistantMessage2,
|
|
2206
2207
|
{
|
|
2207
2208
|
rawData: message,
|
|
@@ -2215,20 +2216,20 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2215
2216
|
}
|
|
2216
2217
|
} catch (e) {
|
|
2217
2218
|
console.error(`Error executing render function for action ${message.name}: ${e}`);
|
|
2218
|
-
return /* @__PURE__ */ (0,
|
|
2219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2219
2220
|
AssistantMessage2,
|
|
2220
2221
|
{
|
|
2221
2222
|
rawData: message,
|
|
2222
2223
|
"data-message-role": "assistant",
|
|
2223
2224
|
isLoading: false,
|
|
2224
2225
|
isGenerating: false,
|
|
2225
|
-
subComponent: /* @__PURE__ */ (0,
|
|
2226
|
-
/* @__PURE__ */ (0,
|
|
2226
|
+
subComponent: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("b", { children: [
|
|
2227
2228
|
"\u274C Error executing render function for action ",
|
|
2228
2229
|
message.name,
|
|
2229
2230
|
":"
|
|
2230
2231
|
] }),
|
|
2231
|
-
/* @__PURE__ */ (0,
|
|
2232
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
|
|
2232
2233
|
] })
|
|
2233
2234
|
},
|
|
2234
2235
|
index
|
|
@@ -2238,7 +2239,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2238
2239
|
} else if (!inProgress || !isCurrentMessage) {
|
|
2239
2240
|
return null;
|
|
2240
2241
|
} else {
|
|
2241
|
-
return /* @__PURE__ */ (0,
|
|
2242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2242
2243
|
AssistantMessage2,
|
|
2243
2244
|
{
|
|
2244
2245
|
rawData: message,
|
|
@@ -2253,7 +2254,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2253
2254
|
}
|
|
2254
2255
|
|
|
2255
2256
|
// src/components/chat/messages/RenderResultMessage.tsx
|
|
2256
|
-
var
|
|
2257
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2257
2258
|
function RenderResultMessage(_a) {
|
|
2258
2259
|
var _b = _a, {
|
|
2259
2260
|
AssistantMessage: AssistantMessage2 = AssistantMessage
|
|
@@ -2262,7 +2263,7 @@ function RenderResultMessage(_a) {
|
|
|
2262
2263
|
]);
|
|
2263
2264
|
const { message, inProgress, index, isCurrentMessage } = props;
|
|
2264
2265
|
if (message.isResultMessage() && inProgress && isCurrentMessage) {
|
|
2265
|
-
return /* @__PURE__ */ (0,
|
|
2266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2266
2267
|
AssistantMessage2,
|
|
2267
2268
|
{
|
|
2268
2269
|
"data-message-role": "assistant",
|
|
@@ -2279,7 +2280,7 @@ function RenderResultMessage(_a) {
|
|
|
2279
2280
|
|
|
2280
2281
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
2281
2282
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
2282
|
-
var
|
|
2283
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2283
2284
|
function RenderAgentStateMessage(_a) {
|
|
2284
2285
|
var _b = _a, {
|
|
2285
2286
|
AssistantMessage: AssistantMessage2 = AssistantMessage
|
|
@@ -2296,7 +2297,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2296
2297
|
if (render) {
|
|
2297
2298
|
if (typeof render === "string") {
|
|
2298
2299
|
if (isCurrentMessage && inProgress) {
|
|
2299
|
-
return /* @__PURE__ */ (0,
|
|
2300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2300
2301
|
AssistantMessage2,
|
|
2301
2302
|
{
|
|
2302
2303
|
rawData: message,
|
|
@@ -2322,7 +2323,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2322
2323
|
return null;
|
|
2323
2324
|
}
|
|
2324
2325
|
if (!toRender && isCurrentMessage && inProgress) {
|
|
2325
|
-
return /* @__PURE__ */ (0,
|
|
2326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2326
2327
|
AssistantMessage2,
|
|
2327
2328
|
{
|
|
2328
2329
|
"data-message-role": "assistant",
|
|
@@ -2336,7 +2337,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2336
2337
|
return null;
|
|
2337
2338
|
}
|
|
2338
2339
|
if (typeof toRender === "string") {
|
|
2339
|
-
return /* @__PURE__ */ (0,
|
|
2340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2340
2341
|
AssistantMessage2,
|
|
2341
2342
|
{
|
|
2342
2343
|
rawData: message,
|
|
@@ -2348,7 +2349,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2348
2349
|
index
|
|
2349
2350
|
);
|
|
2350
2351
|
} else {
|
|
2351
|
-
return /* @__PURE__ */ (0,
|
|
2352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2352
2353
|
AssistantMessage2,
|
|
2353
2354
|
{
|
|
2354
2355
|
rawData: message,
|
|
@@ -2364,7 +2365,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2364
2365
|
} else if (!inProgress || !isCurrentMessage) {
|
|
2365
2366
|
return null;
|
|
2366
2367
|
} else {
|
|
2367
|
-
return /* @__PURE__ */ (0,
|
|
2368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2368
2369
|
AssistantMessage2,
|
|
2369
2370
|
{
|
|
2370
2371
|
rawData: message,
|
|
@@ -2379,7 +2380,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2379
2380
|
}
|
|
2380
2381
|
|
|
2381
2382
|
// src/components/chat/messages/RenderImageMessage.tsx
|
|
2382
|
-
var
|
|
2383
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2383
2384
|
function RenderImageMessage(_a) {
|
|
2384
2385
|
var _b = _a, {
|
|
2385
2386
|
UserMessage: UserMessage2 = UserMessage,
|
|
@@ -2400,7 +2401,7 @@ function RenderImageMessage(_a) {
|
|
|
2400
2401
|
} = props;
|
|
2401
2402
|
if (message.isImageMessage()) {
|
|
2402
2403
|
const imageData = `data:${message.format};base64,${message.bytes}`;
|
|
2403
|
-
const imageComponent = /* @__PURE__ */ (0,
|
|
2404
|
+
const imageComponent = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "copilotKitImage", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2404
2405
|
"img",
|
|
2405
2406
|
{
|
|
2406
2407
|
src: imageData,
|
|
@@ -2409,7 +2410,7 @@ function RenderImageMessage(_a) {
|
|
|
2409
2410
|
}
|
|
2410
2411
|
) });
|
|
2411
2412
|
if (message.role === "user") {
|
|
2412
|
-
return /* @__PURE__ */ (0,
|
|
2413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2413
2414
|
UserMessage2,
|
|
2414
2415
|
{
|
|
2415
2416
|
"data-message-role": "user",
|
|
@@ -2420,7 +2421,7 @@ function RenderImageMessage(_a) {
|
|
|
2420
2421
|
index
|
|
2421
2422
|
);
|
|
2422
2423
|
} else if (message.role === "assistant") {
|
|
2423
|
-
return /* @__PURE__ */ (0,
|
|
2424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2424
2425
|
AssistantMessage2,
|
|
2425
2426
|
{
|
|
2426
2427
|
"data-message-role": "assistant",
|
|
@@ -2446,9 +2447,9 @@ function RenderImageMessage(_a) {
|
|
|
2446
2447
|
var import_react_core9 = require("@copilotkit/react-core");
|
|
2447
2448
|
var import_shared2 = require("@copilotkit/shared");
|
|
2448
2449
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2449
|
-
var
|
|
2450
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2450
2451
|
function Suggestion({ title, message, onClick, partial, className }) {
|
|
2451
|
-
return /* @__PURE__ */ (0,
|
|
2452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2452
2453
|
"button",
|
|
2453
2454
|
{
|
|
2454
2455
|
disabled: partial,
|
|
@@ -2458,7 +2459,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
|
|
|
2458
2459
|
},
|
|
2459
2460
|
className: className || (partial ? "suggestion loading" : "suggestion"),
|
|
2460
2461
|
"data-test-id": "suggestion",
|
|
2461
|
-
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0,
|
|
2462
|
+
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: title })
|
|
2462
2463
|
}
|
|
2463
2464
|
);
|
|
2464
2465
|
}
|
|
@@ -2540,7 +2541,7 @@ var import_shared3 = require("@copilotkit/shared");
|
|
|
2540
2541
|
var import_react_core11 = require("@copilotkit/react-core");
|
|
2541
2542
|
|
|
2542
2543
|
// src/components/chat/ImageUploadQueue.tsx
|
|
2543
|
-
var
|
|
2544
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2544
2545
|
var ImageUploadQueue = ({
|
|
2545
2546
|
images,
|
|
2546
2547
|
onRemoveImage,
|
|
@@ -2548,7 +2549,7 @@ var ImageUploadQueue = ({
|
|
|
2548
2549
|
}) => {
|
|
2549
2550
|
if (images.length === 0)
|
|
2550
2551
|
return null;
|
|
2551
|
-
return /* @__PURE__ */ (0,
|
|
2552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2552
2553
|
"div",
|
|
2553
2554
|
{
|
|
2554
2555
|
className: `copilotKitImageUploadQueue ${className}`,
|
|
@@ -2559,7 +2560,7 @@ var ImageUploadQueue = ({
|
|
|
2559
2560
|
margin: "8px",
|
|
2560
2561
|
padding: "8px"
|
|
2561
2562
|
},
|
|
2562
|
-
children: images.map((image, index) => /* @__PURE__ */ (0,
|
|
2563
|
+
children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2563
2564
|
"div",
|
|
2564
2565
|
{
|
|
2565
2566
|
className: "copilotKitImageUploadQueueItem",
|
|
@@ -2572,7 +2573,7 @@ var ImageUploadQueue = ({
|
|
|
2572
2573
|
overflow: "hidden"
|
|
2573
2574
|
},
|
|
2574
2575
|
children: [
|
|
2575
|
-
/* @__PURE__ */ (0,
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2576
2577
|
"img",
|
|
2577
2578
|
{
|
|
2578
2579
|
src: `data:${image.contentType};base64,${image.bytes}`,
|
|
@@ -2584,7 +2585,7 @@ var ImageUploadQueue = ({
|
|
|
2584
2585
|
}
|
|
2585
2586
|
}
|
|
2586
2587
|
),
|
|
2587
|
-
/* @__PURE__ */ (0,
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2588
2589
|
"button",
|
|
2589
2590
|
{
|
|
2590
2591
|
onClick: () => onRemoveImage(index),
|
|
@@ -2618,7 +2619,7 @@ var ImageUploadQueue = ({
|
|
|
2618
2619
|
};
|
|
2619
2620
|
|
|
2620
2621
|
// src/components/chat/Chat.tsx
|
|
2621
|
-
var
|
|
2622
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2622
2623
|
function CopilotChat({
|
|
2623
2624
|
instructions,
|
|
2624
2625
|
onSubmitMessage,
|
|
@@ -2775,8 +2776,8 @@ function CopilotChat({
|
|
|
2775
2776
|
const removeSelectedImage = (index) => {
|
|
2776
2777
|
setSelectedImages((prev) => prev.filter((_, i) => i !== index));
|
|
2777
2778
|
};
|
|
2778
|
-
return /* @__PURE__ */ (0,
|
|
2779
|
-
/* @__PURE__ */ (0,
|
|
2779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2780
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2780
2781
|
Messages2,
|
|
2781
2782
|
{
|
|
2782
2783
|
AssistantMessage: AssistantMessage2,
|
|
@@ -2792,7 +2793,7 @@ function CopilotChat({
|
|
|
2792
2793
|
onCopy: handleCopy,
|
|
2793
2794
|
onThumbsUp,
|
|
2794
2795
|
onThumbsDown,
|
|
2795
|
-
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2796
|
+
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2796
2797
|
Suggestion,
|
|
2797
2798
|
{
|
|
2798
2799
|
title: suggestion.title,
|
|
@@ -2805,9 +2806,9 @@ function CopilotChat({
|
|
|
2805
2806
|
)) })
|
|
2806
2807
|
}
|
|
2807
2808
|
),
|
|
2808
|
-
imageUploadsEnabled && /* @__PURE__ */ (0,
|
|
2809
|
-
/* @__PURE__ */ (0,
|
|
2810
|
-
/* @__PURE__ */ (0,
|
|
2809
|
+
imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2811
2812
|
"input",
|
|
2812
2813
|
{
|
|
2813
2814
|
type: "file",
|
|
@@ -2819,7 +2820,7 @@ function CopilotChat({
|
|
|
2819
2820
|
}
|
|
2820
2821
|
)
|
|
2821
2822
|
] }),
|
|
2822
|
-
/* @__PURE__ */ (0,
|
|
2823
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2823
2824
|
Input2,
|
|
2824
2825
|
{
|
|
2825
2826
|
inProgress: isLoading,
|
|
@@ -2842,10 +2843,10 @@ function WrappedCopilotChat({
|
|
|
2842
2843
|
}) {
|
|
2843
2844
|
const chatContext = import_react13.default.useContext(ChatContext);
|
|
2844
2845
|
if (!chatContext) {
|
|
2845
|
-
return /* @__PURE__ */ (0,
|
|
2846
|
-
}, children: /* @__PURE__ */ (0,
|
|
2846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2847
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
|
|
2847
2848
|
}
|
|
2848
|
-
return /* @__PURE__ */ (0,
|
|
2849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children });
|
|
2849
2850
|
}
|
|
2850
2851
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2851
2852
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
@@ -3030,7 +3031,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
3030
3031
|
};
|
|
3031
3032
|
|
|
3032
3033
|
// src/components/chat/Modal.tsx
|
|
3033
|
-
var
|
|
3034
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3034
3035
|
var CopilotModal = ({
|
|
3035
3036
|
instructions,
|
|
3036
3037
|
defaultOpen = false,
|
|
@@ -3064,19 +3065,19 @@ var CopilotModal = ({
|
|
|
3064
3065
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3065
3066
|
setOpenState(open);
|
|
3066
3067
|
};
|
|
3067
|
-
return /* @__PURE__ */ (0,
|
|
3068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
3068
3069
|
children,
|
|
3069
|
-
/* @__PURE__ */ (0,
|
|
3070
|
-
/* @__PURE__ */ (0,
|
|
3071
|
-
/* @__PURE__ */ (0,
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className, children: [
|
|
3071
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button2, {}),
|
|
3072
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3072
3073
|
Window2,
|
|
3073
3074
|
{
|
|
3074
3075
|
clickOutsideToClose,
|
|
3075
3076
|
shortcut,
|
|
3076
3077
|
hitEscapeToClose,
|
|
3077
3078
|
children: [
|
|
3078
|
-
/* @__PURE__ */ (0,
|
|
3079
|
-
/* @__PURE__ */ (0,
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Header2, {}),
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3080
3081
|
CopilotChat,
|
|
3081
3082
|
{
|
|
3082
3083
|
instructions,
|
|
@@ -3103,17 +3104,17 @@ var CopilotModal = ({
|
|
|
3103
3104
|
};
|
|
3104
3105
|
|
|
3105
3106
|
// src/components/chat/Popup.tsx
|
|
3106
|
-
var
|
|
3107
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3107
3108
|
function CopilotPopup(props) {
|
|
3108
3109
|
props = __spreadProps(__spreadValues({}, props), {
|
|
3109
3110
|
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
3110
3111
|
});
|
|
3111
|
-
return /* @__PURE__ */ (0,
|
|
3112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
|
|
3112
3113
|
}
|
|
3113
3114
|
|
|
3114
3115
|
// src/components/chat/Sidebar.tsx
|
|
3115
3116
|
var import_react15 = require("react");
|
|
3116
|
-
var
|
|
3117
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3117
3118
|
function CopilotSidebar(props) {
|
|
3118
3119
|
props = __spreadProps(__spreadValues({}, props), {
|
|
3119
3120
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
@@ -3126,7 +3127,7 @@ function CopilotSidebar(props) {
|
|
|
3126
3127
|
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
3127
3128
|
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
3128
3129
|
};
|
|
3129
|
-
return /* @__PURE__ */ (0,
|
|
3130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
|
|
3130
3131
|
}
|
|
3131
3132
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3132
3133
|
0 && (module.exports = {
|