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