@axiom-lattice/react-sdk 2.1.16 → 2.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -9
- package/dist/index.d.ts +2 -9
- package/dist/index.js +1041 -916
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +920 -790
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -8
package/dist/index.js
CHANGED
|
@@ -47,7 +47,6 @@ __export(index_exports, {
|
|
|
47
47
|
LatticeChatShell: () => LatticeChatShell,
|
|
48
48
|
LatticeChatShellContext: () => LatticeChatShellContext,
|
|
49
49
|
LatticeChatShellContextProvider: () => LatticeChatShellContextProvider,
|
|
50
|
-
MDMermaid: () => MDMermaid,
|
|
51
50
|
MDResponse: () => MDResponse,
|
|
52
51
|
MDViewFormItem: () => MDViewFormItem,
|
|
53
52
|
SideAppViewBrowser: () => SideAppViewBrowser,
|
|
@@ -638,7 +637,7 @@ function AgentThreadProvider({
|
|
|
638
637
|
}
|
|
639
638
|
}, []);
|
|
640
639
|
const resumeStream = (0, import_react3.useCallback)(
|
|
641
|
-
(messageId) => {
|
|
640
|
+
(messageId, onMessageChunk) => {
|
|
642
641
|
if (!threadId) {
|
|
643
642
|
throw new Error("Thread ID is required to resume stream");
|
|
644
643
|
}
|
|
@@ -672,7 +671,10 @@ function AgentThreadProvider({
|
|
|
672
671
|
};
|
|
673
672
|
const stopResumeStream = client.resumeStream(
|
|
674
673
|
resumeStreamOptions,
|
|
675
|
-
|
|
674
|
+
(chunk) => {
|
|
675
|
+
onMessageChunk?.(chunk);
|
|
676
|
+
handleStreamEvent(chunk);
|
|
677
|
+
},
|
|
676
678
|
async () => {
|
|
677
679
|
setState((prev) => ({
|
|
678
680
|
...prev,
|
|
@@ -722,7 +724,6 @@ function AgentThreadProvider({
|
|
|
722
724
|
lastAgentStateCreatedAtRef.current = currentCreatedAt;
|
|
723
725
|
}
|
|
724
726
|
let needUpdateFields = {};
|
|
725
|
-
let fetchedMessages = [];
|
|
726
727
|
needUpdateFields.agentState = agentState;
|
|
727
728
|
needUpdateFields.todos = agentState?.values?.todos;
|
|
728
729
|
const interrupts = agentState?.tasks?.flatMap(
|
|
@@ -738,19 +739,24 @@ function AgentThreadProvider({
|
|
|
738
739
|
}
|
|
739
740
|
);
|
|
740
741
|
needUpdateFields.interrupts = interrupts;
|
|
741
|
-
fetchedMessages = await client.getMessages({ threadId });
|
|
742
|
-
needUpdateFields.messages = fetchedMessages;
|
|
742
|
+
const fetchedMessages = await client.getMessages({ threadId });
|
|
743
743
|
chunkMessageMerger.current.reset();
|
|
744
744
|
chunkMessageMerger.current.initialMessages(fetchedMessages);
|
|
745
|
+
needUpdateFields.messages = chunkMessageMerger.current.getMessages();
|
|
745
746
|
setState((prev) => ({
|
|
746
747
|
...prev,
|
|
747
748
|
...needUpdateFields,
|
|
748
749
|
isLoading: false
|
|
749
750
|
}));
|
|
750
|
-
if (options.enableResumeStream &&
|
|
751
|
-
const lastMessage =
|
|
752
|
-
|
|
753
|
-
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
|
+
});
|
|
754
760
|
}
|
|
755
761
|
} catch (error) {
|
|
756
762
|
setState((prev) => ({
|
|
@@ -1324,99 +1330,244 @@ var ColumnLayout = ({
|
|
|
1324
1330
|
};
|
|
1325
1331
|
|
|
1326
1332
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
1327
|
-
var
|
|
1333
|
+
var import_icons13 = require("@ant-design/icons");
|
|
1328
1334
|
|
|
1329
1335
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
1330
|
-
var
|
|
1331
|
-
var
|
|
1336
|
+
var import_antd2 = require("antd");
|
|
1337
|
+
var import_react10 = require("react");
|
|
1332
1338
|
|
|
1333
1339
|
// src/components/GenUI/MDResponse.tsx
|
|
1334
|
-
var
|
|
1335
|
-
var
|
|
1336
|
-
var import_prism = require("react-syntax-highlighter/dist/cjs/styles/prism");
|
|
1337
|
-
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
1338
|
-
var import_react8 = require("react");
|
|
1340
|
+
var import_x_markdown = __toESM(require("@ant-design/x-markdown"));
|
|
1341
|
+
var import_react9 = require("react");
|
|
1339
1342
|
var import_antd_style2 = require("antd-style");
|
|
1340
|
-
var import_rehype_raw = __toESM(require("rehype-raw"));
|
|
1341
1343
|
|
|
1342
|
-
// src/components/GenUI/
|
|
1343
|
-
var
|
|
1344
|
+
// src/components/GenUI/Code.tsx
|
|
1345
|
+
var import_x = require("@ant-design/x");
|
|
1346
|
+
|
|
1347
|
+
// src/components/GenUI/ReactInfographic.tsx
|
|
1348
|
+
var import_infographic = require("@antv/infographic");
|
|
1344
1349
|
var import_react7 = require("react");
|
|
1345
|
-
var import_uuid = require("uuid");
|
|
1346
1350
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1347
|
-
var
|
|
1348
|
-
const
|
|
1349
|
-
const
|
|
1350
|
-
|
|
1351
|
-
const targetInternal = (0, import_react7.useRef)(null);
|
|
1351
|
+
var ReactInfographic = (props) => {
|
|
1352
|
+
const { children } = props;
|
|
1353
|
+
const $container = (0, import_react7.useRef)(null);
|
|
1354
|
+
let infographicInstance = (0, import_react7.useRef)(null);
|
|
1352
1355
|
(0, import_react7.useEffect)(() => {
|
|
1353
|
-
if (
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
theme: "default",
|
|
1357
|
-
securityLevel: "loose",
|
|
1358
|
-
themeCSS: `
|
|
1359
|
-
g.classGroup rect {
|
|
1360
|
-
fill: #282a36;
|
|
1361
|
-
stroke: #6272a4;
|
|
1362
|
-
}
|
|
1363
|
-
g.classGroup text {
|
|
1364
|
-
fill: #f8f8f2;
|
|
1365
|
-
}
|
|
1366
|
-
g.classGroup line {
|
|
1367
|
-
stroke: #f8f8f2;
|
|
1368
|
-
stroke-width: 0.5;
|
|
1369
|
-
}
|
|
1370
|
-
.classLabel .box {
|
|
1371
|
-
stroke: #21222c;
|
|
1372
|
-
stroke-width: 3;
|
|
1373
|
-
fill: #21222c;
|
|
1374
|
-
opacity: 1;
|
|
1375
|
-
}
|
|
1376
|
-
.classLabel .label {
|
|
1377
|
-
fill: #f1fa8c;
|
|
1378
|
-
}
|
|
1379
|
-
.relation {
|
|
1380
|
-
stroke: #ff79c6;
|
|
1381
|
-
stroke-width: 1;
|
|
1382
|
-
}
|
|
1383
|
-
#compositionStart, #compositionEnd {
|
|
1384
|
-
fill: #bd93f9;
|
|
1385
|
-
stroke: #bd93f9;
|
|
1386
|
-
stroke-width: 1;
|
|
1387
|
-
}
|
|
1388
|
-
#aggregationEnd, #aggregationStart {
|
|
1389
|
-
fill: #21222c;
|
|
1390
|
-
stroke: #50fa7b;
|
|
1391
|
-
stroke-width: 1;
|
|
1392
|
-
}
|
|
1393
|
-
#dependencyStart, #dependencyEnd {
|
|
1394
|
-
fill: #00bcd4;
|
|
1395
|
-
stroke: #00bcd4;
|
|
1396
|
-
stroke-width: 1;
|
|
1397
|
-
}
|
|
1398
|
-
#extensionStart, #extensionEnd {
|
|
1399
|
-
fill: #f8f8f2;
|
|
1400
|
-
stroke: #f8f8f2;
|
|
1401
|
-
stroke-width: 1;
|
|
1402
|
-
}
|
|
1403
|
-
`,
|
|
1404
|
-
fontFamily: "Fira Code",
|
|
1405
|
-
sequence: { showSequenceNumbers: true }
|
|
1406
|
-
});
|
|
1407
|
-
import_mermaid.default.render(domId.current, code, target.current).then((result) => {
|
|
1408
|
-
target.current.innerHTML = result.svg;
|
|
1409
|
-
}).catch((error) => {
|
|
1410
|
-
console.log(error);
|
|
1356
|
+
if ($container.current) {
|
|
1357
|
+
infographicInstance.current = new import_infographic.Infographic({
|
|
1358
|
+
container: $container.current
|
|
1411
1359
|
});
|
|
1412
1360
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1361
|
+
return () => {
|
|
1362
|
+
infographicInstance.current?.destroy();
|
|
1363
|
+
};
|
|
1364
|
+
}, []);
|
|
1365
|
+
(0, import_react7.useEffect)(() => {
|
|
1366
|
+
infographicInstance.current?.render(children);
|
|
1367
|
+
}, [children]);
|
|
1368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: $container });
|
|
1415
1369
|
};
|
|
1416
1370
|
|
|
1417
|
-
// src/components/GenUI/
|
|
1371
|
+
// src/components/GenUI/Code.tsx
|
|
1418
1372
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1419
|
-
var
|
|
1373
|
+
var Code = (props) => {
|
|
1374
|
+
const { className, children } = props;
|
|
1375
|
+
const language = className?.match(/language-(\w+)/)?.[1] || "";
|
|
1376
|
+
let childrenStr;
|
|
1377
|
+
if (typeof children === "string") {
|
|
1378
|
+
childrenStr = children;
|
|
1379
|
+
}
|
|
1380
|
+
if (Array.isArray(children)) {
|
|
1381
|
+
childrenStr = children.join("");
|
|
1382
|
+
}
|
|
1383
|
+
if (language) {
|
|
1384
|
+
const Element = getElement(language)?.card_view;
|
|
1385
|
+
if (Element) {
|
|
1386
|
+
let childrenData;
|
|
1387
|
+
try {
|
|
1388
|
+
childrenData = JSON.parse(childrenStr);
|
|
1389
|
+
} catch (error) {
|
|
1390
|
+
}
|
|
1391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Element, { component_key: language, data: childrenData });
|
|
1392
|
+
}
|
|
1393
|
+
switch (language) {
|
|
1394
|
+
case "infographic":
|
|
1395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ReactInfographic, { children });
|
|
1396
|
+
case "mermaid":
|
|
1397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_x.Mermaid, { children });
|
|
1398
|
+
default:
|
|
1399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_x.CodeHighlighter, { lang: language, children });
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_x.CodeHighlighter, { lang: language, children });
|
|
1403
|
+
};
|
|
1404
|
+
|
|
1405
|
+
// src/components/GenUI/MDComponentWrap.tsx
|
|
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");
|
|
1420
1571
|
var useStyles = (0, import_antd_style2.createStyles)(({ token, css }) => ({
|
|
1421
1572
|
markdownTableContainer: css`
|
|
1422
1573
|
overflow-x: auto;
|
|
@@ -1506,117 +1657,33 @@ var MDResponse = ({
|
|
|
1506
1657
|
noGenUI
|
|
1507
1658
|
}) => {
|
|
1508
1659
|
const { styles } = useStyles();
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
table({ node, ...props }) {
|
|
1518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles.markdownTableContainer, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("table", { className: styles.markdownTable, ...props }) });
|
|
1519
|
-
},
|
|
1520
|
-
th({ node, ...props }) {
|
|
1521
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { className: styles.markdownTh, ...props });
|
|
1522
|
-
},
|
|
1523
|
-
td({ node, ...props }) {
|
|
1524
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { className: styles.markdownTd, ...props });
|
|
1525
|
-
},
|
|
1526
|
-
tr({ node, ...props }) {
|
|
1527
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("tr", { className: styles.markdownTr, ...props });
|
|
1528
|
-
},
|
|
1529
|
-
code({ children, className, node, ...rest }) {
|
|
1530
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
1531
|
-
const language = match?.[1];
|
|
1532
|
-
if (language) {
|
|
1533
|
-
const Element = getElement(language)?.card_view;
|
|
1534
|
-
if (Element) {
|
|
1535
|
-
let childrenData;
|
|
1536
|
-
try {
|
|
1537
|
-
childrenData = JSON.parse(children);
|
|
1538
|
-
} catch (error) {
|
|
1539
|
-
}
|
|
1540
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1541
|
-
Element,
|
|
1542
|
-
{
|
|
1543
|
-
context,
|
|
1544
|
-
interactive,
|
|
1545
|
-
component_key: language,
|
|
1546
|
-
data: childrenData
|
|
1547
|
-
}
|
|
1548
|
-
);
|
|
1549
|
-
}
|
|
1550
|
-
switch (language) {
|
|
1551
|
-
case "mermaid":
|
|
1552
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MDMermaid, { children });
|
|
1553
|
-
default:
|
|
1554
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1555
|
-
SyntaxHighlighter,
|
|
1556
|
-
{
|
|
1557
|
-
...rest,
|
|
1558
|
-
PreTag: "div",
|
|
1559
|
-
language,
|
|
1560
|
-
style: import_prism.dark,
|
|
1561
|
-
children: String(children).replace(/\n$/, "")
|
|
1562
|
-
}
|
|
1563
|
-
);
|
|
1564
|
-
}
|
|
1565
|
-
} else {
|
|
1566
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { ...rest, className, children });
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
},
|
|
1570
|
-
remarkPlugins: [import_remark_gfm.default],
|
|
1571
|
-
rehypePlugins: [import_rehype_raw.default]
|
|
1572
|
-
}),
|
|
1573
|
-
[userData, interactive, embeddedLink, styles]
|
|
1574
|
-
);
|
|
1575
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles.markdownContainer, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_markdown.default, { ...config, children: content }) });
|
|
1660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: styles.markdownContainer, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1661
|
+
import_x_markdown.default,
|
|
1662
|
+
{
|
|
1663
|
+
components: mdComponents,
|
|
1664
|
+
content,
|
|
1665
|
+
paragraphTag: "div"
|
|
1666
|
+
}
|
|
1667
|
+
) });
|
|
1576
1668
|
};
|
|
1577
1669
|
var MDViewFormItem = ({ value }) => {
|
|
1578
|
-
return /* @__PURE__ */ (0,
|
|
1579
|
-
};
|
|
1580
|
-
var IFrameCard = ({ src }) => {
|
|
1581
|
-
const containerRef = (0, import_react8.useRef)(null);
|
|
1582
|
-
const [width, setWidth] = (0, import_react8.useState)("640px");
|
|
1583
|
-
const [height, setHeight] = (0, import_react8.useState)("320px");
|
|
1584
|
-
const valid_images = [
|
|
1585
|
-
"jpg",
|
|
1586
|
-
"jpeg",
|
|
1587
|
-
"png",
|
|
1588
|
-
"gif",
|
|
1589
|
-
"bmp",
|
|
1590
|
-
"svg",
|
|
1591
|
-
"tif",
|
|
1592
|
-
"tiff",
|
|
1593
|
-
"webp"
|
|
1594
|
-
];
|
|
1595
|
-
if (!src) {
|
|
1596
|
-
return null;
|
|
1597
|
-
}
|
|
1598
|
-
const spitedSrc = src.split(".");
|
|
1599
|
-
if (valid_images.includes(spitedSrc[spitedSrc.length - 1].toLowerCase())) {
|
|
1600
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { src, style: { width: "100%" } }) });
|
|
1601
|
-
} else {
|
|
1602
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: src, target: "_black", children: src }) });
|
|
1603
|
-
}
|
|
1670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MDResponse, { content: value || "" });
|
|
1604
1671
|
};
|
|
1605
1672
|
|
|
1606
1673
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
1607
|
-
var
|
|
1608
|
-
var { Text } =
|
|
1674
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1675
|
+
var { Text: Text2 } = import_antd2.Typography;
|
|
1609
1676
|
var ConfirmFeedback = ({
|
|
1610
1677
|
data,
|
|
1611
1678
|
interactive = true
|
|
1612
1679
|
}) => {
|
|
1613
1680
|
const { message: message5, type, config, feedback, options } = data ?? {};
|
|
1614
1681
|
const { sendMessage } = useAgentChat();
|
|
1615
|
-
const [clicked, setClicked] = (0,
|
|
1616
|
-
return /* @__PURE__ */ (0,
|
|
1617
|
-
/* @__PURE__ */ (0,
|
|
1618
|
-
options ? /* @__PURE__ */ (0,
|
|
1619
|
-
|
|
1682
|
+
const [clicked, setClicked] = (0, import_react10.useState)(false);
|
|
1683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd2.Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MDResponse, { content: message5 }),
|
|
1685
|
+
options ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd2.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1686
|
+
import_antd2.Button,
|
|
1620
1687
|
{
|
|
1621
1688
|
title: option.description,
|
|
1622
1689
|
disabled: !interactive || clicked || feedback,
|
|
@@ -1638,9 +1705,9 @@ var ConfirmFeedback = ({
|
|
|
1638
1705
|
children: option.label
|
|
1639
1706
|
},
|
|
1640
1707
|
option.value
|
|
1641
|
-
)) }) : /* @__PURE__ */ (0,
|
|
1642
|
-
/* @__PURE__ */ (0,
|
|
1643
|
-
|
|
1708
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd2.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: [
|
|
1709
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1710
|
+
import_antd2.Button,
|
|
1644
1711
|
{
|
|
1645
1712
|
disabled: !interactive || clicked || feedback,
|
|
1646
1713
|
style: {
|
|
@@ -1662,8 +1729,8 @@ var ConfirmFeedback = ({
|
|
|
1662
1729
|
children: "\u786E\u8BA4"
|
|
1663
1730
|
}
|
|
1664
1731
|
),
|
|
1665
|
-
/* @__PURE__ */ (0,
|
|
1666
|
-
|
|
1732
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1733
|
+
import_antd2.Button,
|
|
1667
1734
|
{
|
|
1668
1735
|
disabled: !interactive || clicked || feedback,
|
|
1669
1736
|
type: "default",
|
|
@@ -1689,155 +1756,10 @@ var ConfirmFeedback = ({
|
|
|
1689
1756
|
] });
|
|
1690
1757
|
};
|
|
1691
1758
|
|
|
1692
|
-
// src/components/GenUI/elements/generic_data_table.tsx
|
|
1693
|
-
var import_antd2 = require("antd");
|
|
1694
|
-
var import_react10 = require("react");
|
|
1695
|
-
var import_icons = require("@ant-design/icons");
|
|
1696
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1697
|
-
var { Text: Text2 } = import_antd2.Typography;
|
|
1698
|
-
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
1699
|
-
const { dataSource, message: message5 } = data ?? {};
|
|
1700
|
-
const [expandedRowKeys, setExpandedRowKeys] = (0, import_react10.useState)([]);
|
|
1701
|
-
const { openSideApp } = useChatUIContext();
|
|
1702
|
-
const processedData = dataSource?.map((item, index) => ({
|
|
1703
|
-
...item,
|
|
1704
|
-
key: `${index}_${JSON.stringify(item).slice(0, 20)}`
|
|
1705
|
-
})) || [];
|
|
1706
|
-
const generateColumns = (dataItem) => {
|
|
1707
|
-
if (!dataItem || typeof dataItem !== "object") {
|
|
1708
|
-
return [];
|
|
1709
|
-
}
|
|
1710
|
-
return Object.keys(dataItem).filter((key) => key !== "key" && key !== "expandItem").map((key) => ({
|
|
1711
|
-
title: formatColumnTitle(key),
|
|
1712
|
-
dataIndex: key,
|
|
1713
|
-
key,
|
|
1714
|
-
width: 150,
|
|
1715
|
-
sorter: (a, b) => {
|
|
1716
|
-
const aVal = a[key];
|
|
1717
|
-
const bVal = b[key];
|
|
1718
|
-
if (aVal === null || aVal === void 0) return 1;
|
|
1719
|
-
if (bVal === null || bVal === void 0) return -1;
|
|
1720
|
-
if (typeof aVal === "number" && typeof bVal === "number") {
|
|
1721
|
-
return aVal - bVal;
|
|
1722
|
-
}
|
|
1723
|
-
const aDate = new Date(aVal);
|
|
1724
|
-
const bDate = new Date(bVal);
|
|
1725
|
-
if (!isNaN(aDate.getTime()) && !isNaN(bDate.getTime())) {
|
|
1726
|
-
return aDate.getTime() - bDate.getTime();
|
|
1727
|
-
}
|
|
1728
|
-
return String(aVal).localeCompare(String(bVal), "zh-CN");
|
|
1729
|
-
},
|
|
1730
|
-
render: (value) => {
|
|
1731
|
-
if (value === null || value === void 0) {
|
|
1732
|
-
return "-";
|
|
1733
|
-
}
|
|
1734
|
-
if (typeof value === "object") {
|
|
1735
|
-
return JSON.stringify(value);
|
|
1736
|
-
}
|
|
1737
|
-
return String(value);
|
|
1738
|
-
}
|
|
1739
|
-
}));
|
|
1740
|
-
};
|
|
1741
|
-
const formatColumnTitle = (key) => {
|
|
1742
|
-
return key.replace(/([A-Z])/g, " $1").replace(/_/g, " ").replace(/^./, (str) => str.toUpperCase()).trim();
|
|
1743
|
-
};
|
|
1744
|
-
const columns = processedData.length > 0 ? generateColumns(processedData[0]) : [];
|
|
1745
|
-
const expandedRowRender = (record) => {
|
|
1746
|
-
const expandItem = record.expandItem;
|
|
1747
|
-
if (!expandItem) {
|
|
1748
|
-
return null;
|
|
1749
|
-
}
|
|
1750
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { padding: "16px" }, children: [
|
|
1751
|
-
expandItem.content && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { marginBottom: "16px" }, children: [
|
|
1752
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text2, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u8BE6\u7EC6\u4FE1\u606F:" }),
|
|
1753
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MDResponse, { content: expandItem.content })
|
|
1754
|
-
] }),
|
|
1755
|
-
expandItem.dataSource && expandItem.dataSource.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
|
|
1756
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text2, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u5B50\u8868\u6570\u636E:" }),
|
|
1757
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1758
|
-
GenericDataTable,
|
|
1759
|
-
{
|
|
1760
|
-
component_key: `nested_${record.key}`,
|
|
1761
|
-
data: {
|
|
1762
|
-
dataSource: expandItem.dataSource,
|
|
1763
|
-
message: void 0
|
|
1764
|
-
},
|
|
1765
|
-
interactive
|
|
1766
|
-
}
|
|
1767
|
-
)
|
|
1768
|
-
] })
|
|
1769
|
-
] });
|
|
1770
|
-
};
|
|
1771
|
-
const exportToExcel = () => {
|
|
1772
|
-
if (!processedData || processedData.length === 0) return;
|
|
1773
|
-
console.warn(
|
|
1774
|
-
"Export to Excel not implemented in SDK yet (requires xlsx dependency)"
|
|
1775
|
-
);
|
|
1776
|
-
};
|
|
1777
|
-
const hasExpandableRows = processedData.some((item) => item.expandItem);
|
|
1778
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1779
|
-
import_antd2.Table,
|
|
1780
|
-
{
|
|
1781
|
-
size: "small",
|
|
1782
|
-
title: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd2.Flex, { justify: "space-between", align: "center", children: [
|
|
1783
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd2.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text2, { strong: true, style: { fontSize: 16 }, children: message5 || "" }) }),
|
|
1784
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd2.Space, { children: [
|
|
1785
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1786
|
-
import_antd2.Button,
|
|
1787
|
-
{
|
|
1788
|
-
type: "text",
|
|
1789
|
-
size: "small",
|
|
1790
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.DownloadOutlined, {}),
|
|
1791
|
-
onClick: exportToExcel,
|
|
1792
|
-
disabled: !processedData || processedData.length === 0,
|
|
1793
|
-
children: "\u5BFC\u51FAExcel"
|
|
1794
|
-
}
|
|
1795
|
-
),
|
|
1796
|
-
default_open_in_side_app && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1797
|
-
import_antd2.Button,
|
|
1798
|
-
{
|
|
1799
|
-
type: "link",
|
|
1800
|
-
size: "small",
|
|
1801
|
-
onClick: () => {
|
|
1802
|
-
openSideApp({
|
|
1803
|
-
component_key: "generic_data_table",
|
|
1804
|
-
message: message5 || "",
|
|
1805
|
-
data: { dataSource, message: message5 }
|
|
1806
|
-
});
|
|
1807
|
-
},
|
|
1808
|
-
children: [
|
|
1809
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.ExpandAltOutlined, {}),
|
|
1810
|
-
"\u5C55\u5F00"
|
|
1811
|
-
]
|
|
1812
|
-
}
|
|
1813
|
-
)
|
|
1814
|
-
] })
|
|
1815
|
-
] }),
|
|
1816
|
-
dataSource: processedData,
|
|
1817
|
-
columns,
|
|
1818
|
-
pagination: {
|
|
1819
|
-
pageSize: 10,
|
|
1820
|
-
showSizeChanger: true,
|
|
1821
|
-
showQuickJumper: true,
|
|
1822
|
-
showTotal: (total, range) => `\u7B2C ${range[0]}-${range[1]} \u6761/\u5171 ${total} \u6761`
|
|
1823
|
-
},
|
|
1824
|
-
scroll: { x: "max-content" },
|
|
1825
|
-
expandable: hasExpandableRows ? {
|
|
1826
|
-
expandedRowRender,
|
|
1827
|
-
expandedRowKeys,
|
|
1828
|
-
onExpandedRowsChange: (keys) => setExpandedRowKeys(keys),
|
|
1829
|
-
rowExpandable: (record) => !!record.expandItem
|
|
1830
|
-
} : void 0,
|
|
1831
|
-
rowKey: "key",
|
|
1832
|
-
bordered: true
|
|
1833
|
-
}
|
|
1834
|
-
);
|
|
1835
|
-
};
|
|
1836
|
-
|
|
1837
1759
|
// src/components/GenUI/elements/generic_data_table_side_app.tsx
|
|
1838
|
-
var
|
|
1760
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1839
1761
|
var GenericDataTableSideApp = (props) => {
|
|
1840
|
-
return /* @__PURE__ */ (0,
|
|
1762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GenericDataTable, { ...props, default_open_in_side_app: false });
|
|
1841
1763
|
};
|
|
1842
1764
|
|
|
1843
1765
|
// src/components/GenUI/elements/ToolCall.tsx
|
|
@@ -1849,7 +1771,7 @@ var import_icons3 = require("@ant-design/icons");
|
|
|
1849
1771
|
var import_antd3 = require("antd");
|
|
1850
1772
|
var import_antd_style3 = require("antd-style");
|
|
1851
1773
|
var import_icons2 = require("@ant-design/icons");
|
|
1852
|
-
var
|
|
1774
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1853
1775
|
var { Text: Text3, Title } = import_antd3.Typography;
|
|
1854
1776
|
var useStyle2 = (0, import_antd_style3.createStyles)(({ token, css }) => ({
|
|
1855
1777
|
card: css`
|
|
@@ -1919,7 +1841,7 @@ var ToolCard = ({
|
|
|
1919
1841
|
}) => {
|
|
1920
1842
|
const { styles } = useStyle2();
|
|
1921
1843
|
if (!data || !data.name) {
|
|
1922
|
-
return /* @__PURE__ */ (0,
|
|
1844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_antd3.Card, { size: "small", className: styles.card, bordered: false, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text3, { type: "secondary", children: "Invalid tool data" }) });
|
|
1923
1845
|
}
|
|
1924
1846
|
const formatToolName = (name) => {
|
|
1925
1847
|
return name.replace(/([a-z])([A-Z])/g, "$1 $2").split(/[_-]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
@@ -1962,7 +1884,7 @@ var ToolCard = ({
|
|
|
1962
1884
|
return typeof value;
|
|
1963
1885
|
};
|
|
1964
1886
|
const hasParameters = data.parameters && Object.keys(data.parameters).length > 0;
|
|
1965
|
-
return /* @__PURE__ */ (0,
|
|
1887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1966
1888
|
import_antd3.Card,
|
|
1967
1889
|
{
|
|
1968
1890
|
size: "small",
|
|
@@ -1970,13 +1892,13 @@ var ToolCard = ({
|
|
|
1970
1892
|
bordered: false,
|
|
1971
1893
|
bodyStyle: { padding: "16px" },
|
|
1972
1894
|
children: [
|
|
1973
|
-
/* @__PURE__ */ (0,
|
|
1974
|
-
/* @__PURE__ */ (0,
|
|
1975
|
-
/* @__PURE__ */ (0,
|
|
1976
|
-
/* @__PURE__ */ (0,
|
|
1977
|
-
data.type && /* @__PURE__ */ (0,
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: styles.header, children: [
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_antd3.Space, { align: "center", children: [
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons2.ToolOutlined, { style: { color: "#1890ff", fontSize: "18px" } }),
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Title, { level: 5, className: styles.toolName, style: { margin: 0 }, children: formatToolName(data.name) }),
|
|
1899
|
+
data.type && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_antd3.Tag, { color: "blue", className: styles.typeTag, children: data.type })
|
|
1978
1900
|
] }),
|
|
1979
|
-
data.description && /* @__PURE__ */ (0,
|
|
1901
|
+
data.description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1980
1902
|
Text3,
|
|
1981
1903
|
{
|
|
1982
1904
|
type: "secondary",
|
|
@@ -1985,19 +1907,19 @@ var ToolCard = ({
|
|
|
1985
1907
|
}
|
|
1986
1908
|
)
|
|
1987
1909
|
] }),
|
|
1988
|
-
hasParameters ? /* @__PURE__ */ (0,
|
|
1989
|
-
/* @__PURE__ */ (0,
|
|
1990
|
-
/* @__PURE__ */ (0,
|
|
1991
|
-
/* @__PURE__ */ (0,
|
|
1910
|
+
hasParameters ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_antd3.Space, { align: "center", style: { marginBottom: "12px" }, children: [
|
|
1912
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons2.CodeOutlined, { style: { color: "#52c41a", fontSize: "14px" } }),
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text3, { strong: true, style: { fontSize: "14px" }, children: [
|
|
1992
1914
|
"Parameters (",
|
|
1993
1915
|
Object.keys(data.parameters).length,
|
|
1994
1916
|
")"
|
|
1995
1917
|
] })
|
|
1996
1918
|
] }),
|
|
1997
|
-
/* @__PURE__ */ (0,
|
|
1998
|
-
/* @__PURE__ */ (0,
|
|
1999
|
-
/* @__PURE__ */ (0,
|
|
2000
|
-
/* @__PURE__ */ (0,
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.parameterGrid, children: Object.entries(data.parameters).map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: styles.parameterItem, children: [
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.parameterName, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_antd3.Space, { align: "center", children: [
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: key }),
|
|
1922
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2001
1923
|
import_antd3.Tag,
|
|
2002
1924
|
{
|
|
2003
1925
|
color: getTypeColor(value),
|
|
@@ -2006,11 +1928,11 @@ var ToolCard = ({
|
|
|
2006
1928
|
}
|
|
2007
1929
|
)
|
|
2008
1930
|
] }) }),
|
|
2009
|
-
/* @__PURE__ */ (0,
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.parameterValue, children: formatParameterValue(value) })
|
|
2010
1932
|
] }, index)) })
|
|
2011
|
-
] }) : /* @__PURE__ */ (0,
|
|
2012
|
-
/* @__PURE__ */ (0,
|
|
2013
|
-
/* @__PURE__ */ (0,
|
|
1933
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_antd3.Space, { align: "center", children: [
|
|
1934
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons2.CodeOutlined, { style: { color: "#d9d9d9", fontSize: "14px" } }),
|
|
1935
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text3, { type: "secondary", style: { fontSize: "13px" }, children: "No parameters" })
|
|
2014
1936
|
] })
|
|
2015
1937
|
]
|
|
2016
1938
|
}
|
|
@@ -2018,15 +1940,15 @@ var ToolCard = ({
|
|
|
2018
1940
|
};
|
|
2019
1941
|
|
|
2020
1942
|
// src/components/GenUI/elements/ToolCall.tsx
|
|
2021
|
-
var
|
|
1943
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2022
1944
|
function getStatusIcon(status) {
|
|
2023
1945
|
switch (status) {
|
|
2024
1946
|
case "success":
|
|
2025
|
-
return /* @__PURE__ */ (0,
|
|
1947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.CheckCircleOutlined, { style: { color: "#52c41a" } });
|
|
2026
1948
|
case "error":
|
|
2027
|
-
return /* @__PURE__ */ (0,
|
|
1949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.InfoCircleOutlined, { style: { color: "#ff4d4f" } });
|
|
2028
1950
|
default:
|
|
2029
|
-
return /* @__PURE__ */ (0,
|
|
1951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons3.LoadingOutlined, { style: { color: "#1890ff" } });
|
|
2030
1952
|
}
|
|
2031
1953
|
}
|
|
2032
1954
|
var ToolCall = ({ data }) => {
|
|
@@ -2049,9 +1971,9 @@ var ToolCall = ({ data }) => {
|
|
|
2049
1971
|
return "Error parsing args";
|
|
2050
1972
|
}
|
|
2051
1973
|
};
|
|
2052
|
-
const header = /* @__PURE__ */ (0,
|
|
2053
|
-
/* @__PURE__ */ (0,
|
|
2054
|
-
/* @__PURE__ */ (0,
|
|
1974
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_antd4.Flex, { align: "center", wrap: "wrap", children: [
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd4.Typography.Text, { strong: true, children: formatToolName(toolCallData.name) }),
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2055
1977
|
import_antd4.Typography.Text,
|
|
2056
1978
|
{
|
|
2057
1979
|
type: "secondary",
|
|
@@ -2065,8 +1987,8 @@ var ToolCall = ({ data }) => {
|
|
|
2065
1987
|
parameters: toolCallData.args,
|
|
2066
1988
|
type: "tool_call"
|
|
2067
1989
|
};
|
|
2068
|
-
const content = /* @__PURE__ */ (0,
|
|
2069
|
-
/* @__PURE__ */ (0,
|
|
1990
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { marginTop: "8px" }, children: [
|
|
1991
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2070
1992
|
ToolCard,
|
|
2071
1993
|
{
|
|
2072
1994
|
data: toolCardData,
|
|
@@ -2074,8 +1996,8 @@ var ToolCall = ({ data }) => {
|
|
|
2074
1996
|
interactive: false
|
|
2075
1997
|
}
|
|
2076
1998
|
),
|
|
2077
|
-
toolCallData.response && /* @__PURE__ */ (0,
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
1999
|
+
toolCallData.response && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { marginTop: "12px" }, children: [
|
|
2000
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2079
2001
|
import_antd4.Typography.Text,
|
|
2080
2002
|
{
|
|
2081
2003
|
strong: true,
|
|
@@ -2083,7 +2005,7 @@ var ToolCall = ({ data }) => {
|
|
|
2083
2005
|
children: "Response:"
|
|
2084
2006
|
}
|
|
2085
2007
|
),
|
|
2086
|
-
/* @__PURE__ */ (0,
|
|
2008
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MDResponse, { content: toolCallData.response })
|
|
2087
2009
|
] })
|
|
2088
2010
|
] });
|
|
2089
2011
|
const expandIcon = ({ isActive }) => {
|
|
@@ -2096,14 +2018,14 @@ var ToolCall = ({ data }) => {
|
|
|
2096
2018
|
component_key: toolCallData.id
|
|
2097
2019
|
});
|
|
2098
2020
|
}
|
|
2099
|
-
return /* @__PURE__ */ (0,
|
|
2021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2100
2022
|
import_antd4.Collapse,
|
|
2101
2023
|
{
|
|
2102
2024
|
size: "small",
|
|
2103
2025
|
bordered: false,
|
|
2104
2026
|
defaultActiveKey: [],
|
|
2105
2027
|
expandIcon,
|
|
2106
|
-
children: /* @__PURE__ */ (0,
|
|
2028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2107
2029
|
import_CollapsePanel.default,
|
|
2108
2030
|
{
|
|
2109
2031
|
header,
|
|
@@ -2120,7 +2042,8 @@ var ToolCall = ({ data }) => {
|
|
|
2120
2042
|
var import_antd5 = require("antd");
|
|
2121
2043
|
var import_antd_style4 = require("antd-style");
|
|
2122
2044
|
var import_icons4 = require("@ant-design/icons");
|
|
2123
|
-
var
|
|
2045
|
+
var import_react11 = require("react");
|
|
2046
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2124
2047
|
var { Text: Text4 } = import_antd5.Typography;
|
|
2125
2048
|
var useStyle3 = (0, import_antd_style4.createStyles)(({ token, css }) => ({
|
|
2126
2049
|
card: css`
|
|
@@ -2151,17 +2074,19 @@ var useStyle3 = (0, import_antd_style4.createStyles)(({ token, css }) => ({
|
|
|
2151
2074
|
var Todo = ({
|
|
2152
2075
|
data,
|
|
2153
2076
|
component_key,
|
|
2154
|
-
interactive = true
|
|
2077
|
+
interactive = true,
|
|
2078
|
+
focusMode = false
|
|
2155
2079
|
}) => {
|
|
2156
2080
|
const { styles } = useStyle3();
|
|
2081
|
+
const [isExpanded, setIsExpanded] = (0, import_react11.useState)(false);
|
|
2157
2082
|
const getStatusIcon2 = (status) => {
|
|
2158
2083
|
switch (status) {
|
|
2159
2084
|
case "completed":
|
|
2160
|
-
return /* @__PURE__ */ (0,
|
|
2085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.CheckCircleOutlined, { style: { color: "#52c41a" } });
|
|
2161
2086
|
case "in_progress":
|
|
2162
|
-
return /* @__PURE__ */ (0,
|
|
2087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.ArrowRightOutlined, { style: { fontWeight: "500" } });
|
|
2163
2088
|
case "pending":
|
|
2164
|
-
return /* @__PURE__ */ (0,
|
|
2089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.ClockCircleOutlined, { style: { color: "gray" } });
|
|
2165
2090
|
default:
|
|
2166
2091
|
return null;
|
|
2167
2092
|
}
|
|
@@ -2202,36 +2127,69 @@ var Todo = ({
|
|
|
2202
2127
|
return "";
|
|
2203
2128
|
}
|
|
2204
2129
|
};
|
|
2130
|
+
const getFilteredData = () => {
|
|
2131
|
+
if (!data || !Array.isArray(data)) {
|
|
2132
|
+
return [];
|
|
2133
|
+
}
|
|
2134
|
+
if (!focusMode || data.length <= 3) {
|
|
2135
|
+
return data;
|
|
2136
|
+
}
|
|
2137
|
+
const firstInProgressIndex = data.findIndex(
|
|
2138
|
+
(item) => item.status === "in_progress"
|
|
2139
|
+
);
|
|
2140
|
+
if (firstInProgressIndex !== -1) {
|
|
2141
|
+
return data.slice(firstInProgressIndex, firstInProgressIndex + 3);
|
|
2142
|
+
}
|
|
2143
|
+
const allCompleted = data.every((item) => item.status === "completed");
|
|
2144
|
+
if (allCompleted) {
|
|
2145
|
+
return data.slice(-3);
|
|
2146
|
+
}
|
|
2147
|
+
return data.slice(0, 3);
|
|
2148
|
+
};
|
|
2205
2149
|
if (!data || !Array.isArray(data)) {
|
|
2206
|
-
return /* @__PURE__ */ (0,
|
|
2150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2207
2151
|
import_antd5.Card,
|
|
2208
2152
|
{
|
|
2209
2153
|
size: "small",
|
|
2210
2154
|
className: `shadow-sm ${styles.card}`,
|
|
2211
2155
|
bordered: false,
|
|
2212
|
-
children: /* @__PURE__ */ (0,
|
|
2156
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text4, { type: "secondary", children: "No todo items available" })
|
|
2213
2157
|
}
|
|
2214
2158
|
);
|
|
2215
2159
|
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2160
|
+
const filteredData = getFilteredData();
|
|
2161
|
+
const hasMoreItems = filteredData.length < data.length;
|
|
2162
|
+
const displayData = isExpanded ? data : filteredData;
|
|
2163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd5.Card, { size: "small", className: `shadow-sm ${styles.card}`, bordered: false, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_antd5.Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
2164
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2218
2165
|
import_antd5.List,
|
|
2219
2166
|
{
|
|
2220
2167
|
size: "small",
|
|
2221
|
-
dataSource:
|
|
2222
|
-
renderItem: (item, index) => /* @__PURE__ */ (0,
|
|
2168
|
+
dataSource: displayData,
|
|
2169
|
+
renderItem: (item, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2223
2170
|
import_antd5.List.Item,
|
|
2224
2171
|
{
|
|
2225
2172
|
className: `${styles.todoItem} ${getItemClassName(item.status)}`,
|
|
2226
|
-
children: /* @__PURE__ */ (0,
|
|
2173
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_antd5.Space, { align: "center", style: { width: "100%" }, children: [
|
|
2227
2174
|
getStatusIcon2(item.status),
|
|
2228
|
-
/* @__PURE__ */ (0,
|
|
2175
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text4, { style: { flex: 1 }, children: item.content })
|
|
2229
2176
|
] })
|
|
2230
2177
|
}
|
|
2231
2178
|
)
|
|
2232
2179
|
}
|
|
2233
2180
|
),
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2181
|
+
hasMoreItems && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2182
|
+
import_antd5.Button,
|
|
2183
|
+
{
|
|
2184
|
+
type: "link",
|
|
2185
|
+
size: "small",
|
|
2186
|
+
icon: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.UpOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.DownOutlined, {}),
|
|
2187
|
+
onClick: () => setIsExpanded(!isExpanded),
|
|
2188
|
+
style: { padding: 0, height: "auto" },
|
|
2189
|
+
children: isExpanded ? "Collapse" : `Show all ${data.length} items (${data.length - filteredData.length} hidden)`
|
|
2190
|
+
}
|
|
2191
|
+
),
|
|
2192
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text4, { type: "secondary", style: { fontSize: 12 }, children: [
|
|
2235
2193
|
"Total items: ",
|
|
2236
2194
|
data.length,
|
|
2237
2195
|
" | Completed:",
|
|
@@ -2250,7 +2208,7 @@ var Todo = ({
|
|
|
2250
2208
|
var import_antd6 = require("antd");
|
|
2251
2209
|
var import_icons5 = require("@ant-design/icons");
|
|
2252
2210
|
var import_CollapsePanel2 = __toESM(require("antd/es/collapse/CollapsePanel"));
|
|
2253
|
-
var
|
|
2211
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2254
2212
|
var { Text: Text5 } = import_antd6.Typography;
|
|
2255
2213
|
var WriteTodos = ({
|
|
2256
2214
|
data,
|
|
@@ -2264,11 +2222,11 @@ var WriteTodos = ({
|
|
|
2264
2222
|
(item) => item.status === "completed"
|
|
2265
2223
|
).length;
|
|
2266
2224
|
const expandIcon = () => {
|
|
2267
|
-
return /* @__PURE__ */ (0,
|
|
2225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons5.UnorderedListOutlined, {});
|
|
2268
2226
|
};
|
|
2269
|
-
const header = /* @__PURE__ */ (0,
|
|
2270
|
-
/* @__PURE__ */ (0,
|
|
2271
|
-
/* @__PURE__ */ (0,
|
|
2227
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_antd6.Space, { children: [
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text5, { strong: true, children: "TODOs" }),
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text5, { style: { fontSize: 12 }, type: "secondary", children: [
|
|
2272
2230
|
completedCount,
|
|
2273
2231
|
"/",
|
|
2274
2232
|
totalCount,
|
|
@@ -2278,24 +2236,25 @@ var WriteTodos = ({
|
|
|
2278
2236
|
if (!toolCallData) {
|
|
2279
2237
|
return null;
|
|
2280
2238
|
}
|
|
2281
|
-
return /* @__PURE__ */ (0,
|
|
2239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2282
2240
|
import_antd6.Collapse,
|
|
2283
2241
|
{
|
|
2284
2242
|
size: "small",
|
|
2285
2243
|
bordered: false,
|
|
2286
2244
|
defaultActiveKey: [toolCallData.id],
|
|
2287
2245
|
expandIcon,
|
|
2288
|
-
children: /* @__PURE__ */ (0,
|
|
2246
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2289
2247
|
import_CollapsePanel2.default,
|
|
2290
2248
|
{
|
|
2291
2249
|
header,
|
|
2292
2250
|
style: { minWidth: 400 },
|
|
2293
|
-
children: /* @__PURE__ */ (0,
|
|
2251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2294
2252
|
Todo,
|
|
2295
2253
|
{
|
|
2296
2254
|
data: data.args.todos,
|
|
2297
2255
|
component_key,
|
|
2298
|
-
interactive
|
|
2256
|
+
interactive,
|
|
2257
|
+
focusMode: true
|
|
2299
2258
|
}
|
|
2300
2259
|
)
|
|
2301
2260
|
},
|
|
@@ -2306,47 +2265,47 @@ var WriteTodos = ({
|
|
|
2306
2265
|
};
|
|
2307
2266
|
|
|
2308
2267
|
// src/components/GenUI/FileExplorer.tsx
|
|
2309
|
-
var
|
|
2268
|
+
var import_react12 = require("react");
|
|
2310
2269
|
var import_antd7 = require("antd");
|
|
2311
2270
|
var import_icons7 = require("@ant-design/icons");
|
|
2312
2271
|
var import_antd_style5 = require("antd-style");
|
|
2313
2272
|
|
|
2314
2273
|
// src/components/GenUI/elements/getFileIcon.tsx
|
|
2315
2274
|
var import_icons6 = require("@ant-design/icons");
|
|
2316
|
-
var
|
|
2275
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2317
2276
|
var getFileIcon = (filename) => {
|
|
2318
2277
|
const ext = filename?.split(".")?.pop()?.toLowerCase();
|
|
2319
2278
|
const iconStyle = { fontSize: 14, marginRight: 4, verticalAlign: "middle" };
|
|
2320
2279
|
switch (ext) {
|
|
2321
2280
|
case "ts":
|
|
2322
2281
|
case "tsx":
|
|
2323
|
-
return /* @__PURE__ */ (0,
|
|
2282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.CodeOutlined, { style: { ...iconStyle, color: "#3178c6" } });
|
|
2324
2283
|
case "js":
|
|
2325
2284
|
case "jsx":
|
|
2326
|
-
return /* @__PURE__ */ (0,
|
|
2285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.CodeOutlined, { style: { ...iconStyle, color: "#f7df1e" } });
|
|
2327
2286
|
case "html":
|
|
2328
|
-
return /* @__PURE__ */ (0,
|
|
2287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.Html5Outlined, { style: { ...iconStyle, color: "#e34c26" } });
|
|
2329
2288
|
case "css":
|
|
2330
2289
|
case "less":
|
|
2331
2290
|
case "scss":
|
|
2332
|
-
return /* @__PURE__ */ (0,
|
|
2291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileUnknownOutlined, { style: { ...iconStyle, color: "#563d7c" } });
|
|
2333
2292
|
case "md":
|
|
2334
|
-
return /* @__PURE__ */ (0,
|
|
2293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileMarkdownOutlined, { style: { ...iconStyle, color: "#083fa1" } });
|
|
2335
2294
|
case "json":
|
|
2336
|
-
return /* @__PURE__ */ (0,
|
|
2295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileTextOutlined, { style: { ...iconStyle, color: "#fbc02d" } });
|
|
2337
2296
|
case "png":
|
|
2338
2297
|
case "jpg":
|
|
2339
2298
|
case "jpeg":
|
|
2340
2299
|
case "gif":
|
|
2341
2300
|
case "svg":
|
|
2342
|
-
return /* @__PURE__ */ (0,
|
|
2301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileImageOutlined, { style: { ...iconStyle, color: "#4caf50" } });
|
|
2343
2302
|
default:
|
|
2344
|
-
return /* @__PURE__ */ (0,
|
|
2303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons6.FileOutlined, { style: { ...iconStyle, color: "#9e9e9e" } });
|
|
2345
2304
|
}
|
|
2346
2305
|
};
|
|
2347
2306
|
|
|
2348
2307
|
// src/components/GenUI/FileExplorer.tsx
|
|
2349
|
-
var
|
|
2308
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2350
2309
|
var useStyles2 = (0, import_antd_style5.createStyles)(({ token, css }) => ({
|
|
2351
2310
|
container: css`
|
|
2352
2311
|
height: 100%;
|
|
@@ -2478,7 +2437,7 @@ var getFolderIcon = (expanded) => {
|
|
|
2478
2437
|
color: "#dcb67a",
|
|
2479
2438
|
verticalAlign: "middle"
|
|
2480
2439
|
};
|
|
2481
|
-
return expanded ? /* @__PURE__ */ (0,
|
|
2440
|
+
return expanded ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.FolderOpenOutlined, { style: iconStyle }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.FolderOutlined, { style: iconStyle });
|
|
2482
2441
|
};
|
|
2483
2442
|
var sortTreeNodes = (nodes) => {
|
|
2484
2443
|
return nodes.sort((a, b) => {
|
|
@@ -2503,7 +2462,7 @@ var buildTreeData = (files, expandedKeys) => {
|
|
|
2503
2462
|
const key = parts.slice(0, index + 1).join("/");
|
|
2504
2463
|
let existingNode = currentLevel.find((node) => node.key === key);
|
|
2505
2464
|
if (!existingNode) {
|
|
2506
|
-
const title = part === "" && index === 0 ? /* @__PURE__ */ (0,
|
|
2465
|
+
const title = part === "" && index === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2507
2466
|
"span",
|
|
2508
2467
|
{
|
|
2509
2468
|
style: {
|
|
@@ -2538,17 +2497,17 @@ var FileExplorer = ({
|
|
|
2538
2497
|
}) => {
|
|
2539
2498
|
const { files } = data ?? {};
|
|
2540
2499
|
const { styles, cx } = useStyles2();
|
|
2541
|
-
const [fileList, setFileList] = (0,
|
|
2542
|
-
const [selectedKey, setSelectedKey] = (0,
|
|
2543
|
-
const [expandedKeys, setExpandedKeys] = (0,
|
|
2544
|
-
const [copied, setCopied] = (0,
|
|
2545
|
-
(0,
|
|
2500
|
+
const [fileList, setFileList] = (0, import_react12.useState)([]);
|
|
2501
|
+
const [selectedKey, setSelectedKey] = (0, import_react12.useState)("");
|
|
2502
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react12.useState)([]);
|
|
2503
|
+
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
2504
|
+
(0, import_react12.useEffect)(() => {
|
|
2546
2505
|
if (copied) {
|
|
2547
2506
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
2548
2507
|
return () => clearTimeout(timer);
|
|
2549
2508
|
}
|
|
2550
2509
|
}, [copied]);
|
|
2551
|
-
(0,
|
|
2510
|
+
(0, import_react12.useEffect)(() => {
|
|
2552
2511
|
let list = [];
|
|
2553
2512
|
if (Array.isArray(files)) {
|
|
2554
2513
|
list = files;
|
|
@@ -2564,11 +2523,11 @@ var FileExplorer = ({
|
|
|
2564
2523
|
setSelectedKey(list[0].name);
|
|
2565
2524
|
}
|
|
2566
2525
|
}, [files]);
|
|
2567
|
-
const treeData = (0,
|
|
2526
|
+
const treeData = (0, import_react12.useMemo)(
|
|
2568
2527
|
() => buildTreeData(fileList, expandedKeys),
|
|
2569
2528
|
[fileList, expandedKeys]
|
|
2570
2529
|
);
|
|
2571
|
-
(0,
|
|
2530
|
+
(0, import_react12.useEffect)(() => {
|
|
2572
2531
|
if (treeData.length > 0 && expandedKeys.length === 0) {
|
|
2573
2532
|
const getAllKeys = (nodes) => {
|
|
2574
2533
|
let keys = [];
|
|
@@ -2585,7 +2544,7 @@ var FileExplorer = ({
|
|
|
2585
2544
|
setExpandedKeys(getAllKeys(treeData));
|
|
2586
2545
|
}
|
|
2587
2546
|
}, [treeData.length]);
|
|
2588
|
-
const selectedFile = (0,
|
|
2547
|
+
const selectedFile = (0, import_react12.useMemo)(() => {
|
|
2589
2548
|
return fileList.find((f) => f.name === selectedKey);
|
|
2590
2549
|
}, [fileList, selectedKey]);
|
|
2591
2550
|
const handleCopy = () => {
|
|
@@ -2612,7 +2571,7 @@ var FileExplorer = ({
|
|
|
2612
2571
|
};
|
|
2613
2572
|
const renderContent = () => {
|
|
2614
2573
|
if (!selectedFile) {
|
|
2615
|
-
return /* @__PURE__ */ (0,
|
|
2574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.emptyState, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2616
2575
|
import_antd7.Empty,
|
|
2617
2576
|
{
|
|
2618
2577
|
description: "Select a file to preview",
|
|
@@ -2621,38 +2580,38 @@ var FileExplorer = ({
|
|
|
2621
2580
|
) });
|
|
2622
2581
|
}
|
|
2623
2582
|
const content = Array.isArray(selectedFile.content) ? selectedFile.content.join("\n") : selectedFile.content;
|
|
2624
|
-
return /* @__PURE__ */ (0,
|
|
2583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2625
2584
|
"div",
|
|
2626
2585
|
{
|
|
2627
2586
|
style: { minHeight: "100%", display: "flex", flexDirection: "column" },
|
|
2628
2587
|
children: [
|
|
2629
|
-
/* @__PURE__ */ (0,
|
|
2630
|
-
/* @__PURE__ */ (0,
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: styles.header, children: [
|
|
2589
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd7.Tooltip, { title: "Copy Content", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2631
2590
|
import_antd7.Button,
|
|
2632
2591
|
{
|
|
2633
2592
|
type: "text",
|
|
2634
|
-
icon: copied ? /* @__PURE__ */ (0,
|
|
2593
|
+
icon: copied ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.CheckOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.CopyOutlined, {}),
|
|
2635
2594
|
onClick: handleCopy,
|
|
2636
2595
|
size: "small"
|
|
2637
2596
|
}
|
|
2638
2597
|
) }),
|
|
2639
|
-
/* @__PURE__ */ (0,
|
|
2598
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd7.Tooltip, { title: "Download File", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2640
2599
|
import_antd7.Button,
|
|
2641
2600
|
{
|
|
2642
2601
|
type: "text",
|
|
2643
|
-
icon: /* @__PURE__ */ (0,
|
|
2602
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons7.DownloadOutlined, {}),
|
|
2644
2603
|
onClick: handleDownload,
|
|
2645
2604
|
size: "small"
|
|
2646
2605
|
}
|
|
2647
2606
|
) })
|
|
2648
2607
|
] }),
|
|
2649
|
-
/* @__PURE__ */ (0,
|
|
2608
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.contentBody, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MDResponse, { content }) })
|
|
2650
2609
|
]
|
|
2651
2610
|
}
|
|
2652
2611
|
);
|
|
2653
2612
|
};
|
|
2654
|
-
return /* @__PURE__ */ (0,
|
|
2655
|
-
/* @__PURE__ */ (0,
|
|
2613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_antd7.Splitter, { className: styles.splitter, children: [
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd7.Splitter.Panel, { defaultSize: "25%", min: "15%", max: "40%", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.leftPanel, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2656
2615
|
import_antd7.Tree,
|
|
2657
2616
|
{
|
|
2658
2617
|
showIcon: true,
|
|
@@ -2690,16 +2649,16 @@ var FileExplorer = ({
|
|
|
2690
2649
|
}
|
|
2691
2650
|
}
|
|
2692
2651
|
) }) }),
|
|
2693
|
-
/* @__PURE__ */ (0,
|
|
2652
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd7.Splitter.Panel, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: styles.rightPanel, children: renderContent() }) })
|
|
2694
2653
|
] }) });
|
|
2695
2654
|
};
|
|
2696
2655
|
|
|
2697
2656
|
// src/components/GenUI/elements/attachments_card.tsx
|
|
2698
|
-
var
|
|
2657
|
+
var import_x2 = require("@ant-design/x");
|
|
2699
2658
|
var import_antd8 = require("antd");
|
|
2700
2659
|
var import_dayjs = __toESM(require("dayjs"));
|
|
2701
|
-
var
|
|
2702
|
-
var
|
|
2660
|
+
var import_react13 = require("react");
|
|
2661
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2703
2662
|
var AttachmentsCard = ({
|
|
2704
2663
|
data,
|
|
2705
2664
|
component_key,
|
|
@@ -2707,8 +2666,8 @@ var AttachmentsCard = ({
|
|
|
2707
2666
|
columns = 1,
|
|
2708
2667
|
showDownloadButton = false
|
|
2709
2668
|
}) => {
|
|
2710
|
-
const { Text:
|
|
2711
|
-
const [showAll, setShowAll] = (0,
|
|
2669
|
+
const { Text: Text14 } = import_antd8.Typography;
|
|
2670
|
+
const [showAll, setShowAll] = (0, import_react13.useState)(false);
|
|
2712
2671
|
const { openSideApp } = useChatUIContext();
|
|
2713
2672
|
const getStyles = () => {
|
|
2714
2673
|
switch (size) {
|
|
@@ -2767,7 +2726,7 @@ var AttachmentsCard = ({
|
|
|
2767
2726
|
};
|
|
2768
2727
|
const DownloadButton = ({ item }) => {
|
|
2769
2728
|
if (!showDownloadButton) return null;
|
|
2770
|
-
return /* @__PURE__ */ (0,
|
|
2729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2771
2730
|
"div",
|
|
2772
2731
|
{
|
|
2773
2732
|
style: {
|
|
@@ -2781,8 +2740,8 @@ var AttachmentsCard = ({
|
|
|
2781
2740
|
}
|
|
2782
2741
|
);
|
|
2783
2742
|
};
|
|
2784
|
-
const renderFileDescription = (item) => /* @__PURE__ */ (0,
|
|
2785
|
-
|
|
2743
|
+
const renderFileDescription = (item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Space, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2744
|
+
Text14,
|
|
2786
2745
|
{
|
|
2787
2746
|
type: "secondary",
|
|
2788
2747
|
style: {
|
|
@@ -2795,18 +2754,18 @@ var AttachmentsCard = ({
|
|
|
2795
2754
|
const displayData2 = data || [];
|
|
2796
2755
|
const shouldShowViewMore2 = displayData2.length > 4;
|
|
2797
2756
|
const visibleData2 = showAll ? displayData2 : displayData2.slice(0, 4);
|
|
2798
|
-
return /* @__PURE__ */ (0,
|
|
2799
|
-
/* @__PURE__ */ (0,
|
|
2757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_antd8.Flex, { vertical: true, gap: "small", children: [
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Row, { gutter: [8, 8], children: visibleData2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Col, { span: 24 / columns, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2800
2759
|
"div",
|
|
2801
2760
|
{
|
|
2802
2761
|
onClick: (evt) => {
|
|
2803
2762
|
evt.stopPropagation();
|
|
2804
2763
|
handleItemClick(item);
|
|
2805
2764
|
},
|
|
2806
|
-
children: /* @__PURE__ */ (0,
|
|
2807
|
-
/* @__PURE__ */ (0,
|
|
2808
|
-
/* @__PURE__ */ (0,
|
|
2809
|
-
|
|
2765
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_antd8.Card, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DownloadButton, { item }),
|
|
2767
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2768
|
+
import_x2.FileCard,
|
|
2810
2769
|
{
|
|
2811
2770
|
style: getFileCardStyle(item),
|
|
2812
2771
|
name: item.name,
|
|
@@ -2814,7 +2773,7 @@ var AttachmentsCard = ({
|
|
|
2814
2773
|
description: renderFileDescription(item)
|
|
2815
2774
|
}
|
|
2816
2775
|
),
|
|
2817
|
-
item.files && /* @__PURE__ */ (0,
|
|
2776
|
+
item.files && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2818
2777
|
AttachmentsCard,
|
|
2819
2778
|
{
|
|
2820
2779
|
data: item.files,
|
|
@@ -2827,7 +2786,7 @@ var AttachmentsCard = ({
|
|
|
2827
2786
|
] })
|
|
2828
2787
|
}
|
|
2829
2788
|
) }, item.id)) }),
|
|
2830
|
-
shouldShowViewMore2 && /* @__PURE__ */ (0,
|
|
2789
|
+
shouldShowViewMore2 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2831
2790
|
import_antd8.Button,
|
|
2832
2791
|
{
|
|
2833
2792
|
type: "link",
|
|
@@ -2841,11 +2800,11 @@ var AttachmentsCard = ({
|
|
|
2841
2800
|
const displayData = data || [];
|
|
2842
2801
|
const shouldShowViewMore = displayData.length > 4;
|
|
2843
2802
|
const visibleData = showAll ? displayData : displayData.slice(0, 4);
|
|
2844
|
-
return /* @__PURE__ */ (0,
|
|
2845
|
-
visibleData.map((item) => /* @__PURE__ */ (0,
|
|
2846
|
-
/* @__PURE__ */ (0,
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
2848
|
-
|
|
2803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_antd8.Flex, { vertical: true, gap: size === "small" ? "small" : "middle", children: [
|
|
2804
|
+
visibleData.map((item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { onClick: () => handleItemClick(item), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_antd8.Card, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DownloadButton, { item }),
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2807
|
+
import_x2.FileCard,
|
|
2849
2808
|
{
|
|
2850
2809
|
style: getFileCardStyle(item),
|
|
2851
2810
|
name: item.name,
|
|
@@ -2853,13 +2812,13 @@ var AttachmentsCard = ({
|
|
|
2853
2812
|
description: renderFileDescription(item)
|
|
2854
2813
|
}
|
|
2855
2814
|
),
|
|
2856
|
-
item.files && /* @__PURE__ */ (0,
|
|
2857
|
-
/* @__PURE__ */ (0,
|
|
2815
|
+
item.files && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { paddingLeft: "12px" }, children: [
|
|
2816
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text14, { type: "secondary", style: { fontSize: "12px" }, children: [
|
|
2858
2817
|
"\u5305\u542B\u6587\u4EF6(",
|
|
2859
2818
|
item.files.length,
|
|
2860
2819
|
")"
|
|
2861
2820
|
] }),
|
|
2862
|
-
/* @__PURE__ */ (0,
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2863
2822
|
AttachmentsCard,
|
|
2864
2823
|
{
|
|
2865
2824
|
data: item.files,
|
|
@@ -2871,7 +2830,7 @@ var AttachmentsCard = ({
|
|
|
2871
2830
|
)
|
|
2872
2831
|
] })
|
|
2873
2832
|
] }) }, item.id)),
|
|
2874
|
-
shouldShowViewMore && /* @__PURE__ */ (0,
|
|
2833
|
+
shouldShowViewMore && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2875
2834
|
import_antd8.Button,
|
|
2876
2835
|
{
|
|
2877
2836
|
type: "link",
|
|
@@ -2889,17 +2848,17 @@ var AttachmentsCard = ({
|
|
|
2889
2848
|
|
|
2890
2849
|
// src/components/GenUI/elements/attachments_viewer_side_app.tsx
|
|
2891
2850
|
var import_antd9 = require("antd");
|
|
2892
|
-
var
|
|
2893
|
-
var
|
|
2851
|
+
var import_react14 = require("react");
|
|
2852
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2894
2853
|
function AttachmentsViewerSideApp({
|
|
2895
2854
|
data,
|
|
2896
2855
|
component_key
|
|
2897
2856
|
}) {
|
|
2898
|
-
const [fileUri, setFileUri] = (0,
|
|
2899
|
-
const [loading, setLoading] = (0,
|
|
2900
|
-
const { file_id } = data ?? {};
|
|
2857
|
+
const [fileUri, setFileUri] = (0, import_react14.useState)();
|
|
2858
|
+
const [loading, setLoading] = (0, import_react14.useState)(false);
|
|
2859
|
+
const { file_id, url } = data ?? {};
|
|
2901
2860
|
if (loading) {
|
|
2902
|
-
return /* @__PURE__ */ (0,
|
|
2861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd9.Skeleton, { active: true });
|
|
2903
2862
|
}
|
|
2904
2863
|
const canPreviewInIframe = (fileName) => {
|
|
2905
2864
|
if (!fileName) return false;
|
|
@@ -2934,18 +2893,18 @@ function AttachmentsViewerSideApp({
|
|
|
2934
2893
|
return previewableExtensions.includes(extension);
|
|
2935
2894
|
};
|
|
2936
2895
|
const isPreviewable = fileUri?.fileName ? canPreviewInIframe(fileUri.fileName) : false;
|
|
2937
|
-
return isPreviewable ? /* @__PURE__ */ (0,
|
|
2896
|
+
return isPreviewable || url ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2938
2897
|
"iframe",
|
|
2939
2898
|
{
|
|
2940
2899
|
style: { width: "100%", height: "100%", border: 0 },
|
|
2941
|
-
src: fileUri?.url
|
|
2900
|
+
src: fileUri?.url || url
|
|
2942
2901
|
}
|
|
2943
|
-
) : /* @__PURE__ */ (0,
|
|
2902
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2944
2903
|
import_antd9.Empty,
|
|
2945
2904
|
{
|
|
2946
|
-
description: /* @__PURE__ */ (0,
|
|
2947
|
-
/* @__PURE__ */ (0,
|
|
2948
|
-
/* @__PURE__ */ (0,
|
|
2905
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2906
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: "\u6682\u65F6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u8BF7\u4E0B\u8F7D\u540E\u67E5\u770B\u3002" }),
|
|
2907
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_antd9.Button, { type: "link", href: fileUri?.url, download: fileUri?.fileName, children: [
|
|
2949
2908
|
"\u4E0B\u8F7D",
|
|
2950
2909
|
fileUri?.fileName
|
|
2951
2910
|
] })
|
|
@@ -2959,12 +2918,12 @@ function AttachmentsViewerSideApp({
|
|
|
2959
2918
|
var import_antd11 = require("antd");
|
|
2960
2919
|
|
|
2961
2920
|
// src/components/GenUI/elements/ContentPreviewCollapse.tsx
|
|
2962
|
-
var
|
|
2921
|
+
var import_react15 = require("react");
|
|
2963
2922
|
var import_antd10 = require("antd");
|
|
2964
2923
|
var import_antd_style6 = require("antd-style");
|
|
2965
2924
|
var import_icons8 = require("@ant-design/icons");
|
|
2966
2925
|
var import_CollapsePanel3 = __toESM(require("antd/es/collapse/CollapsePanel"));
|
|
2967
|
-
var
|
|
2926
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2968
2927
|
var DEFAULT_COLLAPSED_MAX_HEIGHT = 180;
|
|
2969
2928
|
var DEFAULT_EXPANDED_MAX_HEIGHT = 500;
|
|
2970
2929
|
var useStyle4 = (0, import_antd_style6.createStyles)(
|
|
@@ -3029,18 +2988,18 @@ var ContentPreviewCollapse = ({
|
|
|
3029
2988
|
showAllText = "Show all content",
|
|
3030
2989
|
showLessText = "Show less"
|
|
3031
2990
|
}) => {
|
|
3032
|
-
const [showFullContent, setShowFullContent] = (0,
|
|
3033
|
-
const [isOverflowing, setIsOverflowing] = (0,
|
|
3034
|
-
const contentRef = (0,
|
|
2991
|
+
const [showFullContent, setShowFullContent] = (0, import_react15.useState)(false);
|
|
2992
|
+
const [isOverflowing, setIsOverflowing] = (0, import_react15.useState)(false);
|
|
2993
|
+
const contentRef = (0, import_react15.useRef)(null);
|
|
3035
2994
|
const showShadow = isOverflowing && !showFullContent;
|
|
3036
2995
|
const { styles, cx } = useStyle4({ showShadow });
|
|
3037
|
-
const checkOverflow = (0,
|
|
2996
|
+
const checkOverflow = (0, import_react15.useCallback)(() => {
|
|
3038
2997
|
if (contentRef.current) {
|
|
3039
2998
|
const scrollHeight = contentRef.current.scrollHeight;
|
|
3040
2999
|
setIsOverflowing(scrollHeight > collapsedMaxHeight);
|
|
3041
3000
|
}
|
|
3042
3001
|
}, [collapsedMaxHeight]);
|
|
3043
|
-
(0,
|
|
3002
|
+
(0, import_react15.useEffect)(() => {
|
|
3044
3003
|
const element = contentRef.current;
|
|
3045
3004
|
if (!element) return;
|
|
3046
3005
|
checkOverflow();
|
|
@@ -3056,7 +3015,7 @@ var ContentPreviewCollapse = ({
|
|
|
3056
3015
|
e.stopPropagation();
|
|
3057
3016
|
setShowFullContent(!showFullContent);
|
|
3058
3017
|
};
|
|
3059
|
-
return /* @__PURE__ */ (0,
|
|
3018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3060
3019
|
import_antd10.Collapse,
|
|
3061
3020
|
{
|
|
3062
3021
|
className: styles.collapse,
|
|
@@ -3064,29 +3023,29 @@ var ContentPreviewCollapse = ({
|
|
|
3064
3023
|
bordered: false,
|
|
3065
3024
|
defaultActiveKey: defaultExpanded ? [panelKey] : [],
|
|
3066
3025
|
expandIcon,
|
|
3067
|
-
children: /* @__PURE__ */ (0,
|
|
3026
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3068
3027
|
import_CollapsePanel3.default,
|
|
3069
3028
|
{
|
|
3070
3029
|
header,
|
|
3071
3030
|
extra,
|
|
3072
3031
|
style: { minWidth },
|
|
3073
3032
|
children: [
|
|
3074
|
-
/* @__PURE__ */ (0,
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3075
3034
|
"div",
|
|
3076
3035
|
{
|
|
3077
3036
|
className: cx(styles.contentContainer, showFullContent && "expanded"),
|
|
3078
3037
|
style: {
|
|
3079
3038
|
maxHeight: showFullContent ? expandedMaxHeight : collapsedMaxHeight
|
|
3080
3039
|
},
|
|
3081
|
-
children: /* @__PURE__ */ (0,
|
|
3040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref: contentRef, className: styles.content, children })
|
|
3082
3041
|
}
|
|
3083
3042
|
),
|
|
3084
|
-
isOverflowing && /* @__PURE__ */ (0,
|
|
3085
|
-
/* @__PURE__ */ (0,
|
|
3086
|
-
/* @__PURE__ */ (0,
|
|
3087
|
-
] }) : /* @__PURE__ */ (0,
|
|
3088
|
-
/* @__PURE__ */ (0,
|
|
3089
|
-
/* @__PURE__ */ (0,
|
|
3043
|
+
isOverflowing && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: styles.toggleButton, onClick: handleToggleContent, children: showFullContent ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons8.UpOutlined, { style: { fontSize: 10 } }),
|
|
3045
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: showLessText })
|
|
3046
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3047
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons8.DownOutlined, { style: { fontSize: 10 } }),
|
|
3048
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: showAllText })
|
|
3090
3049
|
] }) })
|
|
3091
3050
|
]
|
|
3092
3051
|
},
|
|
@@ -3097,7 +3056,7 @@ var ContentPreviewCollapse = ({
|
|
|
3097
3056
|
};
|
|
3098
3057
|
|
|
3099
3058
|
// src/components/GenUI/elements/WriteFile.tsx
|
|
3100
|
-
var
|
|
3059
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3101
3060
|
var { Text: Text6 } = import_antd11.Typography;
|
|
3102
3061
|
var WriteFile = ({
|
|
3103
3062
|
data,
|
|
@@ -3111,9 +3070,9 @@ var WriteFile = ({
|
|
|
3111
3070
|
return null;
|
|
3112
3071
|
}
|
|
3113
3072
|
const expandIcon = () => getFileIcon(file_path);
|
|
3114
|
-
const header = /* @__PURE__ */ (0,
|
|
3115
|
-
/* @__PURE__ */ (0,
|
|
3116
|
-
/* @__PURE__ */ (0,
|
|
3073
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_antd11.Space, { children: [
|
|
3074
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text6, { strong: true, children: "New" }),
|
|
3075
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text6, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
3117
3076
|
] });
|
|
3118
3077
|
const handleItemClick = (toolCallData2) => {
|
|
3119
3078
|
openSideApp({
|
|
@@ -3125,13 +3084,13 @@ var WriteFile = ({
|
|
|
3125
3084
|
}
|
|
3126
3085
|
});
|
|
3127
3086
|
};
|
|
3128
|
-
return /* @__PURE__ */ (0,
|
|
3087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3129
3088
|
ContentPreviewCollapse,
|
|
3130
3089
|
{
|
|
3131
3090
|
panelKey: toolCallData.id,
|
|
3132
3091
|
header,
|
|
3133
3092
|
expandIcon,
|
|
3134
|
-
extra: /* @__PURE__ */ (0,
|
|
3093
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3135
3094
|
import_antd11.Button,
|
|
3136
3095
|
{
|
|
3137
3096
|
type: "link",
|
|
@@ -3143,7 +3102,7 @@ var WriteFile = ({
|
|
|
3143
3102
|
children: "Diff View"
|
|
3144
3103
|
}
|
|
3145
3104
|
),
|
|
3146
|
-
children: /* @__PURE__ */ (0,
|
|
3105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MDResponse, { content })
|
|
3147
3106
|
}
|
|
3148
3107
|
);
|
|
3149
3108
|
};
|
|
@@ -3151,10 +3110,10 @@ var WriteFile = ({
|
|
|
3151
3110
|
// src/components/GenUI/elements/file_content_diff_view.tsx
|
|
3152
3111
|
var import_react_diff_viewer = __toESM(require("@alexbruf/react-diff-viewer"));
|
|
3153
3112
|
var import_react_diff_viewer2 = require("@alexbruf/react-diff-viewer/index.css");
|
|
3154
|
-
var
|
|
3113
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3155
3114
|
var FileContentDiffView = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
3156
3115
|
const { old_code, new_code } = data;
|
|
3157
|
-
return /* @__PURE__ */ (0,
|
|
3116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3158
3117
|
import_react_diff_viewer.default,
|
|
3159
3118
|
{
|
|
3160
3119
|
oldValue: old_code,
|
|
@@ -3166,7 +3125,7 @@ var FileContentDiffView = ({ data, interactive = true, default_open_in_side_app
|
|
|
3166
3125
|
|
|
3167
3126
|
// src/components/GenUI/elements/EditFile.tsx
|
|
3168
3127
|
var import_antd12 = require("antd");
|
|
3169
|
-
var
|
|
3128
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3170
3129
|
var { Text: Text7 } = import_antd12.Typography;
|
|
3171
3130
|
var EditFile = ({
|
|
3172
3131
|
data,
|
|
@@ -3180,9 +3139,9 @@ var EditFile = ({
|
|
|
3180
3139
|
return null;
|
|
3181
3140
|
}
|
|
3182
3141
|
const expandIcon = () => getFileIcon(file_path);
|
|
3183
|
-
const header = /* @__PURE__ */ (0,
|
|
3184
|
-
/* @__PURE__ */ (0,
|
|
3185
|
-
/* @__PURE__ */ (0,
|
|
3142
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_antd12.Space, { children: [
|
|
3143
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text7, { strong: true, children: "Edit" }),
|
|
3144
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text7, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
3186
3145
|
] });
|
|
3187
3146
|
const handleItemClick = (toolCallData2) => {
|
|
3188
3147
|
openSideApp({
|
|
@@ -3194,13 +3153,13 @@ var EditFile = ({
|
|
|
3194
3153
|
}
|
|
3195
3154
|
});
|
|
3196
3155
|
};
|
|
3197
|
-
return /* @__PURE__ */ (0,
|
|
3156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3198
3157
|
ContentPreviewCollapse,
|
|
3199
3158
|
{
|
|
3200
3159
|
panelKey: toolCallData.id,
|
|
3201
3160
|
header,
|
|
3202
3161
|
expandIcon,
|
|
3203
|
-
extra: /* @__PURE__ */ (0,
|
|
3162
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3204
3163
|
import_antd12.Button,
|
|
3205
3164
|
{
|
|
3206
3165
|
type: "link",
|
|
@@ -3212,7 +3171,7 @@ var EditFile = ({
|
|
|
3212
3171
|
children: "Diff View"
|
|
3213
3172
|
}
|
|
3214
3173
|
),
|
|
3215
|
-
children: /* @__PURE__ */ (0,
|
|
3174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MDResponse, { content: new_string })
|
|
3216
3175
|
}
|
|
3217
3176
|
);
|
|
3218
3177
|
};
|
|
@@ -3221,7 +3180,7 @@ var EditFile = ({
|
|
|
3221
3180
|
var import_antd13 = require("antd");
|
|
3222
3181
|
var import_antd_style7 = require("antd-style");
|
|
3223
3182
|
var import_icons9 = require("@ant-design/icons");
|
|
3224
|
-
var
|
|
3183
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3225
3184
|
var { Text: Text8 } = import_antd13.Typography;
|
|
3226
3185
|
var useStyle5 = (0, import_antd_style7.createStyles)(({ token, css }) => ({
|
|
3227
3186
|
card: css`
|
|
@@ -3389,14 +3348,14 @@ var TaskCard = ({
|
|
|
3389
3348
|
switch (status2) {
|
|
3390
3349
|
case "success":
|
|
3391
3350
|
return {
|
|
3392
|
-
icon: /* @__PURE__ */ (0,
|
|
3351
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.CheckCircleOutlined, { style: { fontSize: 16 } }),
|
|
3393
3352
|
color: "success",
|
|
3394
3353
|
text: "Completed",
|
|
3395
3354
|
bgColor: "rgba(82, 196, 26, 0.1)"
|
|
3396
3355
|
};
|
|
3397
3356
|
case "error":
|
|
3398
3357
|
return {
|
|
3399
|
-
icon: /* @__PURE__ */ (0,
|
|
3358
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.CloseCircleOutlined, { style: { fontSize: 16 } }),
|
|
3400
3359
|
color: "error",
|
|
3401
3360
|
text: "Failed",
|
|
3402
3361
|
bgColor: "rgba(255, 77, 79, 0.1)"
|
|
@@ -3404,7 +3363,7 @@ var TaskCard = ({
|
|
|
3404
3363
|
case "pending":
|
|
3405
3364
|
default:
|
|
3406
3365
|
return {
|
|
3407
|
-
icon: /* @__PURE__ */ (0,
|
|
3366
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.LoadingOutlined, { style: { fontSize: 16 } }),
|
|
3408
3367
|
color: "processing",
|
|
3409
3368
|
text: "In Progress",
|
|
3410
3369
|
bgColor: "rgba(24, 144, 255, 0.1)"
|
|
@@ -3424,7 +3383,7 @@ var TaskCard = ({
|
|
|
3424
3383
|
}
|
|
3425
3384
|
});
|
|
3426
3385
|
};
|
|
3427
|
-
return /* @__PURE__ */ (0,
|
|
3386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3428
3387
|
import_antd13.Card,
|
|
3429
3388
|
{
|
|
3430
3389
|
size: "small",
|
|
@@ -3433,28 +3392,28 @@ var TaskCard = ({
|
|
|
3433
3392
|
onClick: handleCardClick,
|
|
3434
3393
|
hoverable: interactive,
|
|
3435
3394
|
bodyStyle: { padding: 0 },
|
|
3436
|
-
children: /* @__PURE__ */ (0,
|
|
3437
|
-
/* @__PURE__ */ (0,
|
|
3438
|
-
/* @__PURE__ */ (0,
|
|
3439
|
-
/* @__PURE__ */ (0,
|
|
3440
|
-
subagent_type && /* @__PURE__ */ (0,
|
|
3441
|
-
description && /* @__PURE__ */ (0,
|
|
3395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.cardBody, children: [
|
|
3396
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.titleSection, children: [
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.iconWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.CarryOutOutlined, { style: { fontSize: 20, color: "#1890ff" } }) }),
|
|
3398
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.titleContent, children: [
|
|
3399
|
+
subagent_type && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.taskType, children: subagent_type }),
|
|
3400
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text8, { className: styles.description, children: description })
|
|
3442
3401
|
] })
|
|
3443
3402
|
] }) }),
|
|
3444
|
-
/* @__PURE__ */ (0,
|
|
3445
|
-
/* @__PURE__ */ (0,
|
|
3446
|
-
assignee && /* @__PURE__ */ (0,
|
|
3447
|
-
/* @__PURE__ */ (0,
|
|
3403
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.footer, children: [
|
|
3404
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.footerLeft, children: [
|
|
3405
|
+
assignee && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: styles.assigneeContainer, children: [
|
|
3406
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3448
3407
|
import_antd13.Avatar,
|
|
3449
3408
|
{
|
|
3450
3409
|
size: 24,
|
|
3451
|
-
icon: /* @__PURE__ */ (0,
|
|
3410
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.UserOutlined, {}),
|
|
3452
3411
|
className: styles.assigneeAvatar
|
|
3453
3412
|
}
|
|
3454
3413
|
),
|
|
3455
|
-
/* @__PURE__ */ (0,
|
|
3414
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text8, { className: styles.assigneeName, children: assignee })
|
|
3456
3415
|
] }),
|
|
3457
|
-
/* @__PURE__ */ (0,
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3458
3417
|
import_antd13.Tag,
|
|
3459
3418
|
{
|
|
3460
3419
|
icon: statusConfig.icon,
|
|
@@ -3472,16 +3431,16 @@ var TaskCard = ({
|
|
|
3472
3431
|
}
|
|
3473
3432
|
)
|
|
3474
3433
|
] }),
|
|
3475
|
-
interactive && /* @__PURE__ */ (0,
|
|
3434
|
+
interactive && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons9.RightOutlined, { className: styles.actionIcon })
|
|
3476
3435
|
] }),
|
|
3477
|
-
showResponse && /* @__PURE__ */ (0,
|
|
3436
|
+
showResponse && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3478
3437
|
"div",
|
|
3479
3438
|
{
|
|
3480
3439
|
className: styles.responseSection,
|
|
3481
3440
|
onClick: (e) => e.stopPropagation(),
|
|
3482
3441
|
children: [
|
|
3483
|
-
/* @__PURE__ */ (0,
|
|
3484
|
-
/* @__PURE__ */ (0,
|
|
3442
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text8, { className: styles.responseHeader, children: "Response" }),
|
|
3443
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.responseContent, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MDResponse, { content: response }) })
|
|
3485
3444
|
]
|
|
3486
3445
|
}
|
|
3487
3446
|
)
|
|
@@ -3495,23 +3454,23 @@ var import_antd20 = require("antd");
|
|
|
3495
3454
|
|
|
3496
3455
|
// src/components/Chat/Chating.tsx
|
|
3497
3456
|
var import_icons11 = require("@ant-design/icons");
|
|
3498
|
-
var
|
|
3457
|
+
var import_x5 = require("@ant-design/x");
|
|
3499
3458
|
|
|
3500
3459
|
// src/components/Chat/MessageList.tsx
|
|
3501
|
-
var
|
|
3460
|
+
var import_x3 = require("@ant-design/x");
|
|
3502
3461
|
var import_antd14 = require("antd");
|
|
3503
3462
|
var import_ErrorBoundary = __toESM(require("antd/es/alert/ErrorBoundary"));
|
|
3504
|
-
var
|
|
3505
|
-
var
|
|
3463
|
+
var import_react16 = require("react");
|
|
3464
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3506
3465
|
var LazyBubble = ({
|
|
3507
3466
|
message: message5,
|
|
3508
3467
|
renderContent,
|
|
3509
3468
|
autoLoadRightPanel
|
|
3510
3469
|
}) => {
|
|
3511
|
-
const ref = (0,
|
|
3512
|
-
const [isVisible, setIsVisible] = (0,
|
|
3513
|
-
const [wasEverVisible, setWasEverVisible] = (0,
|
|
3514
|
-
(0,
|
|
3470
|
+
const ref = (0, import_react16.useRef)(null);
|
|
3471
|
+
const [isVisible, setIsVisible] = (0, import_react16.useState)(false);
|
|
3472
|
+
const [wasEverVisible, setWasEverVisible] = (0, import_react16.useState)(false);
|
|
3473
|
+
(0, import_react16.useEffect)(() => {
|
|
3515
3474
|
const observer = new IntersectionObserver(
|
|
3516
3475
|
([entry]) => {
|
|
3517
3476
|
const visible = entry.isIntersecting;
|
|
@@ -3531,22 +3490,22 @@ var LazyBubble = ({
|
|
|
3531
3490
|
}
|
|
3532
3491
|
};
|
|
3533
3492
|
}, [wasEverVisible]);
|
|
3534
|
-
(0,
|
|
3493
|
+
(0, import_react16.useEffect)(() => {
|
|
3535
3494
|
autoLoadRightPanel?.();
|
|
3536
3495
|
}, []);
|
|
3537
3496
|
const getPlaceholder = () => {
|
|
3538
3497
|
const estimatedHeight = message5.content ? Math.min(100, message5.content.length / 5) : 100;
|
|
3539
|
-
return /* @__PURE__ */ (0,
|
|
3498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
3540
3499
|
};
|
|
3541
|
-
return /* @__PURE__ */ (0,
|
|
3500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message5) : getPlaceholder() }) });
|
|
3542
3501
|
};
|
|
3543
|
-
var MemoizedBubbleList = (0,
|
|
3502
|
+
var MemoizedBubbleList = (0, import_react16.memo)(
|
|
3544
3503
|
({
|
|
3545
3504
|
items,
|
|
3546
3505
|
role,
|
|
3547
3506
|
className
|
|
3548
|
-
}) => /* @__PURE__ */ (0,
|
|
3549
|
-
|
|
3507
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3508
|
+
import_x3.Bubble.List,
|
|
3550
3509
|
{
|
|
3551
3510
|
autoScroll: true,
|
|
3552
3511
|
items,
|
|
@@ -3563,18 +3522,18 @@ var MessageList = ({
|
|
|
3563
3522
|
}) => {
|
|
3564
3523
|
const { styles } = useStyle();
|
|
3565
3524
|
const { openSideApp } = useChatUIContext();
|
|
3566
|
-
const messageLengthRef = (0,
|
|
3567
|
-
(0,
|
|
3525
|
+
const messageLengthRef = (0, import_react16.useRef)(messages?.length ?? 0);
|
|
3526
|
+
(0, import_react16.useEffect)(() => {
|
|
3568
3527
|
if (messages?.length) {
|
|
3569
3528
|
messageLengthRef.current = messages?.length;
|
|
3570
3529
|
}
|
|
3571
3530
|
}, [messages?.length]);
|
|
3572
|
-
const renderContent = (0,
|
|
3531
|
+
const renderContent = (0, import_react16.useCallback)((message5) => {
|
|
3573
3532
|
const { content } = message5;
|
|
3574
3533
|
try {
|
|
3575
3534
|
const json = JSON.parse(content);
|
|
3576
3535
|
if (json.action && json.message) {
|
|
3577
|
-
return /* @__PURE__ */ (0,
|
|
3536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MDResponse, { content: json.message });
|
|
3578
3537
|
}
|
|
3579
3538
|
} catch (error) {
|
|
3580
3539
|
}
|
|
@@ -3584,14 +3543,14 @@ ${JSON.stringify(tool_call)}
|
|
|
3584
3543
|
\`\`\``;
|
|
3585
3544
|
}) || [];
|
|
3586
3545
|
const content_md = [content, ...tool_calls_md].join("\n");
|
|
3587
|
-
return /* @__PURE__ */ (0,
|
|
3546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_antd14.Space, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MDResponse, { content: content_md }) });
|
|
3588
3547
|
}, []);
|
|
3589
|
-
const items = (0,
|
|
3548
|
+
const items = (0, import_react16.useMemo)(
|
|
3590
3549
|
() => messages.map((message5, index) => ({
|
|
3591
3550
|
key: message5.id,
|
|
3592
3551
|
role: message5.role,
|
|
3593
3552
|
typing: false,
|
|
3594
|
-
content: /* @__PURE__ */ (0,
|
|
3553
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3595
3554
|
LazyBubble,
|
|
3596
3555
|
{
|
|
3597
3556
|
message: message5,
|
|
@@ -3651,9 +3610,9 @@ ${JSON.stringify(tool_call)}
|
|
|
3651
3610
|
}
|
|
3652
3611
|
};
|
|
3653
3612
|
if (items.length === 0) {
|
|
3654
|
-
return /* @__PURE__ */ (0,
|
|
3613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { flex: 1 } });
|
|
3655
3614
|
}
|
|
3656
|
-
return /* @__PURE__ */ (0,
|
|
3615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3657
3616
|
MemoizedBubbleList,
|
|
3658
3617
|
{
|
|
3659
3618
|
items,
|
|
@@ -3665,13 +3624,13 @@ ${JSON.stringify(tool_call)}
|
|
|
3665
3624
|
|
|
3666
3625
|
// src/components/Chat/Chating.tsx
|
|
3667
3626
|
var import_antd19 = require("antd");
|
|
3668
|
-
var
|
|
3627
|
+
var import_react18 = __toESM(require("react"));
|
|
3669
3628
|
|
|
3670
3629
|
// src/components/GenUI/HITLContainer.tsx
|
|
3671
3630
|
var import_antd15 = require("antd");
|
|
3672
3631
|
var import_antd_style8 = require("antd-style");
|
|
3673
3632
|
var import_CollapsePanel4 = __toESM(require("antd/es/collapse/CollapsePanel"));
|
|
3674
|
-
var
|
|
3633
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3675
3634
|
var { Text: Text9 } = import_antd15.Typography;
|
|
3676
3635
|
var useStyle6 = (0, import_antd_style8.createStyles)(({ token, css }) => ({
|
|
3677
3636
|
card: css`
|
|
@@ -3687,18 +3646,18 @@ var useStyle6 = (0, import_antd_style8.createStyles)(({ token, css }) => ({
|
|
|
3687
3646
|
var HITLContainer = () => {
|
|
3688
3647
|
const { styles } = useStyle6();
|
|
3689
3648
|
const { interrupts } = useAgentChat();
|
|
3690
|
-
return interrupts && interrupts.length > 0 ? /* @__PURE__ */ (0,
|
|
3649
|
+
return interrupts && interrupts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3691
3650
|
import_antd15.Collapse,
|
|
3692
3651
|
{
|
|
3693
3652
|
className: styles.card,
|
|
3694
3653
|
size: "small",
|
|
3695
3654
|
bordered: false,
|
|
3696
3655
|
defaultActiveKey: ["hitl"],
|
|
3697
|
-
children: /* @__PURE__ */ (0,
|
|
3656
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3698
3657
|
import_CollapsePanel4.default,
|
|
3699
3658
|
{
|
|
3700
3659
|
showArrow: false,
|
|
3701
|
-
header: /* @__PURE__ */ (0,
|
|
3660
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3702
3661
|
import_antd15.Tag,
|
|
3703
3662
|
{
|
|
3704
3663
|
bordered: false,
|
|
@@ -3713,7 +3672,7 @@ var HITLContainer = () => {
|
|
|
3713
3672
|
children: "\u7B49\u5F85\u53CD\u9988"
|
|
3714
3673
|
}
|
|
3715
3674
|
),
|
|
3716
|
-
children: /* @__PURE__ */ (0,
|
|
3675
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_antd15.Space, { direction: "vertical", style: { width: "100%" }, children: interrupts.map((interrupt) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MDResponse, { content: interrupt.value }, interrupt.id)) })
|
|
3717
3676
|
},
|
|
3718
3677
|
"hitl"
|
|
3719
3678
|
)
|
|
@@ -3726,7 +3685,7 @@ var import_antd18 = require("antd");
|
|
|
3726
3685
|
|
|
3727
3686
|
// src/components/Chat/TodoProgress.tsx
|
|
3728
3687
|
var import_antd16 = require("antd");
|
|
3729
|
-
var
|
|
3688
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3730
3689
|
var TodoProgress = ({}) => {
|
|
3731
3690
|
const { openSideApp } = useChatUIContext();
|
|
3732
3691
|
const { todos } = useAgentChat();
|
|
@@ -3739,14 +3698,14 @@ var TodoProgress = ({}) => {
|
|
|
3739
3698
|
const totalCount = todos.length;
|
|
3740
3699
|
const hasInProgress = todos.some((item) => item.status === "in_progress");
|
|
3741
3700
|
const percent = Math.round(completedCount / totalCount * 100);
|
|
3742
|
-
return /* @__PURE__ */ (0,
|
|
3701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3743
3702
|
import_antd16.Popover,
|
|
3744
3703
|
{
|
|
3745
|
-
content: /* @__PURE__ */ (0,
|
|
3704
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { width: 400 }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Todo, { data: todos, component_key: "header_todos" }) }),
|
|
3746
3705
|
title: "Todos",
|
|
3747
3706
|
trigger: "click",
|
|
3748
3707
|
placement: "bottomRight",
|
|
3749
|
-
children: /* @__PURE__ */ (0,
|
|
3708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_antd16.Tooltip, { title: `${completedCount} / ${totalCount} tasks completed`, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { cursor: "pointer", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3750
3709
|
import_antd16.Progress,
|
|
3751
3710
|
{
|
|
3752
3711
|
type: "circle",
|
|
@@ -3757,7 +3716,7 @@ var TodoProgress = ({}) => {
|
|
|
3757
3716
|
percent,
|
|
3758
3717
|
status: hasInProgress ? "active" : "normal",
|
|
3759
3718
|
width: 30,
|
|
3760
|
-
format: () => /* @__PURE__ */ (0,
|
|
3719
|
+
format: () => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3761
3720
|
"div",
|
|
3762
3721
|
{
|
|
3763
3722
|
style: {
|
|
@@ -3766,7 +3725,7 @@ var TodoProgress = ({}) => {
|
|
|
3766
3725
|
alignItems: "center",
|
|
3767
3726
|
lineHeight: 1
|
|
3768
3727
|
},
|
|
3769
|
-
children: /* @__PURE__ */ (0,
|
|
3728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { style: { fontSize: 8 }, children: [
|
|
3770
3729
|
completedCount,
|
|
3771
3730
|
"/",
|
|
3772
3731
|
totalCount
|
|
@@ -3782,7 +3741,7 @@ var TodoProgress = ({}) => {
|
|
|
3782
3741
|
// src/components/Chat/FileExplorerButton.tsx
|
|
3783
3742
|
var import_antd17 = require("antd");
|
|
3784
3743
|
var import_icons10 = require("@ant-design/icons");
|
|
3785
|
-
var
|
|
3744
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3786
3745
|
var FileExplorerButton = ({}) => {
|
|
3787
3746
|
const { agentState } = useAgentChat();
|
|
3788
3747
|
const { openSideApp } = useChatUIContext();
|
|
@@ -3791,11 +3750,11 @@ var FileExplorerButton = ({}) => {
|
|
|
3791
3750
|
return null;
|
|
3792
3751
|
}
|
|
3793
3752
|
const fileCount = Object.keys(files).length;
|
|
3794
|
-
return /* @__PURE__ */ (0,
|
|
3753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_antd17.Tooltip, { title: "File Explorer", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_antd17.Badge, { count: fileCount, size: "small", color: "blue", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3795
3754
|
import_antd17.Button,
|
|
3796
3755
|
{
|
|
3797
3756
|
type: "text",
|
|
3798
|
-
icon: /* @__PURE__ */ (0,
|
|
3757
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_icons10.FileTextOutlined, {}),
|
|
3799
3758
|
onClick: () => openSideApp({
|
|
3800
3759
|
component_key: "file_explorer",
|
|
3801
3760
|
message: "File Explorer",
|
|
@@ -3806,13 +3765,13 @@ var FileExplorerButton = ({}) => {
|
|
|
3806
3765
|
};
|
|
3807
3766
|
|
|
3808
3767
|
// src/components/Chat/AgentHeader.tsx
|
|
3809
|
-
var
|
|
3810
|
-
var
|
|
3811
|
-
var
|
|
3768
|
+
var import_x4 = require("@ant-design/x");
|
|
3769
|
+
var import_react17 = require("react");
|
|
3770
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3812
3771
|
var { Text: Text10 } = import_antd18.Typography;
|
|
3813
3772
|
var AgentHeader = (props) => {
|
|
3814
3773
|
const { description, avatar, name, extra, extraMeta } = props;
|
|
3815
|
-
const extraMetaComponents = (0,
|
|
3774
|
+
const extraMetaComponents = (0, import_react17.useMemo)(() => {
|
|
3816
3775
|
if (extraMeta && extraMeta.length > 0) {
|
|
3817
3776
|
return extraMeta.map((meta) => {
|
|
3818
3777
|
const Element = getElement(meta.id)?.card_view;
|
|
@@ -3821,7 +3780,7 @@ var AgentHeader = (props) => {
|
|
|
3821
3780
|
try {
|
|
3822
3781
|
} catch (error) {
|
|
3823
3782
|
}
|
|
3824
|
-
return /* @__PURE__ */ (0,
|
|
3783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3825
3784
|
Element,
|
|
3826
3785
|
{
|
|
3827
3786
|
component_key: meta.id,
|
|
@@ -3834,24 +3793,24 @@ var AgentHeader = (props) => {
|
|
|
3834
3793
|
}
|
|
3835
3794
|
return void 0;
|
|
3836
3795
|
}, [extraMeta]);
|
|
3837
|
-
return /* @__PURE__ */ (0,
|
|
3838
|
-
/* @__PURE__ */ (0,
|
|
3839
|
-
|
|
3796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
3797
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3798
|
+
import_x4.Welcome,
|
|
3840
3799
|
{
|
|
3841
3800
|
style: { padding: 8 },
|
|
3842
3801
|
variant: "borderless",
|
|
3843
|
-
description: description ? /* @__PURE__ */ (0,
|
|
3844
|
-
icon: avatar ? /* @__PURE__ */ (0,
|
|
3802
|
+
description: description ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text10, { ellipsis: { tooltip: description }, children: description }) : void 0,
|
|
3803
|
+
icon: avatar ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Avatar, { src: avatar, size: 48 }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Avatar, { size: 48, children: name?.charAt(0).toUpperCase() }),
|
|
3845
3804
|
title: name ? name : void 0,
|
|
3846
|
-
extra: /* @__PURE__ */ (0,
|
|
3805
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_antd18.Space, { children: [
|
|
3847
3806
|
extra,
|
|
3848
|
-
/* @__PURE__ */ (0,
|
|
3849
|
-
/* @__PURE__ */ (0,
|
|
3850
|
-
extraMetaComponents && /* @__PURE__ */ (0,
|
|
3807
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TodoProgress, {}),
|
|
3808
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FileExplorerButton, {}),
|
|
3809
|
+
extraMetaComponents && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Space, { align: "center", style: { marginRight: 16 }, children: extraMetaComponents })
|
|
3851
3810
|
] })
|
|
3852
3811
|
}
|
|
3853
3812
|
),
|
|
3854
|
-
/* @__PURE__ */ (0,
|
|
3813
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3855
3814
|
"div",
|
|
3856
3815
|
{
|
|
3857
3816
|
style: {
|
|
@@ -3863,7 +3822,7 @@ var AgentHeader = (props) => {
|
|
|
3863
3822
|
};
|
|
3864
3823
|
|
|
3865
3824
|
// src/components/Chat/Chating.tsx
|
|
3866
|
-
var
|
|
3825
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3867
3826
|
var Chating = ({
|
|
3868
3827
|
avatar,
|
|
3869
3828
|
name,
|
|
@@ -3879,12 +3838,12 @@ var Chating = ({
|
|
|
3879
3838
|
showHITL = true,
|
|
3880
3839
|
showRefreshButton = false
|
|
3881
3840
|
}) => {
|
|
3882
|
-
const [content, setContent] = (0,
|
|
3883
|
-
const [attachedFiles, setAttachedFiles] = (0,
|
|
3841
|
+
const [content, setContent] = (0, import_react18.useState)("");
|
|
3842
|
+
const [attachedFiles, setAttachedFiles] = (0, import_react18.useState)([]);
|
|
3884
3843
|
const { styles } = useStyle();
|
|
3885
|
-
const [headerOpen, setHeaderOpen] = (0,
|
|
3886
|
-
const attachmentsRef = (0,
|
|
3887
|
-
const senderRef =
|
|
3844
|
+
const [headerOpen, setHeaderOpen] = (0, import_react18.useState)(false);
|
|
3845
|
+
const attachmentsRef = (0, import_react18.useRef)(null);
|
|
3846
|
+
const senderRef = import_react18.default.useRef(null);
|
|
3888
3847
|
const {
|
|
3889
3848
|
messages,
|
|
3890
3849
|
sendMessage,
|
|
@@ -3896,7 +3855,7 @@ var Chating = ({
|
|
|
3896
3855
|
tenantId,
|
|
3897
3856
|
clearError
|
|
3898
3857
|
} = useAgentChat();
|
|
3899
|
-
(0,
|
|
3858
|
+
(0, import_react18.useEffect)(() => {
|
|
3900
3859
|
regsiterElement("action_show_attachments_uploader", {
|
|
3901
3860
|
card_view: () => null,
|
|
3902
3861
|
action: (data) => {
|
|
@@ -3981,16 +3940,16 @@ var Chating = ({
|
|
|
3981
3940
|
}
|
|
3982
3941
|
return true;
|
|
3983
3942
|
};
|
|
3984
|
-
const attachmentsNode = /* @__PURE__ */ (0,
|
|
3943
|
+
const attachmentsNode = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_antd19.Badge, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3985
3944
|
import_antd19.Button,
|
|
3986
3945
|
{
|
|
3987
3946
|
type: "text",
|
|
3988
|
-
icon: /* @__PURE__ */ (0,
|
|
3947
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons11.PaperClipOutlined, {}),
|
|
3989
3948
|
onClick: () => setHeaderOpen(!headerOpen)
|
|
3990
3949
|
}
|
|
3991
3950
|
) });
|
|
3992
|
-
const senderHeader = /* @__PURE__ */ (0,
|
|
3993
|
-
|
|
3951
|
+
const senderHeader = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3952
|
+
import_x5.Sender.Header,
|
|
3994
3953
|
{
|
|
3995
3954
|
title: "Attachments",
|
|
3996
3955
|
open: headerOpen,
|
|
@@ -4001,8 +3960,8 @@ var Chating = ({
|
|
|
4001
3960
|
}
|
|
4002
3961
|
},
|
|
4003
3962
|
forceRender: true,
|
|
4004
|
-
children: /* @__PURE__ */ (0,
|
|
4005
|
-
|
|
3963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3964
|
+
import_x5.Attachments,
|
|
4006
3965
|
{
|
|
4007
3966
|
ref: attachmentsRef,
|
|
4008
3967
|
items: attachedFiles,
|
|
@@ -4023,7 +3982,7 @@ var Chating = ({
|
|
|
4023
3982
|
multiple: true,
|
|
4024
3983
|
maxCount: 10,
|
|
4025
3984
|
placeholder: (type) => ({
|
|
4026
|
-
icon: /* @__PURE__ */ (0,
|
|
3985
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons11.CloudUploadOutlined, {}),
|
|
4027
3986
|
title: "\u4E0A\u4F20\u6587\u4EF6",
|
|
4028
3987
|
description: attachment_placeholder
|
|
4029
3988
|
})
|
|
@@ -4031,19 +3990,19 @@ var Chating = ({
|
|
|
4031
3990
|
)
|
|
4032
3991
|
}
|
|
4033
3992
|
);
|
|
4034
|
-
const refreshButton = /* @__PURE__ */ (0,
|
|
3993
|
+
const refreshButton = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4035
3994
|
import_antd19.Button,
|
|
4036
3995
|
{
|
|
4037
3996
|
type: "text",
|
|
4038
|
-
icon: /* @__PURE__ */ (0,
|
|
3997
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons11.ReloadOutlined, {}),
|
|
4039
3998
|
onClick: () => {
|
|
4040
3999
|
loadMessages();
|
|
4041
4000
|
}
|
|
4042
4001
|
}
|
|
4043
4002
|
);
|
|
4044
4003
|
const headerExtra = showRefreshButton ? [refreshButton] : [];
|
|
4045
|
-
return /* @__PURE__ */ (0,
|
|
4046
|
-
/* @__PURE__ */ (0,
|
|
4004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: showHeader && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4047
4006
|
AgentHeader,
|
|
4048
4007
|
{
|
|
4049
4008
|
description,
|
|
@@ -4053,9 +4012,9 @@ var Chating = ({
|
|
|
4053
4012
|
extraMeta
|
|
4054
4013
|
}
|
|
4055
4014
|
) }),
|
|
4056
|
-
/* @__PURE__ */ (0,
|
|
4057
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
4058
|
-
error && /* @__PURE__ */ (0,
|
|
4015
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MessageList, { messages, className: styles.messages }),
|
|
4016
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", {}) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_x5.Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
|
|
4017
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4059
4018
|
import_antd19.Alert,
|
|
4060
4019
|
{
|
|
4061
4020
|
type: "error",
|
|
@@ -4065,9 +4024,9 @@ var Chating = ({
|
|
|
4065
4024
|
message: `${error.message}`
|
|
4066
4025
|
}
|
|
4067
4026
|
) }),
|
|
4068
|
-
showHITL && /* @__PURE__ */ (0,
|
|
4069
|
-
showSender && /* @__PURE__ */ (0,
|
|
4070
|
-
|
|
4027
|
+
showHITL && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(HITLContainer, {}),
|
|
4028
|
+
showSender && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4029
|
+
import_x5.Sender,
|
|
4071
4030
|
{
|
|
4072
4031
|
disabled: interrupts && interrupts.length > 0,
|
|
4073
4032
|
allowSpeech: false,
|
|
@@ -4092,11 +4051,11 @@ var Chating = ({
|
|
|
4092
4051
|
};
|
|
4093
4052
|
|
|
4094
4053
|
// src/components/GenUI/elements/task_detail.tsx
|
|
4095
|
-
var
|
|
4054
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4096
4055
|
var { Text: Text11 } = import_antd20.Typography;
|
|
4097
4056
|
var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
4098
4057
|
const { description, subagent_type, thread_id } = data || {};
|
|
4099
|
-
return /* @__PURE__ */ (0,
|
|
4058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4100
4059
|
AgentThreadProvider,
|
|
4101
4060
|
{
|
|
4102
4061
|
threadId: thread_id,
|
|
@@ -4106,7 +4065,7 @@ var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
|
4106
4065
|
enableReturnStateWhenStreamCompleted: true,
|
|
4107
4066
|
enableResumeStream: true
|
|
4108
4067
|
},
|
|
4109
|
-
children: /* @__PURE__ */ (0,
|
|
4068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { style: { overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4110
4069
|
Chating,
|
|
4111
4070
|
{
|
|
4112
4071
|
showRefreshButton: true,
|
|
@@ -4120,6 +4079,170 @@ var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
|
4120
4079
|
);
|
|
4121
4080
|
};
|
|
4122
4081
|
|
|
4082
|
+
// src/components/GenUI/elements/internet_search_card.tsx
|
|
4083
|
+
var import_antd21 = require("antd");
|
|
4084
|
+
var import_icons12 = require("@ant-design/icons");
|
|
4085
|
+
var import_antd_style9 = require("antd-style");
|
|
4086
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4087
|
+
var { Text: Text12 } = import_antd21.Typography;
|
|
4088
|
+
var useStyle7 = (0, import_antd_style9.createStyles)(({ token, css }) => ({
|
|
4089
|
+
listContainer: css`
|
|
4090
|
+
background: ${token.colorBgContainer};
|
|
4091
|
+
border-radius: ${token.borderRadius}px;
|
|
4092
|
+
padding: 8px 0;
|
|
4093
|
+
`,
|
|
4094
|
+
listItem: css`
|
|
4095
|
+
padding: 12px 16px;
|
|
4096
|
+
border-bottom: 1px solid ${token.colorBorderSecondary};
|
|
4097
|
+
transition: background-color 0.2s ease;
|
|
4098
|
+
cursor: pointer;
|
|
4099
|
+
|
|
4100
|
+
&:hover {
|
|
4101
|
+
background: ${token.colorFillTertiary};
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
&:last-child {
|
|
4105
|
+
border-bottom: none;
|
|
4106
|
+
}
|
|
4107
|
+
`,
|
|
4108
|
+
itemContent: css`
|
|
4109
|
+
display: flex;
|
|
4110
|
+
align-items: center;
|
|
4111
|
+
gap: 12px;
|
|
4112
|
+
width: 100%;
|
|
4113
|
+
`,
|
|
4114
|
+
iconWrapper: css`
|
|
4115
|
+
width: 32px;
|
|
4116
|
+
height: 32px;
|
|
4117
|
+
border-radius: 50%;
|
|
4118
|
+
display: flex;
|
|
4119
|
+
align-items: center;
|
|
4120
|
+
justify-content: center;
|
|
4121
|
+
flex-shrink: 0;
|
|
4122
|
+
background: ${token.colorPrimary};
|
|
4123
|
+
color: white;
|
|
4124
|
+
font-size: 14px;
|
|
4125
|
+
font-weight: 600;
|
|
4126
|
+
`,
|
|
4127
|
+
titleWrapper: css`
|
|
4128
|
+
flex: 1;
|
|
4129
|
+
min-width: 0;
|
|
4130
|
+
`,
|
|
4131
|
+
title: css`
|
|
4132
|
+
color: ${token.colorText};
|
|
4133
|
+
font-size: ${token.fontSize}px;
|
|
4134
|
+
line-height: 1.5;
|
|
4135
|
+
margin: 0;
|
|
4136
|
+
overflow: hidden;
|
|
4137
|
+
text-overflow: ellipsis;
|
|
4138
|
+
white-space: nowrap;
|
|
4139
|
+
`,
|
|
4140
|
+
source: css`
|
|
4141
|
+
color: ${token.colorTextSecondary};
|
|
4142
|
+
font-size: ${token.fontSizeSM}px;
|
|
4143
|
+
margin: 0;
|
|
4144
|
+
flex-shrink: 0;
|
|
4145
|
+
margin-left: 16px;
|
|
4146
|
+
`
|
|
4147
|
+
}));
|
|
4148
|
+
var getDomainFromUrl = (url) => {
|
|
4149
|
+
try {
|
|
4150
|
+
const urlObj = new URL(url);
|
|
4151
|
+
return urlObj.hostname.replace(/^www\./, "");
|
|
4152
|
+
} catch {
|
|
4153
|
+
return url;
|
|
4154
|
+
}
|
|
4155
|
+
};
|
|
4156
|
+
var getIconText = (domain) => {
|
|
4157
|
+
if (!domain) return "?";
|
|
4158
|
+
const parts = domain.split(".");
|
|
4159
|
+
if (parts.length >= 2) {
|
|
4160
|
+
const mainPart = parts[parts.length - 2];
|
|
4161
|
+
return mainPart.substring(0, 2).toUpperCase();
|
|
4162
|
+
}
|
|
4163
|
+
return domain.substring(0, 2).toUpperCase();
|
|
4164
|
+
};
|
|
4165
|
+
var getIconColor = (domain) => {
|
|
4166
|
+
const colors = [
|
|
4167
|
+
"#1890ff",
|
|
4168
|
+
// blue
|
|
4169
|
+
"#52c41a",
|
|
4170
|
+
// green
|
|
4171
|
+
"#fa8c16",
|
|
4172
|
+
// orange
|
|
4173
|
+
"#eb2f96",
|
|
4174
|
+
// pink
|
|
4175
|
+
"#722ed1",
|
|
4176
|
+
// purple
|
|
4177
|
+
"#13c2c2",
|
|
4178
|
+
// cyan
|
|
4179
|
+
"#f5222d"
|
|
4180
|
+
// red
|
|
4181
|
+
];
|
|
4182
|
+
let hash = 0;
|
|
4183
|
+
for (let i = 0; i < domain.length; i++) {
|
|
4184
|
+
hash = domain.charCodeAt(i) + ((hash << 5) - hash);
|
|
4185
|
+
}
|
|
4186
|
+
return colors[Math.abs(hash) % colors.length];
|
|
4187
|
+
};
|
|
4188
|
+
var InternetSearchCard = ({
|
|
4189
|
+
data,
|
|
4190
|
+
component_key,
|
|
4191
|
+
interactive = true
|
|
4192
|
+
}) => {
|
|
4193
|
+
const { styles } = useStyle7();
|
|
4194
|
+
const toolCallData = data;
|
|
4195
|
+
const { query } = toolCallData?.args || {};
|
|
4196
|
+
const dataSource = JSON.parse(toolCallData.response || "[]");
|
|
4197
|
+
const { openSideApp } = useChatUIContext();
|
|
4198
|
+
if (!toolCallData) {
|
|
4199
|
+
return null;
|
|
4200
|
+
}
|
|
4201
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_antd21.Space, { children: [
|
|
4202
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text12, { strong: true, children: "Internet Search" }),
|
|
4203
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text12, { title: query, children: query })
|
|
4204
|
+
] });
|
|
4205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4206
|
+
ContentPreviewCollapse,
|
|
4207
|
+
{
|
|
4208
|
+
panelKey: toolCallData.id,
|
|
4209
|
+
header,
|
|
4210
|
+
expandIcon: () => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_icons12.SearchOutlined, {}),
|
|
4211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4212
|
+
import_antd21.List,
|
|
4213
|
+
{
|
|
4214
|
+
size: "small",
|
|
4215
|
+
dataSource,
|
|
4216
|
+
renderItem: (item) => {
|
|
4217
|
+
const url = item.url || "";
|
|
4218
|
+
const domain = getDomainFromUrl(url);
|
|
4219
|
+
const iconText = getIconText(domain);
|
|
4220
|
+
const iconColor = getIconColor(domain);
|
|
4221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_antd21.List.Item, { extra: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text12, { className: styles.source, children: domain }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_antd21.Space, { style: { width: "100%" }, children: [
|
|
4222
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_antd21.Avatar, { style: { background: iconColor }, children: iconText }),
|
|
4223
|
+
" ",
|
|
4224
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4225
|
+
import_antd21.Button,
|
|
4226
|
+
{
|
|
4227
|
+
type: "text",
|
|
4228
|
+
onClick: () => {
|
|
4229
|
+
openSideApp({
|
|
4230
|
+
component_key: "attachments",
|
|
4231
|
+
data: { url, message: item.title },
|
|
4232
|
+
message: item.title
|
|
4233
|
+
});
|
|
4234
|
+
},
|
|
4235
|
+
children: item.title
|
|
4236
|
+
}
|
|
4237
|
+
)
|
|
4238
|
+
] }) });
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
)
|
|
4242
|
+
}
|
|
4243
|
+
);
|
|
4244
|
+
};
|
|
4245
|
+
|
|
4123
4246
|
// src/components/GenUI/elements/builtIns.tsx
|
|
4124
4247
|
var elements = {
|
|
4125
4248
|
action_show_attachments_uploader: {
|
|
@@ -4147,6 +4270,9 @@ var elements = {
|
|
|
4147
4270
|
write_todos: {
|
|
4148
4271
|
card_view: WriteTodos
|
|
4149
4272
|
},
|
|
4273
|
+
internet_search: {
|
|
4274
|
+
card_view: InternetSearchCard
|
|
4275
|
+
},
|
|
4150
4276
|
write_file: {
|
|
4151
4277
|
card_view: WriteFile
|
|
4152
4278
|
},
|
|
@@ -4185,11 +4311,11 @@ var regsiterElement = (language, ElementMeta) => {
|
|
|
4185
4311
|
};
|
|
4186
4312
|
|
|
4187
4313
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
4188
|
-
var
|
|
4189
|
-
var
|
|
4190
|
-
var
|
|
4191
|
-
var
|
|
4192
|
-
var
|
|
4314
|
+
var import_antd22 = require("antd");
|
|
4315
|
+
var import_antd_style10 = require("antd-style");
|
|
4316
|
+
var import_react19 = require("react");
|
|
4317
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4318
|
+
var useStyle8 = (0, import_antd_style10.createStyles)(({ token, css }) => {
|
|
4193
4319
|
return {
|
|
4194
4320
|
tabContainer: css`
|
|
4195
4321
|
.ant-tabs-content-holder {
|
|
@@ -4208,13 +4334,13 @@ var useStyle7 = (0, import_antd_style9.createStyles)(({ token, css }) => {
|
|
|
4208
4334
|
};
|
|
4209
4335
|
});
|
|
4210
4336
|
var EmptySideAppView = ({ component_key, data }) => {
|
|
4211
|
-
return /* @__PURE__ */ (0,
|
|
4212
|
-
/* @__PURE__ */ (0,
|
|
4213
|
-
/* @__PURE__ */ (0,
|
|
4337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
4338
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { children: "\u672A\u627E\u5230\u5BF9\u5E94\u7684\u7EC4\u4EF6\u89C6\u56FE" }),
|
|
4339
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
|
|
4214
4340
|
] });
|
|
4215
4341
|
};
|
|
4216
4342
|
var SideAppViewBrowser = () => {
|
|
4217
|
-
const { styles } =
|
|
4343
|
+
const { styles } = useStyle8();
|
|
4218
4344
|
const {
|
|
4219
4345
|
sideAppSize,
|
|
4220
4346
|
sideAppSelectedCard,
|
|
@@ -4222,10 +4348,10 @@ var SideAppViewBrowser = () => {
|
|
|
4222
4348
|
openSideApp,
|
|
4223
4349
|
closeSideApp
|
|
4224
4350
|
} = useChatUIContext();
|
|
4225
|
-
const [activeKey, setActiveKey] = (0,
|
|
4351
|
+
const [activeKey, setActiveKey] = (0, import_react19.useState)(
|
|
4226
4352
|
JSON.stringify(sideAppSelectedCard)
|
|
4227
4353
|
);
|
|
4228
|
-
const [items, setItems] = (0,
|
|
4354
|
+
const [items, setItems] = (0, import_react19.useState)([]);
|
|
4229
4355
|
const add = (key, label, children) => {
|
|
4230
4356
|
const newActiveKey = key;
|
|
4231
4357
|
const newPanes = [...items];
|
|
@@ -4261,7 +4387,7 @@ var SideAppViewBrowser = () => {
|
|
|
4261
4387
|
remove(targetKey);
|
|
4262
4388
|
}
|
|
4263
4389
|
};
|
|
4264
|
-
(0,
|
|
4390
|
+
(0, import_react19.useEffect)(() => {
|
|
4265
4391
|
const SideAppView = getElement(sideAppSelectedCard?.component_key).side_app_view || EmptySideAppView;
|
|
4266
4392
|
const key = JSON.stringify(sideAppSelectedCard);
|
|
4267
4393
|
if (items.find((item) => item.key === key)) {
|
|
@@ -4271,7 +4397,7 @@ var SideAppViewBrowser = () => {
|
|
|
4271
4397
|
add(
|
|
4272
4398
|
key,
|
|
4273
4399
|
sideAppSelectedCard?.message || sideAppSelectedCard?.data.message || "\u672A\u547D\u540D",
|
|
4274
|
-
/* @__PURE__ */ (0,
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4275
4401
|
SideAppView,
|
|
4276
4402
|
{
|
|
4277
4403
|
component_key: sideAppSelectedCard?.component_key || "",
|
|
@@ -4312,26 +4438,26 @@ var SideAppViewBrowser = () => {
|
|
|
4312
4438
|
const getSizeIcon = (size) => {
|
|
4313
4439
|
switch (size) {
|
|
4314
4440
|
case "middle":
|
|
4315
|
-
return /* @__PURE__ */ (0,
|
|
4441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.CompressOutlined, {});
|
|
4316
4442
|
case "large":
|
|
4317
|
-
return /* @__PURE__ */ (0,
|
|
4443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.ExpandOutlined, {});
|
|
4318
4444
|
case "full":
|
|
4319
|
-
return /* @__PURE__ */ (0,
|
|
4445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.FullscreenOutlined, {});
|
|
4320
4446
|
default:
|
|
4321
|
-
return /* @__PURE__ */ (0,
|
|
4447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.ExpandOutlined, {});
|
|
4322
4448
|
}
|
|
4323
4449
|
};
|
|
4324
|
-
return /* @__PURE__ */ (0,
|
|
4325
|
-
|
|
4450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4451
|
+
import_antd22.Tabs,
|
|
4326
4452
|
{
|
|
4327
4453
|
className: styles.tabContainer,
|
|
4328
4454
|
type: "editable-card",
|
|
4329
4455
|
style: { height: "100%" },
|
|
4330
4456
|
hideAdd: true,
|
|
4331
4457
|
tabBarExtraContent: {
|
|
4332
|
-
right: /* @__PURE__ */ (0,
|
|
4333
|
-
/* @__PURE__ */ (0,
|
|
4334
|
-
|
|
4458
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { style: { display: "flex", gap: "4px" }, children: [
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4460
|
+
import_antd22.Button,
|
|
4335
4461
|
{
|
|
4336
4462
|
style: { margin: "8px 0" },
|
|
4337
4463
|
size: "large",
|
|
@@ -4341,13 +4467,13 @@ var SideAppViewBrowser = () => {
|
|
|
4341
4467
|
title: `\u5F53\u524D\u5C3A\u5BF8: ${getSizeLabel(sideAppSize)}, \u70B9\u51FB\u5207\u6362`
|
|
4342
4468
|
}
|
|
4343
4469
|
),
|
|
4344
|
-
/* @__PURE__ */ (0,
|
|
4345
|
-
|
|
4470
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4471
|
+
import_antd22.Button,
|
|
4346
4472
|
{
|
|
4347
4473
|
style: { margin: "8px 0" },
|
|
4348
4474
|
size: "large",
|
|
4349
4475
|
type: "text",
|
|
4350
|
-
icon: /* @__PURE__ */ (0,
|
|
4476
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.CloseOutlined, {}),
|
|
4351
4477
|
onClick: () => {
|
|
4352
4478
|
closeSideApp();
|
|
4353
4479
|
}
|
|
@@ -4364,10 +4490,10 @@ var SideAppViewBrowser = () => {
|
|
|
4364
4490
|
};
|
|
4365
4491
|
|
|
4366
4492
|
// src/components/Chat/LatticeChat.tsx
|
|
4367
|
-
var
|
|
4493
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4368
4494
|
var LatticeChat = (props) => {
|
|
4369
4495
|
const { assistant_id, thread_id = "", menu, ...chatingProps } = props;
|
|
4370
|
-
return /* @__PURE__ */ (0,
|
|
4496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4371
4497
|
AgentThreadProvider,
|
|
4372
4498
|
{
|
|
4373
4499
|
assistantId: assistant_id,
|
|
@@ -4377,12 +4503,12 @@ var LatticeChat = (props) => {
|
|
|
4377
4503
|
enableReturnStateWhenStreamCompleted: true,
|
|
4378
4504
|
enableResumeStream: true
|
|
4379
4505
|
},
|
|
4380
|
-
children: /* @__PURE__ */ (0,
|
|
4506
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChatUIContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4381
4507
|
ColumnLayout,
|
|
4382
4508
|
{
|
|
4383
4509
|
menu,
|
|
4384
|
-
left: thread_id ? /* @__PURE__ */ (0,
|
|
4385
|
-
right: /* @__PURE__ */ (0,
|
|
4510
|
+
left: thread_id ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Chating, { ...chatingProps }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: "\u9700\u8981\u5148\u521B\u5EFA\u4F1A\u8BDD" }),
|
|
4511
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SideAppViewBrowser, {})
|
|
4386
4512
|
}
|
|
4387
4513
|
) })
|
|
4388
4514
|
}
|
|
@@ -4390,15 +4516,15 @@ var LatticeChat = (props) => {
|
|
|
4390
4516
|
};
|
|
4391
4517
|
|
|
4392
4518
|
// src/components/Chat/ConversationContext.tsx
|
|
4393
|
-
var
|
|
4519
|
+
var import_react22 = require("react");
|
|
4394
4520
|
|
|
4395
4521
|
// src/components/Chat/AssistantContext.tsx
|
|
4396
|
-
var
|
|
4522
|
+
var import_react21 = require("react");
|
|
4397
4523
|
var import_client_sdk4 = require("@axiom-lattice/client-sdk");
|
|
4398
4524
|
|
|
4399
4525
|
// src/components/Chat/LatticeChatShellContext.tsx
|
|
4400
|
-
var
|
|
4401
|
-
var
|
|
4526
|
+
var import_react20 = require("react");
|
|
4527
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4402
4528
|
var DEFAULT_CONFIG = {
|
|
4403
4529
|
baseURL: "http://localhost:4001",
|
|
4404
4530
|
apiKey: "",
|
|
@@ -4406,7 +4532,7 @@ var DEFAULT_CONFIG = {
|
|
|
4406
4532
|
timeout: 3e5,
|
|
4407
4533
|
headers: {}
|
|
4408
4534
|
};
|
|
4409
|
-
var LatticeChatShellContext = (0,
|
|
4535
|
+
var LatticeChatShellContext = (0, import_react20.createContext)({
|
|
4410
4536
|
config: DEFAULT_CONFIG,
|
|
4411
4537
|
updateConfig: () => {
|
|
4412
4538
|
},
|
|
@@ -4424,7 +4550,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4424
4550
|
persistToLocalStorage = false,
|
|
4425
4551
|
localStorageKey = "lattice_chat_shell_config"
|
|
4426
4552
|
}) => {
|
|
4427
|
-
const loadInitialConfig = (0,
|
|
4553
|
+
const loadInitialConfig = (0, import_react20.useCallback)(() => {
|
|
4428
4554
|
if (persistToLocalStorage && typeof window !== "undefined") {
|
|
4429
4555
|
try {
|
|
4430
4556
|
const stored = localStorage.getItem(localStorageKey);
|
|
@@ -4438,9 +4564,9 @@ var LatticeChatShellContextProvider = ({
|
|
|
4438
4564
|
}
|
|
4439
4565
|
return { ...DEFAULT_CONFIG, ...initialConfig };
|
|
4440
4566
|
}, [persistToLocalStorage, localStorageKey, initialConfig]);
|
|
4441
|
-
const [config, setConfig] = (0,
|
|
4442
|
-
const [settingsModalOpen, setSettingsModalOpen] = (0,
|
|
4443
|
-
const saveToLocalStorage = (0,
|
|
4567
|
+
const [config, setConfig] = (0, import_react20.useState)(loadInitialConfig);
|
|
4568
|
+
const [settingsModalOpen, setSettingsModalOpen] = (0, import_react20.useState)(false);
|
|
4569
|
+
const saveToLocalStorage = (0, import_react20.useCallback)(
|
|
4444
4570
|
(newConfig) => {
|
|
4445
4571
|
if (persistToLocalStorage && typeof window !== "undefined") {
|
|
4446
4572
|
try {
|
|
@@ -4452,7 +4578,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4452
4578
|
},
|
|
4453
4579
|
[persistToLocalStorage, localStorageKey]
|
|
4454
4580
|
);
|
|
4455
|
-
const updateConfig = (0,
|
|
4581
|
+
const updateConfig = (0, import_react20.useCallback)(
|
|
4456
4582
|
(updates) => {
|
|
4457
4583
|
setConfig((prev) => {
|
|
4458
4584
|
const newConfig = { ...prev, ...updates };
|
|
@@ -4462,7 +4588,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4462
4588
|
},
|
|
4463
4589
|
[saveToLocalStorage]
|
|
4464
4590
|
);
|
|
4465
|
-
const updateConfigValue = (0,
|
|
4591
|
+
const updateConfigValue = (0, import_react20.useCallback)(
|
|
4466
4592
|
(key, value) => {
|
|
4467
4593
|
setConfig((prev) => {
|
|
4468
4594
|
const newConfig = { ...prev, [key]: value };
|
|
@@ -4472,12 +4598,12 @@ var LatticeChatShellContextProvider = ({
|
|
|
4472
4598
|
},
|
|
4473
4599
|
[saveToLocalStorage]
|
|
4474
4600
|
);
|
|
4475
|
-
const resetConfig = (0,
|
|
4601
|
+
const resetConfig = (0, import_react20.useCallback)(() => {
|
|
4476
4602
|
const defaultConfig = { ...DEFAULT_CONFIG, ...initialConfig };
|
|
4477
4603
|
setConfig(defaultConfig);
|
|
4478
4604
|
saveToLocalStorage(defaultConfig);
|
|
4479
4605
|
}, [initialConfig, saveToLocalStorage]);
|
|
4480
|
-
return /* @__PURE__ */ (0,
|
|
4606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4481
4607
|
LatticeChatShellContext.Provider,
|
|
4482
4608
|
{
|
|
4483
4609
|
value: {
|
|
@@ -4493,7 +4619,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4493
4619
|
);
|
|
4494
4620
|
};
|
|
4495
4621
|
var useLatticeChatShellContext = () => {
|
|
4496
|
-
const context = (0,
|
|
4622
|
+
const context = (0, import_react20.useContext)(LatticeChatShellContext);
|
|
4497
4623
|
if (!context) {
|
|
4498
4624
|
throw new Error(
|
|
4499
4625
|
"useLatticeChatShellContext must be used within a LatticeChatShellContextProvider"
|
|
@@ -4503,8 +4629,8 @@ var useLatticeChatShellContext = () => {
|
|
|
4503
4629
|
};
|
|
4504
4630
|
|
|
4505
4631
|
// src/components/Chat/AssistantContext.tsx
|
|
4506
|
-
var
|
|
4507
|
-
var AssistantContext = (0,
|
|
4632
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4633
|
+
var AssistantContext = (0, import_react21.createContext)({
|
|
4508
4634
|
assistants: [],
|
|
4509
4635
|
currentAssistant: null,
|
|
4510
4636
|
isLoading: false,
|
|
@@ -4537,7 +4663,7 @@ var AssistantContextProvider = ({
|
|
|
4537
4663
|
const {
|
|
4538
4664
|
config: { baseURL, apiKey = "", transport = "sse" }
|
|
4539
4665
|
} = useLatticeChatShellContext();
|
|
4540
|
-
const client = (0,
|
|
4666
|
+
const client = (0, import_react21.useMemo)(
|
|
4541
4667
|
() => new import_client_sdk4.Client({
|
|
4542
4668
|
baseURL,
|
|
4543
4669
|
apiKey,
|
|
@@ -4546,17 +4672,17 @@ var AssistantContextProvider = ({
|
|
|
4546
4672
|
}),
|
|
4547
4673
|
[baseURL, apiKey, transport]
|
|
4548
4674
|
);
|
|
4549
|
-
const [state, setState] = (0,
|
|
4675
|
+
const [state, setState] = (0, import_react21.useState)({
|
|
4550
4676
|
assistants: [],
|
|
4551
4677
|
currentAssistant: null,
|
|
4552
4678
|
isLoading: false,
|
|
4553
4679
|
error: null
|
|
4554
4680
|
});
|
|
4555
|
-
const assistantsRef = (0,
|
|
4556
|
-
(0,
|
|
4681
|
+
const assistantsRef = (0, import_react21.useRef)([]);
|
|
4682
|
+
(0, import_react21.useEffect)(() => {
|
|
4557
4683
|
assistantsRef.current = state.assistants;
|
|
4558
4684
|
}, [state.assistants]);
|
|
4559
|
-
const listAssistants = (0,
|
|
4685
|
+
const listAssistants = (0, import_react21.useCallback)(async () => {
|
|
4560
4686
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4561
4687
|
try {
|
|
4562
4688
|
const assistants = await client.assistants.list();
|
|
@@ -4573,7 +4699,7 @@ var AssistantContextProvider = ({
|
|
|
4573
4699
|
}));
|
|
4574
4700
|
}
|
|
4575
4701
|
}, [client]);
|
|
4576
|
-
const getAssistant = (0,
|
|
4702
|
+
const getAssistant = (0, import_react21.useCallback)(
|
|
4577
4703
|
async (id) => {
|
|
4578
4704
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4579
4705
|
try {
|
|
@@ -4596,7 +4722,7 @@ var AssistantContextProvider = ({
|
|
|
4596
4722
|
},
|
|
4597
4723
|
[client]
|
|
4598
4724
|
);
|
|
4599
|
-
const createAssistant = (0,
|
|
4725
|
+
const createAssistant = (0, import_react21.useCallback)(
|
|
4600
4726
|
async (options) => {
|
|
4601
4727
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4602
4728
|
try {
|
|
@@ -4618,7 +4744,7 @@ var AssistantContextProvider = ({
|
|
|
4618
4744
|
},
|
|
4619
4745
|
[client]
|
|
4620
4746
|
);
|
|
4621
|
-
const updateAssistant = (0,
|
|
4747
|
+
const updateAssistant = (0, import_react21.useCallback)(
|
|
4622
4748
|
async (id, options) => {
|
|
4623
4749
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4624
4750
|
try {
|
|
@@ -4643,7 +4769,7 @@ var AssistantContextProvider = ({
|
|
|
4643
4769
|
},
|
|
4644
4770
|
[client]
|
|
4645
4771
|
);
|
|
4646
|
-
const deleteAssistant = (0,
|
|
4772
|
+
const deleteAssistant = (0, import_react21.useCallback)(
|
|
4647
4773
|
async (id) => {
|
|
4648
4774
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4649
4775
|
try {
|
|
@@ -4665,7 +4791,7 @@ var AssistantContextProvider = ({
|
|
|
4665
4791
|
},
|
|
4666
4792
|
[client]
|
|
4667
4793
|
);
|
|
4668
|
-
const selectAssistant = (0,
|
|
4794
|
+
const selectAssistant = (0, import_react21.useCallback)(
|
|
4669
4795
|
async (id) => {
|
|
4670
4796
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4671
4797
|
try {
|
|
@@ -4696,21 +4822,21 @@ var AssistantContextProvider = ({
|
|
|
4696
4822
|
},
|
|
4697
4823
|
[client]
|
|
4698
4824
|
);
|
|
4699
|
-
const clearCurrentAssistant = (0,
|
|
4825
|
+
const clearCurrentAssistant = (0, import_react21.useCallback)(() => {
|
|
4700
4826
|
setState((prev) => ({
|
|
4701
4827
|
...prev,
|
|
4702
4828
|
currentAssistant: null
|
|
4703
4829
|
}));
|
|
4704
4830
|
}, []);
|
|
4705
|
-
const refresh = (0,
|
|
4831
|
+
const refresh = (0, import_react21.useCallback)(async () => {
|
|
4706
4832
|
await listAssistants();
|
|
4707
4833
|
}, [listAssistants]);
|
|
4708
|
-
(0,
|
|
4834
|
+
(0, import_react21.useEffect)(() => {
|
|
4709
4835
|
if (autoLoad) {
|
|
4710
4836
|
listAssistants();
|
|
4711
4837
|
}
|
|
4712
4838
|
}, [autoLoad, listAssistants]);
|
|
4713
|
-
(0,
|
|
4839
|
+
(0, import_react21.useEffect)(() => {
|
|
4714
4840
|
if (state.assistants.length > 0) {
|
|
4715
4841
|
const isCurrentAssistantValid = state.currentAssistant && state.assistants.some((a) => a.id === state.currentAssistant?.id);
|
|
4716
4842
|
if (!isCurrentAssistantValid) {
|
|
@@ -4738,7 +4864,7 @@ var AssistantContextProvider = ({
|
|
|
4738
4864
|
}
|
|
4739
4865
|
}
|
|
4740
4866
|
}, [initialAssistantId, state.assistants, state.currentAssistant]);
|
|
4741
|
-
return /* @__PURE__ */ (0,
|
|
4867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4742
4868
|
AssistantContext.Provider,
|
|
4743
4869
|
{
|
|
4744
4870
|
value: {
|
|
@@ -4757,7 +4883,7 @@ var AssistantContextProvider = ({
|
|
|
4757
4883
|
);
|
|
4758
4884
|
};
|
|
4759
4885
|
var useAssistantContext = () => {
|
|
4760
|
-
const context = (0,
|
|
4886
|
+
const context = (0, import_react21.useContext)(AssistantContext);
|
|
4761
4887
|
if (!context) {
|
|
4762
4888
|
throw new Error(
|
|
4763
4889
|
"useAssistantContext must be used within an AssistantContextProvider"
|
|
@@ -4768,8 +4894,8 @@ var useAssistantContext = () => {
|
|
|
4768
4894
|
|
|
4769
4895
|
// src/components/Chat/ConversationContext.tsx
|
|
4770
4896
|
var import_client_sdk5 = require("@axiom-lattice/client-sdk");
|
|
4771
|
-
var
|
|
4772
|
-
var ConversationContext = (0,
|
|
4897
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4898
|
+
var ConversationContext = (0, import_react22.createContext)({
|
|
4773
4899
|
assistantId: null,
|
|
4774
4900
|
thread: null,
|
|
4775
4901
|
threadId: null,
|
|
@@ -4811,7 +4937,7 @@ var ConversationContextProvider = ({
|
|
|
4811
4937
|
const {
|
|
4812
4938
|
config: { baseURL, apiKey = "", transport = "sse" }
|
|
4813
4939
|
} = useLatticeChatShellContext();
|
|
4814
|
-
const client = (0,
|
|
4940
|
+
const client = (0, import_react22.useMemo)(
|
|
4815
4941
|
() => new import_client_sdk5.Client({
|
|
4816
4942
|
baseURL,
|
|
4817
4943
|
apiKey,
|
|
@@ -4820,18 +4946,18 @@ var ConversationContextProvider = ({
|
|
|
4820
4946
|
}),
|
|
4821
4947
|
[baseURL, apiKey, assistantId, transport]
|
|
4822
4948
|
);
|
|
4823
|
-
const [threads, setThreads] = (0,
|
|
4824
|
-
const [threadId, setThreadId] = (0,
|
|
4825
|
-
const [isLoading, setIsLoading] = (0,
|
|
4826
|
-
const [error, setError] = (0,
|
|
4827
|
-
const loadedAssistantIdRef = (0,
|
|
4828
|
-
const prevAssistantIdRef = (0,
|
|
4829
|
-
const isLoadingRef = (0,
|
|
4830
|
-
const clientRef = (0,
|
|
4831
|
-
(0,
|
|
4949
|
+
const [threads, setThreads] = (0, import_react22.useState)([]);
|
|
4950
|
+
const [threadId, setThreadId] = (0, import_react22.useState)(null);
|
|
4951
|
+
const [isLoading, setIsLoading] = (0, import_react22.useState)(false);
|
|
4952
|
+
const [error, setError] = (0, import_react22.useState)(null);
|
|
4953
|
+
const loadedAssistantIdRef = (0, import_react22.useRef)(null);
|
|
4954
|
+
const prevAssistantIdRef = (0, import_react22.useRef)(null);
|
|
4955
|
+
const isLoadingRef = (0, import_react22.useRef)(false);
|
|
4956
|
+
const clientRef = (0, import_react22.useRef)(client);
|
|
4957
|
+
(0, import_react22.useEffect)(() => {
|
|
4832
4958
|
clientRef.current = client;
|
|
4833
4959
|
}, [client]);
|
|
4834
|
-
const loadThreads = (0,
|
|
4960
|
+
const loadThreads = (0, import_react22.useCallback)(async () => {
|
|
4835
4961
|
const currentClient = clientRef.current;
|
|
4836
4962
|
if (!assistantId || !currentClient.assistantId) {
|
|
4837
4963
|
setThreads([]);
|
|
@@ -4890,7 +5016,7 @@ var ConversationContextProvider = ({
|
|
|
4890
5016
|
isLoadingRef.current = false;
|
|
4891
5017
|
}
|
|
4892
5018
|
}, [assistantId]);
|
|
4893
|
-
(0,
|
|
5019
|
+
(0, import_react22.useEffect)(() => {
|
|
4894
5020
|
const currentClient = clientRef.current;
|
|
4895
5021
|
const prevAssistantId = prevAssistantIdRef.current;
|
|
4896
5022
|
const assistantChanged = prevAssistantId !== assistantId;
|
|
@@ -4909,20 +5035,20 @@ var ConversationContextProvider = ({
|
|
|
4909
5035
|
prevAssistantIdRef.current = null;
|
|
4910
5036
|
}
|
|
4911
5037
|
}, [assistantId, loadThreads]);
|
|
4912
|
-
const thread = (0,
|
|
5038
|
+
const thread = (0, import_react22.useMemo)(() => {
|
|
4913
5039
|
if (!assistantId || !threadId) {
|
|
4914
5040
|
return null;
|
|
4915
5041
|
}
|
|
4916
5042
|
return threads.find((t) => t.id === threadId) || null;
|
|
4917
5043
|
}, [assistantId, threadId, threads]);
|
|
4918
|
-
const setThread = (0,
|
|
5044
|
+
const setThread = (0, import_react22.useCallback)((newThread) => {
|
|
4919
5045
|
if (newThread) {
|
|
4920
5046
|
setThreadId(newThread.id);
|
|
4921
5047
|
} else {
|
|
4922
5048
|
setThreadId(null);
|
|
4923
5049
|
}
|
|
4924
5050
|
}, []);
|
|
4925
|
-
const selectThread = (0,
|
|
5051
|
+
const selectThread = (0, import_react22.useCallback)(
|
|
4926
5052
|
(targetThreadId) => {
|
|
4927
5053
|
const foundThread = threads.find((t) => t.id === targetThreadId);
|
|
4928
5054
|
if (foundThread) {
|
|
@@ -4931,7 +5057,7 @@ var ConversationContextProvider = ({
|
|
|
4931
5057
|
},
|
|
4932
5058
|
[threads]
|
|
4933
5059
|
);
|
|
4934
|
-
const createThread = (0,
|
|
5060
|
+
const createThread = (0, import_react22.useCallback)(
|
|
4935
5061
|
async (label) => {
|
|
4936
5062
|
if (!assistantId || !client.assistantId) {
|
|
4937
5063
|
throw new Error("No assistant selected");
|
|
@@ -4956,7 +5082,7 @@ var ConversationContextProvider = ({
|
|
|
4956
5082
|
},
|
|
4957
5083
|
[assistantId, client, loadThreads]
|
|
4958
5084
|
);
|
|
4959
|
-
const listThreads = (0,
|
|
5085
|
+
const listThreads = (0, import_react22.useCallback)(async () => {
|
|
4960
5086
|
if (!assistantId || !client.assistantId) {
|
|
4961
5087
|
return [];
|
|
4962
5088
|
}
|
|
@@ -4977,7 +5103,7 @@ var ConversationContextProvider = ({
|
|
|
4977
5103
|
setIsLoading(false);
|
|
4978
5104
|
}
|
|
4979
5105
|
}, [assistantId, client, threads]);
|
|
4980
|
-
const updateThread = (0,
|
|
5106
|
+
const updateThread = (0, import_react22.useCallback)(
|
|
4981
5107
|
async (newThread) => {
|
|
4982
5108
|
if (!assistantId || !client.assistantId) {
|
|
4983
5109
|
throw new Error("No assistant selected");
|
|
@@ -4999,13 +5125,13 @@ var ConversationContextProvider = ({
|
|
|
4999
5125
|
},
|
|
5000
5126
|
[assistantId, client, loadThreads]
|
|
5001
5127
|
);
|
|
5002
|
-
const getThreadById = (0,
|
|
5128
|
+
const getThreadById = (0, import_react22.useCallback)(
|
|
5003
5129
|
(targetThreadId) => {
|
|
5004
5130
|
return threads.find((t) => t.id === targetThreadId) || null;
|
|
5005
5131
|
},
|
|
5006
5132
|
[threads]
|
|
5007
5133
|
);
|
|
5008
|
-
const deleteThread = (0,
|
|
5134
|
+
const deleteThread = (0, import_react22.useCallback)(
|
|
5009
5135
|
async (targetThreadId) => {
|
|
5010
5136
|
if (!assistantId || !client.assistantId) {
|
|
5011
5137
|
throw new Error("No assistant selected");
|
|
@@ -5028,10 +5154,10 @@ var ConversationContextProvider = ({
|
|
|
5028
5154
|
},
|
|
5029
5155
|
[threadId, assistantId, client, loadThreads]
|
|
5030
5156
|
);
|
|
5031
|
-
const clearThread = (0,
|
|
5157
|
+
const clearThread = (0, import_react22.useCallback)(() => {
|
|
5032
5158
|
setThreadId(null);
|
|
5033
5159
|
}, []);
|
|
5034
|
-
return /* @__PURE__ */ (0,
|
|
5160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5035
5161
|
ConversationContext.Provider,
|
|
5036
5162
|
{
|
|
5037
5163
|
value: {
|
|
@@ -5056,7 +5182,7 @@ var ConversationContextProvider = ({
|
|
|
5056
5182
|
);
|
|
5057
5183
|
};
|
|
5058
5184
|
var useConversationContext = () => {
|
|
5059
|
-
const context = (0,
|
|
5185
|
+
const context = (0, import_react22.useContext)(ConversationContext);
|
|
5060
5186
|
if (!context) {
|
|
5061
5187
|
throw new Error(
|
|
5062
5188
|
"useConversationContext must be used within a ConversationContextProvider"
|
|
@@ -5066,12 +5192,12 @@ var useConversationContext = () => {
|
|
|
5066
5192
|
};
|
|
5067
5193
|
|
|
5068
5194
|
// src/components/Chat/AgentConversations.tsx
|
|
5069
|
-
var
|
|
5070
|
-
var
|
|
5071
|
-
var
|
|
5072
|
-
var
|
|
5195
|
+
var import_x6 = require("@ant-design/x");
|
|
5196
|
+
var import_antd23 = require("antd");
|
|
5197
|
+
var import_react23 = require("react");
|
|
5198
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5073
5199
|
var AgentConversations = () => {
|
|
5074
|
-
const { token } =
|
|
5200
|
+
const { token } = import_antd23.theme.useToken();
|
|
5075
5201
|
const { currentAssistant } = useAssistantContext();
|
|
5076
5202
|
const {
|
|
5077
5203
|
assistantId,
|
|
@@ -5086,7 +5212,7 @@ var AgentConversations = () => {
|
|
|
5086
5212
|
background: "transparent",
|
|
5087
5213
|
borderRadius: token.borderRadius
|
|
5088
5214
|
};
|
|
5089
|
-
const threadItems = (0,
|
|
5215
|
+
const threadItems = (0, import_react23.useMemo)(() => {
|
|
5090
5216
|
return threads || [];
|
|
5091
5217
|
}, [threads]);
|
|
5092
5218
|
const items = threadItems.map((thread2) => ({
|
|
@@ -5099,8 +5225,8 @@ var AgentConversations = () => {
|
|
|
5099
5225
|
}
|
|
5100
5226
|
await createThread();
|
|
5101
5227
|
};
|
|
5102
|
-
return /* @__PURE__ */ (0,
|
|
5103
|
-
|
|
5228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5229
|
+
import_x6.Conversations,
|
|
5104
5230
|
{
|
|
5105
5231
|
creation: {
|
|
5106
5232
|
onClick: newChatClick
|
|
@@ -5117,16 +5243,16 @@ var AgentConversations = () => {
|
|
|
5117
5243
|
};
|
|
5118
5244
|
|
|
5119
5245
|
// src/components/Chat/ChatSidebar.tsx
|
|
5120
|
-
var
|
|
5121
|
-
var
|
|
5122
|
-
var
|
|
5246
|
+
var import_react24 = require("react");
|
|
5247
|
+
var import_antd25 = require("antd");
|
|
5248
|
+
var import_icons14 = require("@ant-design/icons");
|
|
5123
5249
|
|
|
5124
5250
|
// src/components/Chat/AssistantList.tsx
|
|
5125
|
-
var
|
|
5126
|
-
var
|
|
5127
|
-
var
|
|
5251
|
+
var import_x7 = require("@ant-design/x");
|
|
5252
|
+
var import_antd24 = require("antd");
|
|
5253
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5128
5254
|
var AssistantList = () => {
|
|
5129
|
-
const { token } =
|
|
5255
|
+
const { token } = import_antd24.theme.useToken();
|
|
5130
5256
|
const { assistants, selectAssistant, currentAssistant } = useAssistantContext();
|
|
5131
5257
|
const style = {
|
|
5132
5258
|
width: "100%",
|
|
@@ -5136,8 +5262,8 @@ var AssistantList = () => {
|
|
|
5136
5262
|
const items = assistants.map((assistant) => ({
|
|
5137
5263
|
key: assistant.id,
|
|
5138
5264
|
label: assistant.name,
|
|
5139
|
-
icon: /* @__PURE__ */ (0,
|
|
5140
|
-
|
|
5265
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5266
|
+
import_antd24.Avatar,
|
|
5141
5267
|
{
|
|
5142
5268
|
size: "small",
|
|
5143
5269
|
style: {
|
|
@@ -5148,8 +5274,8 @@ var AssistantList = () => {
|
|
|
5148
5274
|
}
|
|
5149
5275
|
)
|
|
5150
5276
|
}));
|
|
5151
|
-
return /* @__PURE__ */ (0,
|
|
5152
|
-
|
|
5277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5278
|
+
import_x7.Conversations,
|
|
5153
5279
|
{
|
|
5154
5280
|
items,
|
|
5155
5281
|
activeKey: currentAssistant?.id,
|
|
@@ -5162,9 +5288,9 @@ var AssistantList = () => {
|
|
|
5162
5288
|
};
|
|
5163
5289
|
|
|
5164
5290
|
// src/components/Chat/ChatSidebar.tsx
|
|
5165
|
-
var
|
|
5166
|
-
var
|
|
5167
|
-
var useStyles3 = (0,
|
|
5291
|
+
var import_antd_style11 = require("antd-style");
|
|
5292
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5293
|
+
var useStyles3 = (0, import_antd_style11.createStyles)(({ token, css }) => ({
|
|
5168
5294
|
sidebar: css`
|
|
5169
5295
|
display: flex;
|
|
5170
5296
|
flex-direction: column;
|
|
@@ -5341,7 +5467,7 @@ var ChatSidebar = ({
|
|
|
5341
5467
|
const { styles } = useStyles3();
|
|
5342
5468
|
const { setMenuCollapsed, menuCollapsed, sideAppVisible } = useChatUIContext();
|
|
5343
5469
|
const { setSettingsModalOpen } = useLatticeChatShellContext();
|
|
5344
|
-
const [isHovered, setIsHovered] = (0,
|
|
5470
|
+
const [isHovered, setIsHovered] = (0, import_react24.useState)(false);
|
|
5345
5471
|
const handleToggleCollapse = () => {
|
|
5346
5472
|
setMenuCollapsed(!menuCollapsed);
|
|
5347
5473
|
};
|
|
@@ -5358,87 +5484,87 @@ var ChatSidebar = ({
|
|
|
5358
5484
|
const handleMouseLeave = () => {
|
|
5359
5485
|
setIsHovered(false);
|
|
5360
5486
|
};
|
|
5361
|
-
return /* @__PURE__ */ (0,
|
|
5362
|
-
/* @__PURE__ */ (0,
|
|
5487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
5488
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5363
5489
|
"div",
|
|
5364
5490
|
{
|
|
5365
5491
|
className: styles.sidebar,
|
|
5366
5492
|
onMouseEnter: handleMouseEnter,
|
|
5367
5493
|
onMouseLeave: handleMouseLeave,
|
|
5368
|
-
children: !isCollapsed && /* @__PURE__ */ (0,
|
|
5369
|
-
/* @__PURE__ */ (0,
|
|
5370
|
-
/* @__PURE__ */ (0,
|
|
5371
|
-
/* @__PURE__ */ (0,
|
|
5372
|
-
/* @__PURE__ */ (0,
|
|
5494
|
+
children: !isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
5495
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.content, children: [
|
|
5496
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5497
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
|
|
5498
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AssistantList, {})
|
|
5373
5499
|
] }),
|
|
5374
|
-
/* @__PURE__ */ (0,
|
|
5375
|
-
/* @__PURE__ */ (0,
|
|
5376
|
-
/* @__PURE__ */ (0,
|
|
5377
|
-
/* @__PURE__ */ (0,
|
|
5500
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_antd25.Divider, { className: styles.divider }),
|
|
5501
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5502
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
5503
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AgentConversations, {})
|
|
5378
5504
|
] })
|
|
5379
5505
|
] }),
|
|
5380
|
-
/* @__PURE__ */ (0,
|
|
5381
|
-
/* @__PURE__ */ (0,
|
|
5506
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.footer, children: [
|
|
5507
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5382
5508
|
"button",
|
|
5383
5509
|
{
|
|
5384
5510
|
className: styles.actionButton,
|
|
5385
5511
|
onClick: handleToggleCollapse,
|
|
5386
5512
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5387
5513
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5388
|
-
children: isCollapsed ? /* @__PURE__ */ (0,
|
|
5514
|
+
children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuFoldOutlined, {})
|
|
5389
5515
|
}
|
|
5390
5516
|
),
|
|
5391
|
-
/* @__PURE__ */ (0,
|
|
5517
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5392
5518
|
"button",
|
|
5393
5519
|
{
|
|
5394
5520
|
className: styles.actionButton,
|
|
5395
5521
|
onClick: handleSettingsClick,
|
|
5396
5522
|
title: "Settings",
|
|
5397
5523
|
"aria-label": "Settings",
|
|
5398
|
-
children: /* @__PURE__ */ (0,
|
|
5524
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.SettingOutlined, {})
|
|
5399
5525
|
}
|
|
5400
5526
|
)
|
|
5401
5527
|
] })
|
|
5402
5528
|
] })
|
|
5403
5529
|
}
|
|
5404
5530
|
),
|
|
5405
|
-
isCollapsed && /* @__PURE__ */ (0,
|
|
5531
|
+
isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
5406
5532
|
"div",
|
|
5407
5533
|
{
|
|
5408
5534
|
className: `${styles.hoverOverlay} ${isHovered ? "visible" : ""}`,
|
|
5409
5535
|
onMouseEnter: handleMouseEnter,
|
|
5410
5536
|
onMouseLeave: handleMouseLeave,
|
|
5411
5537
|
children: [
|
|
5412
|
-
/* @__PURE__ */ (0,
|
|
5413
|
-
/* @__PURE__ */ (0,
|
|
5414
|
-
/* @__PURE__ */ (0,
|
|
5415
|
-
/* @__PURE__ */ (0,
|
|
5538
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.hoverContent, children: [
|
|
5539
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5540
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
|
|
5541
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AssistantList, {})
|
|
5416
5542
|
] }),
|
|
5417
|
-
/* @__PURE__ */ (0,
|
|
5418
|
-
/* @__PURE__ */ (0,
|
|
5419
|
-
/* @__PURE__ */ (0,
|
|
5420
|
-
/* @__PURE__ */ (0,
|
|
5543
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_antd25.Divider, { className: styles.divider }),
|
|
5544
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5545
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
5546
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AgentConversations, {})
|
|
5421
5547
|
] })
|
|
5422
5548
|
] }),
|
|
5423
|
-
/* @__PURE__ */ (0,
|
|
5424
|
-
/* @__PURE__ */ (0,
|
|
5549
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.footer, children: [
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5425
5551
|
"button",
|
|
5426
5552
|
{
|
|
5427
5553
|
className: styles.actionButton,
|
|
5428
5554
|
onClick: handleToggleCollapse,
|
|
5429
5555
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5430
5556
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5431
|
-
children: isCollapsed ? /* @__PURE__ */ (0,
|
|
5557
|
+
children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuFoldOutlined, {})
|
|
5432
5558
|
}
|
|
5433
5559
|
),
|
|
5434
|
-
/* @__PURE__ */ (0,
|
|
5560
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5435
5561
|
"button",
|
|
5436
5562
|
{
|
|
5437
5563
|
className: styles.actionButton,
|
|
5438
5564
|
onClick: handleSettingsClick,
|
|
5439
5565
|
title: "Settings",
|
|
5440
5566
|
"aria-label": "Settings",
|
|
5441
|
-
children: /* @__PURE__ */ (0,
|
|
5567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.SettingOutlined, {})
|
|
5442
5568
|
}
|
|
5443
5569
|
)
|
|
5444
5570
|
] })
|
|
@@ -5449,14 +5575,14 @@ var ChatSidebar = ({
|
|
|
5449
5575
|
};
|
|
5450
5576
|
|
|
5451
5577
|
// src/components/Chat/LatticeChatView.tsx
|
|
5452
|
-
var
|
|
5578
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5453
5579
|
var LatticeChatView = (props) => {
|
|
5454
5580
|
const { assistantId, thread } = useConversationContext();
|
|
5455
5581
|
const { currentAssistant } = useAssistantContext();
|
|
5456
5582
|
const {
|
|
5457
5583
|
config: { baseURL }
|
|
5458
5584
|
} = useLatticeChatShellContext();
|
|
5459
|
-
return assistantId && thread ? /* @__PURE__ */ (0,
|
|
5585
|
+
return assistantId && thread ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5460
5586
|
AxiomLatticeProvider,
|
|
5461
5587
|
{
|
|
5462
5588
|
config: {
|
|
@@ -5465,14 +5591,14 @@ var LatticeChatView = (props) => {
|
|
|
5465
5591
|
assistantId,
|
|
5466
5592
|
transport: "sse"
|
|
5467
5593
|
},
|
|
5468
|
-
children: /* @__PURE__ */ (0,
|
|
5594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5469
5595
|
LatticeChat,
|
|
5470
5596
|
{
|
|
5471
5597
|
thread_id: thread?.id,
|
|
5472
5598
|
assistant_id: assistantId,
|
|
5473
5599
|
name: currentAssistant?.name,
|
|
5474
5600
|
description: currentAssistant?.description,
|
|
5475
|
-
menu: /* @__PURE__ */ (0,
|
|
5601
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChatSidebar, {})
|
|
5476
5602
|
}
|
|
5477
5603
|
)
|
|
5478
5604
|
}
|
|
@@ -5480,14 +5606,14 @@ var LatticeChatView = (props) => {
|
|
|
5480
5606
|
};
|
|
5481
5607
|
|
|
5482
5608
|
// src/components/Chat/SettingsModal.tsx
|
|
5483
|
-
var
|
|
5484
|
-
var
|
|
5485
|
-
var
|
|
5486
|
-
var
|
|
5487
|
-
var
|
|
5488
|
-
var { Text:
|
|
5489
|
-
var { TextArea } =
|
|
5490
|
-
var useStyles4 = (0,
|
|
5609
|
+
var import_react25 = require("react");
|
|
5610
|
+
var import_antd26 = require("antd");
|
|
5611
|
+
var import_icons15 = require("@ant-design/icons");
|
|
5612
|
+
var import_antd_style12 = require("antd-style");
|
|
5613
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5614
|
+
var { Text: Text13, Title: Title2 } = import_antd26.Typography;
|
|
5615
|
+
var { TextArea } = import_antd26.Input;
|
|
5616
|
+
var useStyles4 = (0, import_antd_style12.createStyles)(({ token, css }) => ({
|
|
5491
5617
|
// settingsModal: css`
|
|
5492
5618
|
// .ant-modal {
|
|
5493
5619
|
// max-width: 100vw !important;
|
|
@@ -5833,12 +5959,12 @@ var SETTINGS_MENU_ITEMS = [
|
|
|
5833
5959
|
{
|
|
5834
5960
|
key: "environment",
|
|
5835
5961
|
label: "Environment Variables",
|
|
5836
|
-
icon: /* @__PURE__ */ (0,
|
|
5962
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.EnvironmentOutlined, {})
|
|
5837
5963
|
},
|
|
5838
5964
|
{
|
|
5839
5965
|
key: "models",
|
|
5840
5966
|
label: "Model Configuration",
|
|
5841
|
-
icon: /* @__PURE__ */ (0,
|
|
5967
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.ApiOutlined, {})
|
|
5842
5968
|
}
|
|
5843
5969
|
];
|
|
5844
5970
|
var SettingsModal = ({
|
|
@@ -5847,7 +5973,7 @@ var SettingsModal = ({
|
|
|
5847
5973
|
}) => {
|
|
5848
5974
|
const { styles } = useStyles4();
|
|
5849
5975
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
5850
|
-
const [connections, setConnections] = (0,
|
|
5976
|
+
const [connections, setConnections] = (0, import_react25.useState)(() => {
|
|
5851
5977
|
if (typeof window !== "undefined") {
|
|
5852
5978
|
try {
|
|
5853
5979
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -5870,21 +5996,21 @@ var SettingsModal = ({
|
|
|
5870
5996
|
}
|
|
5871
5997
|
return [];
|
|
5872
5998
|
});
|
|
5873
|
-
const [serverConfigs, setServerConfigs] = (0,
|
|
5874
|
-
const connectionsRef = (0,
|
|
5875
|
-
(0,
|
|
5999
|
+
const [serverConfigs, setServerConfigs] = (0, import_react25.useState)({});
|
|
6000
|
+
const connectionsRef = (0, import_react25.useRef)(connections);
|
|
6001
|
+
(0, import_react25.useEffect)(() => {
|
|
5876
6002
|
connectionsRef.current = connections;
|
|
5877
6003
|
}, [connections]);
|
|
5878
|
-
const [activeTabKey, setActiveTabKey] = (0,
|
|
6004
|
+
const [activeTabKey, setActiveTabKey] = (0, import_react25.useState)(
|
|
5879
6005
|
connections.length > 0 ? connections[0].id : ""
|
|
5880
6006
|
);
|
|
5881
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
5882
|
-
const [loading, setLoading] = (0,
|
|
5883
|
-
const [showAddServerModal, setShowAddServerModal] = (0,
|
|
5884
|
-
const [newServerUrl, setNewServerUrl] = (0,
|
|
5885
|
-
const [newServerName, setNewServerName] = (0,
|
|
5886
|
-
const [newServerApiKey, setNewServerApiKey] = (0,
|
|
5887
|
-
const [addingServer, setAddingServer] = (0,
|
|
6007
|
+
const [activeMenu, setActiveMenu] = (0, import_react25.useState)("environment");
|
|
6008
|
+
const [loading, setLoading] = (0, import_react25.useState)(false);
|
|
6009
|
+
const [showAddServerModal, setShowAddServerModal] = (0, import_react25.useState)(false);
|
|
6010
|
+
const [newServerUrl, setNewServerUrl] = (0, import_react25.useState)("");
|
|
6011
|
+
const [newServerName, setNewServerName] = (0, import_react25.useState)("");
|
|
6012
|
+
const [newServerApiKey, setNewServerApiKey] = (0, import_react25.useState)("");
|
|
6013
|
+
const [addingServer, setAddingServer] = (0, import_react25.useState)(false);
|
|
5888
6014
|
const saveConnections = (newConnections) => {
|
|
5889
6015
|
setConnections(newConnections);
|
|
5890
6016
|
if (typeof window !== "undefined") {
|
|
@@ -6023,7 +6149,7 @@ var SettingsModal = ({
|
|
|
6023
6149
|
}
|
|
6024
6150
|
} catch (error) {
|
|
6025
6151
|
console.error("Failed to load configuration:", error);
|
|
6026
|
-
|
|
6152
|
+
import_antd26.message.error("Failed to load current configuration");
|
|
6027
6153
|
}
|
|
6028
6154
|
};
|
|
6029
6155
|
const loadModelsConfig = async (serverId) => {
|
|
@@ -6074,7 +6200,7 @@ var SettingsModal = ({
|
|
|
6074
6200
|
console.error("Failed to load models configuration:", error);
|
|
6075
6201
|
}
|
|
6076
6202
|
};
|
|
6077
|
-
(0,
|
|
6203
|
+
(0, import_react25.useEffect)(() => {
|
|
6078
6204
|
if (open && activeTabKey) {
|
|
6079
6205
|
initializeServerConfig(activeTabKey);
|
|
6080
6206
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -6083,7 +6209,7 @@ var SettingsModal = ({
|
|
|
6083
6209
|
}
|
|
6084
6210
|
}
|
|
6085
6211
|
}, [open, activeTabKey]);
|
|
6086
|
-
(0,
|
|
6212
|
+
(0, import_react25.useEffect)(() => {
|
|
6087
6213
|
if (open && activeTabKey) {
|
|
6088
6214
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
6089
6215
|
if (connection?.connected) {
|
|
@@ -6097,7 +6223,7 @@ var SettingsModal = ({
|
|
|
6097
6223
|
}, [open, activeTabKey, activeMenu]);
|
|
6098
6224
|
const handleAddServer = async () => {
|
|
6099
6225
|
if (!newServerUrl.trim()) {
|
|
6100
|
-
|
|
6226
|
+
import_antd26.message.error("Please enter a server URL");
|
|
6101
6227
|
return;
|
|
6102
6228
|
}
|
|
6103
6229
|
let normalizedUrl = newServerUrl.trim();
|
|
@@ -6123,7 +6249,7 @@ var SettingsModal = ({
|
|
|
6123
6249
|
setNewServerUrl("");
|
|
6124
6250
|
setNewServerName("");
|
|
6125
6251
|
setNewServerApiKey("");
|
|
6126
|
-
|
|
6252
|
+
import_antd26.message.success("Server added successfully");
|
|
6127
6253
|
};
|
|
6128
6254
|
const handleDeleteServer = (serverId) => {
|
|
6129
6255
|
const newConnections = connections.filter((c) => c.id !== serverId);
|
|
@@ -6140,7 +6266,7 @@ var SettingsModal = ({
|
|
|
6140
6266
|
setActiveTabKey("");
|
|
6141
6267
|
}
|
|
6142
6268
|
}
|
|
6143
|
-
|
|
6269
|
+
import_antd26.message.success("Server deleted");
|
|
6144
6270
|
};
|
|
6145
6271
|
const handleTabChange = (newTabKey) => {
|
|
6146
6272
|
setConnections(
|
|
@@ -6154,12 +6280,12 @@ var SettingsModal = ({
|
|
|
6154
6280
|
const handleSave = async () => {
|
|
6155
6281
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
6156
6282
|
if (!connection || !connection.connected) {
|
|
6157
|
-
|
|
6283
|
+
import_antd26.message.error("Please connect to a server first");
|
|
6158
6284
|
return;
|
|
6159
6285
|
}
|
|
6160
6286
|
const url = connection.url;
|
|
6161
6287
|
if (!url) {
|
|
6162
|
-
|
|
6288
|
+
import_antd26.message.error("Please connect to a server first");
|
|
6163
6289
|
return;
|
|
6164
6290
|
}
|
|
6165
6291
|
try {
|
|
@@ -6223,23 +6349,23 @@ var SettingsModal = ({
|
|
|
6223
6349
|
const data = await response.json();
|
|
6224
6350
|
if (response.ok && data.success) {
|
|
6225
6351
|
if (data.requiresRestart && data.requiresRestart.length > 0) {
|
|
6226
|
-
|
|
6352
|
+
import_antd26.message.warning(
|
|
6227
6353
|
`Configuration saved. Please restart the server for ${data.requiresRestart.join(
|
|
6228
6354
|
", "
|
|
6229
6355
|
)} to take effect.`,
|
|
6230
6356
|
5
|
|
6231
6357
|
);
|
|
6232
6358
|
} else {
|
|
6233
|
-
|
|
6359
|
+
import_antd26.message.success("Configuration saved and applied successfully");
|
|
6234
6360
|
}
|
|
6235
6361
|
if (data.warnings && data.warnings.length > 0) {
|
|
6236
6362
|
data.warnings.forEach((warning) => {
|
|
6237
|
-
|
|
6363
|
+
import_antd26.message.warning(warning, 5);
|
|
6238
6364
|
});
|
|
6239
6365
|
}
|
|
6240
6366
|
onClose();
|
|
6241
6367
|
} else {
|
|
6242
|
-
|
|
6368
|
+
import_antd26.message.error(data.error || "Failed to save configuration");
|
|
6243
6369
|
}
|
|
6244
6370
|
} else if (activeMenu === "models") {
|
|
6245
6371
|
const validModels = config.models.filter(
|
|
@@ -6258,17 +6384,17 @@ var SettingsModal = ({
|
|
|
6258
6384
|
});
|
|
6259
6385
|
const data = await response.json();
|
|
6260
6386
|
if (response.ok && data.success) {
|
|
6261
|
-
|
|
6387
|
+
import_antd26.message.success(
|
|
6262
6388
|
"Model configuration saved and registered successfully"
|
|
6263
6389
|
);
|
|
6264
6390
|
onClose();
|
|
6265
6391
|
} else {
|
|
6266
|
-
|
|
6392
|
+
import_antd26.message.error(data.error || "Failed to save model configuration");
|
|
6267
6393
|
}
|
|
6268
6394
|
}
|
|
6269
6395
|
} catch (error) {
|
|
6270
6396
|
console.error("Failed to save configuration:", error);
|
|
6271
|
-
|
|
6397
|
+
import_antd26.message.error(error.message || "Failed to save configuration");
|
|
6272
6398
|
} finally {
|
|
6273
6399
|
setLoading(false);
|
|
6274
6400
|
}
|
|
@@ -6284,25 +6410,25 @@ var SettingsModal = ({
|
|
|
6284
6410
|
}
|
|
6285
6411
|
}));
|
|
6286
6412
|
};
|
|
6287
|
-
return /* @__PURE__ */ (0,
|
|
6288
|
-
/* @__PURE__ */ (0,
|
|
6289
|
-
|
|
6413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.formContainer, children: [
|
|
6414
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6415
|
+
import_antd26.Alert,
|
|
6290
6416
|
{
|
|
6291
6417
|
message: "Configuration Effect",
|
|
6292
|
-
description: /* @__PURE__ */ (0,
|
|
6293
|
-
/* @__PURE__ */ (0,
|
|
6294
|
-
/* @__PURE__ */ (0,
|
|
6295
|
-
|
|
6418
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6419
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { marginBottom: 8 }, children: [
|
|
6420
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6421
|
+
import_icons15.CheckCircleOutlined,
|
|
6296
6422
|
{
|
|
6297
6423
|
style: { color: "#52c41a", marginRight: 8 }
|
|
6298
6424
|
}
|
|
6299
6425
|
),
|
|
6300
|
-
/* @__PURE__ */ (0,
|
|
6426
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("strong", { children: "Immediately effective:" }),
|
|
6301
6427
|
" QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
|
|
6302
6428
|
] }),
|
|
6303
|
-
/* @__PURE__ */ (0,
|
|
6304
|
-
/* @__PURE__ */ (0,
|
|
6305
|
-
/* @__PURE__ */ (0,
|
|
6429
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6430
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.ReloadOutlined, { style: { color: "#faad14", marginRight: 8 } }),
|
|
6431
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("strong", { children: "Requires restart:" }),
|
|
6306
6432
|
" PORT (server must be restarted to change port)"
|
|
6307
6433
|
] })
|
|
6308
6434
|
] }),
|
|
@@ -6311,8 +6437,8 @@ var SettingsModal = ({
|
|
|
6311
6437
|
className: styles.alertCard
|
|
6312
6438
|
}
|
|
6313
6439
|
),
|
|
6314
|
-
/* @__PURE__ */ (0,
|
|
6315
|
-
/* @__PURE__ */ (0,
|
|
6440
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure environment variables in .env format (key=value). One variable per line. Leave password fields empty to keep current values." }) }),
|
|
6441
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6316
6442
|
TextArea,
|
|
6317
6443
|
{
|
|
6318
6444
|
value: config.envText,
|
|
@@ -6389,10 +6515,10 @@ QUEUE_NAME=tasks`,
|
|
|
6389
6515
|
}));
|
|
6390
6516
|
}
|
|
6391
6517
|
};
|
|
6392
|
-
return /* @__PURE__ */ (0,
|
|
6393
|
-
/* @__PURE__ */ (0,
|
|
6394
|
-
config.models.map((model, index) => /* @__PURE__ */ (0,
|
|
6395
|
-
/* @__PURE__ */ (0,
|
|
6518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.formContainer, children: [
|
|
6519
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure model lattices. Each model will be registered with the provided key and can be used by agents." }) }),
|
|
6520
|
+
config.models.map((model, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.card, children: [
|
|
6521
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
6396
6522
|
"div",
|
|
6397
6523
|
{
|
|
6398
6524
|
style: {
|
|
@@ -6404,13 +6530,13 @@ QUEUE_NAME=tasks`,
|
|
|
6404
6530
|
borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
|
|
6405
6531
|
},
|
|
6406
6532
|
children: [
|
|
6407
|
-
/* @__PURE__ */ (0,
|
|
6408
|
-
/* @__PURE__ */ (0,
|
|
6533
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6534
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text13, { strong: true, style: { fontSize: 16 }, children: [
|
|
6409
6535
|
"Model ",
|
|
6410
6536
|
index + 1
|
|
6411
6537
|
] }),
|
|
6412
|
-
model.key && /* @__PURE__ */ (0,
|
|
6413
|
-
|
|
6538
|
+
model.key && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
6539
|
+
Text13,
|
|
6414
6540
|
{
|
|
6415
6541
|
type: "secondary",
|
|
6416
6542
|
style: { marginLeft: 8, fontSize: 12 },
|
|
@@ -6422,8 +6548,8 @@ QUEUE_NAME=tasks`,
|
|
|
6422
6548
|
}
|
|
6423
6549
|
)
|
|
6424
6550
|
] }),
|
|
6425
|
-
config.models.length > 1 && /* @__PURE__ */ (0,
|
|
6426
|
-
|
|
6551
|
+
config.models.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6552
|
+
import_antd26.Button,
|
|
6427
6553
|
{
|
|
6428
6554
|
type: "text",
|
|
6429
6555
|
danger: true,
|
|
@@ -6439,11 +6565,11 @@ QUEUE_NAME=tasks`,
|
|
|
6439
6565
|
]
|
|
6440
6566
|
}
|
|
6441
6567
|
),
|
|
6442
|
-
/* @__PURE__ */ (0,
|
|
6443
|
-
/* @__PURE__ */ (0,
|
|
6444
|
-
/* @__PURE__ */ (0,
|
|
6445
|
-
/* @__PURE__ */ (0,
|
|
6446
|
-
|
|
6568
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_antd26.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
6569
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6570
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Key *" }),
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6572
|
+
import_antd26.Input,
|
|
6447
6573
|
{
|
|
6448
6574
|
placeholder: "e.g., default, gpt-4, claude",
|
|
6449
6575
|
value: model.key,
|
|
@@ -6451,12 +6577,12 @@ QUEUE_NAME=tasks`,
|
|
|
6451
6577
|
style: { height: 40 }
|
|
6452
6578
|
}
|
|
6453
6579
|
),
|
|
6454
|
-
/* @__PURE__ */ (0,
|
|
6580
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formDescription, children: "Unique identifier for this model" })
|
|
6455
6581
|
] }),
|
|
6456
|
-
/* @__PURE__ */ (0,
|
|
6457
|
-
/* @__PURE__ */ (0,
|
|
6458
|
-
/* @__PURE__ */ (0,
|
|
6459
|
-
|
|
6582
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6583
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Provider *" }),
|
|
6584
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6585
|
+
import_antd26.Select,
|
|
6460
6586
|
{
|
|
6461
6587
|
style: { width: "100%", height: 40 },
|
|
6462
6588
|
value: model.provider,
|
|
@@ -6471,10 +6597,10 @@ QUEUE_NAME=tasks`,
|
|
|
6471
6597
|
}
|
|
6472
6598
|
)
|
|
6473
6599
|
] }),
|
|
6474
|
-
/* @__PURE__ */ (0,
|
|
6475
|
-
/* @__PURE__ */ (0,
|
|
6476
|
-
/* @__PURE__ */ (0,
|
|
6477
|
-
|
|
6600
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6601
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Model Name *" }),
|
|
6602
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6603
|
+
import_antd26.Input,
|
|
6478
6604
|
{
|
|
6479
6605
|
placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
|
|
6480
6606
|
value: model.model,
|
|
@@ -6483,10 +6609,10 @@ QUEUE_NAME=tasks`,
|
|
|
6483
6609
|
}
|
|
6484
6610
|
)
|
|
6485
6611
|
] }),
|
|
6486
|
-
/* @__PURE__ */ (0,
|
|
6487
|
-
/* @__PURE__ */ (0,
|
|
6488
|
-
/* @__PURE__ */ (0,
|
|
6489
|
-
|
|
6612
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6613
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "API Key" }),
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6615
|
+
import_antd26.Input.Password,
|
|
6490
6616
|
{
|
|
6491
6617
|
placeholder: "Enter your API key",
|
|
6492
6618
|
value: model.apiKey,
|
|
@@ -6494,12 +6620,12 @@ QUEUE_NAME=tasks`,
|
|
|
6494
6620
|
style: { height: 40 }
|
|
6495
6621
|
}
|
|
6496
6622
|
),
|
|
6497
|
-
/* @__PURE__ */ (0,
|
|
6623
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
|
|
6498
6624
|
] }),
|
|
6499
|
-
/* @__PURE__ */ (0,
|
|
6500
|
-
/* @__PURE__ */ (0,
|
|
6501
|
-
/* @__PURE__ */ (0,
|
|
6502
|
-
|
|
6625
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6626
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Base URL" }),
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6628
|
+
import_antd26.Input,
|
|
6503
6629
|
{
|
|
6504
6630
|
placeholder: "e.g., https://api.openai.com/v1",
|
|
6505
6631
|
value: model.baseURL,
|
|
@@ -6507,23 +6633,23 @@ QUEUE_NAME=tasks`,
|
|
|
6507
6633
|
style: { height: 40 }
|
|
6508
6634
|
}
|
|
6509
6635
|
),
|
|
6510
|
-
/* @__PURE__ */ (0,
|
|
6636
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formDescription, children: "Optional custom base URL for the API" })
|
|
6511
6637
|
] }),
|
|
6512
|
-
/* @__PURE__ */ (0,
|
|
6513
|
-
/* @__PURE__ */ (0,
|
|
6514
|
-
|
|
6638
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_antd26.Space, { children: [
|
|
6639
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6640
|
+
import_antd26.Switch,
|
|
6515
6641
|
{
|
|
6516
6642
|
checked: model.streaming,
|
|
6517
6643
|
onChange: (checked) => handleModelChange(index, "streaming", checked)
|
|
6518
6644
|
}
|
|
6519
6645
|
),
|
|
6520
|
-
/* @__PURE__ */ (0,
|
|
6646
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { children: "Enable Streaming" })
|
|
6521
6647
|
] }) }),
|
|
6522
|
-
/* @__PURE__ */ (0,
|
|
6523
|
-
/* @__PURE__ */ (0,
|
|
6524
|
-
/* @__PURE__ */ (0,
|
|
6525
|
-
/* @__PURE__ */ (0,
|
|
6526
|
-
|
|
6648
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { display: "flex", gap: 20 }, children: [
|
|
6649
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { flex: 1 }, children: [
|
|
6650
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Max Tokens" }),
|
|
6651
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6652
|
+
import_antd26.Input,
|
|
6527
6653
|
{
|
|
6528
6654
|
type: "number",
|
|
6529
6655
|
placeholder: "e.g., 4096",
|
|
@@ -6537,10 +6663,10 @@ QUEUE_NAME=tasks`,
|
|
|
6537
6663
|
}
|
|
6538
6664
|
)
|
|
6539
6665
|
] }),
|
|
6540
|
-
/* @__PURE__ */ (0,
|
|
6541
|
-
/* @__PURE__ */ (0,
|
|
6542
|
-
/* @__PURE__ */ (0,
|
|
6543
|
-
|
|
6666
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { flex: 1 }, children: [
|
|
6667
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { className: styles.formLabel, children: "Temperature" }),
|
|
6668
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6669
|
+
import_antd26.Input,
|
|
6544
6670
|
{
|
|
6545
6671
|
type: "number",
|
|
6546
6672
|
step: "0.1",
|
|
@@ -6558,8 +6684,8 @@ QUEUE_NAME=tasks`,
|
|
|
6558
6684
|
] })
|
|
6559
6685
|
] })
|
|
6560
6686
|
] }, index)),
|
|
6561
|
-
/* @__PURE__ */ (0,
|
|
6562
|
-
|
|
6687
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6688
|
+
import_antd26.Button,
|
|
6563
6689
|
{
|
|
6564
6690
|
type: "dashed",
|
|
6565
6691
|
onClick: handleAddModel,
|
|
@@ -6586,9 +6712,9 @@ QUEUE_NAME=tasks`,
|
|
|
6586
6712
|
);
|
|
6587
6713
|
const currentConnection = connections.find((c) => c.id === activeTabKey);
|
|
6588
6714
|
const renderTabLabel = (connection) => {
|
|
6589
|
-
return /* @__PURE__ */ (0,
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
6591
|
-
|
|
6715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
6716
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6717
|
+
import_icons15.CloudServerOutlined,
|
|
6592
6718
|
{
|
|
6593
6719
|
style: {
|
|
6594
6720
|
marginRight: 8,
|
|
@@ -6596,15 +6722,15 @@ QUEUE_NAME=tasks`,
|
|
|
6596
6722
|
}
|
|
6597
6723
|
}
|
|
6598
6724
|
),
|
|
6599
|
-
/* @__PURE__ */ (0,
|
|
6600
|
-
connection.connected && /* @__PURE__ */ (0,
|
|
6601
|
-
|
|
6725
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: connection.name }),
|
|
6726
|
+
connection.connected && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6727
|
+
import_icons15.CheckCircleFilled,
|
|
6602
6728
|
{
|
|
6603
6729
|
style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
|
|
6604
6730
|
}
|
|
6605
6731
|
),
|
|
6606
|
-
connection.error && !connection.connecting && /* @__PURE__ */ (0,
|
|
6607
|
-
|
|
6732
|
+
connection.error && !connection.connecting && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6733
|
+
import_icons15.CloseCircleFilled,
|
|
6608
6734
|
{
|
|
6609
6735
|
style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
|
|
6610
6736
|
}
|
|
@@ -6614,35 +6740,35 @@ QUEUE_NAME=tasks`,
|
|
|
6614
6740
|
const tabItems = connections.map((connection) => ({
|
|
6615
6741
|
key: connection.id,
|
|
6616
6742
|
label: renderTabLabel(connection),
|
|
6617
|
-
children: /* @__PURE__ */ (0,
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
6743
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { style: { display: "flex", height: "100%" }, children: [
|
|
6744
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
6619
6745
|
"div",
|
|
6620
6746
|
{
|
|
6621
6747
|
className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
|
|
6622
6748
|
onClick: () => setActiveMenu(item.key),
|
|
6623
6749
|
children: [
|
|
6624
|
-
/* @__PURE__ */ (0,
|
|
6625
|
-
/* @__PURE__ */ (0,
|
|
6750
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: styles.menuItemIcon, children: item.icon }),
|
|
6751
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: styles.menuItemText, children: item.label })
|
|
6626
6752
|
]
|
|
6627
6753
|
},
|
|
6628
6754
|
item.key
|
|
6629
6755
|
)) }),
|
|
6630
|
-
/* @__PURE__ */ (0,
|
|
6631
|
-
/* @__PURE__ */ (0,
|
|
6632
|
-
/* @__PURE__ */ (0,
|
|
6633
|
-
/* @__PURE__ */ (0,
|
|
6634
|
-
/* @__PURE__ */ (0,
|
|
6756
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.content, children: [
|
|
6757
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.contentHeader, children: [
|
|
6758
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.contentHeaderLeft, children: [
|
|
6759
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Title2, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
|
|
6760
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text13, { className: styles.contentDescription, children: [
|
|
6635
6761
|
activeMenu === "environment" && "Manage environment variables for the gateway server",
|
|
6636
6762
|
activeMenu === "models" && "Configure and register model lattices for use by agents"
|
|
6637
6763
|
] })
|
|
6638
6764
|
] }),
|
|
6639
|
-
/* @__PURE__ */ (0,
|
|
6640
|
-
/* @__PURE__ */ (0,
|
|
6641
|
-
/* @__PURE__ */ (0,
|
|
6642
|
-
|
|
6765
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.contentHeaderRight, children: [
|
|
6766
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_antd26.Button, { onClick: onClose, children: "Cancel" }),
|
|
6767
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6768
|
+
import_antd26.Button,
|
|
6643
6769
|
{
|
|
6644
6770
|
type: "primary",
|
|
6645
|
-
icon: /* @__PURE__ */ (0,
|
|
6771
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.SaveOutlined, {}),
|
|
6646
6772
|
onClick: handleSave,
|
|
6647
6773
|
loading,
|
|
6648
6774
|
children: "Save Configuration"
|
|
@@ -6650,9 +6776,9 @@ QUEUE_NAME=tasks`,
|
|
|
6650
6776
|
)
|
|
6651
6777
|
] })
|
|
6652
6778
|
] }),
|
|
6653
|
-
/* @__PURE__ */ (0,
|
|
6779
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.contentBody, children: renderContent(connection.id) })
|
|
6654
6780
|
] })
|
|
6655
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
6781
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6656
6782
|
"div",
|
|
6657
6783
|
{
|
|
6658
6784
|
style: {
|
|
@@ -6664,29 +6790,29 @@ QUEUE_NAME=tasks`,
|
|
|
6664
6790
|
gap: 16,
|
|
6665
6791
|
padding: 48
|
|
6666
6792
|
},
|
|
6667
|
-
children: connection.connecting ? /* @__PURE__ */ (0,
|
|
6668
|
-
/* @__PURE__ */ (0,
|
|
6669
|
-
/* @__PURE__ */ (0,
|
|
6670
|
-
/* @__PURE__ */ (0,
|
|
6793
|
+
children: connection.connecting ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6794
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
|
|
6795
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Title2, { level: 4, children: "Connecting..." }),
|
|
6796
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text13, { type: "secondary", style: { textAlign: "center" }, children: [
|
|
6671
6797
|
"Connecting to ",
|
|
6672
6798
|
connection.url
|
|
6673
6799
|
] })
|
|
6674
|
-
] }) : /* @__PURE__ */ (0,
|
|
6675
|
-
/* @__PURE__ */ (0,
|
|
6676
|
-
/* @__PURE__ */ (0,
|
|
6677
|
-
/* @__PURE__ */ (0,
|
|
6678
|
-
|
|
6800
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6801
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
|
|
6802
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Title2, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
|
|
6803
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6804
|
+
Text13,
|
|
6679
6805
|
{
|
|
6680
6806
|
type: "secondary",
|
|
6681
6807
|
style: { textAlign: "center", maxWidth: 400 },
|
|
6682
6808
|
children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
|
|
6683
6809
|
}
|
|
6684
6810
|
),
|
|
6685
|
-
/* @__PURE__ */ (0,
|
|
6686
|
-
|
|
6811
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6812
|
+
import_antd26.Button,
|
|
6687
6813
|
{
|
|
6688
6814
|
type: "primary",
|
|
6689
|
-
icon: /* @__PURE__ */ (0,
|
|
6815
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.LinkOutlined, {}),
|
|
6690
6816
|
onClick: () => checkConnection(connection.id),
|
|
6691
6817
|
loading: connection.connecting,
|
|
6692
6818
|
style: { marginTop: 16 },
|
|
@@ -6698,9 +6824,9 @@ QUEUE_NAME=tasks`,
|
|
|
6698
6824
|
) }),
|
|
6699
6825
|
closable: connections.length > 1
|
|
6700
6826
|
}));
|
|
6701
|
-
return /* @__PURE__ */ (0,
|
|
6702
|
-
/* @__PURE__ */ (0,
|
|
6703
|
-
|
|
6827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6828
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6829
|
+
import_antd26.Modal,
|
|
6704
6830
|
{
|
|
6705
6831
|
open,
|
|
6706
6832
|
onCancel: onClose,
|
|
@@ -6708,8 +6834,8 @@ QUEUE_NAME=tasks`,
|
|
|
6708
6834
|
width: "80%",
|
|
6709
6835
|
footer: null,
|
|
6710
6836
|
title: "Settings",
|
|
6711
|
-
children: /* @__PURE__ */ (0,
|
|
6712
|
-
|
|
6837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6838
|
+
import_antd26.Tabs,
|
|
6713
6839
|
{
|
|
6714
6840
|
activeKey: activeTabKey,
|
|
6715
6841
|
onChange: handleTabChange,
|
|
@@ -6722,7 +6848,7 @@ QUEUE_NAME=tasks`,
|
|
|
6722
6848
|
}
|
|
6723
6849
|
},
|
|
6724
6850
|
items: tabItems,
|
|
6725
|
-
addIcon: /* @__PURE__ */ (0,
|
|
6851
|
+
addIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
6726
6852
|
"div",
|
|
6727
6853
|
{
|
|
6728
6854
|
style: {
|
|
@@ -6732,8 +6858,8 @@ QUEUE_NAME=tasks`,
|
|
|
6732
6858
|
padding: "4px 8px"
|
|
6733
6859
|
},
|
|
6734
6860
|
children: [
|
|
6735
|
-
/* @__PURE__ */ (0,
|
|
6736
|
-
/* @__PURE__ */ (0,
|
|
6861
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons15.PlusOutlined, {}),
|
|
6862
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: "Add Server" })
|
|
6737
6863
|
]
|
|
6738
6864
|
}
|
|
6739
6865
|
)
|
|
@@ -6741,8 +6867,8 @@ QUEUE_NAME=tasks`,
|
|
|
6741
6867
|
) })
|
|
6742
6868
|
}
|
|
6743
6869
|
),
|
|
6744
|
-
/* @__PURE__ */ (0,
|
|
6745
|
-
|
|
6870
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6871
|
+
import_antd26.Modal,
|
|
6746
6872
|
{
|
|
6747
6873
|
title: "Add New Server",
|
|
6748
6874
|
open: showAddServerModal,
|
|
@@ -6755,11 +6881,11 @@ QUEUE_NAME=tasks`,
|
|
|
6755
6881
|
},
|
|
6756
6882
|
confirmLoading: addingServer,
|
|
6757
6883
|
className: styles.addServerModal,
|
|
6758
|
-
children: /* @__PURE__ */ (0,
|
|
6759
|
-
/* @__PURE__ */ (0,
|
|
6760
|
-
/* @__PURE__ */ (0,
|
|
6761
|
-
/* @__PURE__ */ (0,
|
|
6762
|
-
|
|
6884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_antd26.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
6885
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6886
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
|
|
6887
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6888
|
+
import_antd26.Input,
|
|
6763
6889
|
{
|
|
6764
6890
|
placeholder: "e.g., Production Server",
|
|
6765
6891
|
value: newServerName,
|
|
@@ -6767,12 +6893,12 @@ QUEUE_NAME=tasks`,
|
|
|
6767
6893
|
onPressEnter: handleAddServer
|
|
6768
6894
|
}
|
|
6769
6895
|
),
|
|
6770
|
-
/* @__PURE__ */ (0,
|
|
6896
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
|
|
6771
6897
|
] }),
|
|
6772
|
-
/* @__PURE__ */ (0,
|
|
6773
|
-
/* @__PURE__ */ (0,
|
|
6774
|
-
/* @__PURE__ */ (0,
|
|
6775
|
-
|
|
6898
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6899
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
|
|
6900
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6901
|
+
import_antd26.Input,
|
|
6776
6902
|
{
|
|
6777
6903
|
placeholder: "e.g., http://localhost:4001",
|
|
6778
6904
|
value: newServerUrl,
|
|
@@ -6780,12 +6906,12 @@ QUEUE_NAME=tasks`,
|
|
|
6780
6906
|
onPressEnter: handleAddServer
|
|
6781
6907
|
}
|
|
6782
6908
|
),
|
|
6783
|
-
/* @__PURE__ */ (0,
|
|
6909
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
|
|
6784
6910
|
] }),
|
|
6785
|
-
/* @__PURE__ */ (0,
|
|
6786
|
-
/* @__PURE__ */ (0,
|
|
6787
|
-
/* @__PURE__ */ (0,
|
|
6788
|
-
|
|
6911
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6912
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
|
|
6913
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6914
|
+
import_antd26.Input.Password,
|
|
6789
6915
|
{
|
|
6790
6916
|
placeholder: "Optional: Enter API key for authentication",
|
|
6791
6917
|
value: newServerApiKey,
|
|
@@ -6793,7 +6919,7 @@ QUEUE_NAME=tasks`,
|
|
|
6793
6919
|
onPressEnter: handleAddServer
|
|
6794
6920
|
}
|
|
6795
6921
|
),
|
|
6796
|
-
/* @__PURE__ */ (0,
|
|
6922
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text13, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
|
|
6797
6923
|
] })
|
|
6798
6924
|
] })
|
|
6799
6925
|
}
|
|
@@ -6802,10 +6928,10 @@ QUEUE_NAME=tasks`,
|
|
|
6802
6928
|
};
|
|
6803
6929
|
|
|
6804
6930
|
// src/components/Chat/AgentServerSetting.tsx
|
|
6805
|
-
var
|
|
6931
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
6806
6932
|
var AgentServerSetting = () => {
|
|
6807
6933
|
const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
|
|
6808
|
-
return /* @__PURE__ */ (0,
|
|
6934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
6809
6935
|
SettingsModal,
|
|
6810
6936
|
{
|
|
6811
6937
|
open: settingsModalOpen,
|
|
@@ -6815,11 +6941,11 @@ var AgentServerSetting = () => {
|
|
|
6815
6941
|
};
|
|
6816
6942
|
|
|
6817
6943
|
// src/components/Chat/LatticeChatShell.tsx
|
|
6818
|
-
var
|
|
6944
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6819
6945
|
var LatticeChatShell = (props) => {
|
|
6820
|
-
return /* @__PURE__ */ (0,
|
|
6821
|
-
/* @__PURE__ */ (0,
|
|
6822
|
-
/* @__PURE__ */ (0,
|
|
6946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(LatticeChatShellContextProvider, { ...props, children: [
|
|
6947
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ConversationContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(LatticeChatView, {}) }) }),
|
|
6948
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(AgentServerSetting, {})
|
|
6823
6949
|
] });
|
|
6824
6950
|
};
|
|
6825
6951
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -6840,7 +6966,6 @@ var LatticeChatShell = (props) => {
|
|
|
6840
6966
|
LatticeChatShell,
|
|
6841
6967
|
LatticeChatShellContext,
|
|
6842
6968
|
LatticeChatShellContextProvider,
|
|
6843
|
-
MDMermaid,
|
|
6844
6969
|
MDResponse,
|
|
6845
6970
|
MDViewFormItem,
|
|
6846
6971
|
SideAppViewBrowser,
|