@axiom-lattice/react-sdk 2.1.17 → 2.1.18
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/dist/index.d.mts +2 -7
- package/dist/index.d.ts +2 -7
- package/dist/index.js +979 -736
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +859 -612
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -637,7 +637,7 @@ function AgentThreadProvider({
|
|
|
637
637
|
}
|
|
638
638
|
}, []);
|
|
639
639
|
const resumeStream = (0, import_react3.useCallback)(
|
|
640
|
-
(messageId) => {
|
|
640
|
+
(messageId, onMessageChunk) => {
|
|
641
641
|
if (!threadId) {
|
|
642
642
|
throw new Error("Thread ID is required to resume stream");
|
|
643
643
|
}
|
|
@@ -671,7 +671,10 @@ function AgentThreadProvider({
|
|
|
671
671
|
};
|
|
672
672
|
const stopResumeStream = client.resumeStream(
|
|
673
673
|
resumeStreamOptions,
|
|
674
|
-
|
|
674
|
+
(chunk) => {
|
|
675
|
+
onMessageChunk?.(chunk);
|
|
676
|
+
handleStreamEvent(chunk);
|
|
677
|
+
},
|
|
675
678
|
async () => {
|
|
676
679
|
setState((prev) => ({
|
|
677
680
|
...prev,
|
|
@@ -721,7 +724,6 @@ function AgentThreadProvider({
|
|
|
721
724
|
lastAgentStateCreatedAtRef.current = currentCreatedAt;
|
|
722
725
|
}
|
|
723
726
|
let needUpdateFields = {};
|
|
724
|
-
let fetchedMessages = [];
|
|
725
727
|
needUpdateFields.agentState = agentState;
|
|
726
728
|
needUpdateFields.todos = agentState?.values?.todos;
|
|
727
729
|
const interrupts = agentState?.tasks?.flatMap(
|
|
@@ -737,19 +739,24 @@ function AgentThreadProvider({
|
|
|
737
739
|
}
|
|
738
740
|
);
|
|
739
741
|
needUpdateFields.interrupts = interrupts;
|
|
740
|
-
fetchedMessages = await client.getMessages({ threadId });
|
|
741
|
-
needUpdateFields.messages = fetchedMessages;
|
|
742
|
+
const fetchedMessages = await client.getMessages({ threadId });
|
|
742
743
|
chunkMessageMerger.current.reset();
|
|
743
744
|
chunkMessageMerger.current.initialMessages(fetchedMessages);
|
|
745
|
+
needUpdateFields.messages = chunkMessageMerger.current.getMessages();
|
|
744
746
|
setState((prev) => ({
|
|
745
747
|
...prev,
|
|
746
748
|
...needUpdateFields,
|
|
747
749
|
isLoading: false
|
|
748
750
|
}));
|
|
749
|
-
if (options.enableResumeStream &&
|
|
750
|
-
const lastMessage =
|
|
751
|
-
|
|
752
|
-
resumeStream(lastMessage.id)
|
|
751
|
+
if (options.enableResumeStream && needUpdateFields.messages.length > 0) {
|
|
752
|
+
const lastMessage = needUpdateFields.messages[needUpdateFields.messages.length - 1];
|
|
753
|
+
let lastMessageIsRemoved = false;
|
|
754
|
+
resumeStream(lastMessage.id, (chunk) => {
|
|
755
|
+
if (!lastMessageIsRemoved) {
|
|
756
|
+
chunkMessageMerger.current.removeMessageById(lastMessage.id);
|
|
757
|
+
lastMessageIsRemoved = true;
|
|
758
|
+
}
|
|
759
|
+
});
|
|
753
760
|
}
|
|
754
761
|
} catch (error) {
|
|
755
762
|
setState((prev) => ({
|
|
@@ -1323,15 +1330,15 @@ var ColumnLayout = ({
|
|
|
1323
1330
|
};
|
|
1324
1331
|
|
|
1325
1332
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
1326
|
-
var
|
|
1333
|
+
var import_icons13 = require("@ant-design/icons");
|
|
1327
1334
|
|
|
1328
1335
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
1329
|
-
var
|
|
1330
|
-
var
|
|
1336
|
+
var import_antd2 = require("antd");
|
|
1337
|
+
var import_react10 = require("react");
|
|
1331
1338
|
|
|
1332
1339
|
// src/components/GenUI/MDResponse.tsx
|
|
1333
1340
|
var import_x_markdown = __toESM(require("@ant-design/x-markdown"));
|
|
1334
|
-
var
|
|
1341
|
+
var import_react9 = require("react");
|
|
1335
1342
|
var import_antd_style2 = require("antd-style");
|
|
1336
1343
|
|
|
1337
1344
|
// src/components/GenUI/Code.tsx
|
|
@@ -1366,13 +1373,19 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
|
1366
1373
|
var Code = (props) => {
|
|
1367
1374
|
const { className, children } = props;
|
|
1368
1375
|
const language = className?.match(/language-(\w+)/)?.[1] || "";
|
|
1369
|
-
|
|
1376
|
+
let childrenStr;
|
|
1377
|
+
if (typeof children === "string") {
|
|
1378
|
+
childrenStr = children;
|
|
1379
|
+
}
|
|
1380
|
+
if (Array.isArray(children)) {
|
|
1381
|
+
childrenStr = children.join("");
|
|
1382
|
+
}
|
|
1370
1383
|
if (language) {
|
|
1371
1384
|
const Element = getElement(language)?.card_view;
|
|
1372
1385
|
if (Element) {
|
|
1373
1386
|
let childrenData;
|
|
1374
1387
|
try {
|
|
1375
|
-
childrenData = JSON.parse(
|
|
1388
|
+
childrenData = JSON.parse(childrenStr);
|
|
1376
1389
|
} catch (error) {
|
|
1377
1390
|
}
|
|
1378
1391
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Element, { component_key: language, data: childrenData });
|
|
@@ -1389,8 +1402,172 @@ var Code = (props) => {
|
|
|
1389
1402
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_x.CodeHighlighter, { lang: language, children });
|
|
1390
1403
|
};
|
|
1391
1404
|
|
|
1392
|
-
// src/components/GenUI/
|
|
1405
|
+
// src/components/GenUI/MDComponentWrap.tsx
|
|
1393
1406
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1407
|
+
var MDComponentWrap = (Element) => {
|
|
1408
|
+
return (props) => {
|
|
1409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Element, { ...props });
|
|
1410
|
+
};
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
// src/components/GenUI/elements/generic_data_table.tsx
|
|
1414
|
+
var import_antd = require("antd");
|
|
1415
|
+
var import_react8 = require("react");
|
|
1416
|
+
var import_icons = require("@ant-design/icons");
|
|
1417
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1418
|
+
var { Text } = import_antd.Typography;
|
|
1419
|
+
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
1420
|
+
const { dataSource, message: message5 } = data ?? {};
|
|
1421
|
+
const [expandedRowKeys, setExpandedRowKeys] = (0, import_react8.useState)([]);
|
|
1422
|
+
const { openSideApp } = useChatUIContext();
|
|
1423
|
+
const processedData = dataSource?.map((item, index) => ({
|
|
1424
|
+
...item,
|
|
1425
|
+
key: `${index}_${JSON.stringify(item).slice(0, 20)}`
|
|
1426
|
+
})) || [];
|
|
1427
|
+
const generateColumns = (dataItem) => {
|
|
1428
|
+
if (!dataItem || typeof dataItem !== "object") {
|
|
1429
|
+
return [];
|
|
1430
|
+
}
|
|
1431
|
+
return Object.keys(dataItem).filter((key) => key !== "key" && key !== "expandItem").map((key) => ({
|
|
1432
|
+
title: formatColumnTitle(key),
|
|
1433
|
+
dataIndex: key,
|
|
1434
|
+
key,
|
|
1435
|
+
width: 150,
|
|
1436
|
+
sorter: (a, b) => {
|
|
1437
|
+
const aVal = a[key];
|
|
1438
|
+
const bVal = b[key];
|
|
1439
|
+
if (aVal === null || aVal === void 0) return 1;
|
|
1440
|
+
if (bVal === null || bVal === void 0) return -1;
|
|
1441
|
+
if (typeof aVal === "number" && typeof bVal === "number") {
|
|
1442
|
+
return aVal - bVal;
|
|
1443
|
+
}
|
|
1444
|
+
const aDate = new Date(aVal);
|
|
1445
|
+
const bDate = new Date(bVal);
|
|
1446
|
+
if (!isNaN(aDate.getTime()) && !isNaN(bDate.getTime())) {
|
|
1447
|
+
return aDate.getTime() - bDate.getTime();
|
|
1448
|
+
}
|
|
1449
|
+
return String(aVal).localeCompare(String(bVal), "zh-CN");
|
|
1450
|
+
},
|
|
1451
|
+
render: (value) => {
|
|
1452
|
+
if (value === null || value === void 0) {
|
|
1453
|
+
return "-";
|
|
1454
|
+
}
|
|
1455
|
+
if (typeof value === "object") {
|
|
1456
|
+
return JSON.stringify(value);
|
|
1457
|
+
}
|
|
1458
|
+
return String(value);
|
|
1459
|
+
}
|
|
1460
|
+
}));
|
|
1461
|
+
};
|
|
1462
|
+
const formatColumnTitle = (key) => {
|
|
1463
|
+
return key.replace(/([A-Z])/g, " $1").replace(/_/g, " ").replace(/^./, (str) => str.toUpperCase()).trim();
|
|
1464
|
+
};
|
|
1465
|
+
const columns = processedData.length > 0 ? generateColumns(processedData[0]) : [];
|
|
1466
|
+
const expandedRowRender = (record) => {
|
|
1467
|
+
const expandItem = record.expandItem;
|
|
1468
|
+
if (!expandItem) {
|
|
1469
|
+
return null;
|
|
1470
|
+
}
|
|
1471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { padding: "16px" }, children: [
|
|
1472
|
+
expandItem.content && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { marginBottom: "16px" }, children: [
|
|
1473
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u8BE6\u7EC6\u4FE1\u606F:" }),
|
|
1474
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MDResponse, { content: expandItem.content })
|
|
1475
|
+
] }),
|
|
1476
|
+
expandItem.dataSource && expandItem.dataSource.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
|
|
1477
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u5B50\u8868\u6570\u636E:" }),
|
|
1478
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1479
|
+
GenericDataTable,
|
|
1480
|
+
{
|
|
1481
|
+
component_key: `nested_${record.key}`,
|
|
1482
|
+
data: {
|
|
1483
|
+
dataSource: expandItem.dataSource,
|
|
1484
|
+
message: void 0
|
|
1485
|
+
},
|
|
1486
|
+
interactive
|
|
1487
|
+
}
|
|
1488
|
+
)
|
|
1489
|
+
] })
|
|
1490
|
+
] });
|
|
1491
|
+
};
|
|
1492
|
+
const exportToExcel = () => {
|
|
1493
|
+
if (!processedData || processedData.length === 0) return;
|
|
1494
|
+
console.warn(
|
|
1495
|
+
"Export to Excel not implemented in SDK yet (requires xlsx dependency)"
|
|
1496
|
+
);
|
|
1497
|
+
};
|
|
1498
|
+
const hasExpandableRows = processedData.some((item) => item.expandItem);
|
|
1499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1500
|
+
import_antd.Table,
|
|
1501
|
+
{
|
|
1502
|
+
size: "small",
|
|
1503
|
+
title: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd.Flex, { justify: "space-between", align: "center", children: [
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { strong: true, style: { fontSize: 16 }, children: message5 || "" }) }),
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd.Space, { children: [
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1507
|
+
import_antd.Button,
|
|
1508
|
+
{
|
|
1509
|
+
type: "text",
|
|
1510
|
+
size: "small",
|
|
1511
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.DownloadOutlined, {}),
|
|
1512
|
+
onClick: exportToExcel,
|
|
1513
|
+
disabled: !processedData || processedData.length === 0,
|
|
1514
|
+
children: "\u5BFC\u51FAExcel"
|
|
1515
|
+
}
|
|
1516
|
+
),
|
|
1517
|
+
default_open_in_side_app && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1518
|
+
import_antd.Button,
|
|
1519
|
+
{
|
|
1520
|
+
type: "link",
|
|
1521
|
+
size: "small",
|
|
1522
|
+
onClick: () => {
|
|
1523
|
+
openSideApp({
|
|
1524
|
+
component_key: "generic_data_table",
|
|
1525
|
+
message: message5 || "",
|
|
1526
|
+
data: { dataSource, message: message5 }
|
|
1527
|
+
});
|
|
1528
|
+
},
|
|
1529
|
+
children: [
|
|
1530
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.ExpandAltOutlined, {}),
|
|
1531
|
+
"\u5C55\u5F00"
|
|
1532
|
+
]
|
|
1533
|
+
}
|
|
1534
|
+
)
|
|
1535
|
+
] })
|
|
1536
|
+
] }),
|
|
1537
|
+
dataSource: processedData,
|
|
1538
|
+
columns,
|
|
1539
|
+
pagination: {
|
|
1540
|
+
pageSize: 10,
|
|
1541
|
+
showSizeChanger: true,
|
|
1542
|
+
showQuickJumper: true,
|
|
1543
|
+
showTotal: (total, range) => `\u7B2C ${range[0]}-${range[1]} \u6761/\u5171 ${total} \u6761`
|
|
1544
|
+
},
|
|
1545
|
+
scroll: { x: "max-content" },
|
|
1546
|
+
expandable: hasExpandableRows ? {
|
|
1547
|
+
expandedRowRender,
|
|
1548
|
+
expandedRowKeys,
|
|
1549
|
+
onExpandedRowsChange: (keys) => setExpandedRowKeys(keys),
|
|
1550
|
+
rowExpandable: (record) => !!record.expandItem
|
|
1551
|
+
} : void 0,
|
|
1552
|
+
rowKey: "key",
|
|
1553
|
+
bordered: true
|
|
1554
|
+
}
|
|
1555
|
+
);
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
// src/components/GenUI/mdComponents.tsx
|
|
1559
|
+
var genericdatatable = MDComponentWrap(GenericDataTable);
|
|
1560
|
+
var mdComponents = {
|
|
1561
|
+
code: Code,
|
|
1562
|
+
genericdatatable
|
|
1563
|
+
// row: Row,
|
|
1564
|
+
// col: Col,
|
|
1565
|
+
// input: Input,
|
|
1566
|
+
// button: Button,
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1569
|
+
// src/components/GenUI/MDResponse.tsx
|
|
1570
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1394
1571
|
var useStyles = (0, import_antd_style2.createStyles)(({ token, css }) => ({
|
|
1395
1572
|
markdownTableContainer: css`
|
|
1396
1573
|
overflow-x: auto;
|
|
@@ -1480,26 +1657,33 @@ var MDResponse = ({
|
|
|
1480
1657
|
noGenUI
|
|
1481
1658
|
}) => {
|
|
1482
1659
|
const { styles } = useStyles();
|
|
1483
|
-
return /* @__PURE__ */ (0,
|
|
1660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: styles.markdownContainer, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1661
|
+
import_x_markdown.default,
|
|
1662
|
+
{
|
|
1663
|
+
components: mdComponents,
|
|
1664
|
+
content,
|
|
1665
|
+
paragraphTag: "div"
|
|
1666
|
+
}
|
|
1667
|
+
) });
|
|
1484
1668
|
};
|
|
1485
1669
|
var MDViewFormItem = ({ value }) => {
|
|
1486
|
-
return /* @__PURE__ */ (0,
|
|
1670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MDResponse, { content: value || "" });
|
|
1487
1671
|
};
|
|
1488
1672
|
|
|
1489
1673
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
1490
|
-
var
|
|
1491
|
-
var { Text } =
|
|
1674
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1675
|
+
var { Text: Text2 } = import_antd2.Typography;
|
|
1492
1676
|
var ConfirmFeedback = ({
|
|
1493
1677
|
data,
|
|
1494
1678
|
interactive = true
|
|
1495
1679
|
}) => {
|
|
1496
1680
|
const { message: message5, type, config, feedback, options } = data ?? {};
|
|
1497
1681
|
const { sendMessage } = useAgentChat();
|
|
1498
|
-
const [clicked, setClicked] = (0,
|
|
1499
|
-
return /* @__PURE__ */ (0,
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
options ? /* @__PURE__ */ (0,
|
|
1502
|
-
|
|
1682
|
+
const [clicked, setClicked] = (0, import_react10.useState)(false);
|
|
1683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd2.Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MDResponse, { content: message5 }),
|
|
1685
|
+
options ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd2.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1686
|
+
import_antd2.Button,
|
|
1503
1687
|
{
|
|
1504
1688
|
title: option.description,
|
|
1505
1689
|
disabled: !interactive || clicked || feedback,
|
|
@@ -1521,9 +1705,9 @@ var ConfirmFeedback = ({
|
|
|
1521
1705
|
children: option.label
|
|
1522
1706
|
},
|
|
1523
1707
|
option.value
|
|
1524
|
-
)) }) : /* @__PURE__ */ (0,
|
|
1525
|
-
/* @__PURE__ */ (0,
|
|
1526
|
-
|
|
1708
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd2.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: [
|
|
1709
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1710
|
+
import_antd2.Button,
|
|
1527
1711
|
{
|
|
1528
1712
|
disabled: !interactive || clicked || feedback,
|
|
1529
1713
|
style: {
|
|
@@ -1545,8 +1729,8 @@ var ConfirmFeedback = ({
|
|
|
1545
1729
|
children: "\u786E\u8BA4"
|
|
1546
1730
|
}
|
|
1547
1731
|
),
|
|
1548
|
-
/* @__PURE__ */ (0,
|
|
1549
|
-
|
|
1732
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1733
|
+
import_antd2.Button,
|
|
1550
1734
|
{
|
|
1551
1735
|
disabled: !interactive || clicked || feedback,
|
|
1552
1736
|
type: "default",
|
|
@@ -1572,155 +1756,10 @@ var ConfirmFeedback = ({
|
|
|
1572
1756
|
] });
|
|
1573
1757
|
};
|
|
1574
1758
|
|
|
1575
|
-
// src/components/GenUI/elements/generic_data_table.tsx
|
|
1576
|
-
var import_antd2 = require("antd");
|
|
1577
|
-
var import_react10 = require("react");
|
|
1578
|
-
var import_icons = require("@ant-design/icons");
|
|
1579
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1580
|
-
var { Text: Text2 } = import_antd2.Typography;
|
|
1581
|
-
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
1582
|
-
const { dataSource, message: message5 } = data ?? {};
|
|
1583
|
-
const [expandedRowKeys, setExpandedRowKeys] = (0, import_react10.useState)([]);
|
|
1584
|
-
const { openSideApp } = useChatUIContext();
|
|
1585
|
-
const processedData = dataSource?.map((item, index) => ({
|
|
1586
|
-
...item,
|
|
1587
|
-
key: `${index}_${JSON.stringify(item).slice(0, 20)}`
|
|
1588
|
-
})) || [];
|
|
1589
|
-
const generateColumns = (dataItem) => {
|
|
1590
|
-
if (!dataItem || typeof dataItem !== "object") {
|
|
1591
|
-
return [];
|
|
1592
|
-
}
|
|
1593
|
-
return Object.keys(dataItem).filter((key) => key !== "key" && key !== "expandItem").map((key) => ({
|
|
1594
|
-
title: formatColumnTitle(key),
|
|
1595
|
-
dataIndex: key,
|
|
1596
|
-
key,
|
|
1597
|
-
width: 150,
|
|
1598
|
-
sorter: (a, b) => {
|
|
1599
|
-
const aVal = a[key];
|
|
1600
|
-
const bVal = b[key];
|
|
1601
|
-
if (aVal === null || aVal === void 0) return 1;
|
|
1602
|
-
if (bVal === null || bVal === void 0) return -1;
|
|
1603
|
-
if (typeof aVal === "number" && typeof bVal === "number") {
|
|
1604
|
-
return aVal - bVal;
|
|
1605
|
-
}
|
|
1606
|
-
const aDate = new Date(aVal);
|
|
1607
|
-
const bDate = new Date(bVal);
|
|
1608
|
-
if (!isNaN(aDate.getTime()) && !isNaN(bDate.getTime())) {
|
|
1609
|
-
return aDate.getTime() - bDate.getTime();
|
|
1610
|
-
}
|
|
1611
|
-
return String(aVal).localeCompare(String(bVal), "zh-CN");
|
|
1612
|
-
},
|
|
1613
|
-
render: (value) => {
|
|
1614
|
-
if (value === null || value === void 0) {
|
|
1615
|
-
return "-";
|
|
1616
|
-
}
|
|
1617
|
-
if (typeof value === "object") {
|
|
1618
|
-
return JSON.stringify(value);
|
|
1619
|
-
}
|
|
1620
|
-
return String(value);
|
|
1621
|
-
}
|
|
1622
|
-
}));
|
|
1623
|
-
};
|
|
1624
|
-
const formatColumnTitle = (key) => {
|
|
1625
|
-
return key.replace(/([A-Z])/g, " $1").replace(/_/g, " ").replace(/^./, (str) => str.toUpperCase()).trim();
|
|
1626
|
-
};
|
|
1627
|
-
const columns = processedData.length > 0 ? generateColumns(processedData[0]) : [];
|
|
1628
|
-
const expandedRowRender = (record) => {
|
|
1629
|
-
const expandItem = record.expandItem;
|
|
1630
|
-
if (!expandItem) {
|
|
1631
|
-
return null;
|
|
1632
|
-
}
|
|
1633
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: "16px" }, children: [
|
|
1634
|
-
expandItem.content && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { marginBottom: "16px" }, children: [
|
|
1635
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text2, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u8BE6\u7EC6\u4FE1\u606F:" }),
|
|
1636
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MDResponse, { content: expandItem.content })
|
|
1637
|
-
] }),
|
|
1638
|
-
expandItem.dataSource && expandItem.dataSource.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
1639
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text2, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u5B50\u8868\u6570\u636E:" }),
|
|
1640
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1641
|
-
GenericDataTable,
|
|
1642
|
-
{
|
|
1643
|
-
component_key: `nested_${record.key}`,
|
|
1644
|
-
data: {
|
|
1645
|
-
dataSource: expandItem.dataSource,
|
|
1646
|
-
message: void 0
|
|
1647
|
-
},
|
|
1648
|
-
interactive
|
|
1649
|
-
}
|
|
1650
|
-
)
|
|
1651
|
-
] })
|
|
1652
|
-
] });
|
|
1653
|
-
};
|
|
1654
|
-
const exportToExcel = () => {
|
|
1655
|
-
if (!processedData || processedData.length === 0) return;
|
|
1656
|
-
console.warn(
|
|
1657
|
-
"Export to Excel not implemented in SDK yet (requires xlsx dependency)"
|
|
1658
|
-
);
|
|
1659
|
-
};
|
|
1660
|
-
const hasExpandableRows = processedData.some((item) => item.expandItem);
|
|
1661
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1662
|
-
import_antd2.Table,
|
|
1663
|
-
{
|
|
1664
|
-
size: "small",
|
|
1665
|
-
title: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_antd2.Flex, { justify: "space-between", align: "center", children: [
|
|
1666
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_antd2.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text2, { strong: true, style: { fontSize: 16 }, children: message5 || "" }) }),
|
|
1667
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_antd2.Space, { children: [
|
|
1668
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1669
|
-
import_antd2.Button,
|
|
1670
|
-
{
|
|
1671
|
-
type: "text",
|
|
1672
|
-
size: "small",
|
|
1673
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons.DownloadOutlined, {}),
|
|
1674
|
-
onClick: exportToExcel,
|
|
1675
|
-
disabled: !processedData || processedData.length === 0,
|
|
1676
|
-
children: "\u5BFC\u51FAExcel"
|
|
1677
|
-
}
|
|
1678
|
-
),
|
|
1679
|
-
default_open_in_side_app && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1680
|
-
import_antd2.Button,
|
|
1681
|
-
{
|
|
1682
|
-
type: "link",
|
|
1683
|
-
size: "small",
|
|
1684
|
-
onClick: () => {
|
|
1685
|
-
openSideApp({
|
|
1686
|
-
component_key: "generic_data_table",
|
|
1687
|
-
message: message5 || "",
|
|
1688
|
-
data: { dataSource, message: message5 }
|
|
1689
|
-
});
|
|
1690
|
-
},
|
|
1691
|
-
children: [
|
|
1692
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons.ExpandAltOutlined, {}),
|
|
1693
|
-
"\u5C55\u5F00"
|
|
1694
|
-
]
|
|
1695
|
-
}
|
|
1696
|
-
)
|
|
1697
|
-
] })
|
|
1698
|
-
] }),
|
|
1699
|
-
dataSource: processedData,
|
|
1700
|
-
columns,
|
|
1701
|
-
pagination: {
|
|
1702
|
-
pageSize: 10,
|
|
1703
|
-
showSizeChanger: true,
|
|
1704
|
-
showQuickJumper: true,
|
|
1705
|
-
showTotal: (total, range) => `\u7B2C ${range[0]}-${range[1]} \u6761/\u5171 ${total} \u6761`
|
|
1706
|
-
},
|
|
1707
|
-
scroll: { x: "max-content" },
|
|
1708
|
-
expandable: hasExpandableRows ? {
|
|
1709
|
-
expandedRowRender,
|
|
1710
|
-
expandedRowKeys,
|
|
1711
|
-
onExpandedRowsChange: (keys) => setExpandedRowKeys(keys),
|
|
1712
|
-
rowExpandable: (record) => !!record.expandItem
|
|
1713
|
-
} : void 0,
|
|
1714
|
-
rowKey: "key",
|
|
1715
|
-
bordered: true
|
|
1716
|
-
}
|
|
1717
|
-
);
|
|
1718
|
-
};
|
|
1719
|
-
|
|
1720
1759
|
// src/components/GenUI/elements/generic_data_table_side_app.tsx
|
|
1721
|
-
var
|
|
1760
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1722
1761
|
var GenericDataTableSideApp = (props) => {
|
|
1723
|
-
return /* @__PURE__ */ (0,
|
|
1762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GenericDataTable, { ...props, default_open_in_side_app: false });
|
|
1724
1763
|
};
|
|
1725
1764
|
|
|
1726
1765
|
// src/components/GenUI/elements/ToolCall.tsx
|
|
@@ -1732,7 +1771,7 @@ var import_icons3 = require("@ant-design/icons");
|
|
|
1732
1771
|
var import_antd3 = require("antd");
|
|
1733
1772
|
var import_antd_style3 = require("antd-style");
|
|
1734
1773
|
var import_icons2 = require("@ant-design/icons");
|
|
1735
|
-
var
|
|
1774
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1736
1775
|
var { Text: Text3, Title } = import_antd3.Typography;
|
|
1737
1776
|
var useStyle2 = (0, import_antd_style3.createStyles)(({ token, css }) => ({
|
|
1738
1777
|
card: css`
|
|
@@ -1802,7 +1841,7 @@ var ToolCard = ({
|
|
|
1802
1841
|
}) => {
|
|
1803
1842
|
const { styles } = useStyle2();
|
|
1804
1843
|
if (!data || !data.name) {
|
|
1805
|
-
return /* @__PURE__ */ (0,
|
|
1844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_antd3.Card, { size: "small", className: styles.card, bordered: false, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text3, { type: "secondary", children: "Invalid tool data" }) });
|
|
1806
1845
|
}
|
|
1807
1846
|
const formatToolName = (name) => {
|
|
1808
1847
|
return name.replace(/([a-z])([A-Z])/g, "$1 $2").split(/[_-]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
@@ -1845,7 +1884,7 @@ var ToolCard = ({
|
|
|
1845
1884
|
return typeof value;
|
|
1846
1885
|
};
|
|
1847
1886
|
const hasParameters = data.parameters && Object.keys(data.parameters).length > 0;
|
|
1848
|
-
return /* @__PURE__ */ (0,
|
|
1887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1849
1888
|
import_antd3.Card,
|
|
1850
1889
|
{
|
|
1851
1890
|
size: "small",
|
|
@@ -1853,13 +1892,13 @@ var ToolCard = ({
|
|
|
1853
1892
|
bordered: false,
|
|
1854
1893
|
bodyStyle: { padding: "16px" },
|
|
1855
1894
|
children: [
|
|
1856
|
-
/* @__PURE__ */ (0,
|
|
1857
|
-
/* @__PURE__ */ (0,
|
|
1858
|
-
/* @__PURE__ */ (0,
|
|
1859
|
-
/* @__PURE__ */ (0,
|
|
1860
|
-
data.type && /* @__PURE__ */ (0,
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: styles.header, children: [
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_antd3.Space, { align: "center", children: [
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons2.ToolOutlined, { style: { color: "#1890ff", fontSize: "18px" } }),
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Title, { level: 5, className: styles.toolName, style: { margin: 0 }, children: formatToolName(data.name) }),
|
|
1899
|
+
data.type && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_antd3.Tag, { color: "blue", className: styles.typeTag, children: data.type })
|
|
1861
1900
|
] }),
|
|
1862
|
-
data.description && /* @__PURE__ */ (0,
|
|
1901
|
+
data.description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1863
1902
|
Text3,
|
|
1864
1903
|
{
|
|
1865
1904
|
type: "secondary",
|
|
@@ -1868,19 +1907,19 @@ var ToolCard = ({
|
|
|
1868
1907
|
}
|
|
1869
1908
|
)
|
|
1870
1909
|
] }),
|
|
1871
|
-
hasParameters ? /* @__PURE__ */ (0,
|
|
1872
|
-
/* @__PURE__ */ (0,
|
|
1873
|
-
/* @__PURE__ */ (0,
|
|
1874
|
-
/* @__PURE__ */ (0,
|
|
1910
|
+
hasParameters ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_antd3.Space, { align: "center", style: { marginBottom: "12px" }, children: [
|
|
1912
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons2.CodeOutlined, { style: { color: "#52c41a", fontSize: "14px" } }),
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text3, { strong: true, style: { fontSize: "14px" }, children: [
|
|
1875
1914
|
"Parameters (",
|
|
1876
1915
|
Object.keys(data.parameters).length,
|
|
1877
1916
|
")"
|
|
1878
1917
|
] })
|
|
1879
1918
|
] }),
|
|
1880
|
-
/* @__PURE__ */ (0,
|
|
1881
|
-
/* @__PURE__ */ (0,
|
|
1882
|
-
/* @__PURE__ */ (0,
|
|
1883
|
-
/* @__PURE__ */ (0,
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.parameterGrid, children: Object.entries(data.parameters).map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: styles.parameterItem, children: [
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.parameterName, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_antd3.Space, { align: "center", children: [
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: key }),
|
|
1922
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1884
1923
|
import_antd3.Tag,
|
|
1885
1924
|
{
|
|
1886
1925
|
color: getTypeColor(value),
|
|
@@ -1889,11 +1928,11 @@ var ToolCard = ({
|
|
|
1889
1928
|
}
|
|
1890
1929
|
)
|
|
1891
1930
|
] }) }),
|
|
1892
|
-
/* @__PURE__ */ (0,
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.parameterValue, children: formatParameterValue(value) })
|
|
1893
1932
|
] }, index)) })
|
|
1894
|
-
] }) : /* @__PURE__ */ (0,
|
|
1895
|
-
/* @__PURE__ */ (0,
|
|
1896
|
-
/* @__PURE__ */ (0,
|
|
1933
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_antd3.Space, { align: "center", children: [
|
|
1934
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons2.CodeOutlined, { style: { color: "#d9d9d9", fontSize: "14px" } }),
|
|
1935
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text3, { type: "secondary", style: { fontSize: "13px" }, children: "No parameters" })
|
|
1897
1936
|
] })
|
|
1898
1937
|
]
|
|
1899
1938
|
}
|
|
@@ -1901,15 +1940,15 @@ var ToolCard = ({
|
|
|
1901
1940
|
};
|
|
1902
1941
|
|
|
1903
1942
|
// src/components/GenUI/elements/ToolCall.tsx
|
|
1904
|
-
var
|
|
1943
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1905
1944
|
function getStatusIcon(status) {
|
|
1906
1945
|
switch (status) {
|
|
1907
1946
|
case "success":
|
|
1908
|
-
return /* @__PURE__ */ (0,
|
|
1947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CheckCircleOutlined, { style: { color: "#52c41a" } });
|
|
1909
1948
|
case "error":
|
|
1910
|
-
return /* @__PURE__ */ (0,
|
|
1949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.InfoCircleOutlined, { style: { color: "#ff4d4f" } });
|
|
1911
1950
|
default:
|
|
1912
|
-
return /* @__PURE__ */ (0,
|
|
1951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.LoadingOutlined, { style: { color: "#1890ff" } });
|
|
1913
1952
|
}
|
|
1914
1953
|
}
|
|
1915
1954
|
var ToolCall = ({ data }) => {
|
|
@@ -1932,9 +1971,9 @@ var ToolCall = ({ data }) => {
|
|
|
1932
1971
|
return "Error parsing args";
|
|
1933
1972
|
}
|
|
1934
1973
|
};
|
|
1935
|
-
const header = /* @__PURE__ */ (0,
|
|
1936
|
-
/* @__PURE__ */ (0,
|
|
1937
|
-
/* @__PURE__ */ (0,
|
|
1974
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_antd4.Flex, { align: "center", wrap: "wrap", children: [
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd4.Typography.Text, { strong: true, children: formatToolName(toolCallData.name) }),
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1938
1977
|
import_antd4.Typography.Text,
|
|
1939
1978
|
{
|
|
1940
1979
|
type: "secondary",
|
|
@@ -1948,8 +1987,8 @@ var ToolCall = ({ data }) => {
|
|
|
1948
1987
|
parameters: toolCallData.args,
|
|
1949
1988
|
type: "tool_call"
|
|
1950
1989
|
};
|
|
1951
|
-
const content = /* @__PURE__ */ (0,
|
|
1952
|
-
/* @__PURE__ */ (0,
|
|
1990
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { marginTop: "8px" }, children: [
|
|
1991
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1953
1992
|
ToolCard,
|
|
1954
1993
|
{
|
|
1955
1994
|
data: toolCardData,
|
|
@@ -1957,8 +1996,8 @@ var ToolCall = ({ data }) => {
|
|
|
1957
1996
|
interactive: false
|
|
1958
1997
|
}
|
|
1959
1998
|
),
|
|
1960
|
-
toolCallData.response && /* @__PURE__ */ (0,
|
|
1961
|
-
/* @__PURE__ */ (0,
|
|
1999
|
+
toolCallData.response && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { marginTop: "12px" }, children: [
|
|
2000
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1962
2001
|
import_antd4.Typography.Text,
|
|
1963
2002
|
{
|
|
1964
2003
|
strong: true,
|
|
@@ -1966,7 +2005,7 @@ var ToolCall = ({ data }) => {
|
|
|
1966
2005
|
children: "Response:"
|
|
1967
2006
|
}
|
|
1968
2007
|
),
|
|
1969
|
-
/* @__PURE__ */ (0,
|
|
2008
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MDResponse, { content: toolCallData.response })
|
|
1970
2009
|
] })
|
|
1971
2010
|
] });
|
|
1972
2011
|
const expandIcon = ({ isActive }) => {
|
|
@@ -1979,14 +2018,14 @@ var ToolCall = ({ data }) => {
|
|
|
1979
2018
|
component_key: toolCallData.id
|
|
1980
2019
|
});
|
|
1981
2020
|
}
|
|
1982
|
-
return /* @__PURE__ */ (0,
|
|
2021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1983
2022
|
import_antd4.Collapse,
|
|
1984
2023
|
{
|
|
1985
2024
|
size: "small",
|
|
1986
2025
|
bordered: false,
|
|
1987
2026
|
defaultActiveKey: [],
|
|
1988
2027
|
expandIcon,
|
|
1989
|
-
children: /* @__PURE__ */ (0,
|
|
2028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1990
2029
|
import_CollapsePanel.default,
|
|
1991
2030
|
{
|
|
1992
2031
|
header,
|
|
@@ -2003,7 +2042,8 @@ var ToolCall = ({ data }) => {
|
|
|
2003
2042
|
var import_antd5 = require("antd");
|
|
2004
2043
|
var import_antd_style4 = require("antd-style");
|
|
2005
2044
|
var import_icons4 = require("@ant-design/icons");
|
|
2006
|
-
var
|
|
2045
|
+
var import_react11 = require("react");
|
|
2046
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2007
2047
|
var { Text: Text4 } = import_antd5.Typography;
|
|
2008
2048
|
var useStyle3 = (0, import_antd_style4.createStyles)(({ token, css }) => ({
|
|
2009
2049
|
card: css`
|
|
@@ -2034,17 +2074,19 @@ var useStyle3 = (0, import_antd_style4.createStyles)(({ token, css }) => ({
|
|
|
2034
2074
|
var Todo = ({
|
|
2035
2075
|
data,
|
|
2036
2076
|
component_key,
|
|
2037
|
-
interactive = true
|
|
2077
|
+
interactive = true,
|
|
2078
|
+
focusMode = false
|
|
2038
2079
|
}) => {
|
|
2039
2080
|
const { styles } = useStyle3();
|
|
2081
|
+
const [isExpanded, setIsExpanded] = (0, import_react11.useState)(false);
|
|
2040
2082
|
const getStatusIcon2 = (status) => {
|
|
2041
2083
|
switch (status) {
|
|
2042
2084
|
case "completed":
|
|
2043
|
-
return /* @__PURE__ */ (0,
|
|
2085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.CheckCircleOutlined, { style: { color: "#52c41a" } });
|
|
2044
2086
|
case "in_progress":
|
|
2045
|
-
return /* @__PURE__ */ (0,
|
|
2087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.ArrowRightOutlined, { style: { fontWeight: "500" } });
|
|
2046
2088
|
case "pending":
|
|
2047
|
-
return /* @__PURE__ */ (0,
|
|
2089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.ClockCircleOutlined, { style: { color: "gray" } });
|
|
2048
2090
|
default:
|
|
2049
2091
|
return null;
|
|
2050
2092
|
}
|
|
@@ -2085,36 +2127,69 @@ var Todo = ({
|
|
|
2085
2127
|
return "";
|
|
2086
2128
|
}
|
|
2087
2129
|
};
|
|
2130
|
+
const getFilteredData = () => {
|
|
2131
|
+
if (!data || !Array.isArray(data)) {
|
|
2132
|
+
return [];
|
|
2133
|
+
}
|
|
2134
|
+
if (!focusMode || data.length <= 3) {
|
|
2135
|
+
return data;
|
|
2136
|
+
}
|
|
2137
|
+
const firstInProgressIndex = data.findIndex(
|
|
2138
|
+
(item) => item.status === "in_progress"
|
|
2139
|
+
);
|
|
2140
|
+
if (firstInProgressIndex !== -1) {
|
|
2141
|
+
return data.slice(firstInProgressIndex, firstInProgressIndex + 3);
|
|
2142
|
+
}
|
|
2143
|
+
const allCompleted = data.every((item) => item.status === "completed");
|
|
2144
|
+
if (allCompleted) {
|
|
2145
|
+
return data.slice(-3);
|
|
2146
|
+
}
|
|
2147
|
+
return data.slice(0, 3);
|
|
2148
|
+
};
|
|
2088
2149
|
if (!data || !Array.isArray(data)) {
|
|
2089
|
-
return /* @__PURE__ */ (0,
|
|
2150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2090
2151
|
import_antd5.Card,
|
|
2091
2152
|
{
|
|
2092
2153
|
size: "small",
|
|
2093
2154
|
className: `shadow-sm ${styles.card}`,
|
|
2094
2155
|
bordered: false,
|
|
2095
|
-
children: /* @__PURE__ */ (0,
|
|
2156
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text4, { type: "secondary", children: "No todo items available" })
|
|
2096
2157
|
}
|
|
2097
2158
|
);
|
|
2098
2159
|
}
|
|
2099
|
-
|
|
2100
|
-
|
|
2160
|
+
const filteredData = getFilteredData();
|
|
2161
|
+
const hasMoreItems = filteredData.length < data.length;
|
|
2162
|
+
const displayData = isExpanded ? data : filteredData;
|
|
2163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd5.Card, { size: "small", className: `shadow-sm ${styles.card}`, bordered: false, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_antd5.Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
2164
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2101
2165
|
import_antd5.List,
|
|
2102
2166
|
{
|
|
2103
2167
|
size: "small",
|
|
2104
|
-
dataSource:
|
|
2105
|
-
renderItem: (item, index) => /* @__PURE__ */ (0,
|
|
2168
|
+
dataSource: displayData,
|
|
2169
|
+
renderItem: (item, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2106
2170
|
import_antd5.List.Item,
|
|
2107
2171
|
{
|
|
2108
2172
|
className: `${styles.todoItem} ${getItemClassName(item.status)}`,
|
|
2109
|
-
children: /* @__PURE__ */ (0,
|
|
2173
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_antd5.Space, { align: "center", style: { width: "100%" }, children: [
|
|
2110
2174
|
getStatusIcon2(item.status),
|
|
2111
|
-
/* @__PURE__ */ (0,
|
|
2175
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text4, { style: { flex: 1 }, children: item.content })
|
|
2112
2176
|
] })
|
|
2113
2177
|
}
|
|
2114
2178
|
)
|
|
2115
2179
|
}
|
|
2116
2180
|
),
|
|
2117
|
-
/* @__PURE__ */ (0,
|
|
2181
|
+
hasMoreItems && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2182
|
+
import_antd5.Button,
|
|
2183
|
+
{
|
|
2184
|
+
type: "link",
|
|
2185
|
+
size: "small",
|
|
2186
|
+
icon: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.UpOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.DownOutlined, {}),
|
|
2187
|
+
onClick: () => setIsExpanded(!isExpanded),
|
|
2188
|
+
style: { padding: 0, height: "auto" },
|
|
2189
|
+
children: isExpanded ? "Collapse" : `Show all ${data.length} items (${data.length - filteredData.length} hidden)`
|
|
2190
|
+
}
|
|
2191
|
+
),
|
|
2192
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text4, { type: "secondary", style: { fontSize: 12 }, children: [
|
|
2118
2193
|
"Total items: ",
|
|
2119
2194
|
data.length,
|
|
2120
2195
|
" | Completed:",
|
|
@@ -2133,7 +2208,7 @@ var Todo = ({
|
|
|
2133
2208
|
var import_antd6 = require("antd");
|
|
2134
2209
|
var import_icons5 = require("@ant-design/icons");
|
|
2135
2210
|
var import_CollapsePanel2 = __toESM(require("antd/es/collapse/CollapsePanel"));
|
|
2136
|
-
var
|
|
2211
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2137
2212
|
var { Text: Text5 } = import_antd6.Typography;
|
|
2138
2213
|
var WriteTodos = ({
|
|
2139
2214
|
data,
|
|
@@ -2147,11 +2222,11 @@ var WriteTodos = ({
|
|
|
2147
2222
|
(item) => item.status === "completed"
|
|
2148
2223
|
).length;
|
|
2149
2224
|
const expandIcon = () => {
|
|
2150
|
-
return /* @__PURE__ */ (0,
|
|
2225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons5.UnorderedListOutlined, {});
|
|
2151
2226
|
};
|
|
2152
|
-
const header = /* @__PURE__ */ (0,
|
|
2153
|
-
/* @__PURE__ */ (0,
|
|
2154
|
-
/* @__PURE__ */ (0,
|
|
2227
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_antd6.Space, { children: [
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text5, { strong: true, children: "TODOs" }),
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text5, { style: { fontSize: 12 }, type: "secondary", children: [
|
|
2155
2230
|
completedCount,
|
|
2156
2231
|
"/",
|
|
2157
2232
|
totalCount,
|
|
@@ -2161,24 +2236,25 @@ var WriteTodos = ({
|
|
|
2161
2236
|
if (!toolCallData) {
|
|
2162
2237
|
return null;
|
|
2163
2238
|
}
|
|
2164
|
-
return /* @__PURE__ */ (0,
|
|
2239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2165
2240
|
import_antd6.Collapse,
|
|
2166
2241
|
{
|
|
2167
2242
|
size: "small",
|
|
2168
2243
|
bordered: false,
|
|
2169
2244
|
defaultActiveKey: [toolCallData.id],
|
|
2170
2245
|
expandIcon,
|
|
2171
|
-
children: /* @__PURE__ */ (0,
|
|
2246
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2172
2247
|
import_CollapsePanel2.default,
|
|
2173
2248
|
{
|
|
2174
2249
|
header,
|
|
2175
2250
|
style: { minWidth: 400 },
|
|
2176
|
-
children: /* @__PURE__ */ (0,
|
|
2251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2177
2252
|
Todo,
|
|
2178
2253
|
{
|
|
2179
2254
|
data: data.args.todos,
|
|
2180
2255
|
component_key,
|
|
2181
|
-
interactive
|
|
2256
|
+
interactive,
|
|
2257
|
+
focusMode: true
|
|
2182
2258
|
}
|
|
2183
2259
|
)
|
|
2184
2260
|
},
|
|
@@ -2189,47 +2265,47 @@ var WriteTodos = ({
|
|
|
2189
2265
|
};
|
|
2190
2266
|
|
|
2191
2267
|
// src/components/GenUI/FileExplorer.tsx
|
|
2192
|
-
var
|
|
2268
|
+
var import_react12 = require("react");
|
|
2193
2269
|
var import_antd7 = require("antd");
|
|
2194
2270
|
var import_icons7 = require("@ant-design/icons");
|
|
2195
2271
|
var import_antd_style5 = require("antd-style");
|
|
2196
2272
|
|
|
2197
2273
|
// src/components/GenUI/elements/getFileIcon.tsx
|
|
2198
2274
|
var import_icons6 = require("@ant-design/icons");
|
|
2199
|
-
var
|
|
2275
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2200
2276
|
var getFileIcon = (filename) => {
|
|
2201
2277
|
const ext = filename?.split(".")?.pop()?.toLowerCase();
|
|
2202
2278
|
const iconStyle = { fontSize: 14, marginRight: 4, verticalAlign: "middle" };
|
|
2203
2279
|
switch (ext) {
|
|
2204
2280
|
case "ts":
|
|
2205
2281
|
case "tsx":
|
|
2206
|
-
return /* @__PURE__ */ (0,
|
|
2282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.CodeOutlined, { style: { ...iconStyle, color: "#3178c6" } });
|
|
2207
2283
|
case "js":
|
|
2208
2284
|
case "jsx":
|
|
2209
|
-
return /* @__PURE__ */ (0,
|
|
2285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.CodeOutlined, { style: { ...iconStyle, color: "#f7df1e" } });
|
|
2210
2286
|
case "html":
|
|
2211
|
-
return /* @__PURE__ */ (0,
|
|
2287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.Html5Outlined, { style: { ...iconStyle, color: "#e34c26" } });
|
|
2212
2288
|
case "css":
|
|
2213
2289
|
case "less":
|
|
2214
2290
|
case "scss":
|
|
2215
|
-
return /* @__PURE__ */ (0,
|
|
2291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileUnknownOutlined, { style: { ...iconStyle, color: "#563d7c" } });
|
|
2216
2292
|
case "md":
|
|
2217
|
-
return /* @__PURE__ */ (0,
|
|
2293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileMarkdownOutlined, { style: { ...iconStyle, color: "#083fa1" } });
|
|
2218
2294
|
case "json":
|
|
2219
|
-
return /* @__PURE__ */ (0,
|
|
2295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileTextOutlined, { style: { ...iconStyle, color: "#fbc02d" } });
|
|
2220
2296
|
case "png":
|
|
2221
2297
|
case "jpg":
|
|
2222
2298
|
case "jpeg":
|
|
2223
2299
|
case "gif":
|
|
2224
2300
|
case "svg":
|
|
2225
|
-
return /* @__PURE__ */ (0,
|
|
2301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileImageOutlined, { style: { ...iconStyle, color: "#4caf50" } });
|
|
2226
2302
|
default:
|
|
2227
|
-
return /* @__PURE__ */ (0,
|
|
2303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileOutlined, { style: { ...iconStyle, color: "#9e9e9e" } });
|
|
2228
2304
|
}
|
|
2229
2305
|
};
|
|
2230
2306
|
|
|
2231
2307
|
// src/components/GenUI/FileExplorer.tsx
|
|
2232
|
-
var
|
|
2308
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2233
2309
|
var useStyles2 = (0, import_antd_style5.createStyles)(({ token, css }) => ({
|
|
2234
2310
|
container: css`
|
|
2235
2311
|
height: 100%;
|
|
@@ -2361,7 +2437,7 @@ var getFolderIcon = (expanded) => {
|
|
|
2361
2437
|
color: "#dcb67a",
|
|
2362
2438
|
verticalAlign: "middle"
|
|
2363
2439
|
};
|
|
2364
|
-
return expanded ? /* @__PURE__ */ (0,
|
|
2440
|
+
return expanded ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.FolderOpenOutlined, { style: iconStyle }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.FolderOutlined, { style: iconStyle });
|
|
2365
2441
|
};
|
|
2366
2442
|
var sortTreeNodes = (nodes) => {
|
|
2367
2443
|
return nodes.sort((a, b) => {
|
|
@@ -2386,7 +2462,7 @@ var buildTreeData = (files, expandedKeys) => {
|
|
|
2386
2462
|
const key = parts.slice(0, index + 1).join("/");
|
|
2387
2463
|
let existingNode = currentLevel.find((node) => node.key === key);
|
|
2388
2464
|
if (!existingNode) {
|
|
2389
|
-
const title = part === "" && index === 0 ? /* @__PURE__ */ (0,
|
|
2465
|
+
const title = part === "" && index === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2390
2466
|
"span",
|
|
2391
2467
|
{
|
|
2392
2468
|
style: {
|
|
@@ -2421,17 +2497,17 @@ var FileExplorer = ({
|
|
|
2421
2497
|
}) => {
|
|
2422
2498
|
const { files } = data ?? {};
|
|
2423
2499
|
const { styles, cx } = useStyles2();
|
|
2424
|
-
const [fileList, setFileList] = (0,
|
|
2425
|
-
const [selectedKey, setSelectedKey] = (0,
|
|
2426
|
-
const [expandedKeys, setExpandedKeys] = (0,
|
|
2427
|
-
const [copied, setCopied] = (0,
|
|
2428
|
-
(0,
|
|
2500
|
+
const [fileList, setFileList] = (0, import_react12.useState)([]);
|
|
2501
|
+
const [selectedKey, setSelectedKey] = (0, import_react12.useState)("");
|
|
2502
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react12.useState)([]);
|
|
2503
|
+
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
2504
|
+
(0, import_react12.useEffect)(() => {
|
|
2429
2505
|
if (copied) {
|
|
2430
2506
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
2431
2507
|
return () => clearTimeout(timer);
|
|
2432
2508
|
}
|
|
2433
2509
|
}, [copied]);
|
|
2434
|
-
(0,
|
|
2510
|
+
(0, import_react12.useEffect)(() => {
|
|
2435
2511
|
let list = [];
|
|
2436
2512
|
if (Array.isArray(files)) {
|
|
2437
2513
|
list = files;
|
|
@@ -2447,11 +2523,11 @@ var FileExplorer = ({
|
|
|
2447
2523
|
setSelectedKey(list[0].name);
|
|
2448
2524
|
}
|
|
2449
2525
|
}, [files]);
|
|
2450
|
-
const treeData = (0,
|
|
2526
|
+
const treeData = (0, import_react12.useMemo)(
|
|
2451
2527
|
() => buildTreeData(fileList, expandedKeys),
|
|
2452
2528
|
[fileList, expandedKeys]
|
|
2453
2529
|
);
|
|
2454
|
-
(0,
|
|
2530
|
+
(0, import_react12.useEffect)(() => {
|
|
2455
2531
|
if (treeData.length > 0 && expandedKeys.length === 0) {
|
|
2456
2532
|
const getAllKeys = (nodes) => {
|
|
2457
2533
|
let keys = [];
|
|
@@ -2468,7 +2544,7 @@ var FileExplorer = ({
|
|
|
2468
2544
|
setExpandedKeys(getAllKeys(treeData));
|
|
2469
2545
|
}
|
|
2470
2546
|
}, [treeData.length]);
|
|
2471
|
-
const selectedFile = (0,
|
|
2547
|
+
const selectedFile = (0, import_react12.useMemo)(() => {
|
|
2472
2548
|
return fileList.find((f) => f.name === selectedKey);
|
|
2473
2549
|
}, [fileList, selectedKey]);
|
|
2474
2550
|
const handleCopy = () => {
|
|
@@ -2495,7 +2571,7 @@ var FileExplorer = ({
|
|
|
2495
2571
|
};
|
|
2496
2572
|
const renderContent = () => {
|
|
2497
2573
|
if (!selectedFile) {
|
|
2498
|
-
return /* @__PURE__ */ (0,
|
|
2574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.emptyState, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2499
2575
|
import_antd7.Empty,
|
|
2500
2576
|
{
|
|
2501
2577
|
description: "Select a file to preview",
|
|
@@ -2504,38 +2580,38 @@ var FileExplorer = ({
|
|
|
2504
2580
|
) });
|
|
2505
2581
|
}
|
|
2506
2582
|
const content = Array.isArray(selectedFile.content) ? selectedFile.content.join("\n") : selectedFile.content;
|
|
2507
|
-
return /* @__PURE__ */ (0,
|
|
2583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2508
2584
|
"div",
|
|
2509
2585
|
{
|
|
2510
2586
|
style: { minHeight: "100%", display: "flex", flexDirection: "column" },
|
|
2511
2587
|
children: [
|
|
2512
|
-
/* @__PURE__ */ (0,
|
|
2513
|
-
/* @__PURE__ */ (0,
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: styles.header, children: [
|
|
2589
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd7.Tooltip, { title: "Copy Content", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2514
2590
|
import_antd7.Button,
|
|
2515
2591
|
{
|
|
2516
2592
|
type: "text",
|
|
2517
|
-
icon: copied ? /* @__PURE__ */ (0,
|
|
2593
|
+
icon: copied ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.CheckOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.CopyOutlined, {}),
|
|
2518
2594
|
onClick: handleCopy,
|
|
2519
2595
|
size: "small"
|
|
2520
2596
|
}
|
|
2521
2597
|
) }),
|
|
2522
|
-
/* @__PURE__ */ (0,
|
|
2598
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd7.Tooltip, { title: "Download File", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2523
2599
|
import_antd7.Button,
|
|
2524
2600
|
{
|
|
2525
2601
|
type: "text",
|
|
2526
|
-
icon: /* @__PURE__ */ (0,
|
|
2602
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.DownloadOutlined, {}),
|
|
2527
2603
|
onClick: handleDownload,
|
|
2528
2604
|
size: "small"
|
|
2529
2605
|
}
|
|
2530
2606
|
) })
|
|
2531
2607
|
] }),
|
|
2532
|
-
/* @__PURE__ */ (0,
|
|
2608
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.contentBody, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MDResponse, { content }) })
|
|
2533
2609
|
]
|
|
2534
2610
|
}
|
|
2535
2611
|
);
|
|
2536
2612
|
};
|
|
2537
|
-
return /* @__PURE__ */ (0,
|
|
2538
|
-
/* @__PURE__ */ (0,
|
|
2613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_antd7.Splitter, { className: styles.splitter, children: [
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd7.Splitter.Panel, { defaultSize: "25%", min: "15%", max: "40%", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.leftPanel, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2539
2615
|
import_antd7.Tree,
|
|
2540
2616
|
{
|
|
2541
2617
|
showIcon: true,
|
|
@@ -2573,7 +2649,7 @@ var FileExplorer = ({
|
|
|
2573
2649
|
}
|
|
2574
2650
|
}
|
|
2575
2651
|
) }) }),
|
|
2576
|
-
/* @__PURE__ */ (0,
|
|
2652
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd7.Splitter.Panel, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.rightPanel, children: renderContent() }) })
|
|
2577
2653
|
] }) });
|
|
2578
2654
|
};
|
|
2579
2655
|
|
|
@@ -2581,8 +2657,8 @@ var FileExplorer = ({
|
|
|
2581
2657
|
var import_x2 = require("@ant-design/x");
|
|
2582
2658
|
var import_antd8 = require("antd");
|
|
2583
2659
|
var import_dayjs = __toESM(require("dayjs"));
|
|
2584
|
-
var
|
|
2585
|
-
var
|
|
2660
|
+
var import_react13 = require("react");
|
|
2661
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2586
2662
|
var AttachmentsCard = ({
|
|
2587
2663
|
data,
|
|
2588
2664
|
component_key,
|
|
@@ -2590,8 +2666,8 @@ var AttachmentsCard = ({
|
|
|
2590
2666
|
columns = 1,
|
|
2591
2667
|
showDownloadButton = false
|
|
2592
2668
|
}) => {
|
|
2593
|
-
const { Text:
|
|
2594
|
-
const [showAll, setShowAll] = (0,
|
|
2669
|
+
const { Text: Text14 } = import_antd8.Typography;
|
|
2670
|
+
const [showAll, setShowAll] = (0, import_react13.useState)(false);
|
|
2595
2671
|
const { openSideApp } = useChatUIContext();
|
|
2596
2672
|
const getStyles = () => {
|
|
2597
2673
|
switch (size) {
|
|
@@ -2650,7 +2726,7 @@ var AttachmentsCard = ({
|
|
|
2650
2726
|
};
|
|
2651
2727
|
const DownloadButton = ({ item }) => {
|
|
2652
2728
|
if (!showDownloadButton) return null;
|
|
2653
|
-
return /* @__PURE__ */ (0,
|
|
2729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2654
2730
|
"div",
|
|
2655
2731
|
{
|
|
2656
2732
|
style: {
|
|
@@ -2664,8 +2740,8 @@ var AttachmentsCard = ({
|
|
|
2664
2740
|
}
|
|
2665
2741
|
);
|
|
2666
2742
|
};
|
|
2667
|
-
const renderFileDescription = (item) => /* @__PURE__ */ (0,
|
|
2668
|
-
|
|
2743
|
+
const renderFileDescription = (item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Space, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2744
|
+
Text14,
|
|
2669
2745
|
{
|
|
2670
2746
|
type: "secondary",
|
|
2671
2747
|
style: {
|
|
@@ -2678,17 +2754,17 @@ var AttachmentsCard = ({
|
|
|
2678
2754
|
const displayData2 = data || [];
|
|
2679
2755
|
const shouldShowViewMore2 = displayData2.length > 4;
|
|
2680
2756
|
const visibleData2 = showAll ? displayData2 : displayData2.slice(0, 4);
|
|
2681
|
-
return /* @__PURE__ */ (0,
|
|
2682
|
-
/* @__PURE__ */ (0,
|
|
2757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_antd8.Flex, { vertical: true, gap: "small", children: [
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Row, { gutter: [8, 8], children: visibleData2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Col, { span: 24 / columns, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2683
2759
|
"div",
|
|
2684
2760
|
{
|
|
2685
2761
|
onClick: (evt) => {
|
|
2686
2762
|
evt.stopPropagation();
|
|
2687
2763
|
handleItemClick(item);
|
|
2688
2764
|
},
|
|
2689
|
-
children: /* @__PURE__ */ (0,
|
|
2690
|
-
/* @__PURE__ */ (0,
|
|
2691
|
-
/* @__PURE__ */ (0,
|
|
2765
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_antd8.Card, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DownloadButton, { item }),
|
|
2767
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2692
2768
|
import_x2.FileCard,
|
|
2693
2769
|
{
|
|
2694
2770
|
style: getFileCardStyle(item),
|
|
@@ -2697,7 +2773,7 @@ var AttachmentsCard = ({
|
|
|
2697
2773
|
description: renderFileDescription(item)
|
|
2698
2774
|
}
|
|
2699
2775
|
),
|
|
2700
|
-
item.files && /* @__PURE__ */ (0,
|
|
2776
|
+
item.files && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2701
2777
|
AttachmentsCard,
|
|
2702
2778
|
{
|
|
2703
2779
|
data: item.files,
|
|
@@ -2710,7 +2786,7 @@ var AttachmentsCard = ({
|
|
|
2710
2786
|
] })
|
|
2711
2787
|
}
|
|
2712
2788
|
) }, item.id)) }),
|
|
2713
|
-
shouldShowViewMore2 && /* @__PURE__ */ (0,
|
|
2789
|
+
shouldShowViewMore2 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2714
2790
|
import_antd8.Button,
|
|
2715
2791
|
{
|
|
2716
2792
|
type: "link",
|
|
@@ -2724,10 +2800,10 @@ var AttachmentsCard = ({
|
|
|
2724
2800
|
const displayData = data || [];
|
|
2725
2801
|
const shouldShowViewMore = displayData.length > 4;
|
|
2726
2802
|
const visibleData = showAll ? displayData : displayData.slice(0, 4);
|
|
2727
|
-
return /* @__PURE__ */ (0,
|
|
2728
|
-
visibleData.map((item) => /* @__PURE__ */ (0,
|
|
2729
|
-
/* @__PURE__ */ (0,
|
|
2730
|
-
/* @__PURE__ */ (0,
|
|
2803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_antd8.Flex, { vertical: true, gap: size === "small" ? "small" : "middle", children: [
|
|
2804
|
+
visibleData.map((item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { onClick: () => handleItemClick(item), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_antd8.Card, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DownloadButton, { item }),
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2731
2807
|
import_x2.FileCard,
|
|
2732
2808
|
{
|
|
2733
2809
|
style: getFileCardStyle(item),
|
|
@@ -2736,13 +2812,13 @@ var AttachmentsCard = ({
|
|
|
2736
2812
|
description: renderFileDescription(item)
|
|
2737
2813
|
}
|
|
2738
2814
|
),
|
|
2739
|
-
item.files && /* @__PURE__ */ (0,
|
|
2740
|
-
/* @__PURE__ */ (0,
|
|
2815
|
+
item.files && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { paddingLeft: "12px" }, children: [
|
|
2816
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text14, { type: "secondary", style: { fontSize: "12px" }, children: [
|
|
2741
2817
|
"\u5305\u542B\u6587\u4EF6(",
|
|
2742
2818
|
item.files.length,
|
|
2743
2819
|
")"
|
|
2744
2820
|
] }),
|
|
2745
|
-
/* @__PURE__ */ (0,
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2746
2822
|
AttachmentsCard,
|
|
2747
2823
|
{
|
|
2748
2824
|
data: item.files,
|
|
@@ -2754,7 +2830,7 @@ var AttachmentsCard = ({
|
|
|
2754
2830
|
)
|
|
2755
2831
|
] })
|
|
2756
2832
|
] }) }, item.id)),
|
|
2757
|
-
shouldShowViewMore && /* @__PURE__ */ (0,
|
|
2833
|
+
shouldShowViewMore && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2758
2834
|
import_antd8.Button,
|
|
2759
2835
|
{
|
|
2760
2836
|
type: "link",
|
|
@@ -2772,17 +2848,17 @@ var AttachmentsCard = ({
|
|
|
2772
2848
|
|
|
2773
2849
|
// src/components/GenUI/elements/attachments_viewer_side_app.tsx
|
|
2774
2850
|
var import_antd9 = require("antd");
|
|
2775
|
-
var
|
|
2776
|
-
var
|
|
2851
|
+
var import_react14 = require("react");
|
|
2852
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2777
2853
|
function AttachmentsViewerSideApp({
|
|
2778
2854
|
data,
|
|
2779
2855
|
component_key
|
|
2780
2856
|
}) {
|
|
2781
|
-
const [fileUri, setFileUri] = (0,
|
|
2782
|
-
const [loading, setLoading] = (0,
|
|
2783
|
-
const { file_id } = data ?? {};
|
|
2857
|
+
const [fileUri, setFileUri] = (0, import_react14.useState)();
|
|
2858
|
+
const [loading, setLoading] = (0, import_react14.useState)(false);
|
|
2859
|
+
const { file_id, url } = data ?? {};
|
|
2784
2860
|
if (loading) {
|
|
2785
|
-
return /* @__PURE__ */ (0,
|
|
2861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd9.Skeleton, { active: true });
|
|
2786
2862
|
}
|
|
2787
2863
|
const canPreviewInIframe = (fileName) => {
|
|
2788
2864
|
if (!fileName) return false;
|
|
@@ -2817,18 +2893,18 @@ function AttachmentsViewerSideApp({
|
|
|
2817
2893
|
return previewableExtensions.includes(extension);
|
|
2818
2894
|
};
|
|
2819
2895
|
const isPreviewable = fileUri?.fileName ? canPreviewInIframe(fileUri.fileName) : false;
|
|
2820
|
-
return isPreviewable ? /* @__PURE__ */ (0,
|
|
2896
|
+
return isPreviewable || url ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2821
2897
|
"iframe",
|
|
2822
2898
|
{
|
|
2823
2899
|
style: { width: "100%", height: "100%", border: 0 },
|
|
2824
|
-
src: fileUri?.url
|
|
2900
|
+
src: fileUri?.url || url
|
|
2825
2901
|
}
|
|
2826
|
-
) : /* @__PURE__ */ (0,
|
|
2902
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2827
2903
|
import_antd9.Empty,
|
|
2828
2904
|
{
|
|
2829
|
-
description: /* @__PURE__ */ (0,
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
2831
|
-
/* @__PURE__ */ (0,
|
|
2905
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2906
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: "\u6682\u65F6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u8BF7\u4E0B\u8F7D\u540E\u67E5\u770B\u3002" }),
|
|
2907
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_antd9.Button, { type: "link", href: fileUri?.url, download: fileUri?.fileName, children: [
|
|
2832
2908
|
"\u4E0B\u8F7D",
|
|
2833
2909
|
fileUri?.fileName
|
|
2834
2910
|
] })
|
|
@@ -2842,12 +2918,12 @@ function AttachmentsViewerSideApp({
|
|
|
2842
2918
|
var import_antd11 = require("antd");
|
|
2843
2919
|
|
|
2844
2920
|
// src/components/GenUI/elements/ContentPreviewCollapse.tsx
|
|
2845
|
-
var
|
|
2921
|
+
var import_react15 = require("react");
|
|
2846
2922
|
var import_antd10 = require("antd");
|
|
2847
2923
|
var import_antd_style6 = require("antd-style");
|
|
2848
2924
|
var import_icons8 = require("@ant-design/icons");
|
|
2849
2925
|
var import_CollapsePanel3 = __toESM(require("antd/es/collapse/CollapsePanel"));
|
|
2850
|
-
var
|
|
2926
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2851
2927
|
var DEFAULT_COLLAPSED_MAX_HEIGHT = 180;
|
|
2852
2928
|
var DEFAULT_EXPANDED_MAX_HEIGHT = 500;
|
|
2853
2929
|
var useStyle4 = (0, import_antd_style6.createStyles)(
|
|
@@ -2912,18 +2988,18 @@ var ContentPreviewCollapse = ({
|
|
|
2912
2988
|
showAllText = "Show all content",
|
|
2913
2989
|
showLessText = "Show less"
|
|
2914
2990
|
}) => {
|
|
2915
|
-
const [showFullContent, setShowFullContent] = (0,
|
|
2916
|
-
const [isOverflowing, setIsOverflowing] = (0,
|
|
2917
|
-
const contentRef = (0,
|
|
2991
|
+
const [showFullContent, setShowFullContent] = (0, import_react15.useState)(false);
|
|
2992
|
+
const [isOverflowing, setIsOverflowing] = (0, import_react15.useState)(false);
|
|
2993
|
+
const contentRef = (0, import_react15.useRef)(null);
|
|
2918
2994
|
const showShadow = isOverflowing && !showFullContent;
|
|
2919
2995
|
const { styles, cx } = useStyle4({ showShadow });
|
|
2920
|
-
const checkOverflow = (0,
|
|
2996
|
+
const checkOverflow = (0, import_react15.useCallback)(() => {
|
|
2921
2997
|
if (contentRef.current) {
|
|
2922
2998
|
const scrollHeight = contentRef.current.scrollHeight;
|
|
2923
2999
|
setIsOverflowing(scrollHeight > collapsedMaxHeight);
|
|
2924
3000
|
}
|
|
2925
3001
|
}, [collapsedMaxHeight]);
|
|
2926
|
-
(0,
|
|
3002
|
+
(0, import_react15.useEffect)(() => {
|
|
2927
3003
|
const element = contentRef.current;
|
|
2928
3004
|
if (!element) return;
|
|
2929
3005
|
checkOverflow();
|
|
@@ -2939,7 +3015,7 @@ var ContentPreviewCollapse = ({
|
|
|
2939
3015
|
e.stopPropagation();
|
|
2940
3016
|
setShowFullContent(!showFullContent);
|
|
2941
3017
|
};
|
|
2942
|
-
return /* @__PURE__ */ (0,
|
|
3018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2943
3019
|
import_antd10.Collapse,
|
|
2944
3020
|
{
|
|
2945
3021
|
className: styles.collapse,
|
|
@@ -2947,29 +3023,29 @@ var ContentPreviewCollapse = ({
|
|
|
2947
3023
|
bordered: false,
|
|
2948
3024
|
defaultActiveKey: defaultExpanded ? [panelKey] : [],
|
|
2949
3025
|
expandIcon,
|
|
2950
|
-
children: /* @__PURE__ */ (0,
|
|
3026
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2951
3027
|
import_CollapsePanel3.default,
|
|
2952
3028
|
{
|
|
2953
3029
|
header,
|
|
2954
3030
|
extra,
|
|
2955
3031
|
style: { minWidth },
|
|
2956
3032
|
children: [
|
|
2957
|
-
/* @__PURE__ */ (0,
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2958
3034
|
"div",
|
|
2959
3035
|
{
|
|
2960
3036
|
className: cx(styles.contentContainer, showFullContent && "expanded"),
|
|
2961
3037
|
style: {
|
|
2962
3038
|
maxHeight: showFullContent ? expandedMaxHeight : collapsedMaxHeight
|
|
2963
3039
|
},
|
|
2964
|
-
children: /* @__PURE__ */ (0,
|
|
3040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref: contentRef, className: styles.content, children })
|
|
2965
3041
|
}
|
|
2966
3042
|
),
|
|
2967
|
-
isOverflowing && /* @__PURE__ */ (0,
|
|
2968
|
-
/* @__PURE__ */ (0,
|
|
2969
|
-
/* @__PURE__ */ (0,
|
|
2970
|
-
] }) : /* @__PURE__ */ (0,
|
|
2971
|
-
/* @__PURE__ */ (0,
|
|
2972
|
-
/* @__PURE__ */ (0,
|
|
3043
|
+
isOverflowing && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: styles.toggleButton, onClick: handleToggleContent, children: showFullContent ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons8.UpOutlined, { style: { fontSize: 10 } }),
|
|
3045
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: showLessText })
|
|
3046
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3047
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons8.DownOutlined, { style: { fontSize: 10 } }),
|
|
3048
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: showAllText })
|
|
2973
3049
|
] }) })
|
|
2974
3050
|
]
|
|
2975
3051
|
},
|
|
@@ -2980,7 +3056,7 @@ var ContentPreviewCollapse = ({
|
|
|
2980
3056
|
};
|
|
2981
3057
|
|
|
2982
3058
|
// src/components/GenUI/elements/WriteFile.tsx
|
|
2983
|
-
var
|
|
3059
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2984
3060
|
var { Text: Text6 } = import_antd11.Typography;
|
|
2985
3061
|
var WriteFile = ({
|
|
2986
3062
|
data,
|
|
@@ -2994,9 +3070,9 @@ var WriteFile = ({
|
|
|
2994
3070
|
return null;
|
|
2995
3071
|
}
|
|
2996
3072
|
const expandIcon = () => getFileIcon(file_path);
|
|
2997
|
-
const header = /* @__PURE__ */ (0,
|
|
2998
|
-
/* @__PURE__ */ (0,
|
|
2999
|
-
/* @__PURE__ */ (0,
|
|
3073
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_antd11.Space, { children: [
|
|
3074
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text6, { strong: true, children: "New" }),
|
|
3075
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text6, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
3000
3076
|
] });
|
|
3001
3077
|
const handleItemClick = (toolCallData2) => {
|
|
3002
3078
|
openSideApp({
|
|
@@ -3008,13 +3084,13 @@ var WriteFile = ({
|
|
|
3008
3084
|
}
|
|
3009
3085
|
});
|
|
3010
3086
|
};
|
|
3011
|
-
return /* @__PURE__ */ (0,
|
|
3087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3012
3088
|
ContentPreviewCollapse,
|
|
3013
3089
|
{
|
|
3014
3090
|
panelKey: toolCallData.id,
|
|
3015
3091
|
header,
|
|
3016
3092
|
expandIcon,
|
|
3017
|
-
extra: /* @__PURE__ */ (0,
|
|
3093
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3018
3094
|
import_antd11.Button,
|
|
3019
3095
|
{
|
|
3020
3096
|
type: "link",
|
|
@@ -3026,7 +3102,7 @@ var WriteFile = ({
|
|
|
3026
3102
|
children: "Diff View"
|
|
3027
3103
|
}
|
|
3028
3104
|
),
|
|
3029
|
-
children: /* @__PURE__ */ (0,
|
|
3105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MDResponse, { content })
|
|
3030
3106
|
}
|
|
3031
3107
|
);
|
|
3032
3108
|
};
|
|
@@ -3034,10 +3110,10 @@ var WriteFile = ({
|
|
|
3034
3110
|
// src/components/GenUI/elements/file_content_diff_view.tsx
|
|
3035
3111
|
var import_react_diff_viewer = __toESM(require("@alexbruf/react-diff-viewer"));
|
|
3036
3112
|
var import_react_diff_viewer2 = require("@alexbruf/react-diff-viewer/index.css");
|
|
3037
|
-
var
|
|
3113
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3038
3114
|
var FileContentDiffView = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
3039
3115
|
const { old_code, new_code } = data;
|
|
3040
|
-
return /* @__PURE__ */ (0,
|
|
3116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3041
3117
|
import_react_diff_viewer.default,
|
|
3042
3118
|
{
|
|
3043
3119
|
oldValue: old_code,
|
|
@@ -3049,7 +3125,7 @@ var FileContentDiffView = ({ data, interactive = true, default_open_in_side_app
|
|
|
3049
3125
|
|
|
3050
3126
|
// src/components/GenUI/elements/EditFile.tsx
|
|
3051
3127
|
var import_antd12 = require("antd");
|
|
3052
|
-
var
|
|
3128
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3053
3129
|
var { Text: Text7 } = import_antd12.Typography;
|
|
3054
3130
|
var EditFile = ({
|
|
3055
3131
|
data,
|
|
@@ -3063,9 +3139,9 @@ var EditFile = ({
|
|
|
3063
3139
|
return null;
|
|
3064
3140
|
}
|
|
3065
3141
|
const expandIcon = () => getFileIcon(file_path);
|
|
3066
|
-
const header = /* @__PURE__ */ (0,
|
|
3067
|
-
/* @__PURE__ */ (0,
|
|
3068
|
-
/* @__PURE__ */ (0,
|
|
3142
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_antd12.Space, { children: [
|
|
3143
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text7, { strong: true, children: "Edit" }),
|
|
3144
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text7, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
3069
3145
|
] });
|
|
3070
3146
|
const handleItemClick = (toolCallData2) => {
|
|
3071
3147
|
openSideApp({
|
|
@@ -3077,13 +3153,13 @@ var EditFile = ({
|
|
|
3077
3153
|
}
|
|
3078
3154
|
});
|
|
3079
3155
|
};
|
|
3080
|
-
return /* @__PURE__ */ (0,
|
|
3156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3081
3157
|
ContentPreviewCollapse,
|
|
3082
3158
|
{
|
|
3083
3159
|
panelKey: toolCallData.id,
|
|
3084
3160
|
header,
|
|
3085
3161
|
expandIcon,
|
|
3086
|
-
extra: /* @__PURE__ */ (0,
|
|
3162
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3087
3163
|
import_antd12.Button,
|
|
3088
3164
|
{
|
|
3089
3165
|
type: "link",
|
|
@@ -3095,7 +3171,7 @@ var EditFile = ({
|
|
|
3095
3171
|
children: "Diff View"
|
|
3096
3172
|
}
|
|
3097
3173
|
),
|
|
3098
|
-
children: /* @__PURE__ */ (0,
|
|
3174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MDResponse, { content: new_string })
|
|
3099
3175
|
}
|
|
3100
3176
|
);
|
|
3101
3177
|
};
|
|
@@ -3104,7 +3180,7 @@ var EditFile = ({
|
|
|
3104
3180
|
var import_antd13 = require("antd");
|
|
3105
3181
|
var import_antd_style7 = require("antd-style");
|
|
3106
3182
|
var import_icons9 = require("@ant-design/icons");
|
|
3107
|
-
var
|
|
3183
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3108
3184
|
var { Text: Text8 } = import_antd13.Typography;
|
|
3109
3185
|
var useStyle5 = (0, import_antd_style7.createStyles)(({ token, css }) => ({
|
|
3110
3186
|
card: css`
|
|
@@ -3272,14 +3348,14 @@ var TaskCard = ({
|
|
|
3272
3348
|
switch (status2) {
|
|
3273
3349
|
case "success":
|
|
3274
3350
|
return {
|
|
3275
|
-
icon: /* @__PURE__ */ (0,
|
|
3351
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.CheckCircleOutlined, { style: { fontSize: 16 } }),
|
|
3276
3352
|
color: "success",
|
|
3277
3353
|
text: "Completed",
|
|
3278
3354
|
bgColor: "rgba(82, 196, 26, 0.1)"
|
|
3279
3355
|
};
|
|
3280
3356
|
case "error":
|
|
3281
3357
|
return {
|
|
3282
|
-
icon: /* @__PURE__ */ (0,
|
|
3358
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.CloseCircleOutlined, { style: { fontSize: 16 } }),
|
|
3283
3359
|
color: "error",
|
|
3284
3360
|
text: "Failed",
|
|
3285
3361
|
bgColor: "rgba(255, 77, 79, 0.1)"
|
|
@@ -3287,7 +3363,7 @@ var TaskCard = ({
|
|
|
3287
3363
|
case "pending":
|
|
3288
3364
|
default:
|
|
3289
3365
|
return {
|
|
3290
|
-
icon: /* @__PURE__ */ (0,
|
|
3366
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.LoadingOutlined, { style: { fontSize: 16 } }),
|
|
3291
3367
|
color: "processing",
|
|
3292
3368
|
text: "In Progress",
|
|
3293
3369
|
bgColor: "rgba(24, 144, 255, 0.1)"
|
|
@@ -3307,7 +3383,7 @@ var TaskCard = ({
|
|
|
3307
3383
|
}
|
|
3308
3384
|
});
|
|
3309
3385
|
};
|
|
3310
|
-
return /* @__PURE__ */ (0,
|
|
3386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3311
3387
|
import_antd13.Card,
|
|
3312
3388
|
{
|
|
3313
3389
|
size: "small",
|
|
@@ -3316,28 +3392,28 @@ var TaskCard = ({
|
|
|
3316
3392
|
onClick: handleCardClick,
|
|
3317
3393
|
hoverable: interactive,
|
|
3318
3394
|
bodyStyle: { padding: 0 },
|
|
3319
|
-
children: /* @__PURE__ */ (0,
|
|
3320
|
-
/* @__PURE__ */ (0,
|
|
3321
|
-
/* @__PURE__ */ (0,
|
|
3322
|
-
/* @__PURE__ */ (0,
|
|
3323
|
-
subagent_type && /* @__PURE__ */ (0,
|
|
3324
|
-
description && /* @__PURE__ */ (0,
|
|
3395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.cardBody, children: [
|
|
3396
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.titleSection, children: [
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.iconWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.CarryOutOutlined, { style: { fontSize: 20, color: "#1890ff" } }) }),
|
|
3398
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.titleContent, children: [
|
|
3399
|
+
subagent_type && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.taskType, children: subagent_type }),
|
|
3400
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text8, { className: styles.description, children: description })
|
|
3325
3401
|
] })
|
|
3326
3402
|
] }) }),
|
|
3327
|
-
/* @__PURE__ */ (0,
|
|
3328
|
-
/* @__PURE__ */ (0,
|
|
3329
|
-
assignee && /* @__PURE__ */ (0,
|
|
3330
|
-
/* @__PURE__ */ (0,
|
|
3403
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.footer, children: [
|
|
3404
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.footerLeft, children: [
|
|
3405
|
+
assignee && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.assigneeContainer, children: [
|
|
3406
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3331
3407
|
import_antd13.Avatar,
|
|
3332
3408
|
{
|
|
3333
3409
|
size: 24,
|
|
3334
|
-
icon: /* @__PURE__ */ (0,
|
|
3410
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.UserOutlined, {}),
|
|
3335
3411
|
className: styles.assigneeAvatar
|
|
3336
3412
|
}
|
|
3337
3413
|
),
|
|
3338
|
-
/* @__PURE__ */ (0,
|
|
3414
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text8, { className: styles.assigneeName, children: assignee })
|
|
3339
3415
|
] }),
|
|
3340
|
-
/* @__PURE__ */ (0,
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3341
3417
|
import_antd13.Tag,
|
|
3342
3418
|
{
|
|
3343
3419
|
icon: statusConfig.icon,
|
|
@@ -3355,16 +3431,16 @@ var TaskCard = ({
|
|
|
3355
3431
|
}
|
|
3356
3432
|
)
|
|
3357
3433
|
] }),
|
|
3358
|
-
interactive && /* @__PURE__ */ (0,
|
|
3434
|
+
interactive && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.RightOutlined, { className: styles.actionIcon })
|
|
3359
3435
|
] }),
|
|
3360
|
-
showResponse && /* @__PURE__ */ (0,
|
|
3436
|
+
showResponse && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3361
3437
|
"div",
|
|
3362
3438
|
{
|
|
3363
3439
|
className: styles.responseSection,
|
|
3364
3440
|
onClick: (e) => e.stopPropagation(),
|
|
3365
3441
|
children: [
|
|
3366
|
-
/* @__PURE__ */ (0,
|
|
3367
|
-
/* @__PURE__ */ (0,
|
|
3442
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text8, { className: styles.responseHeader, children: "Response" }),
|
|
3443
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.responseContent, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MDResponse, { content: response }) })
|
|
3368
3444
|
]
|
|
3369
3445
|
}
|
|
3370
3446
|
)
|
|
@@ -3384,17 +3460,17 @@ var import_x5 = require("@ant-design/x");
|
|
|
3384
3460
|
var import_x3 = require("@ant-design/x");
|
|
3385
3461
|
var import_antd14 = require("antd");
|
|
3386
3462
|
var import_ErrorBoundary = __toESM(require("antd/es/alert/ErrorBoundary"));
|
|
3387
|
-
var
|
|
3388
|
-
var
|
|
3463
|
+
var import_react16 = require("react");
|
|
3464
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3389
3465
|
var LazyBubble = ({
|
|
3390
3466
|
message: message5,
|
|
3391
3467
|
renderContent,
|
|
3392
3468
|
autoLoadRightPanel
|
|
3393
3469
|
}) => {
|
|
3394
|
-
const ref = (0,
|
|
3395
|
-
const [isVisible, setIsVisible] = (0,
|
|
3396
|
-
const [wasEverVisible, setWasEverVisible] = (0,
|
|
3397
|
-
(0,
|
|
3470
|
+
const ref = (0, import_react16.useRef)(null);
|
|
3471
|
+
const [isVisible, setIsVisible] = (0, import_react16.useState)(false);
|
|
3472
|
+
const [wasEverVisible, setWasEverVisible] = (0, import_react16.useState)(false);
|
|
3473
|
+
(0, import_react16.useEffect)(() => {
|
|
3398
3474
|
const observer = new IntersectionObserver(
|
|
3399
3475
|
([entry]) => {
|
|
3400
3476
|
const visible = entry.isIntersecting;
|
|
@@ -3414,21 +3490,21 @@ var LazyBubble = ({
|
|
|
3414
3490
|
}
|
|
3415
3491
|
};
|
|
3416
3492
|
}, [wasEverVisible]);
|
|
3417
|
-
(0,
|
|
3493
|
+
(0, import_react16.useEffect)(() => {
|
|
3418
3494
|
autoLoadRightPanel?.();
|
|
3419
3495
|
}, []);
|
|
3420
3496
|
const getPlaceholder = () => {
|
|
3421
3497
|
const estimatedHeight = message5.content ? Math.min(100, message5.content.length / 5) : 100;
|
|
3422
|
-
return /* @__PURE__ */ (0,
|
|
3498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
3423
3499
|
};
|
|
3424
|
-
return /* @__PURE__ */ (0,
|
|
3500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message5) : getPlaceholder() }) });
|
|
3425
3501
|
};
|
|
3426
|
-
var MemoizedBubbleList = (0,
|
|
3502
|
+
var MemoizedBubbleList = (0, import_react16.memo)(
|
|
3427
3503
|
({
|
|
3428
3504
|
items,
|
|
3429
3505
|
role,
|
|
3430
3506
|
className
|
|
3431
|
-
}) => /* @__PURE__ */ (0,
|
|
3507
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3432
3508
|
import_x3.Bubble.List,
|
|
3433
3509
|
{
|
|
3434
3510
|
autoScroll: true,
|
|
@@ -3446,18 +3522,18 @@ var MessageList = ({
|
|
|
3446
3522
|
}) => {
|
|
3447
3523
|
const { styles } = useStyle();
|
|
3448
3524
|
const { openSideApp } = useChatUIContext();
|
|
3449
|
-
const messageLengthRef = (0,
|
|
3450
|
-
(0,
|
|
3525
|
+
const messageLengthRef = (0, import_react16.useRef)(messages?.length ?? 0);
|
|
3526
|
+
(0, import_react16.useEffect)(() => {
|
|
3451
3527
|
if (messages?.length) {
|
|
3452
3528
|
messageLengthRef.current = messages?.length;
|
|
3453
3529
|
}
|
|
3454
3530
|
}, [messages?.length]);
|
|
3455
|
-
const renderContent = (0,
|
|
3531
|
+
const renderContent = (0, import_react16.useCallback)((message5) => {
|
|
3456
3532
|
const { content } = message5;
|
|
3457
3533
|
try {
|
|
3458
3534
|
const json = JSON.parse(content);
|
|
3459
3535
|
if (json.action && json.message) {
|
|
3460
|
-
return /* @__PURE__ */ (0,
|
|
3536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MDResponse, { content: json.message });
|
|
3461
3537
|
}
|
|
3462
3538
|
} catch (error) {
|
|
3463
3539
|
}
|
|
@@ -3467,14 +3543,14 @@ ${JSON.stringify(tool_call)}
|
|
|
3467
3543
|
\`\`\``;
|
|
3468
3544
|
}) || [];
|
|
3469
3545
|
const content_md = [content, ...tool_calls_md].join("\n");
|
|
3470
|
-
return /* @__PURE__ */ (0,
|
|
3546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_antd14.Space, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MDResponse, { content: content_md }) });
|
|
3471
3547
|
}, []);
|
|
3472
|
-
const items = (0,
|
|
3548
|
+
const items = (0, import_react16.useMemo)(
|
|
3473
3549
|
() => messages.map((message5, index) => ({
|
|
3474
3550
|
key: message5.id,
|
|
3475
3551
|
role: message5.role,
|
|
3476
3552
|
typing: false,
|
|
3477
|
-
content: /* @__PURE__ */ (0,
|
|
3553
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3478
3554
|
LazyBubble,
|
|
3479
3555
|
{
|
|
3480
3556
|
message: message5,
|
|
@@ -3534,9 +3610,9 @@ ${JSON.stringify(tool_call)}
|
|
|
3534
3610
|
}
|
|
3535
3611
|
};
|
|
3536
3612
|
if (items.length === 0) {
|
|
3537
|
-
return /* @__PURE__ */ (0,
|
|
3613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { flex: 1 } });
|
|
3538
3614
|
}
|
|
3539
|
-
return /* @__PURE__ */ (0,
|
|
3615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3540
3616
|
MemoizedBubbleList,
|
|
3541
3617
|
{
|
|
3542
3618
|
items,
|
|
@@ -3548,13 +3624,13 @@ ${JSON.stringify(tool_call)}
|
|
|
3548
3624
|
|
|
3549
3625
|
// src/components/Chat/Chating.tsx
|
|
3550
3626
|
var import_antd19 = require("antd");
|
|
3551
|
-
var
|
|
3627
|
+
var import_react18 = __toESM(require("react"));
|
|
3552
3628
|
|
|
3553
3629
|
// src/components/GenUI/HITLContainer.tsx
|
|
3554
3630
|
var import_antd15 = require("antd");
|
|
3555
3631
|
var import_antd_style8 = require("antd-style");
|
|
3556
3632
|
var import_CollapsePanel4 = __toESM(require("antd/es/collapse/CollapsePanel"));
|
|
3557
|
-
var
|
|
3633
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3558
3634
|
var { Text: Text9 } = import_antd15.Typography;
|
|
3559
3635
|
var useStyle6 = (0, import_antd_style8.createStyles)(({ token, css }) => ({
|
|
3560
3636
|
card: css`
|
|
@@ -3570,18 +3646,18 @@ var useStyle6 = (0, import_antd_style8.createStyles)(({ token, css }) => ({
|
|
|
3570
3646
|
var HITLContainer = () => {
|
|
3571
3647
|
const { styles } = useStyle6();
|
|
3572
3648
|
const { interrupts } = useAgentChat();
|
|
3573
|
-
return interrupts && interrupts.length > 0 ? /* @__PURE__ */ (0,
|
|
3649
|
+
return interrupts && interrupts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3574
3650
|
import_antd15.Collapse,
|
|
3575
3651
|
{
|
|
3576
3652
|
className: styles.card,
|
|
3577
3653
|
size: "small",
|
|
3578
3654
|
bordered: false,
|
|
3579
3655
|
defaultActiveKey: ["hitl"],
|
|
3580
|
-
children: /* @__PURE__ */ (0,
|
|
3656
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3581
3657
|
import_CollapsePanel4.default,
|
|
3582
3658
|
{
|
|
3583
3659
|
showArrow: false,
|
|
3584
|
-
header: /* @__PURE__ */ (0,
|
|
3660
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3585
3661
|
import_antd15.Tag,
|
|
3586
3662
|
{
|
|
3587
3663
|
bordered: false,
|
|
@@ -3596,7 +3672,7 @@ var HITLContainer = () => {
|
|
|
3596
3672
|
children: "\u7B49\u5F85\u53CD\u9988"
|
|
3597
3673
|
}
|
|
3598
3674
|
),
|
|
3599
|
-
children: /* @__PURE__ */ (0,
|
|
3675
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_antd15.Space, { direction: "vertical", style: { width: "100%" }, children: interrupts.map((interrupt) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MDResponse, { content: interrupt.value }, interrupt.id)) })
|
|
3600
3676
|
},
|
|
3601
3677
|
"hitl"
|
|
3602
3678
|
)
|
|
@@ -3609,7 +3685,7 @@ var import_antd18 = require("antd");
|
|
|
3609
3685
|
|
|
3610
3686
|
// src/components/Chat/TodoProgress.tsx
|
|
3611
3687
|
var import_antd16 = require("antd");
|
|
3612
|
-
var
|
|
3688
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3613
3689
|
var TodoProgress = ({}) => {
|
|
3614
3690
|
const { openSideApp } = useChatUIContext();
|
|
3615
3691
|
const { todos } = useAgentChat();
|
|
@@ -3622,14 +3698,14 @@ var TodoProgress = ({}) => {
|
|
|
3622
3698
|
const totalCount = todos.length;
|
|
3623
3699
|
const hasInProgress = todos.some((item) => item.status === "in_progress");
|
|
3624
3700
|
const percent = Math.round(completedCount / totalCount * 100);
|
|
3625
|
-
return /* @__PURE__ */ (0,
|
|
3701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3626
3702
|
import_antd16.Popover,
|
|
3627
3703
|
{
|
|
3628
|
-
content: /* @__PURE__ */ (0,
|
|
3704
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { width: 400 }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Todo, { data: todos, component_key: "header_todos" }) }),
|
|
3629
3705
|
title: "Todos",
|
|
3630
3706
|
trigger: "click",
|
|
3631
3707
|
placement: "bottomRight",
|
|
3632
|
-
children: /* @__PURE__ */ (0,
|
|
3708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_antd16.Tooltip, { title: `${completedCount} / ${totalCount} tasks completed`, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { cursor: "pointer", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3633
3709
|
import_antd16.Progress,
|
|
3634
3710
|
{
|
|
3635
3711
|
type: "circle",
|
|
@@ -3640,7 +3716,7 @@ var TodoProgress = ({}) => {
|
|
|
3640
3716
|
percent,
|
|
3641
3717
|
status: hasInProgress ? "active" : "normal",
|
|
3642
3718
|
width: 30,
|
|
3643
|
-
format: () => /* @__PURE__ */ (0,
|
|
3719
|
+
format: () => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3644
3720
|
"div",
|
|
3645
3721
|
{
|
|
3646
3722
|
style: {
|
|
@@ -3649,7 +3725,7 @@ var TodoProgress = ({}) => {
|
|
|
3649
3725
|
alignItems: "center",
|
|
3650
3726
|
lineHeight: 1
|
|
3651
3727
|
},
|
|
3652
|
-
children: /* @__PURE__ */ (0,
|
|
3728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { style: { fontSize: 8 }, children: [
|
|
3653
3729
|
completedCount,
|
|
3654
3730
|
"/",
|
|
3655
3731
|
totalCount
|
|
@@ -3665,7 +3741,7 @@ var TodoProgress = ({}) => {
|
|
|
3665
3741
|
// src/components/Chat/FileExplorerButton.tsx
|
|
3666
3742
|
var import_antd17 = require("antd");
|
|
3667
3743
|
var import_icons10 = require("@ant-design/icons");
|
|
3668
|
-
var
|
|
3744
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3669
3745
|
var FileExplorerButton = ({}) => {
|
|
3670
3746
|
const { agentState } = useAgentChat();
|
|
3671
3747
|
const { openSideApp } = useChatUIContext();
|
|
@@ -3674,11 +3750,11 @@ var FileExplorerButton = ({}) => {
|
|
|
3674
3750
|
return null;
|
|
3675
3751
|
}
|
|
3676
3752
|
const fileCount = Object.keys(files).length;
|
|
3677
|
-
return /* @__PURE__ */ (0,
|
|
3753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_antd17.Tooltip, { title: "File Explorer", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_antd17.Badge, { count: fileCount, size: "small", color: "blue", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3678
3754
|
import_antd17.Button,
|
|
3679
3755
|
{
|
|
3680
3756
|
type: "text",
|
|
3681
|
-
icon: /* @__PURE__ */ (0,
|
|
3757
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_icons10.FileTextOutlined, {}),
|
|
3682
3758
|
onClick: () => openSideApp({
|
|
3683
3759
|
component_key: "file_explorer",
|
|
3684
3760
|
message: "File Explorer",
|
|
@@ -3690,12 +3766,12 @@ var FileExplorerButton = ({}) => {
|
|
|
3690
3766
|
|
|
3691
3767
|
// src/components/Chat/AgentHeader.tsx
|
|
3692
3768
|
var import_x4 = require("@ant-design/x");
|
|
3693
|
-
var
|
|
3694
|
-
var
|
|
3769
|
+
var import_react17 = require("react");
|
|
3770
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3695
3771
|
var { Text: Text10 } = import_antd18.Typography;
|
|
3696
3772
|
var AgentHeader = (props) => {
|
|
3697
3773
|
const { description, avatar, name, extra, extraMeta } = props;
|
|
3698
|
-
const extraMetaComponents = (0,
|
|
3774
|
+
const extraMetaComponents = (0, import_react17.useMemo)(() => {
|
|
3699
3775
|
if (extraMeta && extraMeta.length > 0) {
|
|
3700
3776
|
return extraMeta.map((meta) => {
|
|
3701
3777
|
const Element = getElement(meta.id)?.card_view;
|
|
@@ -3704,7 +3780,7 @@ var AgentHeader = (props) => {
|
|
|
3704
3780
|
try {
|
|
3705
3781
|
} catch (error) {
|
|
3706
3782
|
}
|
|
3707
|
-
return /* @__PURE__ */ (0,
|
|
3783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3708
3784
|
Element,
|
|
3709
3785
|
{
|
|
3710
3786
|
component_key: meta.id,
|
|
@@ -3717,24 +3793,24 @@ var AgentHeader = (props) => {
|
|
|
3717
3793
|
}
|
|
3718
3794
|
return void 0;
|
|
3719
3795
|
}, [extraMeta]);
|
|
3720
|
-
return /* @__PURE__ */ (0,
|
|
3721
|
-
/* @__PURE__ */ (0,
|
|
3796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
3797
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3722
3798
|
import_x4.Welcome,
|
|
3723
3799
|
{
|
|
3724
3800
|
style: { padding: 8 },
|
|
3725
3801
|
variant: "borderless",
|
|
3726
|
-
description: description ? /* @__PURE__ */ (0,
|
|
3727
|
-
icon: avatar ? /* @__PURE__ */ (0,
|
|
3802
|
+
description: description ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text10, { ellipsis: { tooltip: description }, children: description }) : void 0,
|
|
3803
|
+
icon: avatar ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Avatar, { src: avatar, size: 48 }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Avatar, { size: 48, children: name?.charAt(0).toUpperCase() }),
|
|
3728
3804
|
title: name ? name : void 0,
|
|
3729
|
-
extra: /* @__PURE__ */ (0,
|
|
3805
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_antd18.Space, { children: [
|
|
3730
3806
|
extra,
|
|
3731
|
-
/* @__PURE__ */ (0,
|
|
3732
|
-
/* @__PURE__ */ (0,
|
|
3733
|
-
extraMetaComponents && /* @__PURE__ */ (0,
|
|
3807
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TodoProgress, {}),
|
|
3808
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FileExplorerButton, {}),
|
|
3809
|
+
extraMetaComponents && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Space, { align: "center", style: { marginRight: 16 }, children: extraMetaComponents })
|
|
3734
3810
|
] })
|
|
3735
3811
|
}
|
|
3736
3812
|
),
|
|
3737
|
-
/* @__PURE__ */ (0,
|
|
3813
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3738
3814
|
"div",
|
|
3739
3815
|
{
|
|
3740
3816
|
style: {
|
|
@@ -3746,7 +3822,7 @@ var AgentHeader = (props) => {
|
|
|
3746
3822
|
};
|
|
3747
3823
|
|
|
3748
3824
|
// src/components/Chat/Chating.tsx
|
|
3749
|
-
var
|
|
3825
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3750
3826
|
var Chating = ({
|
|
3751
3827
|
avatar,
|
|
3752
3828
|
name,
|
|
@@ -3762,12 +3838,12 @@ var Chating = ({
|
|
|
3762
3838
|
showHITL = true,
|
|
3763
3839
|
showRefreshButton = false
|
|
3764
3840
|
}) => {
|
|
3765
|
-
const [content, setContent] = (0,
|
|
3766
|
-
const [attachedFiles, setAttachedFiles] = (0,
|
|
3841
|
+
const [content, setContent] = (0, import_react18.useState)("");
|
|
3842
|
+
const [attachedFiles, setAttachedFiles] = (0, import_react18.useState)([]);
|
|
3767
3843
|
const { styles } = useStyle();
|
|
3768
|
-
const [headerOpen, setHeaderOpen] = (0,
|
|
3769
|
-
const attachmentsRef = (0,
|
|
3770
|
-
const senderRef =
|
|
3844
|
+
const [headerOpen, setHeaderOpen] = (0, import_react18.useState)(false);
|
|
3845
|
+
const attachmentsRef = (0, import_react18.useRef)(null);
|
|
3846
|
+
const senderRef = import_react18.default.useRef(null);
|
|
3771
3847
|
const {
|
|
3772
3848
|
messages,
|
|
3773
3849
|
sendMessage,
|
|
@@ -3779,7 +3855,7 @@ var Chating = ({
|
|
|
3779
3855
|
tenantId,
|
|
3780
3856
|
clearError
|
|
3781
3857
|
} = useAgentChat();
|
|
3782
|
-
(0,
|
|
3858
|
+
(0, import_react18.useEffect)(() => {
|
|
3783
3859
|
regsiterElement("action_show_attachments_uploader", {
|
|
3784
3860
|
card_view: () => null,
|
|
3785
3861
|
action: (data) => {
|
|
@@ -3864,15 +3940,15 @@ var Chating = ({
|
|
|
3864
3940
|
}
|
|
3865
3941
|
return true;
|
|
3866
3942
|
};
|
|
3867
|
-
const attachmentsNode = /* @__PURE__ */ (0,
|
|
3943
|
+
const attachmentsNode = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_antd19.Badge, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3868
3944
|
import_antd19.Button,
|
|
3869
3945
|
{
|
|
3870
3946
|
type: "text",
|
|
3871
|
-
icon: /* @__PURE__ */ (0,
|
|
3947
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons11.PaperClipOutlined, {}),
|
|
3872
3948
|
onClick: () => setHeaderOpen(!headerOpen)
|
|
3873
3949
|
}
|
|
3874
3950
|
) });
|
|
3875
|
-
const senderHeader = /* @__PURE__ */ (0,
|
|
3951
|
+
const senderHeader = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3876
3952
|
import_x5.Sender.Header,
|
|
3877
3953
|
{
|
|
3878
3954
|
title: "Attachments",
|
|
@@ -3884,7 +3960,7 @@ var Chating = ({
|
|
|
3884
3960
|
}
|
|
3885
3961
|
},
|
|
3886
3962
|
forceRender: true,
|
|
3887
|
-
children: /* @__PURE__ */ (0,
|
|
3963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3888
3964
|
import_x5.Attachments,
|
|
3889
3965
|
{
|
|
3890
3966
|
ref: attachmentsRef,
|
|
@@ -3906,7 +3982,7 @@ var Chating = ({
|
|
|
3906
3982
|
multiple: true,
|
|
3907
3983
|
maxCount: 10,
|
|
3908
3984
|
placeholder: (type) => ({
|
|
3909
|
-
icon: /* @__PURE__ */ (0,
|
|
3985
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons11.CloudUploadOutlined, {}),
|
|
3910
3986
|
title: "\u4E0A\u4F20\u6587\u4EF6",
|
|
3911
3987
|
description: attachment_placeholder
|
|
3912
3988
|
})
|
|
@@ -3914,19 +3990,19 @@ var Chating = ({
|
|
|
3914
3990
|
)
|
|
3915
3991
|
}
|
|
3916
3992
|
);
|
|
3917
|
-
const refreshButton = /* @__PURE__ */ (0,
|
|
3993
|
+
const refreshButton = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3918
3994
|
import_antd19.Button,
|
|
3919
3995
|
{
|
|
3920
3996
|
type: "text",
|
|
3921
|
-
icon: /* @__PURE__ */ (0,
|
|
3997
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons11.ReloadOutlined, {}),
|
|
3922
3998
|
onClick: () => {
|
|
3923
3999
|
loadMessages();
|
|
3924
4000
|
}
|
|
3925
4001
|
}
|
|
3926
4002
|
);
|
|
3927
4003
|
const headerExtra = showRefreshButton ? [refreshButton] : [];
|
|
3928
|
-
return /* @__PURE__ */ (0,
|
|
3929
|
-
/* @__PURE__ */ (0,
|
|
4004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: showHeader && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3930
4006
|
AgentHeader,
|
|
3931
4007
|
{
|
|
3932
4008
|
description,
|
|
@@ -3936,9 +4012,9 @@ var Chating = ({
|
|
|
3936
4012
|
extraMeta
|
|
3937
4013
|
}
|
|
3938
4014
|
) }),
|
|
3939
|
-
/* @__PURE__ */ (0,
|
|
3940
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
3941
|
-
error && /* @__PURE__ */ (0,
|
|
4015
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MessageList, { messages, className: styles.messages }),
|
|
4016
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", {}) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_x5.Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
|
|
4017
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3942
4018
|
import_antd19.Alert,
|
|
3943
4019
|
{
|
|
3944
4020
|
type: "error",
|
|
@@ -3948,8 +4024,8 @@ var Chating = ({
|
|
|
3948
4024
|
message: `${error.message}`
|
|
3949
4025
|
}
|
|
3950
4026
|
) }),
|
|
3951
|
-
showHITL && /* @__PURE__ */ (0,
|
|
3952
|
-
showSender && /* @__PURE__ */ (0,
|
|
4027
|
+
showHITL && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(HITLContainer, {}),
|
|
4028
|
+
showSender && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3953
4029
|
import_x5.Sender,
|
|
3954
4030
|
{
|
|
3955
4031
|
disabled: interrupts && interrupts.length > 0,
|
|
@@ -3975,11 +4051,11 @@ var Chating = ({
|
|
|
3975
4051
|
};
|
|
3976
4052
|
|
|
3977
4053
|
// src/components/GenUI/elements/task_detail.tsx
|
|
3978
|
-
var
|
|
4054
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3979
4055
|
var { Text: Text11 } = import_antd20.Typography;
|
|
3980
4056
|
var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
3981
4057
|
const { description, subagent_type, thread_id } = data || {};
|
|
3982
|
-
return /* @__PURE__ */ (0,
|
|
4058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3983
4059
|
AgentThreadProvider,
|
|
3984
4060
|
{
|
|
3985
4061
|
threadId: thread_id,
|
|
@@ -3989,7 +4065,7 @@ var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
|
3989
4065
|
enableReturnStateWhenStreamCompleted: true,
|
|
3990
4066
|
enableResumeStream: true
|
|
3991
4067
|
},
|
|
3992
|
-
children: /* @__PURE__ */ (0,
|
|
4068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { style: { overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3993
4069
|
Chating,
|
|
3994
4070
|
{
|
|
3995
4071
|
showRefreshButton: true,
|
|
@@ -4003,6 +4079,170 @@ var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
|
4003
4079
|
);
|
|
4004
4080
|
};
|
|
4005
4081
|
|
|
4082
|
+
// src/components/GenUI/elements/internet_search_card.tsx
|
|
4083
|
+
var import_antd21 = require("antd");
|
|
4084
|
+
var import_icons12 = require("@ant-design/icons");
|
|
4085
|
+
var import_antd_style9 = require("antd-style");
|
|
4086
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4087
|
+
var { Text: Text12 } = import_antd21.Typography;
|
|
4088
|
+
var useStyle7 = (0, import_antd_style9.createStyles)(({ token, css }) => ({
|
|
4089
|
+
listContainer: css`
|
|
4090
|
+
background: ${token.colorBgContainer};
|
|
4091
|
+
border-radius: ${token.borderRadius}px;
|
|
4092
|
+
padding: 8px 0;
|
|
4093
|
+
`,
|
|
4094
|
+
listItem: css`
|
|
4095
|
+
padding: 12px 16px;
|
|
4096
|
+
border-bottom: 1px solid ${token.colorBorderSecondary};
|
|
4097
|
+
transition: background-color 0.2s ease;
|
|
4098
|
+
cursor: pointer;
|
|
4099
|
+
|
|
4100
|
+
&:hover {
|
|
4101
|
+
background: ${token.colorFillTertiary};
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
&:last-child {
|
|
4105
|
+
border-bottom: none;
|
|
4106
|
+
}
|
|
4107
|
+
`,
|
|
4108
|
+
itemContent: css`
|
|
4109
|
+
display: flex;
|
|
4110
|
+
align-items: center;
|
|
4111
|
+
gap: 12px;
|
|
4112
|
+
width: 100%;
|
|
4113
|
+
`,
|
|
4114
|
+
iconWrapper: css`
|
|
4115
|
+
width: 32px;
|
|
4116
|
+
height: 32px;
|
|
4117
|
+
border-radius: 50%;
|
|
4118
|
+
display: flex;
|
|
4119
|
+
align-items: center;
|
|
4120
|
+
justify-content: center;
|
|
4121
|
+
flex-shrink: 0;
|
|
4122
|
+
background: ${token.colorPrimary};
|
|
4123
|
+
color: white;
|
|
4124
|
+
font-size: 14px;
|
|
4125
|
+
font-weight: 600;
|
|
4126
|
+
`,
|
|
4127
|
+
titleWrapper: css`
|
|
4128
|
+
flex: 1;
|
|
4129
|
+
min-width: 0;
|
|
4130
|
+
`,
|
|
4131
|
+
title: css`
|
|
4132
|
+
color: ${token.colorText};
|
|
4133
|
+
font-size: ${token.fontSize}px;
|
|
4134
|
+
line-height: 1.5;
|
|
4135
|
+
margin: 0;
|
|
4136
|
+
overflow: hidden;
|
|
4137
|
+
text-overflow: ellipsis;
|
|
4138
|
+
white-space: nowrap;
|
|
4139
|
+
`,
|
|
4140
|
+
source: css`
|
|
4141
|
+
color: ${token.colorTextSecondary};
|
|
4142
|
+
font-size: ${token.fontSizeSM}px;
|
|
4143
|
+
margin: 0;
|
|
4144
|
+
flex-shrink: 0;
|
|
4145
|
+
margin-left: 16px;
|
|
4146
|
+
`
|
|
4147
|
+
}));
|
|
4148
|
+
var getDomainFromUrl = (url) => {
|
|
4149
|
+
try {
|
|
4150
|
+
const urlObj = new URL(url);
|
|
4151
|
+
return urlObj.hostname.replace(/^www\./, "");
|
|
4152
|
+
} catch {
|
|
4153
|
+
return url;
|
|
4154
|
+
}
|
|
4155
|
+
};
|
|
4156
|
+
var getIconText = (domain) => {
|
|
4157
|
+
if (!domain) return "?";
|
|
4158
|
+
const parts = domain.split(".");
|
|
4159
|
+
if (parts.length >= 2) {
|
|
4160
|
+
const mainPart = parts[parts.length - 2];
|
|
4161
|
+
return mainPart.substring(0, 2).toUpperCase();
|
|
4162
|
+
}
|
|
4163
|
+
return domain.substring(0, 2).toUpperCase();
|
|
4164
|
+
};
|
|
4165
|
+
var getIconColor = (domain) => {
|
|
4166
|
+
const colors = [
|
|
4167
|
+
"#1890ff",
|
|
4168
|
+
// blue
|
|
4169
|
+
"#52c41a",
|
|
4170
|
+
// green
|
|
4171
|
+
"#fa8c16",
|
|
4172
|
+
// orange
|
|
4173
|
+
"#eb2f96",
|
|
4174
|
+
// pink
|
|
4175
|
+
"#722ed1",
|
|
4176
|
+
// purple
|
|
4177
|
+
"#13c2c2",
|
|
4178
|
+
// cyan
|
|
4179
|
+
"#f5222d"
|
|
4180
|
+
// red
|
|
4181
|
+
];
|
|
4182
|
+
let hash = 0;
|
|
4183
|
+
for (let i = 0; i < domain.length; i++) {
|
|
4184
|
+
hash = domain.charCodeAt(i) + ((hash << 5) - hash);
|
|
4185
|
+
}
|
|
4186
|
+
return colors[Math.abs(hash) % colors.length];
|
|
4187
|
+
};
|
|
4188
|
+
var InternetSearchCard = ({
|
|
4189
|
+
data,
|
|
4190
|
+
component_key,
|
|
4191
|
+
interactive = true
|
|
4192
|
+
}) => {
|
|
4193
|
+
const { styles } = useStyle7();
|
|
4194
|
+
const toolCallData = data;
|
|
4195
|
+
const { query } = toolCallData?.args || {};
|
|
4196
|
+
const dataSource = JSON.parse(toolCallData.response || "[]");
|
|
4197
|
+
const { openSideApp } = useChatUIContext();
|
|
4198
|
+
if (!toolCallData) {
|
|
4199
|
+
return null;
|
|
4200
|
+
}
|
|
4201
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_antd21.Space, { children: [
|
|
4202
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text12, { strong: true, children: "Internet Search" }),
|
|
4203
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text12, { title: query, children: query })
|
|
4204
|
+
] });
|
|
4205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4206
|
+
ContentPreviewCollapse,
|
|
4207
|
+
{
|
|
4208
|
+
panelKey: toolCallData.id,
|
|
4209
|
+
header,
|
|
4210
|
+
expandIcon: () => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_icons12.SearchOutlined, {}),
|
|
4211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4212
|
+
import_antd21.List,
|
|
4213
|
+
{
|
|
4214
|
+
size: "small",
|
|
4215
|
+
dataSource,
|
|
4216
|
+
renderItem: (item) => {
|
|
4217
|
+
const url = item.url || "";
|
|
4218
|
+
const domain = getDomainFromUrl(url);
|
|
4219
|
+
const iconText = getIconText(domain);
|
|
4220
|
+
const iconColor = getIconColor(domain);
|
|
4221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_antd21.List.Item, { extra: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text12, { className: styles.source, children: domain }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_antd21.Space, { style: { width: "100%" }, children: [
|
|
4222
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_antd21.Avatar, { style: { background: iconColor }, children: iconText }),
|
|
4223
|
+
" ",
|
|
4224
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4225
|
+
import_antd21.Button,
|
|
4226
|
+
{
|
|
4227
|
+
type: "text",
|
|
4228
|
+
onClick: () => {
|
|
4229
|
+
openSideApp({
|
|
4230
|
+
component_key: "attachments",
|
|
4231
|
+
data: { url, message: item.title },
|
|
4232
|
+
message: item.title
|
|
4233
|
+
});
|
|
4234
|
+
},
|
|
4235
|
+
children: item.title
|
|
4236
|
+
}
|
|
4237
|
+
)
|
|
4238
|
+
] }) });
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
)
|
|
4242
|
+
}
|
|
4243
|
+
);
|
|
4244
|
+
};
|
|
4245
|
+
|
|
4006
4246
|
// src/components/GenUI/elements/builtIns.tsx
|
|
4007
4247
|
var elements = {
|
|
4008
4248
|
action_show_attachments_uploader: {
|
|
@@ -4030,6 +4270,9 @@ var elements = {
|
|
|
4030
4270
|
write_todos: {
|
|
4031
4271
|
card_view: WriteTodos
|
|
4032
4272
|
},
|
|
4273
|
+
internet_search: {
|
|
4274
|
+
card_view: InternetSearchCard
|
|
4275
|
+
},
|
|
4033
4276
|
write_file: {
|
|
4034
4277
|
card_view: WriteFile
|
|
4035
4278
|
},
|
|
@@ -4068,11 +4311,11 @@ var regsiterElement = (language, ElementMeta) => {
|
|
|
4068
4311
|
};
|
|
4069
4312
|
|
|
4070
4313
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
4071
|
-
var
|
|
4072
|
-
var
|
|
4073
|
-
var
|
|
4074
|
-
var
|
|
4075
|
-
var
|
|
4314
|
+
var import_antd22 = require("antd");
|
|
4315
|
+
var import_antd_style10 = require("antd-style");
|
|
4316
|
+
var import_react19 = require("react");
|
|
4317
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4318
|
+
var useStyle8 = (0, import_antd_style10.createStyles)(({ token, css }) => {
|
|
4076
4319
|
return {
|
|
4077
4320
|
tabContainer: css`
|
|
4078
4321
|
.ant-tabs-content-holder {
|
|
@@ -4091,13 +4334,13 @@ var useStyle7 = (0, import_antd_style9.createStyles)(({ token, css }) => {
|
|
|
4091
4334
|
};
|
|
4092
4335
|
});
|
|
4093
4336
|
var EmptySideAppView = ({ component_key, data }) => {
|
|
4094
|
-
return /* @__PURE__ */ (0,
|
|
4095
|
-
/* @__PURE__ */ (0,
|
|
4096
|
-
/* @__PURE__ */ (0,
|
|
4337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
4338
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { children: "\u672A\u627E\u5230\u5BF9\u5E94\u7684\u7EC4\u4EF6\u89C6\u56FE" }),
|
|
4339
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
|
|
4097
4340
|
] });
|
|
4098
4341
|
};
|
|
4099
4342
|
var SideAppViewBrowser = () => {
|
|
4100
|
-
const { styles } =
|
|
4343
|
+
const { styles } = useStyle8();
|
|
4101
4344
|
const {
|
|
4102
4345
|
sideAppSize,
|
|
4103
4346
|
sideAppSelectedCard,
|
|
@@ -4105,10 +4348,10 @@ var SideAppViewBrowser = () => {
|
|
|
4105
4348
|
openSideApp,
|
|
4106
4349
|
closeSideApp
|
|
4107
4350
|
} = useChatUIContext();
|
|
4108
|
-
const [activeKey, setActiveKey] = (0,
|
|
4351
|
+
const [activeKey, setActiveKey] = (0, import_react19.useState)(
|
|
4109
4352
|
JSON.stringify(sideAppSelectedCard)
|
|
4110
4353
|
);
|
|
4111
|
-
const [items, setItems] = (0,
|
|
4354
|
+
const [items, setItems] = (0, import_react19.useState)([]);
|
|
4112
4355
|
const add = (key, label, children) => {
|
|
4113
4356
|
const newActiveKey = key;
|
|
4114
4357
|
const newPanes = [...items];
|
|
@@ -4144,7 +4387,7 @@ var SideAppViewBrowser = () => {
|
|
|
4144
4387
|
remove(targetKey);
|
|
4145
4388
|
}
|
|
4146
4389
|
};
|
|
4147
|
-
(0,
|
|
4390
|
+
(0, import_react19.useEffect)(() => {
|
|
4148
4391
|
const SideAppView = getElement(sideAppSelectedCard?.component_key).side_app_view || EmptySideAppView;
|
|
4149
4392
|
const key = JSON.stringify(sideAppSelectedCard);
|
|
4150
4393
|
if (items.find((item) => item.key === key)) {
|
|
@@ -4154,7 +4397,7 @@ var SideAppViewBrowser = () => {
|
|
|
4154
4397
|
add(
|
|
4155
4398
|
key,
|
|
4156
4399
|
sideAppSelectedCard?.message || sideAppSelectedCard?.data.message || "\u672A\u547D\u540D",
|
|
4157
|
-
/* @__PURE__ */ (0,
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4158
4401
|
SideAppView,
|
|
4159
4402
|
{
|
|
4160
4403
|
component_key: sideAppSelectedCard?.component_key || "",
|
|
@@ -4195,26 +4438,26 @@ var SideAppViewBrowser = () => {
|
|
|
4195
4438
|
const getSizeIcon = (size) => {
|
|
4196
4439
|
switch (size) {
|
|
4197
4440
|
case "middle":
|
|
4198
|
-
return /* @__PURE__ */ (0,
|
|
4441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.CompressOutlined, {});
|
|
4199
4442
|
case "large":
|
|
4200
|
-
return /* @__PURE__ */ (0,
|
|
4443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.ExpandOutlined, {});
|
|
4201
4444
|
case "full":
|
|
4202
|
-
return /* @__PURE__ */ (0,
|
|
4445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.FullscreenOutlined, {});
|
|
4203
4446
|
default:
|
|
4204
|
-
return /* @__PURE__ */ (0,
|
|
4447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.ExpandOutlined, {});
|
|
4205
4448
|
}
|
|
4206
4449
|
};
|
|
4207
|
-
return /* @__PURE__ */ (0,
|
|
4208
|
-
|
|
4450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4451
|
+
import_antd22.Tabs,
|
|
4209
4452
|
{
|
|
4210
4453
|
className: styles.tabContainer,
|
|
4211
4454
|
type: "editable-card",
|
|
4212
4455
|
style: { height: "100%" },
|
|
4213
4456
|
hideAdd: true,
|
|
4214
4457
|
tabBarExtraContent: {
|
|
4215
|
-
right: /* @__PURE__ */ (0,
|
|
4216
|
-
/* @__PURE__ */ (0,
|
|
4217
|
-
|
|
4458
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { style: { display: "flex", gap: "4px" }, children: [
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4460
|
+
import_antd22.Button,
|
|
4218
4461
|
{
|
|
4219
4462
|
style: { margin: "8px 0" },
|
|
4220
4463
|
size: "large",
|
|
@@ -4224,13 +4467,13 @@ var SideAppViewBrowser = () => {
|
|
|
4224
4467
|
title: `\u5F53\u524D\u5C3A\u5BF8: ${getSizeLabel(sideAppSize)}, \u70B9\u51FB\u5207\u6362`
|
|
4225
4468
|
}
|
|
4226
4469
|
),
|
|
4227
|
-
/* @__PURE__ */ (0,
|
|
4228
|
-
|
|
4470
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4471
|
+
import_antd22.Button,
|
|
4229
4472
|
{
|
|
4230
4473
|
style: { margin: "8px 0" },
|
|
4231
4474
|
size: "large",
|
|
4232
4475
|
type: "text",
|
|
4233
|
-
icon: /* @__PURE__ */ (0,
|
|
4476
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.CloseOutlined, {}),
|
|
4234
4477
|
onClick: () => {
|
|
4235
4478
|
closeSideApp();
|
|
4236
4479
|
}
|
|
@@ -4247,10 +4490,10 @@ var SideAppViewBrowser = () => {
|
|
|
4247
4490
|
};
|
|
4248
4491
|
|
|
4249
4492
|
// src/components/Chat/LatticeChat.tsx
|
|
4250
|
-
var
|
|
4493
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4251
4494
|
var LatticeChat = (props) => {
|
|
4252
4495
|
const { assistant_id, thread_id = "", menu, ...chatingProps } = props;
|
|
4253
|
-
return /* @__PURE__ */ (0,
|
|
4496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4254
4497
|
AgentThreadProvider,
|
|
4255
4498
|
{
|
|
4256
4499
|
assistantId: assistant_id,
|
|
@@ -4260,12 +4503,12 @@ var LatticeChat = (props) => {
|
|
|
4260
4503
|
enableReturnStateWhenStreamCompleted: true,
|
|
4261
4504
|
enableResumeStream: true
|
|
4262
4505
|
},
|
|
4263
|
-
children: /* @__PURE__ */ (0,
|
|
4506
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChatUIContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4264
4507
|
ColumnLayout,
|
|
4265
4508
|
{
|
|
4266
4509
|
menu,
|
|
4267
|
-
left: thread_id ? /* @__PURE__ */ (0,
|
|
4268
|
-
right: /* @__PURE__ */ (0,
|
|
4510
|
+
left: thread_id ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Chating, { ...chatingProps }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: "\u9700\u8981\u5148\u521B\u5EFA\u4F1A\u8BDD" }),
|
|
4511
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SideAppViewBrowser, {})
|
|
4269
4512
|
}
|
|
4270
4513
|
) })
|
|
4271
4514
|
}
|
|
@@ -4273,15 +4516,15 @@ var LatticeChat = (props) => {
|
|
|
4273
4516
|
};
|
|
4274
4517
|
|
|
4275
4518
|
// src/components/Chat/ConversationContext.tsx
|
|
4276
|
-
var
|
|
4519
|
+
var import_react22 = require("react");
|
|
4277
4520
|
|
|
4278
4521
|
// src/components/Chat/AssistantContext.tsx
|
|
4279
|
-
var
|
|
4522
|
+
var import_react21 = require("react");
|
|
4280
4523
|
var import_client_sdk4 = require("@axiom-lattice/client-sdk");
|
|
4281
4524
|
|
|
4282
4525
|
// src/components/Chat/LatticeChatShellContext.tsx
|
|
4283
|
-
var
|
|
4284
|
-
var
|
|
4526
|
+
var import_react20 = require("react");
|
|
4527
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4285
4528
|
var DEFAULT_CONFIG = {
|
|
4286
4529
|
baseURL: "http://localhost:4001",
|
|
4287
4530
|
apiKey: "",
|
|
@@ -4289,7 +4532,7 @@ var DEFAULT_CONFIG = {
|
|
|
4289
4532
|
timeout: 3e5,
|
|
4290
4533
|
headers: {}
|
|
4291
4534
|
};
|
|
4292
|
-
var LatticeChatShellContext = (0,
|
|
4535
|
+
var LatticeChatShellContext = (0, import_react20.createContext)({
|
|
4293
4536
|
config: DEFAULT_CONFIG,
|
|
4294
4537
|
updateConfig: () => {
|
|
4295
4538
|
},
|
|
@@ -4307,7 +4550,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4307
4550
|
persistToLocalStorage = false,
|
|
4308
4551
|
localStorageKey = "lattice_chat_shell_config"
|
|
4309
4552
|
}) => {
|
|
4310
|
-
const loadInitialConfig = (0,
|
|
4553
|
+
const loadInitialConfig = (0, import_react20.useCallback)(() => {
|
|
4311
4554
|
if (persistToLocalStorage && typeof window !== "undefined") {
|
|
4312
4555
|
try {
|
|
4313
4556
|
const stored = localStorage.getItem(localStorageKey);
|
|
@@ -4321,9 +4564,9 @@ var LatticeChatShellContextProvider = ({
|
|
|
4321
4564
|
}
|
|
4322
4565
|
return { ...DEFAULT_CONFIG, ...initialConfig };
|
|
4323
4566
|
}, [persistToLocalStorage, localStorageKey, initialConfig]);
|
|
4324
|
-
const [config, setConfig] = (0,
|
|
4325
|
-
const [settingsModalOpen, setSettingsModalOpen] = (0,
|
|
4326
|
-
const saveToLocalStorage = (0,
|
|
4567
|
+
const [config, setConfig] = (0, import_react20.useState)(loadInitialConfig);
|
|
4568
|
+
const [settingsModalOpen, setSettingsModalOpen] = (0, import_react20.useState)(false);
|
|
4569
|
+
const saveToLocalStorage = (0, import_react20.useCallback)(
|
|
4327
4570
|
(newConfig) => {
|
|
4328
4571
|
if (persistToLocalStorage && typeof window !== "undefined") {
|
|
4329
4572
|
try {
|
|
@@ -4335,7 +4578,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4335
4578
|
},
|
|
4336
4579
|
[persistToLocalStorage, localStorageKey]
|
|
4337
4580
|
);
|
|
4338
|
-
const updateConfig = (0,
|
|
4581
|
+
const updateConfig = (0, import_react20.useCallback)(
|
|
4339
4582
|
(updates) => {
|
|
4340
4583
|
setConfig((prev) => {
|
|
4341
4584
|
const newConfig = { ...prev, ...updates };
|
|
@@ -4345,7 +4588,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4345
4588
|
},
|
|
4346
4589
|
[saveToLocalStorage]
|
|
4347
4590
|
);
|
|
4348
|
-
const updateConfigValue = (0,
|
|
4591
|
+
const updateConfigValue = (0, import_react20.useCallback)(
|
|
4349
4592
|
(key, value) => {
|
|
4350
4593
|
setConfig((prev) => {
|
|
4351
4594
|
const newConfig = { ...prev, [key]: value };
|
|
@@ -4355,12 +4598,12 @@ var LatticeChatShellContextProvider = ({
|
|
|
4355
4598
|
},
|
|
4356
4599
|
[saveToLocalStorage]
|
|
4357
4600
|
);
|
|
4358
|
-
const resetConfig = (0,
|
|
4601
|
+
const resetConfig = (0, import_react20.useCallback)(() => {
|
|
4359
4602
|
const defaultConfig = { ...DEFAULT_CONFIG, ...initialConfig };
|
|
4360
4603
|
setConfig(defaultConfig);
|
|
4361
4604
|
saveToLocalStorage(defaultConfig);
|
|
4362
4605
|
}, [initialConfig, saveToLocalStorage]);
|
|
4363
|
-
return /* @__PURE__ */ (0,
|
|
4606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4364
4607
|
LatticeChatShellContext.Provider,
|
|
4365
4608
|
{
|
|
4366
4609
|
value: {
|
|
@@ -4376,7 +4619,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4376
4619
|
);
|
|
4377
4620
|
};
|
|
4378
4621
|
var useLatticeChatShellContext = () => {
|
|
4379
|
-
const context = (0,
|
|
4622
|
+
const context = (0, import_react20.useContext)(LatticeChatShellContext);
|
|
4380
4623
|
if (!context) {
|
|
4381
4624
|
throw new Error(
|
|
4382
4625
|
"useLatticeChatShellContext must be used within a LatticeChatShellContextProvider"
|
|
@@ -4386,8 +4629,8 @@ var useLatticeChatShellContext = () => {
|
|
|
4386
4629
|
};
|
|
4387
4630
|
|
|
4388
4631
|
// src/components/Chat/AssistantContext.tsx
|
|
4389
|
-
var
|
|
4390
|
-
var AssistantContext = (0,
|
|
4632
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4633
|
+
var AssistantContext = (0, import_react21.createContext)({
|
|
4391
4634
|
assistants: [],
|
|
4392
4635
|
currentAssistant: null,
|
|
4393
4636
|
isLoading: false,
|
|
@@ -4420,7 +4663,7 @@ var AssistantContextProvider = ({
|
|
|
4420
4663
|
const {
|
|
4421
4664
|
config: { baseURL, apiKey = "", transport = "sse" }
|
|
4422
4665
|
} = useLatticeChatShellContext();
|
|
4423
|
-
const client = (0,
|
|
4666
|
+
const client = (0, import_react21.useMemo)(
|
|
4424
4667
|
() => new import_client_sdk4.Client({
|
|
4425
4668
|
baseURL,
|
|
4426
4669
|
apiKey,
|
|
@@ -4429,17 +4672,17 @@ var AssistantContextProvider = ({
|
|
|
4429
4672
|
}),
|
|
4430
4673
|
[baseURL, apiKey, transport]
|
|
4431
4674
|
);
|
|
4432
|
-
const [state, setState] = (0,
|
|
4675
|
+
const [state, setState] = (0, import_react21.useState)({
|
|
4433
4676
|
assistants: [],
|
|
4434
4677
|
currentAssistant: null,
|
|
4435
4678
|
isLoading: false,
|
|
4436
4679
|
error: null
|
|
4437
4680
|
});
|
|
4438
|
-
const assistantsRef = (0,
|
|
4439
|
-
(0,
|
|
4681
|
+
const assistantsRef = (0, import_react21.useRef)([]);
|
|
4682
|
+
(0, import_react21.useEffect)(() => {
|
|
4440
4683
|
assistantsRef.current = state.assistants;
|
|
4441
4684
|
}, [state.assistants]);
|
|
4442
|
-
const listAssistants = (0,
|
|
4685
|
+
const listAssistants = (0, import_react21.useCallback)(async () => {
|
|
4443
4686
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4444
4687
|
try {
|
|
4445
4688
|
const assistants = await client.assistants.list();
|
|
@@ -4456,7 +4699,7 @@ var AssistantContextProvider = ({
|
|
|
4456
4699
|
}));
|
|
4457
4700
|
}
|
|
4458
4701
|
}, [client]);
|
|
4459
|
-
const getAssistant = (0,
|
|
4702
|
+
const getAssistant = (0, import_react21.useCallback)(
|
|
4460
4703
|
async (id) => {
|
|
4461
4704
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4462
4705
|
try {
|
|
@@ -4479,7 +4722,7 @@ var AssistantContextProvider = ({
|
|
|
4479
4722
|
},
|
|
4480
4723
|
[client]
|
|
4481
4724
|
);
|
|
4482
|
-
const createAssistant = (0,
|
|
4725
|
+
const createAssistant = (0, import_react21.useCallback)(
|
|
4483
4726
|
async (options) => {
|
|
4484
4727
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4485
4728
|
try {
|
|
@@ -4501,7 +4744,7 @@ var AssistantContextProvider = ({
|
|
|
4501
4744
|
},
|
|
4502
4745
|
[client]
|
|
4503
4746
|
);
|
|
4504
|
-
const updateAssistant = (0,
|
|
4747
|
+
const updateAssistant = (0, import_react21.useCallback)(
|
|
4505
4748
|
async (id, options) => {
|
|
4506
4749
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4507
4750
|
try {
|
|
@@ -4526,7 +4769,7 @@ var AssistantContextProvider = ({
|
|
|
4526
4769
|
},
|
|
4527
4770
|
[client]
|
|
4528
4771
|
);
|
|
4529
|
-
const deleteAssistant = (0,
|
|
4772
|
+
const deleteAssistant = (0, import_react21.useCallback)(
|
|
4530
4773
|
async (id) => {
|
|
4531
4774
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4532
4775
|
try {
|
|
@@ -4548,7 +4791,7 @@ var AssistantContextProvider = ({
|
|
|
4548
4791
|
},
|
|
4549
4792
|
[client]
|
|
4550
4793
|
);
|
|
4551
|
-
const selectAssistant = (0,
|
|
4794
|
+
const selectAssistant = (0, import_react21.useCallback)(
|
|
4552
4795
|
async (id) => {
|
|
4553
4796
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4554
4797
|
try {
|
|
@@ -4579,21 +4822,21 @@ var AssistantContextProvider = ({
|
|
|
4579
4822
|
},
|
|
4580
4823
|
[client]
|
|
4581
4824
|
);
|
|
4582
|
-
const clearCurrentAssistant = (0,
|
|
4825
|
+
const clearCurrentAssistant = (0, import_react21.useCallback)(() => {
|
|
4583
4826
|
setState((prev) => ({
|
|
4584
4827
|
...prev,
|
|
4585
4828
|
currentAssistant: null
|
|
4586
4829
|
}));
|
|
4587
4830
|
}, []);
|
|
4588
|
-
const refresh = (0,
|
|
4831
|
+
const refresh = (0, import_react21.useCallback)(async () => {
|
|
4589
4832
|
await listAssistants();
|
|
4590
4833
|
}, [listAssistants]);
|
|
4591
|
-
(0,
|
|
4834
|
+
(0, import_react21.useEffect)(() => {
|
|
4592
4835
|
if (autoLoad) {
|
|
4593
4836
|
listAssistants();
|
|
4594
4837
|
}
|
|
4595
4838
|
}, [autoLoad, listAssistants]);
|
|
4596
|
-
(0,
|
|
4839
|
+
(0, import_react21.useEffect)(() => {
|
|
4597
4840
|
if (state.assistants.length > 0) {
|
|
4598
4841
|
const isCurrentAssistantValid = state.currentAssistant && state.assistants.some((a) => a.id === state.currentAssistant?.id);
|
|
4599
4842
|
if (!isCurrentAssistantValid) {
|
|
@@ -4621,7 +4864,7 @@ var AssistantContextProvider = ({
|
|
|
4621
4864
|
}
|
|
4622
4865
|
}
|
|
4623
4866
|
}, [initialAssistantId, state.assistants, state.currentAssistant]);
|
|
4624
|
-
return /* @__PURE__ */ (0,
|
|
4867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4625
4868
|
AssistantContext.Provider,
|
|
4626
4869
|
{
|
|
4627
4870
|
value: {
|
|
@@ -4640,7 +4883,7 @@ var AssistantContextProvider = ({
|
|
|
4640
4883
|
);
|
|
4641
4884
|
};
|
|
4642
4885
|
var useAssistantContext = () => {
|
|
4643
|
-
const context = (0,
|
|
4886
|
+
const context = (0, import_react21.useContext)(AssistantContext);
|
|
4644
4887
|
if (!context) {
|
|
4645
4888
|
throw new Error(
|
|
4646
4889
|
"useAssistantContext must be used within an AssistantContextProvider"
|
|
@@ -4651,8 +4894,8 @@ var useAssistantContext = () => {
|
|
|
4651
4894
|
|
|
4652
4895
|
// src/components/Chat/ConversationContext.tsx
|
|
4653
4896
|
var import_client_sdk5 = require("@axiom-lattice/client-sdk");
|
|
4654
|
-
var
|
|
4655
|
-
var ConversationContext = (0,
|
|
4897
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4898
|
+
var ConversationContext = (0, import_react22.createContext)({
|
|
4656
4899
|
assistantId: null,
|
|
4657
4900
|
thread: null,
|
|
4658
4901
|
threadId: null,
|
|
@@ -4694,7 +4937,7 @@ var ConversationContextProvider = ({
|
|
|
4694
4937
|
const {
|
|
4695
4938
|
config: { baseURL, apiKey = "", transport = "sse" }
|
|
4696
4939
|
} = useLatticeChatShellContext();
|
|
4697
|
-
const client = (0,
|
|
4940
|
+
const client = (0, import_react22.useMemo)(
|
|
4698
4941
|
() => new import_client_sdk5.Client({
|
|
4699
4942
|
baseURL,
|
|
4700
4943
|
apiKey,
|
|
@@ -4703,18 +4946,18 @@ var ConversationContextProvider = ({
|
|
|
4703
4946
|
}),
|
|
4704
4947
|
[baseURL, apiKey, assistantId, transport]
|
|
4705
4948
|
);
|
|
4706
|
-
const [threads, setThreads] = (0,
|
|
4707
|
-
const [threadId, setThreadId] = (0,
|
|
4708
|
-
const [isLoading, setIsLoading] = (0,
|
|
4709
|
-
const [error, setError] = (0,
|
|
4710
|
-
const loadedAssistantIdRef = (0,
|
|
4711
|
-
const prevAssistantIdRef = (0,
|
|
4712
|
-
const isLoadingRef = (0,
|
|
4713
|
-
const clientRef = (0,
|
|
4714
|
-
(0,
|
|
4949
|
+
const [threads, setThreads] = (0, import_react22.useState)([]);
|
|
4950
|
+
const [threadId, setThreadId] = (0, import_react22.useState)(null);
|
|
4951
|
+
const [isLoading, setIsLoading] = (0, import_react22.useState)(false);
|
|
4952
|
+
const [error, setError] = (0, import_react22.useState)(null);
|
|
4953
|
+
const loadedAssistantIdRef = (0, import_react22.useRef)(null);
|
|
4954
|
+
const prevAssistantIdRef = (0, import_react22.useRef)(null);
|
|
4955
|
+
const isLoadingRef = (0, import_react22.useRef)(false);
|
|
4956
|
+
const clientRef = (0, import_react22.useRef)(client);
|
|
4957
|
+
(0, import_react22.useEffect)(() => {
|
|
4715
4958
|
clientRef.current = client;
|
|
4716
4959
|
}, [client]);
|
|
4717
|
-
const loadThreads = (0,
|
|
4960
|
+
const loadThreads = (0, import_react22.useCallback)(async () => {
|
|
4718
4961
|
const currentClient = clientRef.current;
|
|
4719
4962
|
if (!assistantId || !currentClient.assistantId) {
|
|
4720
4963
|
setThreads([]);
|
|
@@ -4773,7 +5016,7 @@ var ConversationContextProvider = ({
|
|
|
4773
5016
|
isLoadingRef.current = false;
|
|
4774
5017
|
}
|
|
4775
5018
|
}, [assistantId]);
|
|
4776
|
-
(0,
|
|
5019
|
+
(0, import_react22.useEffect)(() => {
|
|
4777
5020
|
const currentClient = clientRef.current;
|
|
4778
5021
|
const prevAssistantId = prevAssistantIdRef.current;
|
|
4779
5022
|
const assistantChanged = prevAssistantId !== assistantId;
|
|
@@ -4792,20 +5035,20 @@ var ConversationContextProvider = ({
|
|
|
4792
5035
|
prevAssistantIdRef.current = null;
|
|
4793
5036
|
}
|
|
4794
5037
|
}, [assistantId, loadThreads]);
|
|
4795
|
-
const thread = (0,
|
|
5038
|
+
const thread = (0, import_react22.useMemo)(() => {
|
|
4796
5039
|
if (!assistantId || !threadId) {
|
|
4797
5040
|
return null;
|
|
4798
5041
|
}
|
|
4799
5042
|
return threads.find((t) => t.id === threadId) || null;
|
|
4800
5043
|
}, [assistantId, threadId, threads]);
|
|
4801
|
-
const setThread = (0,
|
|
5044
|
+
const setThread = (0, import_react22.useCallback)((newThread) => {
|
|
4802
5045
|
if (newThread) {
|
|
4803
5046
|
setThreadId(newThread.id);
|
|
4804
5047
|
} else {
|
|
4805
5048
|
setThreadId(null);
|
|
4806
5049
|
}
|
|
4807
5050
|
}, []);
|
|
4808
|
-
const selectThread = (0,
|
|
5051
|
+
const selectThread = (0, import_react22.useCallback)(
|
|
4809
5052
|
(targetThreadId) => {
|
|
4810
5053
|
const foundThread = threads.find((t) => t.id === targetThreadId);
|
|
4811
5054
|
if (foundThread) {
|
|
@@ -4814,7 +5057,7 @@ var ConversationContextProvider = ({
|
|
|
4814
5057
|
},
|
|
4815
5058
|
[threads]
|
|
4816
5059
|
);
|
|
4817
|
-
const createThread = (0,
|
|
5060
|
+
const createThread = (0, import_react22.useCallback)(
|
|
4818
5061
|
async (label) => {
|
|
4819
5062
|
if (!assistantId || !client.assistantId) {
|
|
4820
5063
|
throw new Error("No assistant selected");
|
|
@@ -4839,7 +5082,7 @@ var ConversationContextProvider = ({
|
|
|
4839
5082
|
},
|
|
4840
5083
|
[assistantId, client, loadThreads]
|
|
4841
5084
|
);
|
|
4842
|
-
const listThreads = (0,
|
|
5085
|
+
const listThreads = (0, import_react22.useCallback)(async () => {
|
|
4843
5086
|
if (!assistantId || !client.assistantId) {
|
|
4844
5087
|
return [];
|
|
4845
5088
|
}
|
|
@@ -4860,7 +5103,7 @@ var ConversationContextProvider = ({
|
|
|
4860
5103
|
setIsLoading(false);
|
|
4861
5104
|
}
|
|
4862
5105
|
}, [assistantId, client, threads]);
|
|
4863
|
-
const updateThread = (0,
|
|
5106
|
+
const updateThread = (0, import_react22.useCallback)(
|
|
4864
5107
|
async (newThread) => {
|
|
4865
5108
|
if (!assistantId || !client.assistantId) {
|
|
4866
5109
|
throw new Error("No assistant selected");
|
|
@@ -4882,13 +5125,13 @@ var ConversationContextProvider = ({
|
|
|
4882
5125
|
},
|
|
4883
5126
|
[assistantId, client, loadThreads]
|
|
4884
5127
|
);
|
|
4885
|
-
const getThreadById = (0,
|
|
5128
|
+
const getThreadById = (0, import_react22.useCallback)(
|
|
4886
5129
|
(targetThreadId) => {
|
|
4887
5130
|
return threads.find((t) => t.id === targetThreadId) || null;
|
|
4888
5131
|
},
|
|
4889
5132
|
[threads]
|
|
4890
5133
|
);
|
|
4891
|
-
const deleteThread = (0,
|
|
5134
|
+
const deleteThread = (0, import_react22.useCallback)(
|
|
4892
5135
|
async (targetThreadId) => {
|
|
4893
5136
|
if (!assistantId || !client.assistantId) {
|
|
4894
5137
|
throw new Error("No assistant selected");
|
|
@@ -4911,10 +5154,10 @@ var ConversationContextProvider = ({
|
|
|
4911
5154
|
},
|
|
4912
5155
|
[threadId, assistantId, client, loadThreads]
|
|
4913
5156
|
);
|
|
4914
|
-
const clearThread = (0,
|
|
5157
|
+
const clearThread = (0, import_react22.useCallback)(() => {
|
|
4915
5158
|
setThreadId(null);
|
|
4916
5159
|
}, []);
|
|
4917
|
-
return /* @__PURE__ */ (0,
|
|
5160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4918
5161
|
ConversationContext.Provider,
|
|
4919
5162
|
{
|
|
4920
5163
|
value: {
|
|
@@ -4939,7 +5182,7 @@ var ConversationContextProvider = ({
|
|
|
4939
5182
|
);
|
|
4940
5183
|
};
|
|
4941
5184
|
var useConversationContext = () => {
|
|
4942
|
-
const context = (0,
|
|
5185
|
+
const context = (0, import_react22.useContext)(ConversationContext);
|
|
4943
5186
|
if (!context) {
|
|
4944
5187
|
throw new Error(
|
|
4945
5188
|
"useConversationContext must be used within a ConversationContextProvider"
|
|
@@ -4950,11 +5193,11 @@ var useConversationContext = () => {
|
|
|
4950
5193
|
|
|
4951
5194
|
// src/components/Chat/AgentConversations.tsx
|
|
4952
5195
|
var import_x6 = require("@ant-design/x");
|
|
4953
|
-
var
|
|
4954
|
-
var
|
|
4955
|
-
var
|
|
5196
|
+
var import_antd23 = require("antd");
|
|
5197
|
+
var import_react23 = require("react");
|
|
5198
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4956
5199
|
var AgentConversations = () => {
|
|
4957
|
-
const { token } =
|
|
5200
|
+
const { token } = import_antd23.theme.useToken();
|
|
4958
5201
|
const { currentAssistant } = useAssistantContext();
|
|
4959
5202
|
const {
|
|
4960
5203
|
assistantId,
|
|
@@ -4969,7 +5212,7 @@ var AgentConversations = () => {
|
|
|
4969
5212
|
background: "transparent",
|
|
4970
5213
|
borderRadius: token.borderRadius
|
|
4971
5214
|
};
|
|
4972
|
-
const threadItems = (0,
|
|
5215
|
+
const threadItems = (0, import_react23.useMemo)(() => {
|
|
4973
5216
|
return threads || [];
|
|
4974
5217
|
}, [threads]);
|
|
4975
5218
|
const items = threadItems.map((thread2) => ({
|
|
@@ -4982,7 +5225,7 @@ var AgentConversations = () => {
|
|
|
4982
5225
|
}
|
|
4983
5226
|
await createThread();
|
|
4984
5227
|
};
|
|
4985
|
-
return /* @__PURE__ */ (0,
|
|
5228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4986
5229
|
import_x6.Conversations,
|
|
4987
5230
|
{
|
|
4988
5231
|
creation: {
|
|
@@ -5000,16 +5243,16 @@ var AgentConversations = () => {
|
|
|
5000
5243
|
};
|
|
5001
5244
|
|
|
5002
5245
|
// src/components/Chat/ChatSidebar.tsx
|
|
5003
|
-
var
|
|
5004
|
-
var
|
|
5005
|
-
var
|
|
5246
|
+
var import_react24 = require("react");
|
|
5247
|
+
var import_antd25 = require("antd");
|
|
5248
|
+
var import_icons14 = require("@ant-design/icons");
|
|
5006
5249
|
|
|
5007
5250
|
// src/components/Chat/AssistantList.tsx
|
|
5008
5251
|
var import_x7 = require("@ant-design/x");
|
|
5009
|
-
var
|
|
5010
|
-
var
|
|
5252
|
+
var import_antd24 = require("antd");
|
|
5253
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5011
5254
|
var AssistantList = () => {
|
|
5012
|
-
const { token } =
|
|
5255
|
+
const { token } = import_antd24.theme.useToken();
|
|
5013
5256
|
const { assistants, selectAssistant, currentAssistant } = useAssistantContext();
|
|
5014
5257
|
const style = {
|
|
5015
5258
|
width: "100%",
|
|
@@ -5019,8 +5262,8 @@ var AssistantList = () => {
|
|
|
5019
5262
|
const items = assistants.map((assistant) => ({
|
|
5020
5263
|
key: assistant.id,
|
|
5021
5264
|
label: assistant.name,
|
|
5022
|
-
icon: /* @__PURE__ */ (0,
|
|
5023
|
-
|
|
5265
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5266
|
+
import_antd24.Avatar,
|
|
5024
5267
|
{
|
|
5025
5268
|
size: "small",
|
|
5026
5269
|
style: {
|
|
@@ -5031,7 +5274,7 @@ var AssistantList = () => {
|
|
|
5031
5274
|
}
|
|
5032
5275
|
)
|
|
5033
5276
|
}));
|
|
5034
|
-
return /* @__PURE__ */ (0,
|
|
5277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5035
5278
|
import_x7.Conversations,
|
|
5036
5279
|
{
|
|
5037
5280
|
items,
|
|
@@ -5045,9 +5288,9 @@ var AssistantList = () => {
|
|
|
5045
5288
|
};
|
|
5046
5289
|
|
|
5047
5290
|
// src/components/Chat/ChatSidebar.tsx
|
|
5048
|
-
var
|
|
5049
|
-
var
|
|
5050
|
-
var useStyles3 = (0,
|
|
5291
|
+
var import_antd_style11 = require("antd-style");
|
|
5292
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5293
|
+
var useStyles3 = (0, import_antd_style11.createStyles)(({ token, css }) => ({
|
|
5051
5294
|
sidebar: css`
|
|
5052
5295
|
display: flex;
|
|
5053
5296
|
flex-direction: column;
|
|
@@ -5224,7 +5467,7 @@ var ChatSidebar = ({
|
|
|
5224
5467
|
const { styles } = useStyles3();
|
|
5225
5468
|
const { setMenuCollapsed, menuCollapsed, sideAppVisible } = useChatUIContext();
|
|
5226
5469
|
const { setSettingsModalOpen } = useLatticeChatShellContext();
|
|
5227
|
-
const [isHovered, setIsHovered] = (0,
|
|
5470
|
+
const [isHovered, setIsHovered] = (0, import_react24.useState)(false);
|
|
5228
5471
|
const handleToggleCollapse = () => {
|
|
5229
5472
|
setMenuCollapsed(!menuCollapsed);
|
|
5230
5473
|
};
|
|
@@ -5241,87 +5484,87 @@ var ChatSidebar = ({
|
|
|
5241
5484
|
const handleMouseLeave = () => {
|
|
5242
5485
|
setIsHovered(false);
|
|
5243
5486
|
};
|
|
5244
|
-
return /* @__PURE__ */ (0,
|
|
5245
|
-
/* @__PURE__ */ (0,
|
|
5487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
5488
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5246
5489
|
"div",
|
|
5247
5490
|
{
|
|
5248
5491
|
className: styles.sidebar,
|
|
5249
5492
|
onMouseEnter: handleMouseEnter,
|
|
5250
5493
|
onMouseLeave: handleMouseLeave,
|
|
5251
|
-
children: !isCollapsed && /* @__PURE__ */ (0,
|
|
5252
|
-
/* @__PURE__ */ (0,
|
|
5253
|
-
/* @__PURE__ */ (0,
|
|
5254
|
-
/* @__PURE__ */ (0,
|
|
5255
|
-
/* @__PURE__ */ (0,
|
|
5494
|
+
children: !isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
5495
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.content, children: [
|
|
5496
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5497
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
|
|
5498
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AssistantList, {})
|
|
5256
5499
|
] }),
|
|
5257
|
-
/* @__PURE__ */ (0,
|
|
5258
|
-
/* @__PURE__ */ (0,
|
|
5259
|
-
/* @__PURE__ */ (0,
|
|
5260
|
-
/* @__PURE__ */ (0,
|
|
5500
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_antd25.Divider, { className: styles.divider }),
|
|
5501
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5502
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
5503
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AgentConversations, {})
|
|
5261
5504
|
] })
|
|
5262
5505
|
] }),
|
|
5263
|
-
/* @__PURE__ */ (0,
|
|
5264
|
-
/* @__PURE__ */ (0,
|
|
5506
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.footer, children: [
|
|
5507
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5265
5508
|
"button",
|
|
5266
5509
|
{
|
|
5267
5510
|
className: styles.actionButton,
|
|
5268
5511
|
onClick: handleToggleCollapse,
|
|
5269
5512
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5270
5513
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5271
|
-
children: isCollapsed ? /* @__PURE__ */ (0,
|
|
5514
|
+
children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuFoldOutlined, {})
|
|
5272
5515
|
}
|
|
5273
5516
|
),
|
|
5274
|
-
/* @__PURE__ */ (0,
|
|
5517
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5275
5518
|
"button",
|
|
5276
5519
|
{
|
|
5277
5520
|
className: styles.actionButton,
|
|
5278
5521
|
onClick: handleSettingsClick,
|
|
5279
5522
|
title: "Settings",
|
|
5280
5523
|
"aria-label": "Settings",
|
|
5281
|
-
children: /* @__PURE__ */ (0,
|
|
5524
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.SettingOutlined, {})
|
|
5282
5525
|
}
|
|
5283
5526
|
)
|
|
5284
5527
|
] })
|
|
5285
5528
|
] })
|
|
5286
5529
|
}
|
|
5287
5530
|
),
|
|
5288
|
-
isCollapsed && /* @__PURE__ */ (0,
|
|
5531
|
+
isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
5289
5532
|
"div",
|
|
5290
5533
|
{
|
|
5291
5534
|
className: `${styles.hoverOverlay} ${isHovered ? "visible" : ""}`,
|
|
5292
5535
|
onMouseEnter: handleMouseEnter,
|
|
5293
5536
|
onMouseLeave: handleMouseLeave,
|
|
5294
5537
|
children: [
|
|
5295
|
-
/* @__PURE__ */ (0,
|
|
5296
|
-
/* @__PURE__ */ (0,
|
|
5297
|
-
/* @__PURE__ */ (0,
|
|
5298
|
-
/* @__PURE__ */ (0,
|
|
5538
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.hoverContent, children: [
|
|
5539
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5540
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
|
|
5541
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AssistantList, {})
|
|
5299
5542
|
] }),
|
|
5300
|
-
/* @__PURE__ */ (0,
|
|
5301
|
-
/* @__PURE__ */ (0,
|
|
5302
|
-
/* @__PURE__ */ (0,
|
|
5303
|
-
/* @__PURE__ */ (0,
|
|
5543
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_antd25.Divider, { className: styles.divider }),
|
|
5544
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5545
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
5546
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AgentConversations, {})
|
|
5304
5547
|
] })
|
|
5305
5548
|
] }),
|
|
5306
|
-
/* @__PURE__ */ (0,
|
|
5307
|
-
/* @__PURE__ */ (0,
|
|
5549
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.footer, children: [
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5308
5551
|
"button",
|
|
5309
5552
|
{
|
|
5310
5553
|
className: styles.actionButton,
|
|
5311
5554
|
onClick: handleToggleCollapse,
|
|
5312
5555
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5313
5556
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5314
|
-
children: isCollapsed ? /* @__PURE__ */ (0,
|
|
5557
|
+
children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuFoldOutlined, {})
|
|
5315
5558
|
}
|
|
5316
5559
|
),
|
|
5317
|
-
/* @__PURE__ */ (0,
|
|
5560
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5318
5561
|
"button",
|
|
5319
5562
|
{
|
|
5320
5563
|
className: styles.actionButton,
|
|
5321
5564
|
onClick: handleSettingsClick,
|
|
5322
5565
|
title: "Settings",
|
|
5323
5566
|
"aria-label": "Settings",
|
|
5324
|
-
children: /* @__PURE__ */ (0,
|
|
5567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.SettingOutlined, {})
|
|
5325
5568
|
}
|
|
5326
5569
|
)
|
|
5327
5570
|
] })
|
|
@@ -5332,14 +5575,14 @@ var ChatSidebar = ({
|
|
|
5332
5575
|
};
|
|
5333
5576
|
|
|
5334
5577
|
// src/components/Chat/LatticeChatView.tsx
|
|
5335
|
-
var
|
|
5578
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5336
5579
|
var LatticeChatView = (props) => {
|
|
5337
5580
|
const { assistantId, thread } = useConversationContext();
|
|
5338
5581
|
const { currentAssistant } = useAssistantContext();
|
|
5339
5582
|
const {
|
|
5340
5583
|
config: { baseURL }
|
|
5341
5584
|
} = useLatticeChatShellContext();
|
|
5342
|
-
return assistantId && thread ? /* @__PURE__ */ (0,
|
|
5585
|
+
return assistantId && thread ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5343
5586
|
AxiomLatticeProvider,
|
|
5344
5587
|
{
|
|
5345
5588
|
config: {
|
|
@@ -5348,14 +5591,14 @@ var LatticeChatView = (props) => {
|
|
|
5348
5591
|
assistantId,
|
|
5349
5592
|
transport: "sse"
|
|
5350
5593
|
},
|
|
5351
|
-
children: /* @__PURE__ */ (0,
|
|
5594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5352
5595
|
LatticeChat,
|
|
5353
5596
|
{
|
|
5354
5597
|
thread_id: thread?.id,
|
|
5355
5598
|
assistant_id: assistantId,
|
|
5356
5599
|
name: currentAssistant?.name,
|
|
5357
5600
|
description: currentAssistant?.description,
|
|
5358
|
-
menu: /* @__PURE__ */ (0,
|
|
5601
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChatSidebar, {})
|
|
5359
5602
|
}
|
|
5360
5603
|
)
|
|
5361
5604
|
}
|
|
@@ -5363,14 +5606,14 @@ var LatticeChatView = (props) => {
|
|
|
5363
5606
|
};
|
|
5364
5607
|
|
|
5365
5608
|
// src/components/Chat/SettingsModal.tsx
|
|
5366
|
-
var
|
|
5367
|
-
var
|
|
5368
|
-
var
|
|
5369
|
-
var
|
|
5370
|
-
var
|
|
5371
|
-
var { Text:
|
|
5372
|
-
var { TextArea } =
|
|
5373
|
-
var useStyles4 = (0,
|
|
5609
|
+
var import_react25 = require("react");
|
|
5610
|
+
var import_antd26 = require("antd");
|
|
5611
|
+
var import_icons15 = require("@ant-design/icons");
|
|
5612
|
+
var import_antd_style12 = require("antd-style");
|
|
5613
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5614
|
+
var { Text: Text13, Title: Title2 } = import_antd26.Typography;
|
|
5615
|
+
var { TextArea } = import_antd26.Input;
|
|
5616
|
+
var useStyles4 = (0, import_antd_style12.createStyles)(({ token, css }) => ({
|
|
5374
5617
|
// settingsModal: css`
|
|
5375
5618
|
// .ant-modal {
|
|
5376
5619
|
// max-width: 100vw !important;
|
|
@@ -5716,12 +5959,12 @@ var SETTINGS_MENU_ITEMS = [
|
|
|
5716
5959
|
{
|
|
5717
5960
|
key: "environment",
|
|
5718
5961
|
label: "Environment Variables",
|
|
5719
|
-
icon: /* @__PURE__ */ (0,
|
|
5962
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.EnvironmentOutlined, {})
|
|
5720
5963
|
},
|
|
5721
5964
|
{
|
|
5722
5965
|
key: "models",
|
|
5723
5966
|
label: "Model Configuration",
|
|
5724
|
-
icon: /* @__PURE__ */ (0,
|
|
5967
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.ApiOutlined, {})
|
|
5725
5968
|
}
|
|
5726
5969
|
];
|
|
5727
5970
|
var SettingsModal = ({
|
|
@@ -5730,7 +5973,7 @@ var SettingsModal = ({
|
|
|
5730
5973
|
}) => {
|
|
5731
5974
|
const { styles } = useStyles4();
|
|
5732
5975
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
5733
|
-
const [connections, setConnections] = (0,
|
|
5976
|
+
const [connections, setConnections] = (0, import_react25.useState)(() => {
|
|
5734
5977
|
if (typeof window !== "undefined") {
|
|
5735
5978
|
try {
|
|
5736
5979
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -5753,21 +5996,21 @@ var SettingsModal = ({
|
|
|
5753
5996
|
}
|
|
5754
5997
|
return [];
|
|
5755
5998
|
});
|
|
5756
|
-
const [serverConfigs, setServerConfigs] = (0,
|
|
5757
|
-
const connectionsRef = (0,
|
|
5758
|
-
(0,
|
|
5999
|
+
const [serverConfigs, setServerConfigs] = (0, import_react25.useState)({});
|
|
6000
|
+
const connectionsRef = (0, import_react25.useRef)(connections);
|
|
6001
|
+
(0, import_react25.useEffect)(() => {
|
|
5759
6002
|
connectionsRef.current = connections;
|
|
5760
6003
|
}, [connections]);
|
|
5761
|
-
const [activeTabKey, setActiveTabKey] = (0,
|
|
6004
|
+
const [activeTabKey, setActiveTabKey] = (0, import_react25.useState)(
|
|
5762
6005
|
connections.length > 0 ? connections[0].id : ""
|
|
5763
6006
|
);
|
|
5764
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
5765
|
-
const [loading, setLoading] = (0,
|
|
5766
|
-
const [showAddServerModal, setShowAddServerModal] = (0,
|
|
5767
|
-
const [newServerUrl, setNewServerUrl] = (0,
|
|
5768
|
-
const [newServerName, setNewServerName] = (0,
|
|
5769
|
-
const [newServerApiKey, setNewServerApiKey] = (0,
|
|
5770
|
-
const [addingServer, setAddingServer] = (0,
|
|
6007
|
+
const [activeMenu, setActiveMenu] = (0, import_react25.useState)("environment");
|
|
6008
|
+
const [loading, setLoading] = (0, import_react25.useState)(false);
|
|
6009
|
+
const [showAddServerModal, setShowAddServerModal] = (0, import_react25.useState)(false);
|
|
6010
|
+
const [newServerUrl, setNewServerUrl] = (0, import_react25.useState)("");
|
|
6011
|
+
const [newServerName, setNewServerName] = (0, import_react25.useState)("");
|
|
6012
|
+
const [newServerApiKey, setNewServerApiKey] = (0, import_react25.useState)("");
|
|
6013
|
+
const [addingServer, setAddingServer] = (0, import_react25.useState)(false);
|
|
5771
6014
|
const saveConnections = (newConnections) => {
|
|
5772
6015
|
setConnections(newConnections);
|
|
5773
6016
|
if (typeof window !== "undefined") {
|
|
@@ -5906,7 +6149,7 @@ var SettingsModal = ({
|
|
|
5906
6149
|
}
|
|
5907
6150
|
} catch (error) {
|
|
5908
6151
|
console.error("Failed to load configuration:", error);
|
|
5909
|
-
|
|
6152
|
+
import_antd26.message.error("Failed to load current configuration");
|
|
5910
6153
|
}
|
|
5911
6154
|
};
|
|
5912
6155
|
const loadModelsConfig = async (serverId) => {
|
|
@@ -5957,7 +6200,7 @@ var SettingsModal = ({
|
|
|
5957
6200
|
console.error("Failed to load models configuration:", error);
|
|
5958
6201
|
}
|
|
5959
6202
|
};
|
|
5960
|
-
(0,
|
|
6203
|
+
(0, import_react25.useEffect)(() => {
|
|
5961
6204
|
if (open && activeTabKey) {
|
|
5962
6205
|
initializeServerConfig(activeTabKey);
|
|
5963
6206
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -5966,7 +6209,7 @@ var SettingsModal = ({
|
|
|
5966
6209
|
}
|
|
5967
6210
|
}
|
|
5968
6211
|
}, [open, activeTabKey]);
|
|
5969
|
-
(0,
|
|
6212
|
+
(0, import_react25.useEffect)(() => {
|
|
5970
6213
|
if (open && activeTabKey) {
|
|
5971
6214
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
5972
6215
|
if (connection?.connected) {
|
|
@@ -5980,7 +6223,7 @@ var SettingsModal = ({
|
|
|
5980
6223
|
}, [open, activeTabKey, activeMenu]);
|
|
5981
6224
|
const handleAddServer = async () => {
|
|
5982
6225
|
if (!newServerUrl.trim()) {
|
|
5983
|
-
|
|
6226
|
+
import_antd26.message.error("Please enter a server URL");
|
|
5984
6227
|
return;
|
|
5985
6228
|
}
|
|
5986
6229
|
let normalizedUrl = newServerUrl.trim();
|
|
@@ -6006,7 +6249,7 @@ var SettingsModal = ({
|
|
|
6006
6249
|
setNewServerUrl("");
|
|
6007
6250
|
setNewServerName("");
|
|
6008
6251
|
setNewServerApiKey("");
|
|
6009
|
-
|
|
6252
|
+
import_antd26.message.success("Server added successfully");
|
|
6010
6253
|
};
|
|
6011
6254
|
const handleDeleteServer = (serverId) => {
|
|
6012
6255
|
const newConnections = connections.filter((c) => c.id !== serverId);
|
|
@@ -6023,7 +6266,7 @@ var SettingsModal = ({
|
|
|
6023
6266
|
setActiveTabKey("");
|
|
6024
6267
|
}
|
|
6025
6268
|
}
|
|
6026
|
-
|
|
6269
|
+
import_antd26.message.success("Server deleted");
|
|
6027
6270
|
};
|
|
6028
6271
|
const handleTabChange = (newTabKey) => {
|
|
6029
6272
|
setConnections(
|
|
@@ -6037,12 +6280,12 @@ var SettingsModal = ({
|
|
|
6037
6280
|
const handleSave = async () => {
|
|
6038
6281
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
6039
6282
|
if (!connection || !connection.connected) {
|
|
6040
|
-
|
|
6283
|
+
import_antd26.message.error("Please connect to a server first");
|
|
6041
6284
|
return;
|
|
6042
6285
|
}
|
|
6043
6286
|
const url = connection.url;
|
|
6044
6287
|
if (!url) {
|
|
6045
|
-
|
|
6288
|
+
import_antd26.message.error("Please connect to a server first");
|
|
6046
6289
|
return;
|
|
6047
6290
|
}
|
|
6048
6291
|
try {
|
|
@@ -6106,23 +6349,23 @@ var SettingsModal = ({
|
|
|
6106
6349
|
const data = await response.json();
|
|
6107
6350
|
if (response.ok && data.success) {
|
|
6108
6351
|
if (data.requiresRestart && data.requiresRestart.length > 0) {
|
|
6109
|
-
|
|
6352
|
+
import_antd26.message.warning(
|
|
6110
6353
|
`Configuration saved. Please restart the server for ${data.requiresRestart.join(
|
|
6111
6354
|
", "
|
|
6112
6355
|
)} to take effect.`,
|
|
6113
6356
|
5
|
|
6114
6357
|
);
|
|
6115
6358
|
} else {
|
|
6116
|
-
|
|
6359
|
+
import_antd26.message.success("Configuration saved and applied successfully");
|
|
6117
6360
|
}
|
|
6118
6361
|
if (data.warnings && data.warnings.length > 0) {
|
|
6119
6362
|
data.warnings.forEach((warning) => {
|
|
6120
|
-
|
|
6363
|
+
import_antd26.message.warning(warning, 5);
|
|
6121
6364
|
});
|
|
6122
6365
|
}
|
|
6123
6366
|
onClose();
|
|
6124
6367
|
} else {
|
|
6125
|
-
|
|
6368
|
+
import_antd26.message.error(data.error || "Failed to save configuration");
|
|
6126
6369
|
}
|
|
6127
6370
|
} else if (activeMenu === "models") {
|
|
6128
6371
|
const validModels = config.models.filter(
|
|
@@ -6141,17 +6384,17 @@ var SettingsModal = ({
|
|
|
6141
6384
|
});
|
|
6142
6385
|
const data = await response.json();
|
|
6143
6386
|
if (response.ok && data.success) {
|
|
6144
|
-
|
|
6387
|
+
import_antd26.message.success(
|
|
6145
6388
|
"Model configuration saved and registered successfully"
|
|
6146
6389
|
);
|
|
6147
6390
|
onClose();
|
|
6148
6391
|
} else {
|
|
6149
|
-
|
|
6392
|
+
import_antd26.message.error(data.error || "Failed to save model configuration");
|
|
6150
6393
|
}
|
|
6151
6394
|
}
|
|
6152
6395
|
} catch (error) {
|
|
6153
6396
|
console.error("Failed to save configuration:", error);
|
|
6154
|
-
|
|
6397
|
+
import_antd26.message.error(error.message || "Failed to save configuration");
|
|
6155
6398
|
} finally {
|
|
6156
6399
|
setLoading(false);
|
|
6157
6400
|
}
|
|
@@ -6167,25 +6410,25 @@ var SettingsModal = ({
|
|
|
6167
6410
|
}
|
|
6168
6411
|
}));
|
|
6169
6412
|
};
|
|
6170
|
-
return /* @__PURE__ */ (0,
|
|
6171
|
-
/* @__PURE__ */ (0,
|
|
6172
|
-
|
|
6413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.formContainer, children: [
|
|
6414
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6415
|
+
import_antd26.Alert,
|
|
6173
6416
|
{
|
|
6174
6417
|
message: "Configuration Effect",
|
|
6175
|
-
description: /* @__PURE__ */ (0,
|
|
6176
|
-
/* @__PURE__ */ (0,
|
|
6177
|
-
/* @__PURE__ */ (0,
|
|
6178
|
-
|
|
6418
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6419
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { marginBottom: 8 }, children: [
|
|
6420
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6421
|
+
import_icons15.CheckCircleOutlined,
|
|
6179
6422
|
{
|
|
6180
6423
|
style: { color: "#52c41a", marginRight: 8 }
|
|
6181
6424
|
}
|
|
6182
6425
|
),
|
|
6183
|
-
/* @__PURE__ */ (0,
|
|
6426
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("strong", { children: "Immediately effective:" }),
|
|
6184
6427
|
" QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
|
|
6185
6428
|
] }),
|
|
6186
|
-
/* @__PURE__ */ (0,
|
|
6187
|
-
/* @__PURE__ */ (0,
|
|
6188
|
-
/* @__PURE__ */ (0,
|
|
6429
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6430
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.ReloadOutlined, { style: { color: "#faad14", marginRight: 8 } }),
|
|
6431
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("strong", { children: "Requires restart:" }),
|
|
6189
6432
|
" PORT (server must be restarted to change port)"
|
|
6190
6433
|
] })
|
|
6191
6434
|
] }),
|
|
@@ -6194,8 +6437,8 @@ var SettingsModal = ({
|
|
|
6194
6437
|
className: styles.alertCard
|
|
6195
6438
|
}
|
|
6196
6439
|
),
|
|
6197
|
-
/* @__PURE__ */ (0,
|
|
6198
|
-
/* @__PURE__ */ (0,
|
|
6440
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure environment variables in .env format (key=value). One variable per line. Leave password fields empty to keep current values." }) }),
|
|
6441
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6199
6442
|
TextArea,
|
|
6200
6443
|
{
|
|
6201
6444
|
value: config.envText,
|
|
@@ -6272,10 +6515,10 @@ QUEUE_NAME=tasks`,
|
|
|
6272
6515
|
}));
|
|
6273
6516
|
}
|
|
6274
6517
|
};
|
|
6275
|
-
return /* @__PURE__ */ (0,
|
|
6276
|
-
/* @__PURE__ */ (0,
|
|
6277
|
-
config.models.map((model, index) => /* @__PURE__ */ (0,
|
|
6278
|
-
/* @__PURE__ */ (0,
|
|
6518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.formContainer, children: [
|
|
6519
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure model lattices. Each model will be registered with the provided key and can be used by agents." }) }),
|
|
6520
|
+
config.models.map((model, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.card, children: [
|
|
6521
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
6279
6522
|
"div",
|
|
6280
6523
|
{
|
|
6281
6524
|
style: {
|
|
@@ -6287,13 +6530,13 @@ QUEUE_NAME=tasks`,
|
|
|
6287
6530
|
borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
|
|
6288
6531
|
},
|
|
6289
6532
|
children: [
|
|
6290
|
-
/* @__PURE__ */ (0,
|
|
6291
|
-
/* @__PURE__ */ (0,
|
|
6533
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6534
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text13, { strong: true, style: { fontSize: 16 }, children: [
|
|
6292
6535
|
"Model ",
|
|
6293
6536
|
index + 1
|
|
6294
6537
|
] }),
|
|
6295
|
-
model.key && /* @__PURE__ */ (0,
|
|
6296
|
-
|
|
6538
|
+
model.key && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
6539
|
+
Text13,
|
|
6297
6540
|
{
|
|
6298
6541
|
type: "secondary",
|
|
6299
6542
|
style: { marginLeft: 8, fontSize: 12 },
|
|
@@ -6305,8 +6548,8 @@ QUEUE_NAME=tasks`,
|
|
|
6305
6548
|
}
|
|
6306
6549
|
)
|
|
6307
6550
|
] }),
|
|
6308
|
-
config.models.length > 1 && /* @__PURE__ */ (0,
|
|
6309
|
-
|
|
6551
|
+
config.models.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6552
|
+
import_antd26.Button,
|
|
6310
6553
|
{
|
|
6311
6554
|
type: "text",
|
|
6312
6555
|
danger: true,
|
|
@@ -6322,11 +6565,11 @@ QUEUE_NAME=tasks`,
|
|
|
6322
6565
|
]
|
|
6323
6566
|
}
|
|
6324
6567
|
),
|
|
6325
|
-
/* @__PURE__ */ (0,
|
|
6326
|
-
/* @__PURE__ */ (0,
|
|
6327
|
-
/* @__PURE__ */ (0,
|
|
6328
|
-
/* @__PURE__ */ (0,
|
|
6329
|
-
|
|
6568
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_antd26.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
6569
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6570
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Key *" }),
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6572
|
+
import_antd26.Input,
|
|
6330
6573
|
{
|
|
6331
6574
|
placeholder: "e.g., default, gpt-4, claude",
|
|
6332
6575
|
value: model.key,
|
|
@@ -6334,12 +6577,12 @@ QUEUE_NAME=tasks`,
|
|
|
6334
6577
|
style: { height: 40 }
|
|
6335
6578
|
}
|
|
6336
6579
|
),
|
|
6337
|
-
/* @__PURE__ */ (0,
|
|
6580
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formDescription, children: "Unique identifier for this model" })
|
|
6338
6581
|
] }),
|
|
6339
|
-
/* @__PURE__ */ (0,
|
|
6340
|
-
/* @__PURE__ */ (0,
|
|
6341
|
-
/* @__PURE__ */ (0,
|
|
6342
|
-
|
|
6582
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6583
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Provider *" }),
|
|
6584
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6585
|
+
import_antd26.Select,
|
|
6343
6586
|
{
|
|
6344
6587
|
style: { width: "100%", height: 40 },
|
|
6345
6588
|
value: model.provider,
|
|
@@ -6354,10 +6597,10 @@ QUEUE_NAME=tasks`,
|
|
|
6354
6597
|
}
|
|
6355
6598
|
)
|
|
6356
6599
|
] }),
|
|
6357
|
-
/* @__PURE__ */ (0,
|
|
6358
|
-
/* @__PURE__ */ (0,
|
|
6359
|
-
/* @__PURE__ */ (0,
|
|
6360
|
-
|
|
6600
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6601
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Model Name *" }),
|
|
6602
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6603
|
+
import_antd26.Input,
|
|
6361
6604
|
{
|
|
6362
6605
|
placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
|
|
6363
6606
|
value: model.model,
|
|
@@ -6366,10 +6609,10 @@ QUEUE_NAME=tasks`,
|
|
|
6366
6609
|
}
|
|
6367
6610
|
)
|
|
6368
6611
|
] }),
|
|
6369
|
-
/* @__PURE__ */ (0,
|
|
6370
|
-
/* @__PURE__ */ (0,
|
|
6371
|
-
/* @__PURE__ */ (0,
|
|
6372
|
-
|
|
6612
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6613
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "API Key" }),
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6615
|
+
import_antd26.Input.Password,
|
|
6373
6616
|
{
|
|
6374
6617
|
placeholder: "Enter your API key",
|
|
6375
6618
|
value: model.apiKey,
|
|
@@ -6377,12 +6620,12 @@ QUEUE_NAME=tasks`,
|
|
|
6377
6620
|
style: { height: 40 }
|
|
6378
6621
|
}
|
|
6379
6622
|
),
|
|
6380
|
-
/* @__PURE__ */ (0,
|
|
6623
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
|
|
6381
6624
|
] }),
|
|
6382
|
-
/* @__PURE__ */ (0,
|
|
6383
|
-
/* @__PURE__ */ (0,
|
|
6384
|
-
/* @__PURE__ */ (0,
|
|
6385
|
-
|
|
6625
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6626
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Base URL" }),
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6628
|
+
import_antd26.Input,
|
|
6386
6629
|
{
|
|
6387
6630
|
placeholder: "e.g., https://api.openai.com/v1",
|
|
6388
6631
|
value: model.baseURL,
|
|
@@ -6390,23 +6633,23 @@ QUEUE_NAME=tasks`,
|
|
|
6390
6633
|
style: { height: 40 }
|
|
6391
6634
|
}
|
|
6392
6635
|
),
|
|
6393
|
-
/* @__PURE__ */ (0,
|
|
6636
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formDescription, children: "Optional custom base URL for the API" })
|
|
6394
6637
|
] }),
|
|
6395
|
-
/* @__PURE__ */ (0,
|
|
6396
|
-
/* @__PURE__ */ (0,
|
|
6397
|
-
|
|
6638
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_antd26.Space, { children: [
|
|
6639
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6640
|
+
import_antd26.Switch,
|
|
6398
6641
|
{
|
|
6399
6642
|
checked: model.streaming,
|
|
6400
6643
|
onChange: (checked) => handleModelChange(index, "streaming", checked)
|
|
6401
6644
|
}
|
|
6402
6645
|
),
|
|
6403
|
-
/* @__PURE__ */ (0,
|
|
6646
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { children: "Enable Streaming" })
|
|
6404
6647
|
] }) }),
|
|
6405
|
-
/* @__PURE__ */ (0,
|
|
6406
|
-
/* @__PURE__ */ (0,
|
|
6407
|
-
/* @__PURE__ */ (0,
|
|
6408
|
-
/* @__PURE__ */ (0,
|
|
6409
|
-
|
|
6648
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { display: "flex", gap: 20 }, children: [
|
|
6649
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { flex: 1 }, children: [
|
|
6650
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Max Tokens" }),
|
|
6651
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6652
|
+
import_antd26.Input,
|
|
6410
6653
|
{
|
|
6411
6654
|
type: "number",
|
|
6412
6655
|
placeholder: "e.g., 4096",
|
|
@@ -6420,10 +6663,10 @@ QUEUE_NAME=tasks`,
|
|
|
6420
6663
|
}
|
|
6421
6664
|
)
|
|
6422
6665
|
] }),
|
|
6423
|
-
/* @__PURE__ */ (0,
|
|
6424
|
-
/* @__PURE__ */ (0,
|
|
6425
|
-
/* @__PURE__ */ (0,
|
|
6426
|
-
|
|
6666
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { flex: 1 }, children: [
|
|
6667
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Temperature" }),
|
|
6668
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6669
|
+
import_antd26.Input,
|
|
6427
6670
|
{
|
|
6428
6671
|
type: "number",
|
|
6429
6672
|
step: "0.1",
|
|
@@ -6441,8 +6684,8 @@ QUEUE_NAME=tasks`,
|
|
|
6441
6684
|
] })
|
|
6442
6685
|
] })
|
|
6443
6686
|
] }, index)),
|
|
6444
|
-
/* @__PURE__ */ (0,
|
|
6445
|
-
|
|
6687
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6688
|
+
import_antd26.Button,
|
|
6446
6689
|
{
|
|
6447
6690
|
type: "dashed",
|
|
6448
6691
|
onClick: handleAddModel,
|
|
@@ -6469,9 +6712,9 @@ QUEUE_NAME=tasks`,
|
|
|
6469
6712
|
);
|
|
6470
6713
|
const currentConnection = connections.find((c) => c.id === activeTabKey);
|
|
6471
6714
|
const renderTabLabel = (connection) => {
|
|
6472
|
-
return /* @__PURE__ */ (0,
|
|
6473
|
-
/* @__PURE__ */ (0,
|
|
6474
|
-
|
|
6715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
6716
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6717
|
+
import_icons15.CloudServerOutlined,
|
|
6475
6718
|
{
|
|
6476
6719
|
style: {
|
|
6477
6720
|
marginRight: 8,
|
|
@@ -6479,15 +6722,15 @@ QUEUE_NAME=tasks`,
|
|
|
6479
6722
|
}
|
|
6480
6723
|
}
|
|
6481
6724
|
),
|
|
6482
|
-
/* @__PURE__ */ (0,
|
|
6483
|
-
connection.connected && /* @__PURE__ */ (0,
|
|
6484
|
-
|
|
6725
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: connection.name }),
|
|
6726
|
+
connection.connected && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6727
|
+
import_icons15.CheckCircleFilled,
|
|
6485
6728
|
{
|
|
6486
6729
|
style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
|
|
6487
6730
|
}
|
|
6488
6731
|
),
|
|
6489
|
-
connection.error && !connection.connecting && /* @__PURE__ */ (0,
|
|
6490
|
-
|
|
6732
|
+
connection.error && !connection.connecting && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6733
|
+
import_icons15.CloseCircleFilled,
|
|
6491
6734
|
{
|
|
6492
6735
|
style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
|
|
6493
6736
|
}
|
|
@@ -6497,35 +6740,35 @@ QUEUE_NAME=tasks`,
|
|
|
6497
6740
|
const tabItems = connections.map((connection) => ({
|
|
6498
6741
|
key: connection.id,
|
|
6499
6742
|
label: renderTabLabel(connection),
|
|
6500
|
-
children: /* @__PURE__ */ (0,
|
|
6501
|
-
/* @__PURE__ */ (0,
|
|
6743
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { display: "flex", height: "100%" }, children: [
|
|
6744
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
6502
6745
|
"div",
|
|
6503
6746
|
{
|
|
6504
6747
|
className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
|
|
6505
6748
|
onClick: () => setActiveMenu(item.key),
|
|
6506
6749
|
children: [
|
|
6507
|
-
/* @__PURE__ */ (0,
|
|
6508
|
-
/* @__PURE__ */ (0,
|
|
6750
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: styles.menuItemIcon, children: item.icon }),
|
|
6751
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: styles.menuItemText, children: item.label })
|
|
6509
6752
|
]
|
|
6510
6753
|
},
|
|
6511
6754
|
item.key
|
|
6512
6755
|
)) }),
|
|
6513
|
-
/* @__PURE__ */ (0,
|
|
6514
|
-
/* @__PURE__ */ (0,
|
|
6515
|
-
/* @__PURE__ */ (0,
|
|
6516
|
-
/* @__PURE__ */ (0,
|
|
6517
|
-
/* @__PURE__ */ (0,
|
|
6756
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.content, children: [
|
|
6757
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.contentHeader, children: [
|
|
6758
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.contentHeaderLeft, children: [
|
|
6759
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Title2, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
|
|
6760
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text13, { className: styles.contentDescription, children: [
|
|
6518
6761
|
activeMenu === "environment" && "Manage environment variables for the gateway server",
|
|
6519
6762
|
activeMenu === "models" && "Configure and register model lattices for use by agents"
|
|
6520
6763
|
] })
|
|
6521
6764
|
] }),
|
|
6522
|
-
/* @__PURE__ */ (0,
|
|
6523
|
-
/* @__PURE__ */ (0,
|
|
6524
|
-
/* @__PURE__ */ (0,
|
|
6525
|
-
|
|
6765
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.contentHeaderRight, children: [
|
|
6766
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_antd26.Button, { onClick: onClose, children: "Cancel" }),
|
|
6767
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6768
|
+
import_antd26.Button,
|
|
6526
6769
|
{
|
|
6527
6770
|
type: "primary",
|
|
6528
|
-
icon: /* @__PURE__ */ (0,
|
|
6771
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.SaveOutlined, {}),
|
|
6529
6772
|
onClick: handleSave,
|
|
6530
6773
|
loading,
|
|
6531
6774
|
children: "Save Configuration"
|
|
@@ -6533,9 +6776,9 @@ QUEUE_NAME=tasks`,
|
|
|
6533
6776
|
)
|
|
6534
6777
|
] })
|
|
6535
6778
|
] }),
|
|
6536
|
-
/* @__PURE__ */ (0,
|
|
6779
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.contentBody, children: renderContent(connection.id) })
|
|
6537
6780
|
] })
|
|
6538
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
6781
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6539
6782
|
"div",
|
|
6540
6783
|
{
|
|
6541
6784
|
style: {
|
|
@@ -6547,29 +6790,29 @@ QUEUE_NAME=tasks`,
|
|
|
6547
6790
|
gap: 16,
|
|
6548
6791
|
padding: 48
|
|
6549
6792
|
},
|
|
6550
|
-
children: connection.connecting ? /* @__PURE__ */ (0,
|
|
6551
|
-
/* @__PURE__ */ (0,
|
|
6552
|
-
/* @__PURE__ */ (0,
|
|
6553
|
-
/* @__PURE__ */ (0,
|
|
6793
|
+
children: connection.connecting ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6794
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
|
|
6795
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Title2, { level: 4, children: "Connecting..." }),
|
|
6796
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text13, { type: "secondary", style: { textAlign: "center" }, children: [
|
|
6554
6797
|
"Connecting to ",
|
|
6555
6798
|
connection.url
|
|
6556
6799
|
] })
|
|
6557
|
-
] }) : /* @__PURE__ */ (0,
|
|
6558
|
-
/* @__PURE__ */ (0,
|
|
6559
|
-
/* @__PURE__ */ (0,
|
|
6560
|
-
/* @__PURE__ */ (0,
|
|
6561
|
-
|
|
6800
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6801
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
|
|
6802
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Title2, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
|
|
6803
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6804
|
+
Text13,
|
|
6562
6805
|
{
|
|
6563
6806
|
type: "secondary",
|
|
6564
6807
|
style: { textAlign: "center", maxWidth: 400 },
|
|
6565
6808
|
children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
|
|
6566
6809
|
}
|
|
6567
6810
|
),
|
|
6568
|
-
/* @__PURE__ */ (0,
|
|
6569
|
-
|
|
6811
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6812
|
+
import_antd26.Button,
|
|
6570
6813
|
{
|
|
6571
6814
|
type: "primary",
|
|
6572
|
-
icon: /* @__PURE__ */ (0,
|
|
6815
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.LinkOutlined, {}),
|
|
6573
6816
|
onClick: () => checkConnection(connection.id),
|
|
6574
6817
|
loading: connection.connecting,
|
|
6575
6818
|
style: { marginTop: 16 },
|
|
@@ -6581,9 +6824,9 @@ QUEUE_NAME=tasks`,
|
|
|
6581
6824
|
) }),
|
|
6582
6825
|
closable: connections.length > 1
|
|
6583
6826
|
}));
|
|
6584
|
-
return /* @__PURE__ */ (0,
|
|
6585
|
-
/* @__PURE__ */ (0,
|
|
6586
|
-
|
|
6827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6828
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6829
|
+
import_antd26.Modal,
|
|
6587
6830
|
{
|
|
6588
6831
|
open,
|
|
6589
6832
|
onCancel: onClose,
|
|
@@ -6591,8 +6834,8 @@ QUEUE_NAME=tasks`,
|
|
|
6591
6834
|
width: "80%",
|
|
6592
6835
|
footer: null,
|
|
6593
6836
|
title: "Settings",
|
|
6594
|
-
children: /* @__PURE__ */ (0,
|
|
6595
|
-
|
|
6837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6838
|
+
import_antd26.Tabs,
|
|
6596
6839
|
{
|
|
6597
6840
|
activeKey: activeTabKey,
|
|
6598
6841
|
onChange: handleTabChange,
|
|
@@ -6605,7 +6848,7 @@ QUEUE_NAME=tasks`,
|
|
|
6605
6848
|
}
|
|
6606
6849
|
},
|
|
6607
6850
|
items: tabItems,
|
|
6608
|
-
addIcon: /* @__PURE__ */ (0,
|
|
6851
|
+
addIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
6609
6852
|
"div",
|
|
6610
6853
|
{
|
|
6611
6854
|
style: {
|
|
@@ -6615,8 +6858,8 @@ QUEUE_NAME=tasks`,
|
|
|
6615
6858
|
padding: "4px 8px"
|
|
6616
6859
|
},
|
|
6617
6860
|
children: [
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
6619
|
-
/* @__PURE__ */ (0,
|
|
6861
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.PlusOutlined, {}),
|
|
6862
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: "Add Server" })
|
|
6620
6863
|
]
|
|
6621
6864
|
}
|
|
6622
6865
|
)
|
|
@@ -6624,8 +6867,8 @@ QUEUE_NAME=tasks`,
|
|
|
6624
6867
|
) })
|
|
6625
6868
|
}
|
|
6626
6869
|
),
|
|
6627
|
-
/* @__PURE__ */ (0,
|
|
6628
|
-
|
|
6870
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6871
|
+
import_antd26.Modal,
|
|
6629
6872
|
{
|
|
6630
6873
|
title: "Add New Server",
|
|
6631
6874
|
open: showAddServerModal,
|
|
@@ -6638,11 +6881,11 @@ QUEUE_NAME=tasks`,
|
|
|
6638
6881
|
},
|
|
6639
6882
|
confirmLoading: addingServer,
|
|
6640
6883
|
className: styles.addServerModal,
|
|
6641
|
-
children: /* @__PURE__ */ (0,
|
|
6642
|
-
/* @__PURE__ */ (0,
|
|
6643
|
-
/* @__PURE__ */ (0,
|
|
6644
|
-
/* @__PURE__ */ (0,
|
|
6645
|
-
|
|
6884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_antd26.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
6885
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6886
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
|
|
6887
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6888
|
+
import_antd26.Input,
|
|
6646
6889
|
{
|
|
6647
6890
|
placeholder: "e.g., Production Server",
|
|
6648
6891
|
value: newServerName,
|
|
@@ -6650,12 +6893,12 @@ QUEUE_NAME=tasks`,
|
|
|
6650
6893
|
onPressEnter: handleAddServer
|
|
6651
6894
|
}
|
|
6652
6895
|
),
|
|
6653
|
-
/* @__PURE__ */ (0,
|
|
6896
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
|
|
6654
6897
|
] }),
|
|
6655
|
-
/* @__PURE__ */ (0,
|
|
6656
|
-
/* @__PURE__ */ (0,
|
|
6657
|
-
/* @__PURE__ */ (0,
|
|
6658
|
-
|
|
6898
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6899
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
|
|
6900
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6901
|
+
import_antd26.Input,
|
|
6659
6902
|
{
|
|
6660
6903
|
placeholder: "e.g., http://localhost:4001",
|
|
6661
6904
|
value: newServerUrl,
|
|
@@ -6663,12 +6906,12 @@ QUEUE_NAME=tasks`,
|
|
|
6663
6906
|
onPressEnter: handleAddServer
|
|
6664
6907
|
}
|
|
6665
6908
|
),
|
|
6666
|
-
/* @__PURE__ */ (0,
|
|
6909
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
|
|
6667
6910
|
] }),
|
|
6668
|
-
/* @__PURE__ */ (0,
|
|
6669
|
-
/* @__PURE__ */ (0,
|
|
6670
|
-
/* @__PURE__ */ (0,
|
|
6671
|
-
|
|
6911
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6912
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
|
|
6913
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6914
|
+
import_antd26.Input.Password,
|
|
6672
6915
|
{
|
|
6673
6916
|
placeholder: "Optional: Enter API key for authentication",
|
|
6674
6917
|
value: newServerApiKey,
|
|
@@ -6676,7 +6919,7 @@ QUEUE_NAME=tasks`,
|
|
|
6676
6919
|
onPressEnter: handleAddServer
|
|
6677
6920
|
}
|
|
6678
6921
|
),
|
|
6679
|
-
/* @__PURE__ */ (0,
|
|
6922
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
|
|
6680
6923
|
] })
|
|
6681
6924
|
] })
|
|
6682
6925
|
}
|
|
@@ -6685,10 +6928,10 @@ QUEUE_NAME=tasks`,
|
|
|
6685
6928
|
};
|
|
6686
6929
|
|
|
6687
6930
|
// src/components/Chat/AgentServerSetting.tsx
|
|
6688
|
-
var
|
|
6931
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
6689
6932
|
var AgentServerSetting = () => {
|
|
6690
6933
|
const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
|
|
6691
|
-
return /* @__PURE__ */ (0,
|
|
6934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
6692
6935
|
SettingsModal,
|
|
6693
6936
|
{
|
|
6694
6937
|
open: settingsModalOpen,
|
|
@@ -6698,11 +6941,11 @@ var AgentServerSetting = () => {
|
|
|
6698
6941
|
};
|
|
6699
6942
|
|
|
6700
6943
|
// src/components/Chat/LatticeChatShell.tsx
|
|
6701
|
-
var
|
|
6944
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6702
6945
|
var LatticeChatShell = (props) => {
|
|
6703
|
-
return /* @__PURE__ */ (0,
|
|
6704
|
-
/* @__PURE__ */ (0,
|
|
6705
|
-
/* @__PURE__ */ (0,
|
|
6946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(LatticeChatShellContextProvider, { ...props, children: [
|
|
6947
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ConversationContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(LatticeChatView, {}) }) }),
|
|
6948
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(AgentServerSetting, {})
|
|
6706
6949
|
] });
|
|
6707
6950
|
};
|
|
6708
6951
|
// Annotate the CommonJS export names for ESM import in node:
|