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