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