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