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