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