@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
|
@@ -399,15 +399,6 @@ var ChatContextProvider = ({
|
|
|
399
399
|
// src/components/chat/Window.tsx
|
|
400
400
|
var import_react2 = __toESM(require("react"));
|
|
401
401
|
var import_react_core = require("@copilotkit/react-core");
|
|
402
|
-
|
|
403
|
-
// src/hooks/use-dark-mode.ts
|
|
404
|
-
var useDarkMode = () => {
|
|
405
|
-
if (typeof window === "undefined")
|
|
406
|
-
return false;
|
|
407
|
-
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;
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
// src/components/chat/Window.tsx
|
|
411
402
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
412
403
|
var Window = ({
|
|
413
404
|
children,
|
|
@@ -415,17 +406,16 @@ var Window = ({
|
|
|
415
406
|
shortcut,
|
|
416
407
|
hitEscapeToClose
|
|
417
408
|
}) => {
|
|
418
|
-
var _a;
|
|
419
409
|
const windowRef = import_react2.default.useRef(null);
|
|
420
410
|
const context = (0, import_react_core.useCopilotContext)();
|
|
421
411
|
const { open, setOpen } = useChatContext();
|
|
422
412
|
const handleClickOutside = (0, import_react2.useCallback)(
|
|
423
413
|
(event) => {
|
|
424
|
-
var
|
|
414
|
+
var _a;
|
|
425
415
|
if (!clickOutsideToClose) {
|
|
426
416
|
return;
|
|
427
417
|
}
|
|
428
|
-
const parentElement = (
|
|
418
|
+
const parentElement = (_a = windowRef.current) == null ? void 0 : _a.parentElement;
|
|
429
419
|
let className = "";
|
|
430
420
|
if (event.target instanceof HTMLElement) {
|
|
431
421
|
className = event.target.className;
|
|
@@ -439,10 +429,10 @@ var Window = ({
|
|
|
439
429
|
);
|
|
440
430
|
const handleKeyDown = (0, import_react2.useCallback)(
|
|
441
431
|
(event) => {
|
|
442
|
-
var
|
|
432
|
+
var _a;
|
|
443
433
|
const target = event.target;
|
|
444
434
|
const isInput = target.tagName === "INPUT" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.isContentEditable;
|
|
445
|
-
const isDescendantOfWrapper = (
|
|
435
|
+
const isDescendantOfWrapper = (_a = windowRef.current) == null ? void 0 : _a.contains(target);
|
|
446
436
|
if (open && event.key === "Escape" && (!isInput || isDescendantOfWrapper) && hitEscapeToClose) {
|
|
447
437
|
setOpen(false);
|
|
448
438
|
} else if (event.key === shortcut && (isMacOS() && event.metaKey || !isMacOS() && event.ctrlKey) && (!isInput || isDescendantOfWrapper)) {
|
|
@@ -497,29 +487,7 @@ var Window = ({
|
|
|
497
487
|
}
|
|
498
488
|
};
|
|
499
489
|
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
500
|
-
|
|
501
|
-
const showPoweredBy = !((_a = context.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
502
|
-
const poweredByStyle = {
|
|
503
|
-
visibility: "visible",
|
|
504
|
-
display: "block",
|
|
505
|
-
position: "static",
|
|
506
|
-
textAlign: "center",
|
|
507
|
-
fontSize: "12px",
|
|
508
|
-
padding: "3px 0",
|
|
509
|
-
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
510
|
-
};
|
|
511
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
512
|
-
"div",
|
|
513
|
-
{
|
|
514
|
-
className: `copilotKitWindow ${showPoweredBy ? " poweredByContainer" : ""} ${open ? " open" : ""}`,
|
|
515
|
-
ref: windowRef,
|
|
516
|
-
children: [
|
|
517
|
-
children,
|
|
518
|
-
showPoweredBy && // @ts-expect-error -- expecting position not to be a string, but it can be.
|
|
519
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" })
|
|
520
|
-
]
|
|
521
|
-
}
|
|
522
|
-
);
|
|
490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `copilotKitWindow ${open ? " open" : ""}`, ref: windowRef, children });
|
|
523
491
|
};
|
|
524
492
|
var preventScroll = (event) => {
|
|
525
493
|
let targetElement = event.target;
|
|
@@ -1430,30 +1398,60 @@ var usePushToTalk = ({
|
|
|
1430
1398
|
|
|
1431
1399
|
// src/components/chat/Input.tsx
|
|
1432
1400
|
var import_react_core6 = require("@copilotkit/react-core");
|
|
1401
|
+
|
|
1402
|
+
// src/hooks/use-dark-mode.ts
|
|
1403
|
+
var useDarkMode = () => {
|
|
1404
|
+
if (typeof window === "undefined")
|
|
1405
|
+
return false;
|
|
1406
|
+
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;
|
|
1407
|
+
};
|
|
1408
|
+
|
|
1409
|
+
// src/components/chat/PoweredByTag.tsx
|
|
1433
1410
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1411
|
+
function PoweredByTag({ showPoweredBy = true }) {
|
|
1412
|
+
const isDark = useDarkMode();
|
|
1413
|
+
if (!showPoweredBy) {
|
|
1414
|
+
return null;
|
|
1415
|
+
}
|
|
1416
|
+
const poweredByStyle = {
|
|
1417
|
+
visibility: "visible",
|
|
1418
|
+
display: "block",
|
|
1419
|
+
position: "static",
|
|
1420
|
+
textAlign: "center",
|
|
1421
|
+
fontSize: "12px",
|
|
1422
|
+
padding: "3px 0",
|
|
1423
|
+
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
1424
|
+
};
|
|
1425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" }) });
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
// src/components/chat/Input.tsx
|
|
1429
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1434
1430
|
var MAX_NEWLINES = 6;
|
|
1435
1431
|
var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
1432
|
+
var _a;
|
|
1436
1433
|
const context = useChatContext();
|
|
1437
1434
|
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1435
|
+
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
1438
1436
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
1439
1437
|
const textareaRef = (0, import_react9.useRef)(null);
|
|
1440
1438
|
const handleDivClick = (event) => {
|
|
1441
|
-
var
|
|
1439
|
+
var _a2;
|
|
1442
1440
|
const target = event.target;
|
|
1443
1441
|
if (target.closest("button"))
|
|
1444
1442
|
return;
|
|
1445
1443
|
if (target.tagName === "TEXTAREA")
|
|
1446
1444
|
return;
|
|
1447
|
-
(
|
|
1445
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
1448
1446
|
};
|
|
1449
1447
|
const [text, setText] = (0, import_react9.useState)("");
|
|
1450
1448
|
const send = () => {
|
|
1451
|
-
var
|
|
1449
|
+
var _a2;
|
|
1452
1450
|
if (inProgress)
|
|
1453
1451
|
return;
|
|
1454
1452
|
onSend(text);
|
|
1455
1453
|
setText("");
|
|
1456
|
-
(
|
|
1454
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
1457
1455
|
};
|
|
1458
1456
|
const { pushToTalkState, setPushToTalkState } = usePushToTalk({
|
|
1459
1457
|
sendFunction: onSend,
|
|
@@ -1463,62 +1461,65 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1463
1461
|
const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1464
1462
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1465
1463
|
const canSend = () => {
|
|
1466
|
-
var
|
|
1467
|
-
const interruptEvent = (
|
|
1464
|
+
var _a2;
|
|
1465
|
+
const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
|
|
1468
1466
|
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
1469
1467
|
return (isInProgress || !isInProgress && text.trim().length > 0) && pushToTalkState === "idle" && !interruptInProgress;
|
|
1470
1468
|
};
|
|
1471
1469
|
const sendDisabled = !canSend();
|
|
1472
|
-
return /* @__PURE__ */ (0,
|
|
1473
|
-
/* @__PURE__ */ (0,
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
event.
|
|
1485
|
-
|
|
1486
|
-
|
|
1470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1473
|
+
Textarea_default,
|
|
1474
|
+
{
|
|
1475
|
+
ref: textareaRef,
|
|
1476
|
+
placeholder: context.labels.placeholder,
|
|
1477
|
+
autoFocus: false,
|
|
1478
|
+
maxRows: MAX_NEWLINES,
|
|
1479
|
+
value: text,
|
|
1480
|
+
onChange: (event) => setText(event.target.value),
|
|
1481
|
+
onKeyDown: (event) => {
|
|
1482
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1483
|
+
event.preventDefault();
|
|
1484
|
+
if (canSend()) {
|
|
1485
|
+
send();
|
|
1486
|
+
}
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
1489
|
}
|
|
1490
|
-
}
|
|
1491
|
-
),
|
|
1492
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
1493
|
-
onUpload && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
1494
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { flexGrow: 1 } }),
|
|
1495
|
-
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1496
|
-
"button",
|
|
1497
|
-
{
|
|
1498
|
-
onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
|
|
1499
|
-
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
1500
|
-
children: context.icons.pushToTalkIcon
|
|
1501
|
-
}
|
|
1502
1490
|
),
|
|
1503
|
-
/* @__PURE__ */ (0,
|
|
1504
|
-
"button",
|
|
1505
|
-
{
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInputControls", children: [
|
|
1492
|
+
onUpload && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: onUpload, className: "copilotKitInputControlButton", children: context.icons.uploadIcon }),
|
|
1493
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { flexGrow: 1 } }),
|
|
1494
|
+
showPushToTalk && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1495
|
+
"button",
|
|
1496
|
+
{
|
|
1497
|
+
onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
|
|
1498
|
+
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
1499
|
+
children: context.icons.pushToTalkIcon
|
|
1500
|
+
}
|
|
1501
|
+
),
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1503
|
+
"button",
|
|
1504
|
+
{
|
|
1505
|
+
disabled: sendDisabled,
|
|
1506
|
+
onClick: isInProgress ? onStop : send,
|
|
1507
|
+
"data-copilotkit-in-progress": inProgress,
|
|
1508
|
+
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1509
|
+
className: "copilotKitInputControlButton",
|
|
1510
|
+
children: buttonIcon
|
|
1511
|
+
}
|
|
1512
|
+
)
|
|
1513
|
+
] })
|
|
1514
|
+
] }),
|
|
1515
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PoweredByTag, { showPoweredBy })
|
|
1516
|
+
] });
|
|
1516
1517
|
};
|
|
1517
1518
|
|
|
1518
1519
|
// src/components/chat/messages/UserMessage.tsx
|
|
1519
|
-
var
|
|
1520
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1520
1521
|
var UserMessage = (props) => {
|
|
1521
|
-
return /* @__PURE__ */ (0,
|
|
1522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.subComponent || props.message });
|
|
1522
1523
|
};
|
|
1523
1524
|
|
|
1524
1525
|
// src/components/chat/Markdown.tsx
|
|
@@ -1552,7 +1553,7 @@ function useCopyToClipboard({ timeout = 2e3 }) {
|
|
|
1552
1553
|
}
|
|
1553
1554
|
|
|
1554
1555
|
// src/components/chat/CodeBlock.tsx
|
|
1555
|
-
var
|
|
1556
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1556
1557
|
var programmingLanguages = {
|
|
1557
1558
|
javascript: ".js",
|
|
1558
1559
|
python: ".py",
|
|
@@ -1615,15 +1616,15 @@ var CodeBlock = (0, import_react10.memo)(({ language, value }) => {
|
|
|
1615
1616
|
return;
|
|
1616
1617
|
copyToClipboard(value);
|
|
1617
1618
|
};
|
|
1618
|
-
return /* @__PURE__ */ (0,
|
|
1619
|
-
/* @__PURE__ */ (0,
|
|
1620
|
-
/* @__PURE__ */ (0,
|
|
1621
|
-
/* @__PURE__ */ (0,
|
|
1622
|
-
/* @__PURE__ */ (0,
|
|
1623
|
-
/* @__PURE__ */ (0,
|
|
1619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitCodeBlock", children: [
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1623
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1624
1625
|
] })
|
|
1625
1626
|
] }),
|
|
1626
|
-
/* @__PURE__ */ (0,
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1627
1628
|
import_react_syntax_highlighter.Prism,
|
|
1628
1629
|
{
|
|
1629
1630
|
language,
|
|
@@ -1926,18 +1927,18 @@ var highlightStyle = {
|
|
|
1926
1927
|
// src/components/chat/Markdown.tsx
|
|
1927
1928
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
1928
1929
|
var import_remark_math = __toESM(require("remark-math"));
|
|
1929
|
-
var
|
|
1930
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1930
1931
|
var MemoizedReactMarkdown = (0, import_react11.memo)(
|
|
1931
1932
|
import_react_markdown.default,
|
|
1932
1933
|
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
1933
1934
|
);
|
|
1934
1935
|
var Markdown = ({ content }) => {
|
|
1935
|
-
return /* @__PURE__ */ (0,
|
|
1936
|
+
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 }) });
|
|
1936
1937
|
};
|
|
1937
1938
|
var components = {
|
|
1938
1939
|
a(_a) {
|
|
1939
1940
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1940
|
-
return /* @__PURE__ */ (0,
|
|
1941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1941
1942
|
"a",
|
|
1942
1943
|
__spreadProps(__spreadValues({
|
|
1943
1944
|
style: { color: "blue", textDecoration: "underline" }
|
|
@@ -1952,7 +1953,7 @@ var components = {
|
|
|
1952
1953
|
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
1953
1954
|
if (children.length) {
|
|
1954
1955
|
if (children[0] == "\u258D") {
|
|
1955
|
-
return /* @__PURE__ */ (0,
|
|
1956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1956
1957
|
"span",
|
|
1957
1958
|
{
|
|
1958
1959
|
style: {
|
|
@@ -1967,9 +1968,9 @@ var components = {
|
|
|
1967
1968
|
}
|
|
1968
1969
|
const match = /language-(\w+)/.exec(className || "");
|
|
1969
1970
|
if (inline) {
|
|
1970
|
-
return /* @__PURE__ */ (0,
|
|
1971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
|
|
1971
1972
|
}
|
|
1972
|
-
return /* @__PURE__ */ (0,
|
|
1973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1973
1974
|
CodeBlock,
|
|
1974
1975
|
__spreadValues({
|
|
1975
1976
|
language: match && match[1] || "",
|
|
@@ -1982,7 +1983,7 @@ var components = {
|
|
|
1982
1983
|
|
|
1983
1984
|
// src/components/chat/messages/AssistantMessage.tsx
|
|
1984
1985
|
var import_react12 = require("react");
|
|
1985
|
-
var
|
|
1986
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1986
1987
|
var AssistantMessage = (props) => {
|
|
1987
1988
|
const { icons, labels } = useChatContext();
|
|
1988
1989
|
const {
|
|
@@ -2023,17 +2024,17 @@ var AssistantMessage = (props) => {
|
|
|
2023
2024
|
onThumbsDown(message);
|
|
2024
2025
|
}
|
|
2025
2026
|
};
|
|
2026
|
-
const LoadingIcon = () => /* @__PURE__ */ (0,
|
|
2027
|
-
return /* @__PURE__ */ (0,
|
|
2028
|
-
(message || isLoading) && /* @__PURE__ */ (0,
|
|
2029
|
-
message && /* @__PURE__ */ (0,
|
|
2030
|
-
isLoading && /* @__PURE__ */ (0,
|
|
2031
|
-
message && !isLoading && /* @__PURE__ */ (0,
|
|
2027
|
+
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: icons.activityIcon });
|
|
2028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2029
|
+
(message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2030
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Markdown, { content: message || "" }),
|
|
2031
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingIcon, {}),
|
|
2032
|
+
message && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2032
2033
|
"div",
|
|
2033
2034
|
{
|
|
2034
2035
|
className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
|
|
2035
2036
|
children: [
|
|
2036
|
-
/* @__PURE__ */ (0,
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2037
2038
|
"button",
|
|
2038
2039
|
{
|
|
2039
2040
|
className: "copilotKitMessageControlButton",
|
|
@@ -2043,17 +2044,17 @@ var AssistantMessage = (props) => {
|
|
|
2043
2044
|
children: icons.regenerateIcon
|
|
2044
2045
|
}
|
|
2045
2046
|
),
|
|
2046
|
-
/* @__PURE__ */ (0,
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2047
2048
|
"button",
|
|
2048
2049
|
{
|
|
2049
2050
|
className: "copilotKitMessageControlButton",
|
|
2050
2051
|
onClick: handleCopy,
|
|
2051
2052
|
"aria-label": labels.copyToClipboard,
|
|
2052
2053
|
title: labels.copyToClipboard,
|
|
2053
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
2054
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
|
|
2054
2055
|
}
|
|
2055
2056
|
),
|
|
2056
|
-
onThumbsUp && /* @__PURE__ */ (0,
|
|
2057
|
+
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2057
2058
|
"button",
|
|
2058
2059
|
{
|
|
2059
2060
|
className: "copilotKitMessageControlButton",
|
|
@@ -2063,7 +2064,7 @@ var AssistantMessage = (props) => {
|
|
|
2063
2064
|
children: icons.thumbsUpIcon
|
|
2064
2065
|
}
|
|
2065
2066
|
),
|
|
2066
|
-
onThumbsDown && /* @__PURE__ */ (0,
|
|
2067
|
+
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2067
2068
|
"button",
|
|
2068
2069
|
{
|
|
2069
2070
|
className: "copilotKitMessageControlButton",
|
|
@@ -2077,12 +2078,12 @@ var AssistantMessage = (props) => {
|
|
|
2077
2078
|
}
|
|
2078
2079
|
)
|
|
2079
2080
|
] }),
|
|
2080
|
-
/* @__PURE__ */ (0,
|
|
2081
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
|
|
2081
2082
|
] });
|
|
2082
2083
|
};
|
|
2083
2084
|
|
|
2084
2085
|
// src/components/chat/messages/RenderTextMessage.tsx
|
|
2085
|
-
var
|
|
2086
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2086
2087
|
function RenderTextMessage(_a) {
|
|
2087
2088
|
var _b = _a, {
|
|
2088
2089
|
UserMessage: UserMessage2 = UserMessage,
|
|
@@ -2103,7 +2104,7 @@ function RenderTextMessage(_a) {
|
|
|
2103
2104
|
} = props;
|
|
2104
2105
|
if (message.isTextMessage()) {
|
|
2105
2106
|
if (message.role === "user") {
|
|
2106
|
-
return /* @__PURE__ */ (0,
|
|
2107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2107
2108
|
UserMessage2,
|
|
2108
2109
|
{
|
|
2109
2110
|
"data-message-role": "user",
|
|
@@ -2113,7 +2114,7 @@ function RenderTextMessage(_a) {
|
|
|
2113
2114
|
index
|
|
2114
2115
|
);
|
|
2115
2116
|
} else if (message.role == "assistant") {
|
|
2116
|
-
return /* @__PURE__ */ (0,
|
|
2117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2117
2118
|
AssistantMessage2,
|
|
2118
2119
|
{
|
|
2119
2120
|
"data-message-role": "assistant",
|
|
@@ -2136,7 +2137,7 @@ function RenderTextMessage(_a) {
|
|
|
2136
2137
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
2137
2138
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
2138
2139
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
2139
|
-
var
|
|
2140
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2140
2141
|
function RenderActionExecutionMessage(_a) {
|
|
2141
2142
|
var _b = _a, {
|
|
2142
2143
|
AssistantMessage: AssistantMessage2 = AssistantMessage
|
|
@@ -2150,7 +2151,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2150
2151
|
const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
|
|
2151
2152
|
if (typeof render === "string") {
|
|
2152
2153
|
if (isCurrentMessage && inProgress) {
|
|
2153
|
-
return /* @__PURE__ */ (0,
|
|
2154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2154
2155
|
AssistantMessage2,
|
|
2155
2156
|
{
|
|
2156
2157
|
rawData: message,
|
|
@@ -2183,7 +2184,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2183
2184
|
return null;
|
|
2184
2185
|
}
|
|
2185
2186
|
if (typeof toRender === "string") {
|
|
2186
|
-
return /* @__PURE__ */ (0,
|
|
2187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2187
2188
|
AssistantMessage2,
|
|
2188
2189
|
{
|
|
2189
2190
|
rawData: message,
|
|
@@ -2195,7 +2196,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2195
2196
|
index
|
|
2196
2197
|
);
|
|
2197
2198
|
} else {
|
|
2198
|
-
return /* @__PURE__ */ (0,
|
|
2199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2199
2200
|
AssistantMessage2,
|
|
2200
2201
|
{
|
|
2201
2202
|
rawData: message,
|
|
@@ -2209,20 +2210,20 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2209
2210
|
}
|
|
2210
2211
|
} catch (e) {
|
|
2211
2212
|
console.error(`Error executing render function for action ${message.name}: ${e}`);
|
|
2212
|
-
return /* @__PURE__ */ (0,
|
|
2213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2213
2214
|
AssistantMessage2,
|
|
2214
2215
|
{
|
|
2215
2216
|
rawData: message,
|
|
2216
2217
|
"data-message-role": "assistant",
|
|
2217
2218
|
isLoading: false,
|
|
2218
2219
|
isGenerating: false,
|
|
2219
|
-
subComponent: /* @__PURE__ */ (0,
|
|
2220
|
-
/* @__PURE__ */ (0,
|
|
2220
|
+
subComponent: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("b", { children: [
|
|
2221
2222
|
"\u274C Error executing render function for action ",
|
|
2222
2223
|
message.name,
|
|
2223
2224
|
":"
|
|
2224
2225
|
] }),
|
|
2225
|
-
/* @__PURE__ */ (0,
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
|
|
2226
2227
|
] })
|
|
2227
2228
|
},
|
|
2228
2229
|
index
|
|
@@ -2232,7 +2233,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2232
2233
|
} else if (!inProgress || !isCurrentMessage) {
|
|
2233
2234
|
return null;
|
|
2234
2235
|
} else {
|
|
2235
|
-
return /* @__PURE__ */ (0,
|
|
2236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2236
2237
|
AssistantMessage2,
|
|
2237
2238
|
{
|
|
2238
2239
|
rawData: message,
|
|
@@ -2247,7 +2248,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2247
2248
|
}
|
|
2248
2249
|
|
|
2249
2250
|
// src/components/chat/messages/RenderResultMessage.tsx
|
|
2250
|
-
var
|
|
2251
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2251
2252
|
function RenderResultMessage(_a) {
|
|
2252
2253
|
var _b = _a, {
|
|
2253
2254
|
AssistantMessage: AssistantMessage2 = AssistantMessage
|
|
@@ -2256,7 +2257,7 @@ function RenderResultMessage(_a) {
|
|
|
2256
2257
|
]);
|
|
2257
2258
|
const { message, inProgress, index, isCurrentMessage } = props;
|
|
2258
2259
|
if (message.isResultMessage() && inProgress && isCurrentMessage) {
|
|
2259
|
-
return /* @__PURE__ */ (0,
|
|
2260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2260
2261
|
AssistantMessage2,
|
|
2261
2262
|
{
|
|
2262
2263
|
"data-message-role": "assistant",
|
|
@@ -2273,7 +2274,7 @@ function RenderResultMessage(_a) {
|
|
|
2273
2274
|
|
|
2274
2275
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
2275
2276
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
2276
|
-
var
|
|
2277
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2277
2278
|
function RenderAgentStateMessage(_a) {
|
|
2278
2279
|
var _b = _a, {
|
|
2279
2280
|
AssistantMessage: AssistantMessage2 = AssistantMessage
|
|
@@ -2290,7 +2291,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2290
2291
|
if (render) {
|
|
2291
2292
|
if (typeof render === "string") {
|
|
2292
2293
|
if (isCurrentMessage && inProgress) {
|
|
2293
|
-
return /* @__PURE__ */ (0,
|
|
2294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2294
2295
|
AssistantMessage2,
|
|
2295
2296
|
{
|
|
2296
2297
|
rawData: message,
|
|
@@ -2316,7 +2317,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2316
2317
|
return null;
|
|
2317
2318
|
}
|
|
2318
2319
|
if (!toRender && isCurrentMessage && inProgress) {
|
|
2319
|
-
return /* @__PURE__ */ (0,
|
|
2320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2320
2321
|
AssistantMessage2,
|
|
2321
2322
|
{
|
|
2322
2323
|
"data-message-role": "assistant",
|
|
@@ -2330,7 +2331,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2330
2331
|
return null;
|
|
2331
2332
|
}
|
|
2332
2333
|
if (typeof toRender === "string") {
|
|
2333
|
-
return /* @__PURE__ */ (0,
|
|
2334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2334
2335
|
AssistantMessage2,
|
|
2335
2336
|
{
|
|
2336
2337
|
rawData: message,
|
|
@@ -2342,7 +2343,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2342
2343
|
index
|
|
2343
2344
|
);
|
|
2344
2345
|
} else {
|
|
2345
|
-
return /* @__PURE__ */ (0,
|
|
2346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2346
2347
|
AssistantMessage2,
|
|
2347
2348
|
{
|
|
2348
2349
|
rawData: message,
|
|
@@ -2358,7 +2359,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2358
2359
|
} else if (!inProgress || !isCurrentMessage) {
|
|
2359
2360
|
return null;
|
|
2360
2361
|
} else {
|
|
2361
|
-
return /* @__PURE__ */ (0,
|
|
2362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2362
2363
|
AssistantMessage2,
|
|
2363
2364
|
{
|
|
2364
2365
|
rawData: message,
|
|
@@ -2373,7 +2374,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2373
2374
|
}
|
|
2374
2375
|
|
|
2375
2376
|
// src/components/chat/messages/RenderImageMessage.tsx
|
|
2376
|
-
var
|
|
2377
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2377
2378
|
function RenderImageMessage(_a) {
|
|
2378
2379
|
var _b = _a, {
|
|
2379
2380
|
UserMessage: UserMessage2 = UserMessage,
|
|
@@ -2394,7 +2395,7 @@ function RenderImageMessage(_a) {
|
|
|
2394
2395
|
} = props;
|
|
2395
2396
|
if (message.isImageMessage()) {
|
|
2396
2397
|
const imageData = `data:${message.format};base64,${message.bytes}`;
|
|
2397
|
-
const imageComponent = /* @__PURE__ */ (0,
|
|
2398
|
+
const imageComponent = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "copilotKitImage", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2398
2399
|
"img",
|
|
2399
2400
|
{
|
|
2400
2401
|
src: imageData,
|
|
@@ -2403,7 +2404,7 @@ function RenderImageMessage(_a) {
|
|
|
2403
2404
|
}
|
|
2404
2405
|
) });
|
|
2405
2406
|
if (message.role === "user") {
|
|
2406
|
-
return /* @__PURE__ */ (0,
|
|
2407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2407
2408
|
UserMessage2,
|
|
2408
2409
|
{
|
|
2409
2410
|
"data-message-role": "user",
|
|
@@ -2414,7 +2415,7 @@ function RenderImageMessage(_a) {
|
|
|
2414
2415
|
index
|
|
2415
2416
|
);
|
|
2416
2417
|
} else if (message.role === "assistant") {
|
|
2417
|
-
return /* @__PURE__ */ (0,
|
|
2418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2418
2419
|
AssistantMessage2,
|
|
2419
2420
|
{
|
|
2420
2421
|
"data-message-role": "assistant",
|
|
@@ -2440,9 +2441,9 @@ function RenderImageMessage(_a) {
|
|
|
2440
2441
|
var import_react_core9 = require("@copilotkit/react-core");
|
|
2441
2442
|
var import_shared2 = require("@copilotkit/shared");
|
|
2442
2443
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2443
|
-
var
|
|
2444
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2444
2445
|
function Suggestion({ title, message, onClick, partial, className }) {
|
|
2445
|
-
return /* @__PURE__ */ (0,
|
|
2446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2446
2447
|
"button",
|
|
2447
2448
|
{
|
|
2448
2449
|
disabled: partial,
|
|
@@ -2452,7 +2453,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
|
|
|
2452
2453
|
},
|
|
2453
2454
|
className: className || (partial ? "suggestion loading" : "suggestion"),
|
|
2454
2455
|
"data-test-id": "suggestion",
|
|
2455
|
-
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0,
|
|
2456
|
+
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: title })
|
|
2456
2457
|
}
|
|
2457
2458
|
);
|
|
2458
2459
|
}
|
|
@@ -2534,7 +2535,7 @@ var import_shared3 = require("@copilotkit/shared");
|
|
|
2534
2535
|
var import_react_core11 = require("@copilotkit/react-core");
|
|
2535
2536
|
|
|
2536
2537
|
// src/components/chat/ImageUploadQueue.tsx
|
|
2537
|
-
var
|
|
2538
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2538
2539
|
var ImageUploadQueue = ({
|
|
2539
2540
|
images,
|
|
2540
2541
|
onRemoveImage,
|
|
@@ -2542,7 +2543,7 @@ var ImageUploadQueue = ({
|
|
|
2542
2543
|
}) => {
|
|
2543
2544
|
if (images.length === 0)
|
|
2544
2545
|
return null;
|
|
2545
|
-
return /* @__PURE__ */ (0,
|
|
2546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2546
2547
|
"div",
|
|
2547
2548
|
{
|
|
2548
2549
|
className: `copilotKitImageUploadQueue ${className}`,
|
|
@@ -2553,7 +2554,7 @@ var ImageUploadQueue = ({
|
|
|
2553
2554
|
margin: "8px",
|
|
2554
2555
|
padding: "8px"
|
|
2555
2556
|
},
|
|
2556
|
-
children: images.map((image, index) => /* @__PURE__ */ (0,
|
|
2557
|
+
children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2557
2558
|
"div",
|
|
2558
2559
|
{
|
|
2559
2560
|
className: "copilotKitImageUploadQueueItem",
|
|
@@ -2566,7 +2567,7 @@ var ImageUploadQueue = ({
|
|
|
2566
2567
|
overflow: "hidden"
|
|
2567
2568
|
},
|
|
2568
2569
|
children: [
|
|
2569
|
-
/* @__PURE__ */ (0,
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2570
2571
|
"img",
|
|
2571
2572
|
{
|
|
2572
2573
|
src: `data:${image.contentType};base64,${image.bytes}`,
|
|
@@ -2578,7 +2579,7 @@ var ImageUploadQueue = ({
|
|
|
2578
2579
|
}
|
|
2579
2580
|
}
|
|
2580
2581
|
),
|
|
2581
|
-
/* @__PURE__ */ (0,
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2582
2583
|
"button",
|
|
2583
2584
|
{
|
|
2584
2585
|
onClick: () => onRemoveImage(index),
|
|
@@ -2612,7 +2613,7 @@ var ImageUploadQueue = ({
|
|
|
2612
2613
|
};
|
|
2613
2614
|
|
|
2614
2615
|
// src/components/chat/Chat.tsx
|
|
2615
|
-
var
|
|
2616
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2616
2617
|
function CopilotChat({
|
|
2617
2618
|
instructions,
|
|
2618
2619
|
onSubmitMessage,
|
|
@@ -2769,8 +2770,8 @@ function CopilotChat({
|
|
|
2769
2770
|
const removeSelectedImage = (index) => {
|
|
2770
2771
|
setSelectedImages((prev) => prev.filter((_, i) => i !== index));
|
|
2771
2772
|
};
|
|
2772
|
-
return /* @__PURE__ */ (0,
|
|
2773
|
-
/* @__PURE__ */ (0,
|
|
2773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2774
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2774
2775
|
Messages2,
|
|
2775
2776
|
{
|
|
2776
2777
|
AssistantMessage: AssistantMessage2,
|
|
@@ -2786,7 +2787,7 @@ function CopilotChat({
|
|
|
2786
2787
|
onCopy: handleCopy,
|
|
2787
2788
|
onThumbsUp,
|
|
2788
2789
|
onThumbsDown,
|
|
2789
|
-
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2790
|
+
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2790
2791
|
Suggestion,
|
|
2791
2792
|
{
|
|
2792
2793
|
title: suggestion.title,
|
|
@@ -2799,9 +2800,9 @@ function CopilotChat({
|
|
|
2799
2800
|
)) })
|
|
2800
2801
|
}
|
|
2801
2802
|
),
|
|
2802
|
-
imageUploadsEnabled && /* @__PURE__ */ (0,
|
|
2803
|
-
/* @__PURE__ */ (0,
|
|
2804
|
-
/* @__PURE__ */ (0,
|
|
2803
|
+
imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2804
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
|
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2805
2806
|
"input",
|
|
2806
2807
|
{
|
|
2807
2808
|
type: "file",
|
|
@@ -2813,7 +2814,7 @@ function CopilotChat({
|
|
|
2813
2814
|
}
|
|
2814
2815
|
)
|
|
2815
2816
|
] }),
|
|
2816
|
-
/* @__PURE__ */ (0,
|
|
2817
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2817
2818
|
Input2,
|
|
2818
2819
|
{
|
|
2819
2820
|
inProgress: isLoading,
|
|
@@ -2836,10 +2837,10 @@ function WrappedCopilotChat({
|
|
|
2836
2837
|
}) {
|
|
2837
2838
|
const chatContext = import_react13.default.useContext(ChatContext);
|
|
2838
2839
|
if (!chatContext) {
|
|
2839
|
-
return /* @__PURE__ */ (0,
|
|
2840
|
-
}, children: /* @__PURE__ */ (0,
|
|
2840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2841
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
|
|
2841
2842
|
}
|
|
2842
|
-
return /* @__PURE__ */ (0,
|
|
2843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children });
|
|
2843
2844
|
}
|
|
2844
2845
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2845
2846
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
@@ -3024,7 +3025,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
3024
3025
|
};
|
|
3025
3026
|
|
|
3026
3027
|
// src/components/chat/Modal.tsx
|
|
3027
|
-
var
|
|
3028
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3028
3029
|
var CopilotModal = ({
|
|
3029
3030
|
instructions,
|
|
3030
3031
|
defaultOpen = false,
|
|
@@ -3058,19 +3059,19 @@ var CopilotModal = ({
|
|
|
3058
3059
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3059
3060
|
setOpenState(open);
|
|
3060
3061
|
};
|
|
3061
|
-
return /* @__PURE__ */ (0,
|
|
3062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
3062
3063
|
children,
|
|
3063
|
-
/* @__PURE__ */ (0,
|
|
3064
|
-
/* @__PURE__ */ (0,
|
|
3065
|
-
/* @__PURE__ */ (0,
|
|
3064
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className, children: [
|
|
3065
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button2, {}),
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3066
3067
|
Window2,
|
|
3067
3068
|
{
|
|
3068
3069
|
clickOutsideToClose,
|
|
3069
3070
|
shortcut,
|
|
3070
3071
|
hitEscapeToClose,
|
|
3071
3072
|
children: [
|
|
3072
|
-
/* @__PURE__ */ (0,
|
|
3073
|
-
/* @__PURE__ */ (0,
|
|
3073
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Header2, {}),
|
|
3074
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3074
3075
|
CopilotChat,
|
|
3075
3076
|
{
|
|
3076
3077
|
instructions,
|
|
@@ -3097,7 +3098,7 @@ var CopilotModal = ({
|
|
|
3097
3098
|
};
|
|
3098
3099
|
|
|
3099
3100
|
// src/components/chat/Sidebar.tsx
|
|
3100
|
-
var
|
|
3101
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3101
3102
|
function CopilotSidebar(props) {
|
|
3102
3103
|
props = __spreadProps(__spreadValues({}, props), {
|
|
3103
3104
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
@@ -3110,7 +3111,7 @@ function CopilotSidebar(props) {
|
|
|
3110
3111
|
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
3111
3112
|
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
3112
3113
|
};
|
|
3113
|
-
return /* @__PURE__ */ (0,
|
|
3114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
|
|
3114
3115
|
}
|
|
3115
3116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3116
3117
|
0 && (module.exports = {
|