@copilotkit/react-ui 1.8.0-next.6 → 1.8.0-next.7
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 +10 -0
- package/dist/{chunk-FBYETUFL.mjs → chunk-5M7ODWKH.mjs} +6 -12
- package/dist/chunk-5M7ODWKH.mjs.map +1 -0
- package/dist/{chunk-DFHFPZQD.mjs → chunk-EMWOZVCW.mjs} +9 -16
- package/dist/chunk-EMWOZVCW.mjs.map +1 -0
- package/dist/{chunk-Z6YOBQUJ.mjs → chunk-HGA4N4ME.mjs} +8 -13
- package/dist/chunk-HGA4N4ME.mjs.map +1 -0
- package/dist/{chunk-CGVOCLHN.mjs → chunk-P7S3E5UW.mjs} +2 -2
- package/dist/{chunk-6H7IQRIU.mjs → chunk-QTN7AYVL.mjs} +2 -2
- package/dist/{chunk-LYHZXHTJ.mjs → chunk-SNLHKLW3.mjs} +2 -2
- package/dist/{chunk-5JY5QJ2W.mjs → chunk-UN2E3HCK.mjs} +9 -3
- package/dist/chunk-UN2E3HCK.mjs.map +1 -0
- package/dist/{chunk-FFNESJSG.mjs → chunk-Y6OESC5U.mjs} +2 -2
- package/dist/{chunk-QS7UFQFD.mjs → chunk-YGD4IB27.mjs} +2 -2
- package/dist/{chunk-VC4NO5QZ.mjs → chunk-YOEL33HG.mjs} +2 -2
- package/dist/{chunk-GJME6MK4.mjs → chunk-ZY25LVYR.mjs} +2 -2
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +2 -2
- package/dist/components/chat/Chat.d.ts +2 -11
- package/dist/components/chat/Chat.js +67 -76
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +6 -7
- package/dist/components/chat/ChatContext.d.ts +15 -0
- package/dist/components/chat/ChatContext.js +67 -1
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +1 -1
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +2 -2
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +2 -2
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +74 -87
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +10 -11
- package/dist/components/chat/Popup.js +76 -89
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +11 -12
- package/dist/components/chat/Sidebar.js +76 -89
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +11 -12
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +2 -2
- package/dist/components/chat/index.d.ts +1 -1
- package/dist/components/chat/index.js +78 -91
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +14 -15
- package/dist/components/chat/messages/AssistantMessage.js +4 -67
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +2 -2
- package/dist/components/chat/props.d.ts +1 -5
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +78 -91
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +14 -15
- package/dist/index.css +0 -26
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +78 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -16
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +0 -16
- package/src/components/chat/ChatContext.tsx +25 -0
- package/src/components/chat/Modal.tsx +0 -6
- package/src/components/chat/messages/AssistantMessage.tsx +4 -5
- package/src/components/chat/props.ts +0 -5
- package/src/styles.css +0 -1
- package/dist/chunk-5JY5QJ2W.mjs.map +0 -1
- package/dist/chunk-DFHFPZQD.mjs.map +0 -1
- package/dist/chunk-FBYETUFL.mjs.map +0 -1
- package/dist/chunk-UZTZXMYS.mjs +0 -18
- package/dist/chunk-UZTZXMYS.mjs.map +0 -1
- package/dist/chunk-Z6YOBQUJ.mjs.map +0 -1
- package/dist/components/chat/Response.d.ts +0 -7
- package/dist/components/chat/Response.js +0 -64
- package/dist/components/chat/Response.js.map +0 -1
- package/dist/components/chat/Response.mjs +0 -10
- package/dist/components/chat/Response.mjs.map +0 -1
- package/src/components/chat/Response.tsx +0 -12
- package/src/css/response.css +0 -26
- /package/dist/{chunk-CGVOCLHN.mjs.map → chunk-P7S3E5UW.mjs.map} +0 -0
- /package/dist/{chunk-6H7IQRIU.mjs.map → chunk-QTN7AYVL.mjs.map} +0 -0
- /package/dist/{chunk-LYHZXHTJ.mjs.map → chunk-SNLHKLW3.mjs.map} +0 -0
- /package/dist/{chunk-FFNESJSG.mjs.map → chunk-Y6OESC5U.mjs.map} +0 -0
- /package/dist/{chunk-QS7UFQFD.mjs.map → chunk-YGD4IB27.mjs.map} +0 -0
- /package/dist/{chunk-VC4NO5QZ.mjs.map → chunk-YOEL33HG.mjs.map} +0 -0
- /package/dist/{chunk-GJME6MK4.mjs.map → chunk-ZY25LVYR.mjs.map} +0 -0
|
@@ -368,7 +368,10 @@ var ChatContextProvider = ({
|
|
|
368
368
|
spinnerIcon: SpinnerIcon,
|
|
369
369
|
stopIcon: StopIcon,
|
|
370
370
|
regenerateIcon: RegenerateIcon,
|
|
371
|
-
pushToTalkIcon: MicrophoneIcon
|
|
371
|
+
pushToTalkIcon: MicrophoneIcon,
|
|
372
|
+
copyIcon: CopyIcon,
|
|
373
|
+
thumbsUpIcon: ThumbsUpIcon,
|
|
374
|
+
thumbsDownIcon: ThumbsDownIcon
|
|
372
375
|
}), icons),
|
|
373
376
|
[icons]
|
|
374
377
|
);
|
|
@@ -1435,18 +1438,8 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
|
1435
1438
|
] }) });
|
|
1436
1439
|
};
|
|
1437
1440
|
|
|
1438
|
-
// src/components/chat/Response.tsx
|
|
1439
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1440
|
-
var ResponseButton = ({ onClick, inProgress }) => {
|
|
1441
|
-
const context = useChatContext();
|
|
1442
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { onClick, className: "copilotKitResponseButton", children: [
|
|
1443
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: inProgress ? context.icons.stopIcon : context.icons.regenerateIcon }),
|
|
1444
|
-
inProgress ? context.labels.stopGenerating : context.labels.regenerateResponse
|
|
1445
|
-
] });
|
|
1446
|
-
};
|
|
1447
|
-
|
|
1448
1441
|
// src/components/chat/messages/RenderTextMessage.tsx
|
|
1449
|
-
var
|
|
1442
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1450
1443
|
function RenderTextMessage(props) {
|
|
1451
1444
|
const {
|
|
1452
1445
|
message,
|
|
@@ -1462,7 +1455,7 @@ function RenderTextMessage(props) {
|
|
|
1462
1455
|
} = props;
|
|
1463
1456
|
if (message.isTextMessage()) {
|
|
1464
1457
|
if (message.role === "user") {
|
|
1465
|
-
return /* @__PURE__ */ (0,
|
|
1458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1466
1459
|
UserMessage2,
|
|
1467
1460
|
{
|
|
1468
1461
|
"data-message-role": "user",
|
|
@@ -1472,7 +1465,7 @@ function RenderTextMessage(props) {
|
|
|
1472
1465
|
index
|
|
1473
1466
|
);
|
|
1474
1467
|
} else if (message.role == "assistant") {
|
|
1475
|
-
return /* @__PURE__ */ (0,
|
|
1468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1476
1469
|
AssistantMessage2,
|
|
1477
1470
|
{
|
|
1478
1471
|
"data-message-role": "assistant",
|
|
@@ -1495,7 +1488,7 @@ function RenderTextMessage(props) {
|
|
|
1495
1488
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
1496
1489
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
1497
1490
|
var import_react_core6 = require("@copilotkit/react-core");
|
|
1498
|
-
var
|
|
1491
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1499
1492
|
function RenderActionExecutionMessage(props) {
|
|
1500
1493
|
const { chatComponentsCache } = (0, import_react_core6.useCopilotContext)();
|
|
1501
1494
|
const { message, inProgress, index, isCurrentMessage, actionResult, AssistantMessage: AssistantMessage2 } = props;
|
|
@@ -1504,7 +1497,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
1504
1497
|
const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
|
|
1505
1498
|
if (typeof render === "string") {
|
|
1506
1499
|
if (isCurrentMessage && inProgress) {
|
|
1507
|
-
return /* @__PURE__ */ (0,
|
|
1500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1508
1501
|
AssistantMessage2,
|
|
1509
1502
|
{
|
|
1510
1503
|
rawData: message,
|
|
@@ -1537,7 +1530,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
1537
1530
|
return null;
|
|
1538
1531
|
}
|
|
1539
1532
|
if (typeof toRender === "string") {
|
|
1540
|
-
return /* @__PURE__ */ (0,
|
|
1533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1541
1534
|
AssistantMessage2,
|
|
1542
1535
|
{
|
|
1543
1536
|
rawData: message,
|
|
@@ -1549,7 +1542,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
1549
1542
|
index
|
|
1550
1543
|
);
|
|
1551
1544
|
} else {
|
|
1552
|
-
return /* @__PURE__ */ (0,
|
|
1545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1553
1546
|
AssistantMessage2,
|
|
1554
1547
|
{
|
|
1555
1548
|
rawData: message,
|
|
@@ -1563,20 +1556,20 @@ function RenderActionExecutionMessage(props) {
|
|
|
1563
1556
|
}
|
|
1564
1557
|
} catch (e) {
|
|
1565
1558
|
console.error(`Error executing render function for action ${message.name}: ${e}`);
|
|
1566
|
-
return /* @__PURE__ */ (0,
|
|
1559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1567
1560
|
AssistantMessage2,
|
|
1568
1561
|
{
|
|
1569
1562
|
rawData: message,
|
|
1570
1563
|
"data-message-role": "assistant",
|
|
1571
1564
|
isLoading: false,
|
|
1572
1565
|
isGenerating: false,
|
|
1573
|
-
subComponent: /* @__PURE__ */ (0,
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1566
|
+
subComponent: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("b", { children: [
|
|
1575
1568
|
"\u274C Error executing render function for action ",
|
|
1576
1569
|
message.name,
|
|
1577
1570
|
":"
|
|
1578
1571
|
] }),
|
|
1579
|
-
/* @__PURE__ */ (0,
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
|
|
1580
1573
|
] })
|
|
1581
1574
|
},
|
|
1582
1575
|
index
|
|
@@ -1586,7 +1579,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
1586
1579
|
} else if (!inProgress || !isCurrentMessage) {
|
|
1587
1580
|
return null;
|
|
1588
1581
|
} else {
|
|
1589
|
-
return /* @__PURE__ */ (0,
|
|
1582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1590
1583
|
AssistantMessage2,
|
|
1591
1584
|
{
|
|
1592
1585
|
rawData: message,
|
|
@@ -1601,11 +1594,11 @@ function RenderActionExecutionMessage(props) {
|
|
|
1601
1594
|
}
|
|
1602
1595
|
|
|
1603
1596
|
// src/components/chat/messages/RenderResultMessage.tsx
|
|
1604
|
-
var
|
|
1597
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1605
1598
|
function RenderResultMessage(props) {
|
|
1606
1599
|
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
1607
1600
|
if (message.isResultMessage() && inProgress && isCurrentMessage) {
|
|
1608
|
-
return /* @__PURE__ */ (0,
|
|
1601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1609
1602
|
AssistantMessage2,
|
|
1610
1603
|
{
|
|
1611
1604
|
"data-message-role": "assistant",
|
|
@@ -1622,7 +1615,7 @@ function RenderResultMessage(props) {
|
|
|
1622
1615
|
|
|
1623
1616
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
1624
1617
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
1625
|
-
var
|
|
1618
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1626
1619
|
function RenderAgentStateMessage(props) {
|
|
1627
1620
|
const { chatComponentsCache } = (0, import_react_core7.useCopilotContext)();
|
|
1628
1621
|
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
@@ -1634,7 +1627,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1634
1627
|
if (render) {
|
|
1635
1628
|
if (typeof render === "string") {
|
|
1636
1629
|
if (isCurrentMessage && inProgress) {
|
|
1637
|
-
return /* @__PURE__ */ (0,
|
|
1630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1638
1631
|
AssistantMessage2,
|
|
1639
1632
|
{
|
|
1640
1633
|
rawData: message,
|
|
@@ -1660,7 +1653,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1660
1653
|
return null;
|
|
1661
1654
|
}
|
|
1662
1655
|
if (!toRender && isCurrentMessage && inProgress) {
|
|
1663
|
-
return /* @__PURE__ */ (0,
|
|
1656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1664
1657
|
AssistantMessage2,
|
|
1665
1658
|
{
|
|
1666
1659
|
"data-message-role": "assistant",
|
|
@@ -1674,7 +1667,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1674
1667
|
return null;
|
|
1675
1668
|
}
|
|
1676
1669
|
if (typeof toRender === "string") {
|
|
1677
|
-
return /* @__PURE__ */ (0,
|
|
1670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1678
1671
|
AssistantMessage2,
|
|
1679
1672
|
{
|
|
1680
1673
|
rawData: message,
|
|
@@ -1686,7 +1679,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1686
1679
|
index
|
|
1687
1680
|
);
|
|
1688
1681
|
} else {
|
|
1689
|
-
return /* @__PURE__ */ (0,
|
|
1682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1690
1683
|
AssistantMessage2,
|
|
1691
1684
|
{
|
|
1692
1685
|
rawData: message,
|
|
@@ -1702,7 +1695,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1702
1695
|
} else if (!inProgress || !isCurrentMessage) {
|
|
1703
1696
|
return null;
|
|
1704
1697
|
} else {
|
|
1705
|
-
return /* @__PURE__ */ (0,
|
|
1698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1706
1699
|
AssistantMessage2,
|
|
1707
1700
|
{
|
|
1708
1701
|
rawData: message,
|
|
@@ -1747,7 +1740,7 @@ function useCopyToClipboard({ timeout = 2e3 }) {
|
|
|
1747
1740
|
}
|
|
1748
1741
|
|
|
1749
1742
|
// src/components/chat/CodeBlock.tsx
|
|
1750
|
-
var
|
|
1743
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1751
1744
|
var programmingLanguages = {
|
|
1752
1745
|
javascript: ".js",
|
|
1753
1746
|
python: ".py",
|
|
@@ -1810,15 +1803,15 @@ var CodeBlock = (0, import_react10.memo)(({ language, value }) => {
|
|
|
1810
1803
|
return;
|
|
1811
1804
|
copyToClipboard(value);
|
|
1812
1805
|
};
|
|
1813
|
-
return /* @__PURE__ */ (0,
|
|
1814
|
-
/* @__PURE__ */ (0,
|
|
1815
|
-
/* @__PURE__ */ (0,
|
|
1816
|
-
/* @__PURE__ */ (0,
|
|
1817
|
-
/* @__PURE__ */ (0,
|
|
1818
|
-
/* @__PURE__ */ (0,
|
|
1806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitCodeBlock", children: [
|
|
1807
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1808
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1819
1812
|
] })
|
|
1820
1813
|
] }),
|
|
1821
|
-
/* @__PURE__ */ (0,
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1822
1815
|
import_react_syntax_highlighter.Prism,
|
|
1823
1816
|
{
|
|
1824
1817
|
language,
|
|
@@ -2121,18 +2114,18 @@ var highlightStyle = {
|
|
|
2121
2114
|
// src/components/chat/Markdown.tsx
|
|
2122
2115
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
2123
2116
|
var import_remark_math = __toESM(require("remark-math"));
|
|
2124
|
-
var
|
|
2117
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2125
2118
|
var MemoizedReactMarkdown = (0, import_react11.memo)(
|
|
2126
2119
|
import_react_markdown.default,
|
|
2127
2120
|
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
2128
2121
|
);
|
|
2129
2122
|
var Markdown = ({ content }) => {
|
|
2130
|
-
return /* @__PURE__ */ (0,
|
|
2123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MemoizedReactMarkdown, { components, remarkPlugins: [import_remark_gfm.default, import_remark_math.default], children: content }) });
|
|
2131
2124
|
};
|
|
2132
2125
|
var components = {
|
|
2133
2126
|
a(_a) {
|
|
2134
2127
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
2135
|
-
return /* @__PURE__ */ (0,
|
|
2128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2136
2129
|
"a",
|
|
2137
2130
|
__spreadProps(__spreadValues({
|
|
2138
2131
|
style: { color: "blue", textDecoration: "underline" }
|
|
@@ -2147,7 +2140,7 @@ var components = {
|
|
|
2147
2140
|
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
2148
2141
|
if (children.length) {
|
|
2149
2142
|
if (children[0] == "\u258D") {
|
|
2150
|
-
return /* @__PURE__ */ (0,
|
|
2143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2151
2144
|
"span",
|
|
2152
2145
|
{
|
|
2153
2146
|
style: {
|
|
@@ -2162,9 +2155,9 @@ var components = {
|
|
|
2162
2155
|
}
|
|
2163
2156
|
const match = /language-(\w+)/.exec(className || "");
|
|
2164
2157
|
if (inline) {
|
|
2165
|
-
return /* @__PURE__ */ (0,
|
|
2158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
|
|
2166
2159
|
}
|
|
2167
|
-
return /* @__PURE__ */ (0,
|
|
2160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2168
2161
|
CodeBlock,
|
|
2169
2162
|
__spreadValues({
|
|
2170
2163
|
language: match && match[1] || "",
|
|
@@ -2177,7 +2170,7 @@ var components = {
|
|
|
2177
2170
|
|
|
2178
2171
|
// src/components/chat/messages/AssistantMessage.tsx
|
|
2179
2172
|
var import_react12 = require("react");
|
|
2180
|
-
var
|
|
2173
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2181
2174
|
var AssistantMessage = (props) => {
|
|
2182
2175
|
const { icons, labels } = useChatContext();
|
|
2183
2176
|
const {
|
|
@@ -2218,77 +2211,77 @@ var AssistantMessage = (props) => {
|
|
|
2218
2211
|
onThumbsDown(message);
|
|
2219
2212
|
}
|
|
2220
2213
|
};
|
|
2221
|
-
const LoadingIcon = () => /* @__PURE__ */ (0,
|
|
2222
|
-
return /* @__PURE__ */ (0,
|
|
2223
|
-
(message || isLoading) && /* @__PURE__ */ (0,
|
|
2224
|
-
message && /* @__PURE__ */ (0,
|
|
2225
|
-
isLoading && /* @__PURE__ */ (0,
|
|
2226
|
-
message && !isLoading && /* @__PURE__ */ (0,
|
|
2214
|
+
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: icons.activityIcon });
|
|
2215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2216
|
+
(message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2217
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Markdown, { content: message || "" }),
|
|
2218
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LoadingIcon, {}),
|
|
2219
|
+
message && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2227
2220
|
"div",
|
|
2228
2221
|
{
|
|
2229
2222
|
className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
|
|
2230
2223
|
children: [
|
|
2231
|
-
/* @__PURE__ */ (0,
|
|
2224
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2232
2225
|
"button",
|
|
2233
2226
|
{
|
|
2234
2227
|
className: "copilotKitMessageControlButton",
|
|
2235
2228
|
onClick: handleRegenerate,
|
|
2236
2229
|
"aria-label": labels.regenerateResponse,
|
|
2237
2230
|
title: labels.regenerateResponse,
|
|
2238
|
-
children:
|
|
2231
|
+
children: icons.regenerateIcon
|
|
2239
2232
|
}
|
|
2240
2233
|
),
|
|
2241
|
-
/* @__PURE__ */ (0,
|
|
2234
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2242
2235
|
"button",
|
|
2243
2236
|
{
|
|
2244
2237
|
className: "copilotKitMessageControlButton",
|
|
2245
2238
|
onClick: handleCopy,
|
|
2246
2239
|
"aria-label": labels.copyToClipboard,
|
|
2247
2240
|
title: labels.copyToClipboard,
|
|
2248
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
2241
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
|
|
2249
2242
|
}
|
|
2250
2243
|
),
|
|
2251
|
-
onThumbsUp && /* @__PURE__ */ (0,
|
|
2244
|
+
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2252
2245
|
"button",
|
|
2253
2246
|
{
|
|
2254
2247
|
className: "copilotKitMessageControlButton",
|
|
2255
2248
|
onClick: handleThumbsUp,
|
|
2256
2249
|
"aria-label": labels.thumbsUp,
|
|
2257
2250
|
title: labels.thumbsUp,
|
|
2258
|
-
children:
|
|
2251
|
+
children: icons.thumbsUpIcon
|
|
2259
2252
|
}
|
|
2260
2253
|
),
|
|
2261
|
-
onThumbsDown && /* @__PURE__ */ (0,
|
|
2254
|
+
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2262
2255
|
"button",
|
|
2263
2256
|
{
|
|
2264
2257
|
className: "copilotKitMessageControlButton",
|
|
2265
2258
|
onClick: handleThumbsDown,
|
|
2266
2259
|
"aria-label": labels.thumbsDown,
|
|
2267
2260
|
title: labels.thumbsDown,
|
|
2268
|
-
children:
|
|
2261
|
+
children: icons.thumbsDownIcon
|
|
2269
2262
|
}
|
|
2270
2263
|
)
|
|
2271
2264
|
]
|
|
2272
2265
|
}
|
|
2273
2266
|
)
|
|
2274
2267
|
] }),
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
|
|
2276
2269
|
] });
|
|
2277
2270
|
};
|
|
2278
2271
|
|
|
2279
2272
|
// src/components/chat/messages/UserMessage.tsx
|
|
2280
|
-
var
|
|
2273
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2281
2274
|
var UserMessage = (props) => {
|
|
2282
|
-
return /* @__PURE__ */ (0,
|
|
2275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.message });
|
|
2283
2276
|
};
|
|
2284
2277
|
|
|
2285
2278
|
// src/components/chat/Suggestion.tsx
|
|
2286
2279
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
2287
2280
|
var import_shared2 = require("@copilotkit/shared");
|
|
2288
2281
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2289
|
-
var
|
|
2282
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2290
2283
|
function Suggestion({ title, message, onClick, partial, className }) {
|
|
2291
|
-
return /* @__PURE__ */ (0,
|
|
2284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2292
2285
|
"button",
|
|
2293
2286
|
{
|
|
2294
2287
|
disabled: partial,
|
|
@@ -2298,7 +2291,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
|
|
|
2298
2291
|
},
|
|
2299
2292
|
className: className || (partial ? "suggestion loading" : "suggestion"),
|
|
2300
2293
|
"data-test-id": "suggestion",
|
|
2301
|
-
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0,
|
|
2294
|
+
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: title })
|
|
2302
2295
|
}
|
|
2303
2296
|
);
|
|
2304
2297
|
}
|
|
@@ -2378,12 +2371,11 @@ var import_react_core9 = require("@copilotkit/react-core");
|
|
|
2378
2371
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
2379
2372
|
var import_shared3 = require("@copilotkit/shared");
|
|
2380
2373
|
var import_react_core10 = require("@copilotkit/react-core");
|
|
2381
|
-
var
|
|
2374
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2382
2375
|
function CopilotChat({
|
|
2383
2376
|
instructions,
|
|
2384
2377
|
onSubmitMessage,
|
|
2385
2378
|
makeSystemMessage,
|
|
2386
|
-
showResponseButton = true,
|
|
2387
2379
|
onInProgress,
|
|
2388
2380
|
onStopGeneration,
|
|
2389
2381
|
onReloadMessages,
|
|
@@ -2397,7 +2389,6 @@ function CopilotChat({
|
|
|
2397
2389
|
RenderAgentStateMessage: RenderAgentStateMessage2 = RenderAgentStateMessage,
|
|
2398
2390
|
RenderResultMessage: RenderResultMessage2 = RenderResultMessage,
|
|
2399
2391
|
Input: Input2 = Input,
|
|
2400
|
-
ResponseButton: ResponseButton2 = ResponseButton,
|
|
2401
2392
|
className,
|
|
2402
2393
|
icons,
|
|
2403
2394
|
labels,
|
|
@@ -2445,8 +2436,8 @@ function CopilotChat({
|
|
|
2445
2436
|
onCopy(message);
|
|
2446
2437
|
}
|
|
2447
2438
|
};
|
|
2448
|
-
return /* @__PURE__ */ (0,
|
|
2449
|
-
/* @__PURE__ */ (0,
|
|
2439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2450
2441
|
Messages2,
|
|
2451
2442
|
{
|
|
2452
2443
|
AssistantMessage: AssistantMessage2,
|
|
@@ -2461,7 +2452,7 @@ function CopilotChat({
|
|
|
2461
2452
|
onCopy: handleCopy,
|
|
2462
2453
|
onThumbsUp,
|
|
2463
2454
|
onThumbsDown,
|
|
2464
|
-
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2455
|
+
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2465
2456
|
Suggestion,
|
|
2466
2457
|
{
|
|
2467
2458
|
title: suggestion.title,
|
|
@@ -2474,7 +2465,7 @@ function CopilotChat({
|
|
|
2474
2465
|
)) })
|
|
2475
2466
|
}
|
|
2476
2467
|
),
|
|
2477
|
-
/* @__PURE__ */ (0,
|
|
2468
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2478
2469
|
Input2,
|
|
2479
2470
|
{
|
|
2480
2471
|
inProgress: isLoading,
|
|
@@ -2493,10 +2484,10 @@ function WrappedCopilotChat({
|
|
|
2493
2484
|
}) {
|
|
2494
2485
|
const chatContext = import_react13.default.useContext(ChatContext);
|
|
2495
2486
|
if (!chatContext) {
|
|
2496
|
-
return /* @__PURE__ */ (0,
|
|
2497
|
-
}, children: /* @__PURE__ */ (0,
|
|
2487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2488
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
2498
2489
|
}
|
|
2499
|
-
return /* @__PURE__ */ (0,
|
|
2490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children });
|
|
2500
2491
|
}
|
|
2501
2492
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2502
2493
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
@@ -2657,7 +2648,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2657
2648
|
};
|
|
2658
2649
|
|
|
2659
2650
|
// src/components/chat/Modal.tsx
|
|
2660
|
-
var
|
|
2651
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2661
2652
|
var CopilotModal = ({
|
|
2662
2653
|
instructions,
|
|
2663
2654
|
defaultOpen = false,
|
|
@@ -2671,14 +2662,12 @@ var CopilotModal = ({
|
|
|
2671
2662
|
icons,
|
|
2672
2663
|
labels,
|
|
2673
2664
|
makeSystemMessage,
|
|
2674
|
-
showResponseButton = true,
|
|
2675
2665
|
onInProgress,
|
|
2676
2666
|
Window: Window2 = Window,
|
|
2677
2667
|
Button: Button2 = Button,
|
|
2678
2668
|
Header: Header2 = Header,
|
|
2679
2669
|
Messages: Messages2 = Messages,
|
|
2680
2670
|
Input: Input2 = Input,
|
|
2681
|
-
ResponseButton: ResponseButton2 = ResponseButton,
|
|
2682
2671
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2683
2672
|
UserMessage: UserMessage2 = UserMessage,
|
|
2684
2673
|
className,
|
|
@@ -2689,19 +2678,19 @@ var CopilotModal = ({
|
|
|
2689
2678
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
2690
2679
|
setOpenState(open);
|
|
2691
2680
|
};
|
|
2692
|
-
return /* @__PURE__ */ (0,
|
|
2681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
2693
2682
|
children,
|
|
2694
|
-
/* @__PURE__ */ (0,
|
|
2695
|
-
/* @__PURE__ */ (0,
|
|
2696
|
-
/* @__PURE__ */ (0,
|
|
2683
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className, children: [
|
|
2684
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button2, {}),
|
|
2685
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2697
2686
|
Window2,
|
|
2698
2687
|
{
|
|
2699
2688
|
clickOutsideToClose,
|
|
2700
2689
|
shortcut,
|
|
2701
2690
|
hitEscapeToClose,
|
|
2702
2691
|
children: [
|
|
2703
|
-
/* @__PURE__ */ (0,
|
|
2704
|
-
/* @__PURE__ */ (0,
|
|
2692
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Header2, {}),
|
|
2693
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2705
2694
|
CopilotChat,
|
|
2706
2695
|
{
|
|
2707
2696
|
instructions,
|
|
@@ -2709,11 +2698,9 @@ var CopilotModal = ({
|
|
|
2709
2698
|
onStopGeneration,
|
|
2710
2699
|
onReloadMessages,
|
|
2711
2700
|
makeSystemMessage,
|
|
2712
|
-
showResponseButton,
|
|
2713
2701
|
onInProgress,
|
|
2714
2702
|
Messages: Messages2,
|
|
2715
2703
|
Input: Input2,
|
|
2716
|
-
ResponseButton: ResponseButton2,
|
|
2717
2704
|
AssistantMessage: AssistantMessage2,
|
|
2718
2705
|
UserMessage: UserMessage2
|
|
2719
2706
|
}
|
|
@@ -2726,17 +2713,17 @@ var CopilotModal = ({
|
|
|
2726
2713
|
};
|
|
2727
2714
|
|
|
2728
2715
|
// src/components/chat/Popup.tsx
|
|
2729
|
-
var
|
|
2716
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2730
2717
|
function CopilotPopup(props) {
|
|
2731
2718
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2732
2719
|
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
2733
2720
|
});
|
|
2734
|
-
return /* @__PURE__ */ (0,
|
|
2721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
|
|
2735
2722
|
}
|
|
2736
2723
|
|
|
2737
2724
|
// src/components/chat/Sidebar.tsx
|
|
2738
2725
|
var import_react15 = require("react");
|
|
2739
|
-
var
|
|
2726
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2740
2727
|
function CopilotSidebar(props) {
|
|
2741
2728
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2742
2729
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
@@ -2749,7 +2736,7 @@ function CopilotSidebar(props) {
|
|
|
2749
2736
|
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
2750
2737
|
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
2751
2738
|
};
|
|
2752
|
-
return /* @__PURE__ */ (0,
|
|
2739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
|
|
2753
2740
|
}
|
|
2754
2741
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2755
2742
|
0 && (module.exports = {
|