@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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotPopup
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-QTN7AYVL.mjs";
|
|
4
|
+
import "../../chunk-EMWOZVCW.mjs";
|
|
5
|
+
import "../../chunk-P7S3E5UW.mjs";
|
|
6
|
+
import "../../chunk-YGD4IB27.mjs";
|
|
7
7
|
import "../../chunk-V7W6IM2V.mjs";
|
|
8
8
|
import "../../chunk-GBXUOB6L.mjs";
|
|
9
9
|
import "../../chunk-6TCUJ3B7.mjs";
|
|
@@ -11,21 +11,20 @@ import "../../chunk-KXE2JCUH.mjs";
|
|
|
11
11
|
import "../../chunk-YC4NBUGE.mjs";
|
|
12
12
|
import "../../chunk-BH6PCAAL.mjs";
|
|
13
13
|
import "../../chunk-OTPAZXVR.mjs";
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
16
|
-
import "../../chunk-UWWMAJ7R.mjs";
|
|
14
|
+
import "../../chunk-YOEL33HG.mjs";
|
|
15
|
+
import "../../chunk-HGA4N4ME.mjs";
|
|
17
16
|
import "../../chunk-WEYDZBT7.mjs";
|
|
18
17
|
import "../../chunk-7RIBDD4K.mjs";
|
|
19
18
|
import "../../chunk-HEIDCT7I.mjs";
|
|
20
|
-
import "../../chunk-
|
|
19
|
+
import "../../chunk-5M7ODWKH.mjs";
|
|
21
20
|
import "../../chunk-XB6QCUPB.mjs";
|
|
21
|
+
import "../../chunk-UWWMAJ7R.mjs";
|
|
22
22
|
import "../../chunk-TOQ7P4DO.mjs";
|
|
23
|
-
import "../../chunk-
|
|
23
|
+
import "../../chunk-SNLHKLW3.mjs";
|
|
24
24
|
import "../../chunk-YQFVRDNC.mjs";
|
|
25
25
|
import "../../chunk-XNQO5AZZ.mjs";
|
|
26
|
-
import "../../chunk-
|
|
27
|
-
import "../../chunk-
|
|
28
|
-
import "../../chunk-5JY5QJ2W.mjs";
|
|
26
|
+
import "../../chunk-ZY25LVYR.mjs";
|
|
27
|
+
import "../../chunk-UN2E3HCK.mjs";
|
|
29
28
|
import "../../chunk-PCTCOQK2.mjs";
|
|
30
29
|
import "../../chunk-ORSMX3SE.mjs";
|
|
31
30
|
import "../../chunk-54JAUBUJ.mjs";
|
|
@@ -363,7 +363,10 @@ var ChatContextProvider = ({
|
|
|
363
363
|
spinnerIcon: SpinnerIcon,
|
|
364
364
|
stopIcon: StopIcon,
|
|
365
365
|
regenerateIcon: RegenerateIcon,
|
|
366
|
-
pushToTalkIcon: MicrophoneIcon
|
|
366
|
+
pushToTalkIcon: MicrophoneIcon,
|
|
367
|
+
copyIcon: CopyIcon,
|
|
368
|
+
thumbsUpIcon: ThumbsUpIcon,
|
|
369
|
+
thumbsDownIcon: ThumbsDownIcon
|
|
367
370
|
}), icons),
|
|
368
371
|
[icons]
|
|
369
372
|
);
|
|
@@ -1430,18 +1433,8 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
|
1430
1433
|
] }) });
|
|
1431
1434
|
};
|
|
1432
1435
|
|
|
1433
|
-
// src/components/chat/Response.tsx
|
|
1434
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1435
|
-
var ResponseButton = ({ onClick, inProgress }) => {
|
|
1436
|
-
const context = useChatContext();
|
|
1437
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { onClick, className: "copilotKitResponseButton", children: [
|
|
1438
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: inProgress ? context.icons.stopIcon : context.icons.regenerateIcon }),
|
|
1439
|
-
inProgress ? context.labels.stopGenerating : context.labels.regenerateResponse
|
|
1440
|
-
] });
|
|
1441
|
-
};
|
|
1442
|
-
|
|
1443
1436
|
// src/components/chat/messages/RenderTextMessage.tsx
|
|
1444
|
-
var
|
|
1437
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1445
1438
|
function RenderTextMessage(props) {
|
|
1446
1439
|
const {
|
|
1447
1440
|
message,
|
|
@@ -1457,7 +1450,7 @@ function RenderTextMessage(props) {
|
|
|
1457
1450
|
} = props;
|
|
1458
1451
|
if (message.isTextMessage()) {
|
|
1459
1452
|
if (message.role === "user") {
|
|
1460
|
-
return /* @__PURE__ */ (0,
|
|
1453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1461
1454
|
UserMessage2,
|
|
1462
1455
|
{
|
|
1463
1456
|
"data-message-role": "user",
|
|
@@ -1467,7 +1460,7 @@ function RenderTextMessage(props) {
|
|
|
1467
1460
|
index
|
|
1468
1461
|
);
|
|
1469
1462
|
} else if (message.role == "assistant") {
|
|
1470
|
-
return /* @__PURE__ */ (0,
|
|
1463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1471
1464
|
AssistantMessage2,
|
|
1472
1465
|
{
|
|
1473
1466
|
"data-message-role": "assistant",
|
|
@@ -1490,7 +1483,7 @@ function RenderTextMessage(props) {
|
|
|
1490
1483
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
1491
1484
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
1492
1485
|
var import_react_core6 = require("@copilotkit/react-core");
|
|
1493
|
-
var
|
|
1486
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1494
1487
|
function RenderActionExecutionMessage(props) {
|
|
1495
1488
|
const { chatComponentsCache } = (0, import_react_core6.useCopilotContext)();
|
|
1496
1489
|
const { message, inProgress, index, isCurrentMessage, actionResult, AssistantMessage: AssistantMessage2 } = props;
|
|
@@ -1499,7 +1492,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
1499
1492
|
const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
|
|
1500
1493
|
if (typeof render === "string") {
|
|
1501
1494
|
if (isCurrentMessage && inProgress) {
|
|
1502
|
-
return /* @__PURE__ */ (0,
|
|
1495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1503
1496
|
AssistantMessage2,
|
|
1504
1497
|
{
|
|
1505
1498
|
rawData: message,
|
|
@@ -1532,7 +1525,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
1532
1525
|
return null;
|
|
1533
1526
|
}
|
|
1534
1527
|
if (typeof toRender === "string") {
|
|
1535
|
-
return /* @__PURE__ */ (0,
|
|
1528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1536
1529
|
AssistantMessage2,
|
|
1537
1530
|
{
|
|
1538
1531
|
rawData: message,
|
|
@@ -1544,7 +1537,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
1544
1537
|
index
|
|
1545
1538
|
);
|
|
1546
1539
|
} else {
|
|
1547
|
-
return /* @__PURE__ */ (0,
|
|
1540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1548
1541
|
AssistantMessage2,
|
|
1549
1542
|
{
|
|
1550
1543
|
rawData: message,
|
|
@@ -1558,20 +1551,20 @@ function RenderActionExecutionMessage(props) {
|
|
|
1558
1551
|
}
|
|
1559
1552
|
} catch (e) {
|
|
1560
1553
|
console.error(`Error executing render function for action ${message.name}: ${e}`);
|
|
1561
|
-
return /* @__PURE__ */ (0,
|
|
1554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1562
1555
|
AssistantMessage2,
|
|
1563
1556
|
{
|
|
1564
1557
|
rawData: message,
|
|
1565
1558
|
"data-message-role": "assistant",
|
|
1566
1559
|
isLoading: false,
|
|
1567
1560
|
isGenerating: false,
|
|
1568
|
-
subComponent: /* @__PURE__ */ (0,
|
|
1569
|
-
/* @__PURE__ */ (0,
|
|
1561
|
+
subComponent: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("b", { children: [
|
|
1570
1563
|
"\u274C Error executing render function for action ",
|
|
1571
1564
|
message.name,
|
|
1572
1565
|
":"
|
|
1573
1566
|
] }),
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
|
|
1575
1568
|
] })
|
|
1576
1569
|
},
|
|
1577
1570
|
index
|
|
@@ -1581,7 +1574,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
1581
1574
|
} else if (!inProgress || !isCurrentMessage) {
|
|
1582
1575
|
return null;
|
|
1583
1576
|
} else {
|
|
1584
|
-
return /* @__PURE__ */ (0,
|
|
1577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1585
1578
|
AssistantMessage2,
|
|
1586
1579
|
{
|
|
1587
1580
|
rawData: message,
|
|
@@ -1596,11 +1589,11 @@ function RenderActionExecutionMessage(props) {
|
|
|
1596
1589
|
}
|
|
1597
1590
|
|
|
1598
1591
|
// src/components/chat/messages/RenderResultMessage.tsx
|
|
1599
|
-
var
|
|
1592
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1600
1593
|
function RenderResultMessage(props) {
|
|
1601
1594
|
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
1602
1595
|
if (message.isResultMessage() && inProgress && isCurrentMessage) {
|
|
1603
|
-
return /* @__PURE__ */ (0,
|
|
1596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1604
1597
|
AssistantMessage2,
|
|
1605
1598
|
{
|
|
1606
1599
|
"data-message-role": "assistant",
|
|
@@ -1617,7 +1610,7 @@ function RenderResultMessage(props) {
|
|
|
1617
1610
|
|
|
1618
1611
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
1619
1612
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
1620
|
-
var
|
|
1613
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1621
1614
|
function RenderAgentStateMessage(props) {
|
|
1622
1615
|
const { chatComponentsCache } = (0, import_react_core7.useCopilotContext)();
|
|
1623
1616
|
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
@@ -1629,7 +1622,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1629
1622
|
if (render) {
|
|
1630
1623
|
if (typeof render === "string") {
|
|
1631
1624
|
if (isCurrentMessage && inProgress) {
|
|
1632
|
-
return /* @__PURE__ */ (0,
|
|
1625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1633
1626
|
AssistantMessage2,
|
|
1634
1627
|
{
|
|
1635
1628
|
rawData: message,
|
|
@@ -1655,7 +1648,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1655
1648
|
return null;
|
|
1656
1649
|
}
|
|
1657
1650
|
if (!toRender && isCurrentMessage && inProgress) {
|
|
1658
|
-
return /* @__PURE__ */ (0,
|
|
1651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1659
1652
|
AssistantMessage2,
|
|
1660
1653
|
{
|
|
1661
1654
|
"data-message-role": "assistant",
|
|
@@ -1669,7 +1662,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1669
1662
|
return null;
|
|
1670
1663
|
}
|
|
1671
1664
|
if (typeof toRender === "string") {
|
|
1672
|
-
return /* @__PURE__ */ (0,
|
|
1665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1673
1666
|
AssistantMessage2,
|
|
1674
1667
|
{
|
|
1675
1668
|
rawData: message,
|
|
@@ -1681,7 +1674,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1681
1674
|
index
|
|
1682
1675
|
);
|
|
1683
1676
|
} else {
|
|
1684
|
-
return /* @__PURE__ */ (0,
|
|
1677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1685
1678
|
AssistantMessage2,
|
|
1686
1679
|
{
|
|
1687
1680
|
rawData: message,
|
|
@@ -1697,7 +1690,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1697
1690
|
} else if (!inProgress || !isCurrentMessage) {
|
|
1698
1691
|
return null;
|
|
1699
1692
|
} else {
|
|
1700
|
-
return /* @__PURE__ */ (0,
|
|
1693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1701
1694
|
AssistantMessage2,
|
|
1702
1695
|
{
|
|
1703
1696
|
rawData: message,
|
|
@@ -1742,7 +1735,7 @@ function useCopyToClipboard({ timeout = 2e3 }) {
|
|
|
1742
1735
|
}
|
|
1743
1736
|
|
|
1744
1737
|
// src/components/chat/CodeBlock.tsx
|
|
1745
|
-
var
|
|
1738
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1746
1739
|
var programmingLanguages = {
|
|
1747
1740
|
javascript: ".js",
|
|
1748
1741
|
python: ".py",
|
|
@@ -1805,15 +1798,15 @@ var CodeBlock = (0, import_react10.memo)(({ language, value }) => {
|
|
|
1805
1798
|
return;
|
|
1806
1799
|
copyToClipboard(value);
|
|
1807
1800
|
};
|
|
1808
|
-
return /* @__PURE__ */ (0,
|
|
1809
|
-
/* @__PURE__ */ (0,
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
1811
|
-
/* @__PURE__ */ (0,
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1813
|
-
/* @__PURE__ */ (0,
|
|
1801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitCodeBlock", children: [
|
|
1802
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1803
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1804
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1805
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
|
|
1806
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1814
1807
|
] })
|
|
1815
1808
|
] }),
|
|
1816
|
-
/* @__PURE__ */ (0,
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1817
1810
|
import_react_syntax_highlighter.Prism,
|
|
1818
1811
|
{
|
|
1819
1812
|
language,
|
|
@@ -2116,18 +2109,18 @@ var highlightStyle = {
|
|
|
2116
2109
|
// src/components/chat/Markdown.tsx
|
|
2117
2110
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
2118
2111
|
var import_remark_math = __toESM(require("remark-math"));
|
|
2119
|
-
var
|
|
2112
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2120
2113
|
var MemoizedReactMarkdown = (0, import_react11.memo)(
|
|
2121
2114
|
import_react_markdown.default,
|
|
2122
2115
|
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
2123
2116
|
);
|
|
2124
2117
|
var Markdown = ({ content }) => {
|
|
2125
|
-
return /* @__PURE__ */ (0,
|
|
2118
|
+
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 }) });
|
|
2126
2119
|
};
|
|
2127
2120
|
var components = {
|
|
2128
2121
|
a(_a) {
|
|
2129
2122
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
2130
|
-
return /* @__PURE__ */ (0,
|
|
2123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2131
2124
|
"a",
|
|
2132
2125
|
__spreadProps(__spreadValues({
|
|
2133
2126
|
style: { color: "blue", textDecoration: "underline" }
|
|
@@ -2142,7 +2135,7 @@ var components = {
|
|
|
2142
2135
|
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
2143
2136
|
if (children.length) {
|
|
2144
2137
|
if (children[0] == "\u258D") {
|
|
2145
|
-
return /* @__PURE__ */ (0,
|
|
2138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2146
2139
|
"span",
|
|
2147
2140
|
{
|
|
2148
2141
|
style: {
|
|
@@ -2157,9 +2150,9 @@ var components = {
|
|
|
2157
2150
|
}
|
|
2158
2151
|
const match = /language-(\w+)/.exec(className || "");
|
|
2159
2152
|
if (inline) {
|
|
2160
|
-
return /* @__PURE__ */ (0,
|
|
2153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
|
|
2161
2154
|
}
|
|
2162
|
-
return /* @__PURE__ */ (0,
|
|
2155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2163
2156
|
CodeBlock,
|
|
2164
2157
|
__spreadValues({
|
|
2165
2158
|
language: match && match[1] || "",
|
|
@@ -2172,7 +2165,7 @@ var components = {
|
|
|
2172
2165
|
|
|
2173
2166
|
// src/components/chat/messages/AssistantMessage.tsx
|
|
2174
2167
|
var import_react12 = require("react");
|
|
2175
|
-
var
|
|
2168
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2176
2169
|
var AssistantMessage = (props) => {
|
|
2177
2170
|
const { icons, labels } = useChatContext();
|
|
2178
2171
|
const {
|
|
@@ -2213,77 +2206,77 @@ var AssistantMessage = (props) => {
|
|
|
2213
2206
|
onThumbsDown(message);
|
|
2214
2207
|
}
|
|
2215
2208
|
};
|
|
2216
|
-
const LoadingIcon = () => /* @__PURE__ */ (0,
|
|
2217
|
-
return /* @__PURE__ */ (0,
|
|
2218
|
-
(message || isLoading) && /* @__PURE__ */ (0,
|
|
2219
|
-
message && /* @__PURE__ */ (0,
|
|
2220
|
-
isLoading && /* @__PURE__ */ (0,
|
|
2221
|
-
message && !isLoading && /* @__PURE__ */ (0,
|
|
2209
|
+
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: icons.activityIcon });
|
|
2210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2211
|
+
(message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
2212
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Markdown, { content: message || "" }),
|
|
2213
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LoadingIcon, {}),
|
|
2214
|
+
message && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2222
2215
|
"div",
|
|
2223
2216
|
{
|
|
2224
2217
|
className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
|
|
2225
2218
|
children: [
|
|
2226
|
-
/* @__PURE__ */ (0,
|
|
2219
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2227
2220
|
"button",
|
|
2228
2221
|
{
|
|
2229
2222
|
className: "copilotKitMessageControlButton",
|
|
2230
2223
|
onClick: handleRegenerate,
|
|
2231
2224
|
"aria-label": labels.regenerateResponse,
|
|
2232
2225
|
title: labels.regenerateResponse,
|
|
2233
|
-
children:
|
|
2226
|
+
children: icons.regenerateIcon
|
|
2234
2227
|
}
|
|
2235
2228
|
),
|
|
2236
|
-
/* @__PURE__ */ (0,
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2237
2230
|
"button",
|
|
2238
2231
|
{
|
|
2239
2232
|
className: "copilotKitMessageControlButton",
|
|
2240
2233
|
onClick: handleCopy,
|
|
2241
2234
|
"aria-label": labels.copyToClipboard,
|
|
2242
2235
|
title: labels.copyToClipboard,
|
|
2243
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
2236
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
|
|
2244
2237
|
}
|
|
2245
2238
|
),
|
|
2246
|
-
onThumbsUp && /* @__PURE__ */ (0,
|
|
2239
|
+
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2247
2240
|
"button",
|
|
2248
2241
|
{
|
|
2249
2242
|
className: "copilotKitMessageControlButton",
|
|
2250
2243
|
onClick: handleThumbsUp,
|
|
2251
2244
|
"aria-label": labels.thumbsUp,
|
|
2252
2245
|
title: labels.thumbsUp,
|
|
2253
|
-
children:
|
|
2246
|
+
children: icons.thumbsUpIcon
|
|
2254
2247
|
}
|
|
2255
2248
|
),
|
|
2256
|
-
onThumbsDown && /* @__PURE__ */ (0,
|
|
2249
|
+
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2257
2250
|
"button",
|
|
2258
2251
|
{
|
|
2259
2252
|
className: "copilotKitMessageControlButton",
|
|
2260
2253
|
onClick: handleThumbsDown,
|
|
2261
2254
|
"aria-label": labels.thumbsDown,
|
|
2262
2255
|
title: labels.thumbsDown,
|
|
2263
|
-
children:
|
|
2256
|
+
children: icons.thumbsDownIcon
|
|
2264
2257
|
}
|
|
2265
2258
|
)
|
|
2266
2259
|
]
|
|
2267
2260
|
}
|
|
2268
2261
|
)
|
|
2269
2262
|
] }),
|
|
2270
|
-
/* @__PURE__ */ (0,
|
|
2263
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
|
|
2271
2264
|
] });
|
|
2272
2265
|
};
|
|
2273
2266
|
|
|
2274
2267
|
// src/components/chat/messages/UserMessage.tsx
|
|
2275
|
-
var
|
|
2268
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2276
2269
|
var UserMessage = (props) => {
|
|
2277
|
-
return /* @__PURE__ */ (0,
|
|
2270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.message });
|
|
2278
2271
|
};
|
|
2279
2272
|
|
|
2280
2273
|
// src/components/chat/Suggestion.tsx
|
|
2281
2274
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
2282
2275
|
var import_shared2 = require("@copilotkit/shared");
|
|
2283
2276
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2284
|
-
var
|
|
2277
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2285
2278
|
function Suggestion({ title, message, onClick, partial, className }) {
|
|
2286
|
-
return /* @__PURE__ */ (0,
|
|
2279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2287
2280
|
"button",
|
|
2288
2281
|
{
|
|
2289
2282
|
disabled: partial,
|
|
@@ -2293,7 +2286,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
|
|
|
2293
2286
|
},
|
|
2294
2287
|
className: className || (partial ? "suggestion loading" : "suggestion"),
|
|
2295
2288
|
"data-test-id": "suggestion",
|
|
2296
|
-
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0,
|
|
2289
|
+
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: title })
|
|
2297
2290
|
}
|
|
2298
2291
|
);
|
|
2299
2292
|
}
|
|
@@ -2373,12 +2366,11 @@ var import_react_core9 = require("@copilotkit/react-core");
|
|
|
2373
2366
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
2374
2367
|
var import_shared3 = require("@copilotkit/shared");
|
|
2375
2368
|
var import_react_core10 = require("@copilotkit/react-core");
|
|
2376
|
-
var
|
|
2369
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2377
2370
|
function CopilotChat({
|
|
2378
2371
|
instructions,
|
|
2379
2372
|
onSubmitMessage,
|
|
2380
2373
|
makeSystemMessage,
|
|
2381
|
-
showResponseButton = true,
|
|
2382
2374
|
onInProgress,
|
|
2383
2375
|
onStopGeneration,
|
|
2384
2376
|
onReloadMessages,
|
|
@@ -2392,7 +2384,6 @@ function CopilotChat({
|
|
|
2392
2384
|
RenderAgentStateMessage: RenderAgentStateMessage2 = RenderAgentStateMessage,
|
|
2393
2385
|
RenderResultMessage: RenderResultMessage2 = RenderResultMessage,
|
|
2394
2386
|
Input: Input2 = Input,
|
|
2395
|
-
ResponseButton: ResponseButton2 = ResponseButton,
|
|
2396
2387
|
className,
|
|
2397
2388
|
icons,
|
|
2398
2389
|
labels,
|
|
@@ -2440,8 +2431,8 @@ function CopilotChat({
|
|
|
2440
2431
|
onCopy(message);
|
|
2441
2432
|
}
|
|
2442
2433
|
};
|
|
2443
|
-
return /* @__PURE__ */ (0,
|
|
2444
|
-
/* @__PURE__ */ (0,
|
|
2434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2445
2436
|
Messages2,
|
|
2446
2437
|
{
|
|
2447
2438
|
AssistantMessage: AssistantMessage2,
|
|
@@ -2456,7 +2447,7 @@ function CopilotChat({
|
|
|
2456
2447
|
onCopy: handleCopy,
|
|
2457
2448
|
onThumbsUp,
|
|
2458
2449
|
onThumbsDown,
|
|
2459
|
-
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2450
|
+
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2460
2451
|
Suggestion,
|
|
2461
2452
|
{
|
|
2462
2453
|
title: suggestion.title,
|
|
@@ -2469,7 +2460,7 @@ function CopilotChat({
|
|
|
2469
2460
|
)) })
|
|
2470
2461
|
}
|
|
2471
2462
|
),
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2463
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2473
2464
|
Input2,
|
|
2474
2465
|
{
|
|
2475
2466
|
inProgress: isLoading,
|
|
@@ -2488,10 +2479,10 @@ function WrappedCopilotChat({
|
|
|
2488
2479
|
}) {
|
|
2489
2480
|
const chatContext = import_react13.default.useContext(ChatContext);
|
|
2490
2481
|
if (!chatContext) {
|
|
2491
|
-
return /* @__PURE__ */ (0,
|
|
2492
|
-
}, children: /* @__PURE__ */ (0,
|
|
2482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2483
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
2493
2484
|
}
|
|
2494
|
-
return /* @__PURE__ */ (0,
|
|
2485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children });
|
|
2495
2486
|
}
|
|
2496
2487
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2497
2488
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
@@ -2652,7 +2643,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2652
2643
|
};
|
|
2653
2644
|
|
|
2654
2645
|
// src/components/chat/Modal.tsx
|
|
2655
|
-
var
|
|
2646
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2656
2647
|
var CopilotModal = ({
|
|
2657
2648
|
instructions,
|
|
2658
2649
|
defaultOpen = false,
|
|
@@ -2666,14 +2657,12 @@ var CopilotModal = ({
|
|
|
2666
2657
|
icons,
|
|
2667
2658
|
labels,
|
|
2668
2659
|
makeSystemMessage,
|
|
2669
|
-
showResponseButton = true,
|
|
2670
2660
|
onInProgress,
|
|
2671
2661
|
Window: Window2 = Window,
|
|
2672
2662
|
Button: Button2 = Button,
|
|
2673
2663
|
Header: Header2 = Header,
|
|
2674
2664
|
Messages: Messages2 = Messages,
|
|
2675
2665
|
Input: Input2 = Input,
|
|
2676
|
-
ResponseButton: ResponseButton2 = ResponseButton,
|
|
2677
2666
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2678
2667
|
UserMessage: UserMessage2 = UserMessage,
|
|
2679
2668
|
className,
|
|
@@ -2684,19 +2673,19 @@ var CopilotModal = ({
|
|
|
2684
2673
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
2685
2674
|
setOpenState(open);
|
|
2686
2675
|
};
|
|
2687
|
-
return /* @__PURE__ */ (0,
|
|
2676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
2688
2677
|
children,
|
|
2689
|
-
/* @__PURE__ */ (0,
|
|
2690
|
-
/* @__PURE__ */ (0,
|
|
2691
|
-
/* @__PURE__ */ (0,
|
|
2678
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className, children: [
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button2, {}),
|
|
2680
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2692
2681
|
Window2,
|
|
2693
2682
|
{
|
|
2694
2683
|
clickOutsideToClose,
|
|
2695
2684
|
shortcut,
|
|
2696
2685
|
hitEscapeToClose,
|
|
2697
2686
|
children: [
|
|
2698
|
-
/* @__PURE__ */ (0,
|
|
2699
|
-
/* @__PURE__ */ (0,
|
|
2687
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Header2, {}),
|
|
2688
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2700
2689
|
CopilotChat,
|
|
2701
2690
|
{
|
|
2702
2691
|
instructions,
|
|
@@ -2704,11 +2693,9 @@ var CopilotModal = ({
|
|
|
2704
2693
|
onStopGeneration,
|
|
2705
2694
|
onReloadMessages,
|
|
2706
2695
|
makeSystemMessage,
|
|
2707
|
-
showResponseButton,
|
|
2708
2696
|
onInProgress,
|
|
2709
2697
|
Messages: Messages2,
|
|
2710
2698
|
Input: Input2,
|
|
2711
|
-
ResponseButton: ResponseButton2,
|
|
2712
2699
|
AssistantMessage: AssistantMessage2,
|
|
2713
2700
|
UserMessage: UserMessage2
|
|
2714
2701
|
}
|
|
@@ -2721,7 +2708,7 @@ var CopilotModal = ({
|
|
|
2721
2708
|
};
|
|
2722
2709
|
|
|
2723
2710
|
// src/components/chat/Sidebar.tsx
|
|
2724
|
-
var
|
|
2711
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2725
2712
|
function CopilotSidebar(props) {
|
|
2726
2713
|
props = __spreadProps(__spreadValues({}, props), {
|
|
2727
2714
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
@@ -2734,7 +2721,7 @@ function CopilotSidebar(props) {
|
|
|
2734
2721
|
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
2735
2722
|
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
2736
2723
|
};
|
|
2737
|
-
return /* @__PURE__ */ (0,
|
|
2724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
|
|
2738
2725
|
}
|
|
2739
2726
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2740
2727
|
0 && (module.exports = {
|