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