@axiom-lattice/react-sdk 2.1.21 → 2.1.23
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 +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +1769 -733
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1693 -630
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -4
package/dist/index.mjs
CHANGED
|
@@ -136,7 +136,7 @@ function useChat(threadId, options = {}) {
|
|
|
136
136
|
stopStreamingRef.current = null;
|
|
137
137
|
}
|
|
138
138
|
const { input, command, streaming = true } = data;
|
|
139
|
-
const { message:
|
|
139
|
+
const { message: message6, files, ...rest } = input || {};
|
|
140
140
|
setState((prev) => ({
|
|
141
141
|
...prev,
|
|
142
142
|
isLoading: true,
|
|
@@ -145,7 +145,7 @@ function useChat(threadId, options = {}) {
|
|
|
145
145
|
}));
|
|
146
146
|
const userMessage = {
|
|
147
147
|
id: Date.now().toString(),
|
|
148
|
-
content:
|
|
148
|
+
content: message6 || command?.resume?.message || "",
|
|
149
149
|
files,
|
|
150
150
|
role: "human"
|
|
151
151
|
};
|
|
@@ -483,7 +483,7 @@ function AgentThreadProvider({
|
|
|
483
483
|
stopStreamingRef.current = null;
|
|
484
484
|
}
|
|
485
485
|
const { input, command, streaming = true } = data;
|
|
486
|
-
const { message:
|
|
486
|
+
const { message: message6, files, ...rest } = input || {};
|
|
487
487
|
setState((prev) => ({
|
|
488
488
|
...prev,
|
|
489
489
|
isLoading: true,
|
|
@@ -491,7 +491,7 @@ function AgentThreadProvider({
|
|
|
491
491
|
}));
|
|
492
492
|
const userMessage = {
|
|
493
493
|
id: Date.now().toString(),
|
|
494
|
-
content:
|
|
494
|
+
content: message6 || command?.resume?.message || "",
|
|
495
495
|
files,
|
|
496
496
|
role: "human"
|
|
497
497
|
};
|
|
@@ -1094,6 +1094,7 @@ var useStyle = createStyles(({ token, css }) => {
|
|
|
1094
1094
|
gap: 0px;
|
|
1095
1095
|
transition: all 0.3s ease;
|
|
1096
1096
|
flex-shrink: 0;
|
|
1097
|
+
position: relative;
|
|
1097
1098
|
|
|
1098
1099
|
&.drawer-open {
|
|
1099
1100
|
min-width: 200px;
|
|
@@ -1177,6 +1178,14 @@ var useStyle = createStyles(({ token, css }) => {
|
|
|
1177
1178
|
padding: 0 20px;
|
|
1178
1179
|
flex: 1;
|
|
1179
1180
|
overflow: hidden;
|
|
1181
|
+
.ant-bubble:last-child {
|
|
1182
|
+
margin-top: 80px;
|
|
1183
|
+
}
|
|
1184
|
+
`,
|
|
1185
|
+
messagesWithHeader: css`
|
|
1186
|
+
.ant-bubble:last-child {
|
|
1187
|
+
margin-top: 80px;
|
|
1188
|
+
}
|
|
1180
1189
|
`,
|
|
1181
1190
|
placeholder: css`
|
|
1182
1191
|
padding-top: 32px;
|
|
@@ -1184,6 +1193,16 @@ var useStyle = createStyles(({ token, css }) => {
|
|
|
1184
1193
|
sender: css`
|
|
1185
1194
|
box-shadow: ${token.boxShadow};
|
|
1186
1195
|
`,
|
|
1196
|
+
fixedHeader: css`
|
|
1197
|
+
position: absolute;
|
|
1198
|
+
top: 0;
|
|
1199
|
+
left: 0;
|
|
1200
|
+
right: 0;
|
|
1201
|
+
z-index: 100;
|
|
1202
|
+
background: ${token.colorBgContainer}00;
|
|
1203
|
+
backdrop-filter: blur(4px) saturate(180%);
|
|
1204
|
+
-webkit-backdrop-filter: blur(4px) saturate(180%);
|
|
1205
|
+
`,
|
|
1187
1206
|
logo: css`
|
|
1188
1207
|
display: flex;
|
|
1189
1208
|
height: 72px;
|
|
@@ -1287,11 +1306,11 @@ import {
|
|
|
1287
1306
|
|
|
1288
1307
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
1289
1308
|
import { Button as Button2, Space as Space2, Typography as Typography2 } from "antd";
|
|
1290
|
-
import { useState as
|
|
1309
|
+
import { useState as useState10 } from "react";
|
|
1291
1310
|
|
|
1292
1311
|
// src/components/GenUI/MDResponse.tsx
|
|
1293
1312
|
import XMarkdown from "@ant-design/x-markdown";
|
|
1294
|
-
import { useRef as
|
|
1313
|
+
import { useRef as useRef6, useState as useState9, useMemo as useMemo2 } from "react";
|
|
1295
1314
|
import { createStyles as createStyles2 } from "antd-style";
|
|
1296
1315
|
|
|
1297
1316
|
// src/components/GenUI/Code.tsx
|
|
@@ -1308,7 +1327,12 @@ var ReactInfographic = (props) => {
|
|
|
1308
1327
|
useEffect5(() => {
|
|
1309
1328
|
if ($container.current) {
|
|
1310
1329
|
infographicInstance.current = new Infographic({
|
|
1311
|
-
container: $container.current
|
|
1330
|
+
container: $container.current,
|
|
1331
|
+
width: "100%",
|
|
1332
|
+
height: "100%"
|
|
1333
|
+
});
|
|
1334
|
+
infographicInstance.current.on("error", (error) => {
|
|
1335
|
+
console.error(error);
|
|
1312
1336
|
});
|
|
1313
1337
|
}
|
|
1314
1338
|
return () => {
|
|
@@ -1316,13 +1340,459 @@ var ReactInfographic = (props) => {
|
|
|
1316
1340
|
};
|
|
1317
1341
|
}, []);
|
|
1318
1342
|
useEffect5(() => {
|
|
1319
|
-
|
|
1343
|
+
const a = `infographic sequence-steps-simple
|
|
1344
|
+
data
|
|
1345
|
+
sequences
|
|
1346
|
+
- label Step 1
|
|
1347
|
+
- label Step 2
|
|
1348
|
+
- label Step 3
|
|
1349
|
+
order asc`;
|
|
1350
|
+
infographicInstance.current?.render(a);
|
|
1351
|
+
}, [children, infographicInstance.current]);
|
|
1352
|
+
return /* @__PURE__ */ jsx5("div", { style: { height: 600, width: 600 }, ref: $container });
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
// src/components/GenUI/ReactChart.tsx
|
|
1356
|
+
import { useEffect as useEffect6, useRef as useRef5, useState as useState7 } from "react";
|
|
1357
|
+
import * as echarts from "echarts";
|
|
1358
|
+
import { Card, Alert, Table } from "antd";
|
|
1359
|
+
import { parse } from "best-effort-json-parser";
|
|
1360
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1361
|
+
function createDefaultEChartsConfig(tableData) {
|
|
1362
|
+
if (!tableData || tableData.length === 0) {
|
|
1363
|
+
return {
|
|
1364
|
+
title: {
|
|
1365
|
+
text: "Chart",
|
|
1366
|
+
left: "left"
|
|
1367
|
+
},
|
|
1368
|
+
tooltip: {
|
|
1369
|
+
trigger: "axis"
|
|
1370
|
+
},
|
|
1371
|
+
legend: {
|
|
1372
|
+
right: 0,
|
|
1373
|
+
orient: "vertical"
|
|
1374
|
+
},
|
|
1375
|
+
xAxis: {
|
|
1376
|
+
type: "category",
|
|
1377
|
+
data: []
|
|
1378
|
+
},
|
|
1379
|
+
yAxis: {
|
|
1380
|
+
type: "value"
|
|
1381
|
+
},
|
|
1382
|
+
series: [
|
|
1383
|
+
{
|
|
1384
|
+
type: "line",
|
|
1385
|
+
name: "Series 1",
|
|
1386
|
+
data: []
|
|
1387
|
+
}
|
|
1388
|
+
],
|
|
1389
|
+
grid: {
|
|
1390
|
+
left: "3%",
|
|
1391
|
+
right: "4%",
|
|
1392
|
+
bottom: "3%",
|
|
1393
|
+
containLabel: true
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
const firstRow = tableData[0];
|
|
1398
|
+
const keys = Object.keys(firstRow);
|
|
1399
|
+
if (keys.length === 0) {
|
|
1400
|
+
return createDefaultEChartsConfig([]);
|
|
1401
|
+
}
|
|
1402
|
+
const numericKeys = keys.filter((key) => {
|
|
1403
|
+
const value = firstRow[key];
|
|
1404
|
+
return typeof value === "number" || !isNaN(Number(value));
|
|
1405
|
+
});
|
|
1406
|
+
if (numericKeys.length > 0) {
|
|
1407
|
+
const yKey = numericKeys[0];
|
|
1408
|
+
const xKey = keys.find((k) => !numericKeys.includes(k)) || keys[0];
|
|
1409
|
+
const xAxisData = tableData.map(
|
|
1410
|
+
(row, idx) => row[xKey] !== void 0 ? String(row[xKey]) : `Item ${idx + 1}`
|
|
1411
|
+
);
|
|
1412
|
+
const seriesData = tableData.map((row) => {
|
|
1413
|
+
const val = row[yKey];
|
|
1414
|
+
return typeof val === "number" ? val : Number(val) || 0;
|
|
1415
|
+
});
|
|
1416
|
+
return {
|
|
1417
|
+
title: {
|
|
1418
|
+
text: "Chart",
|
|
1419
|
+
left: "left"
|
|
1420
|
+
},
|
|
1421
|
+
tooltip: {
|
|
1422
|
+
trigger: "axis"
|
|
1423
|
+
},
|
|
1424
|
+
legend: {
|
|
1425
|
+
right: 0,
|
|
1426
|
+
orient: "vertical",
|
|
1427
|
+
data: [yKey]
|
|
1428
|
+
},
|
|
1429
|
+
xAxis: {
|
|
1430
|
+
type: "category",
|
|
1431
|
+
data: xAxisData
|
|
1432
|
+
},
|
|
1433
|
+
yAxis: {
|
|
1434
|
+
type: "value"
|
|
1435
|
+
},
|
|
1436
|
+
series: [
|
|
1437
|
+
{
|
|
1438
|
+
type: "line",
|
|
1439
|
+
name: yKey,
|
|
1440
|
+
data: seriesData
|
|
1441
|
+
}
|
|
1442
|
+
],
|
|
1443
|
+
grid: {
|
|
1444
|
+
left: "3%",
|
|
1445
|
+
right: "4%",
|
|
1446
|
+
bottom: "3%",
|
|
1447
|
+
containLabel: true
|
|
1448
|
+
}
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
return {
|
|
1452
|
+
title: {
|
|
1453
|
+
text: "Chart",
|
|
1454
|
+
left: "left"
|
|
1455
|
+
},
|
|
1456
|
+
tooltip: {
|
|
1457
|
+
trigger: "axis"
|
|
1458
|
+
},
|
|
1459
|
+
legend: {
|
|
1460
|
+
right: 0,
|
|
1461
|
+
orient: "vertical"
|
|
1462
|
+
},
|
|
1463
|
+
xAxis: {
|
|
1464
|
+
type: "category",
|
|
1465
|
+
data: tableData.map((_, idx) => `Item ${idx + 1}`)
|
|
1466
|
+
},
|
|
1467
|
+
yAxis: {
|
|
1468
|
+
type: "value"
|
|
1469
|
+
},
|
|
1470
|
+
series: [
|
|
1471
|
+
{
|
|
1472
|
+
type: "bar",
|
|
1473
|
+
name: "Count",
|
|
1474
|
+
data: tableData.map(() => 1)
|
|
1475
|
+
}
|
|
1476
|
+
],
|
|
1477
|
+
grid: {
|
|
1478
|
+
left: "3%",
|
|
1479
|
+
right: "4%",
|
|
1480
|
+
bottom: "3%",
|
|
1481
|
+
containLabel: true
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
function validateAndEnhanceEChartsConfig(config) {
|
|
1486
|
+
if (!config || typeof config !== "object") {
|
|
1487
|
+
return null;
|
|
1488
|
+
}
|
|
1489
|
+
if (!config.series || !Array.isArray(config.series) || config.series.length === 0) {
|
|
1490
|
+
return null;
|
|
1491
|
+
}
|
|
1492
|
+
const enhancedSeries = config.series.map((series, index) => {
|
|
1493
|
+
if (!series || typeof series !== "object") {
|
|
1494
|
+
return null;
|
|
1495
|
+
}
|
|
1496
|
+
if (!series.type || !series.data) {
|
|
1497
|
+
return null;
|
|
1498
|
+
}
|
|
1499
|
+
if (!Array.isArray(series.data) || series.data.length === 0) {
|
|
1500
|
+
return null;
|
|
1501
|
+
}
|
|
1502
|
+
const enhancedSeriesItem = {
|
|
1503
|
+
...series,
|
|
1504
|
+
name: series.name || `Series ${index + 1}`
|
|
1505
|
+
};
|
|
1506
|
+
if (series.type === "pie") {
|
|
1507
|
+
const pieData = series.data.map((item, idx) => {
|
|
1508
|
+
if (typeof item === "object" && item !== null && "value" in item) {
|
|
1509
|
+
return {
|
|
1510
|
+
value: item.value,
|
|
1511
|
+
name: item.name || `Item ${idx + 1}`
|
|
1512
|
+
};
|
|
1513
|
+
} else if (typeof item === "number") {
|
|
1514
|
+
return {
|
|
1515
|
+
value: item,
|
|
1516
|
+
name: `Item ${idx + 1}`
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
return null;
|
|
1520
|
+
}).filter((item) => item !== null);
|
|
1521
|
+
if (pieData.length === 0) {
|
|
1522
|
+
return null;
|
|
1523
|
+
}
|
|
1524
|
+
return {
|
|
1525
|
+
...enhancedSeriesItem,
|
|
1526
|
+
data: pieData
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
return enhancedSeriesItem;
|
|
1530
|
+
}).filter((series) => series !== null);
|
|
1531
|
+
if (enhancedSeries.length === 0) {
|
|
1532
|
+
return null;
|
|
1533
|
+
}
|
|
1534
|
+
const enhancedConfig = {
|
|
1535
|
+
...config,
|
|
1536
|
+
series: enhancedSeries
|
|
1537
|
+
};
|
|
1538
|
+
const firstSeriesType = enhancedSeries[0].type;
|
|
1539
|
+
if (firstSeriesType !== "pie") {
|
|
1540
|
+
if (!enhancedConfig.xAxis) {
|
|
1541
|
+
enhancedConfig.xAxis = {
|
|
1542
|
+
type: "category",
|
|
1543
|
+
data: []
|
|
1544
|
+
};
|
|
1545
|
+
} else if (typeof enhancedConfig.xAxis === "object" && !Array.isArray(enhancedConfig.xAxis)) {
|
|
1546
|
+
const xAxis = enhancedConfig.xAxis;
|
|
1547
|
+
if (!xAxis.type) {
|
|
1548
|
+
xAxis.type = "category";
|
|
1549
|
+
}
|
|
1550
|
+
if (xAxis.type === "category" && !xAxis.data) {
|
|
1551
|
+
const firstSeriesData = enhancedSeries[0].data;
|
|
1552
|
+
if (Array.isArray(firstSeriesData) && firstSeriesData.length > 0) {
|
|
1553
|
+
if (Array.isArray(firstSeriesData[0])) {
|
|
1554
|
+
xAxis.data = firstSeriesData.map((item) => item[0]);
|
|
1555
|
+
} else {
|
|
1556
|
+
xAxis.data = firstSeriesData.map(
|
|
1557
|
+
(_, idx) => `Item ${idx + 1}`
|
|
1558
|
+
);
|
|
1559
|
+
}
|
|
1560
|
+
} else {
|
|
1561
|
+
xAxis.data = [];
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
enhancedConfig.xAxis = xAxis;
|
|
1565
|
+
}
|
|
1566
|
+
if (!enhancedConfig.yAxis) {
|
|
1567
|
+
enhancedConfig.yAxis = {
|
|
1568
|
+
type: "value"
|
|
1569
|
+
};
|
|
1570
|
+
} else if (typeof enhancedConfig.yAxis === "object" && !Array.isArray(enhancedConfig.yAxis)) {
|
|
1571
|
+
if (!enhancedConfig.yAxis.type) {
|
|
1572
|
+
enhancedConfig.yAxis.type = "value";
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
if (!enhancedConfig.title) {
|
|
1577
|
+
enhancedConfig.title = {
|
|
1578
|
+
text: "Chart",
|
|
1579
|
+
left: "left"
|
|
1580
|
+
};
|
|
1581
|
+
} else if (typeof enhancedConfig.title === "object") {
|
|
1582
|
+
const title = enhancedConfig.title;
|
|
1583
|
+
if (!title.left) {
|
|
1584
|
+
title.left = "left";
|
|
1585
|
+
}
|
|
1586
|
+
if (!title.text) {
|
|
1587
|
+
title.text = "Chart";
|
|
1588
|
+
}
|
|
1589
|
+
enhancedConfig.title = title;
|
|
1590
|
+
}
|
|
1591
|
+
if (!enhancedConfig.tooltip) {
|
|
1592
|
+
enhancedConfig.tooltip = {
|
|
1593
|
+
trigger: firstSeriesType === "pie" ? "item" : "axis"
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
if (!enhancedConfig.legend) {
|
|
1597
|
+
if (enhancedSeries.length > 1) {
|
|
1598
|
+
enhancedConfig.legend = {
|
|
1599
|
+
right: 0,
|
|
1600
|
+
orient: "vertical"
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
} else if (typeof enhancedConfig.legend === "object") {
|
|
1604
|
+
const legend = enhancedConfig.legend;
|
|
1605
|
+
enhancedConfig.legend = legend;
|
|
1606
|
+
}
|
|
1607
|
+
if (firstSeriesType !== "pie" && !enhancedConfig.grid) {
|
|
1608
|
+
enhancedConfig.grid = {
|
|
1609
|
+
left: "3%",
|
|
1610
|
+
right: "4%",
|
|
1611
|
+
bottom: "3%",
|
|
1612
|
+
containLabel: true
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
return enhancedConfig;
|
|
1616
|
+
}
|
|
1617
|
+
function parseAndValidateChartData(input) {
|
|
1618
|
+
let rawData = null;
|
|
1619
|
+
try {
|
|
1620
|
+
const inputStr = typeof input === "string" ? input : input.join("");
|
|
1621
|
+
rawData = parse(inputStr);
|
|
1622
|
+
} catch (error) {
|
|
1623
|
+
return {
|
|
1624
|
+
data: null,
|
|
1625
|
+
error: `Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
if (!rawData || typeof rawData !== "object") {
|
|
1629
|
+
return {
|
|
1630
|
+
data: null,
|
|
1631
|
+
error: "Parsed data is not an object"
|
|
1632
|
+
};
|
|
1633
|
+
}
|
|
1634
|
+
const isDirectEChartsConfig = rawData.series && Array.isArray(rawData.series) && rawData.series.length > 0;
|
|
1635
|
+
const chartData = {
|
|
1636
|
+
table: Array.isArray(rawData.table) ? rawData.table : void 0
|
|
1637
|
+
};
|
|
1638
|
+
let echartsConfig = null;
|
|
1639
|
+
if (rawData.echarts) {
|
|
1640
|
+
echartsConfig = rawData.echarts;
|
|
1641
|
+
} else if (isDirectEChartsConfig) {
|
|
1642
|
+
echartsConfig = rawData;
|
|
1643
|
+
}
|
|
1644
|
+
if (echartsConfig) {
|
|
1645
|
+
const enhancedECharts = validateAndEnhanceEChartsConfig(echartsConfig);
|
|
1646
|
+
if (!enhancedECharts) {
|
|
1647
|
+
if (chartData.table && chartData.table.length > 0) {
|
|
1648
|
+
chartData.echarts = createDefaultEChartsConfig(chartData.table);
|
|
1649
|
+
} else {
|
|
1650
|
+
return {
|
|
1651
|
+
data: null,
|
|
1652
|
+
error: "ECharts configuration is invalid or incomplete. Required: series array with at least one series containing type and data."
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1655
|
+
} else {
|
|
1656
|
+
chartData.echarts = enhancedECharts;
|
|
1657
|
+
}
|
|
1658
|
+
} else {
|
|
1659
|
+
if (chartData.table && chartData.table.length > 0) {
|
|
1660
|
+
chartData.echarts = createDefaultEChartsConfig(chartData.table);
|
|
1661
|
+
} else {
|
|
1662
|
+
chartData.echarts = createDefaultEChartsConfig([]);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
return { data: chartData, error: null };
|
|
1666
|
+
}
|
|
1667
|
+
var ReactChart = (props) => {
|
|
1668
|
+
const { children } = props;
|
|
1669
|
+
const chartRef = useRef5(null);
|
|
1670
|
+
const chartInstance = useRef5(null);
|
|
1671
|
+
const resizeObserverRef = useRef5(null);
|
|
1672
|
+
const [error, setError] = useState7(null);
|
|
1673
|
+
const [tableData, setTableData] = useState7(null);
|
|
1674
|
+
useEffect6(() => {
|
|
1675
|
+
if (!chartRef.current) {
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
if (!chartInstance.current) {
|
|
1679
|
+
chartInstance.current = echarts.init(chartRef.current);
|
|
1680
|
+
}
|
|
1681
|
+
let input = null;
|
|
1682
|
+
if (typeof children === "string") {
|
|
1683
|
+
input = children;
|
|
1684
|
+
} else if (Array.isArray(children)) {
|
|
1685
|
+
input = children;
|
|
1686
|
+
}
|
|
1687
|
+
if (!input) {
|
|
1688
|
+
setError("Chart data input is missing");
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
const { data: chartData, error: parseError } = parseAndValidateChartData(input);
|
|
1692
|
+
if (parseError || !chartData) {
|
|
1693
|
+
setError(parseError || "Failed to parse chart data");
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
if (chartData.table && Array.isArray(chartData.table)) {
|
|
1697
|
+
setTableData(chartData.table);
|
|
1698
|
+
}
|
|
1699
|
+
if (chartData.echarts) {
|
|
1700
|
+
try {
|
|
1701
|
+
chartInstance.current.setOption(chartData.echarts, true);
|
|
1702
|
+
setError(null);
|
|
1703
|
+
} catch (err) {
|
|
1704
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to render chart";
|
|
1705
|
+
console.error("Failed to set ECharts option:", err);
|
|
1706
|
+
setError(errorMessage);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
const handleResize = () => {
|
|
1710
|
+
if (chartInstance.current) {
|
|
1711
|
+
chartInstance.current.resize();
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
if (resizeObserverRef.current) {
|
|
1715
|
+
resizeObserverRef.current.disconnect();
|
|
1716
|
+
resizeObserverRef.current = null;
|
|
1717
|
+
}
|
|
1718
|
+
if (chartRef.current && typeof ResizeObserver !== "undefined") {
|
|
1719
|
+
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
1720
|
+
requestAnimationFrame(() => {
|
|
1721
|
+
handleResize();
|
|
1722
|
+
});
|
|
1723
|
+
});
|
|
1724
|
+
resizeObserverRef.current.observe(chartRef.current);
|
|
1725
|
+
}
|
|
1726
|
+
window.addEventListener("resize", handleResize);
|
|
1727
|
+
return () => {
|
|
1728
|
+
if (resizeObserverRef.current) {
|
|
1729
|
+
resizeObserverRef.current.disconnect();
|
|
1730
|
+
resizeObserverRef.current = null;
|
|
1731
|
+
}
|
|
1732
|
+
window.removeEventListener("resize", handleResize);
|
|
1733
|
+
};
|
|
1320
1734
|
}, [children]);
|
|
1321
|
-
|
|
1735
|
+
useEffect6(() => {
|
|
1736
|
+
return () => {
|
|
1737
|
+
if (resizeObserverRef.current) {
|
|
1738
|
+
resizeObserverRef.current.disconnect();
|
|
1739
|
+
resizeObserverRef.current = null;
|
|
1740
|
+
}
|
|
1741
|
+
if (chartInstance.current) {
|
|
1742
|
+
chartInstance.current.dispose();
|
|
1743
|
+
chartInstance.current = null;
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1746
|
+
}, []);
|
|
1747
|
+
const generateColumns = (data) => {
|
|
1748
|
+
if (!data || data.length === 0) return [];
|
|
1749
|
+
const firstRow = data[0];
|
|
1750
|
+
return Object.keys(firstRow).map((key) => ({
|
|
1751
|
+
title: key.replace(/([A-Z])/g, " $1").replace(/_/g, " ").replace(/^./, (str) => str.toUpperCase()).trim(),
|
|
1752
|
+
dataIndex: key,
|
|
1753
|
+
key
|
|
1754
|
+
}));
|
|
1755
|
+
};
|
|
1756
|
+
return /* @__PURE__ */ jsxs2(Card, { children: [
|
|
1757
|
+
error && /* @__PURE__ */ jsx6(
|
|
1758
|
+
Alert,
|
|
1759
|
+
{
|
|
1760
|
+
message: "Chart Error",
|
|
1761
|
+
description: error,
|
|
1762
|
+
type: "error",
|
|
1763
|
+
showIcon: true,
|
|
1764
|
+
style: { marginBottom: 16 }
|
|
1765
|
+
}
|
|
1766
|
+
),
|
|
1767
|
+
tableData && tableData.length > 0 && /* @__PURE__ */ jsx6("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsx6(
|
|
1768
|
+
Table,
|
|
1769
|
+
{
|
|
1770
|
+
dataSource: tableData.map((item, index) => ({
|
|
1771
|
+
...item,
|
|
1772
|
+
key: index
|
|
1773
|
+
})),
|
|
1774
|
+
columns: generateColumns(tableData),
|
|
1775
|
+
pagination: false,
|
|
1776
|
+
size: "small",
|
|
1777
|
+
scroll: { x: "max-content" }
|
|
1778
|
+
}
|
|
1779
|
+
) }),
|
|
1780
|
+
/* @__PURE__ */ jsx6(
|
|
1781
|
+
"div",
|
|
1782
|
+
{
|
|
1783
|
+
ref: chartRef,
|
|
1784
|
+
style: {
|
|
1785
|
+
width: "100%",
|
|
1786
|
+
height: "400px",
|
|
1787
|
+
minHeight: "300px"
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
)
|
|
1791
|
+
] });
|
|
1322
1792
|
};
|
|
1323
1793
|
|
|
1324
1794
|
// src/components/GenUI/Code.tsx
|
|
1325
|
-
import { jsx as
|
|
1795
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1326
1796
|
var Code = (props) => {
|
|
1327
1797
|
const { className, children } = props;
|
|
1328
1798
|
const language = className?.match(/language-(\w+)/)?.[1] || "";
|
|
@@ -1341,37 +1811,39 @@ var Code = (props) => {
|
|
|
1341
1811
|
childrenData = JSON.parse(childrenStr);
|
|
1342
1812
|
} catch (error) {
|
|
1343
1813
|
}
|
|
1344
|
-
return /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ jsx7(Element, { component_key: language, data: childrenData });
|
|
1345
1815
|
}
|
|
1346
1816
|
switch (language) {
|
|
1347
1817
|
case "infographic":
|
|
1348
|
-
return /* @__PURE__ */
|
|
1818
|
+
return /* @__PURE__ */ jsx7(ReactInfographic, { children });
|
|
1349
1819
|
case "mermaid":
|
|
1350
|
-
return /* @__PURE__ */
|
|
1820
|
+
return /* @__PURE__ */ jsx7(Mermaid, { children });
|
|
1821
|
+
case "chart":
|
|
1822
|
+
return /* @__PURE__ */ jsx7(ReactChart, { children });
|
|
1351
1823
|
default:
|
|
1352
|
-
return /* @__PURE__ */
|
|
1824
|
+
return /* @__PURE__ */ jsx7(CodeHighlighter, { lang: language, children });
|
|
1353
1825
|
}
|
|
1354
1826
|
}
|
|
1355
|
-
return /* @__PURE__ */
|
|
1827
|
+
return /* @__PURE__ */ jsx7(CodeHighlighter, { lang: language, children });
|
|
1356
1828
|
};
|
|
1357
1829
|
|
|
1358
1830
|
// src/components/GenUI/MDComponentWrap.tsx
|
|
1359
|
-
import { jsx as
|
|
1831
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1360
1832
|
var MDComponentWrap = (Element) => {
|
|
1361
1833
|
return (props) => {
|
|
1362
|
-
return /* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ jsx8(Element, { ...props });
|
|
1363
1835
|
};
|
|
1364
1836
|
};
|
|
1365
1837
|
|
|
1366
1838
|
// src/components/GenUI/elements/generic_data_table.tsx
|
|
1367
|
-
import { Table, Typography, Button, Flex, Space } from "antd";
|
|
1368
|
-
import { useState as
|
|
1839
|
+
import { Table as Table2, Typography, Button, Flex, Space } from "antd";
|
|
1840
|
+
import { useState as useState8 } from "react";
|
|
1369
1841
|
import { DownloadOutlined, ExpandAltOutlined } from "@ant-design/icons";
|
|
1370
|
-
import { jsx as
|
|
1842
|
+
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1371
1843
|
var { Text } = Typography;
|
|
1372
1844
|
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
1373
|
-
const { dataSource, message:
|
|
1374
|
-
const [expandedRowKeys, setExpandedRowKeys] =
|
|
1845
|
+
const { dataSource, message: message6 } = data ?? {};
|
|
1846
|
+
const [expandedRowKeys, setExpandedRowKeys] = useState8([]);
|
|
1375
1847
|
const { openSideApp } = useChatUIContext();
|
|
1376
1848
|
const processedData = dataSource?.map((item, index) => ({
|
|
1377
1849
|
...item,
|
|
@@ -1421,14 +1893,14 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
1421
1893
|
if (!expandItem) {
|
|
1422
1894
|
return null;
|
|
1423
1895
|
}
|
|
1424
|
-
return /* @__PURE__ */
|
|
1425
|
-
expandItem.content && /* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1427
|
-
/* @__PURE__ */
|
|
1896
|
+
return /* @__PURE__ */ jsxs3("div", { style: { padding: "16px" }, children: [
|
|
1897
|
+
expandItem.content && /* @__PURE__ */ jsxs3("div", { style: { marginBottom: "16px" }, children: [
|
|
1898
|
+
/* @__PURE__ */ jsx9(Text, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u8BE6\u7EC6\u4FE1\u606F:" }),
|
|
1899
|
+
/* @__PURE__ */ jsx9(MDResponse, { content: expandItem.content })
|
|
1428
1900
|
] }),
|
|
1429
|
-
expandItem.dataSource && expandItem.dataSource.length > 0 && /* @__PURE__ */
|
|
1430
|
-
/* @__PURE__ */
|
|
1431
|
-
/* @__PURE__ */
|
|
1901
|
+
expandItem.dataSource && expandItem.dataSource.length > 0 && /* @__PURE__ */ jsxs3("div", { children: [
|
|
1902
|
+
/* @__PURE__ */ jsx9(Text, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u5B50\u8868\u6570\u636E:" }),
|
|
1903
|
+
/* @__PURE__ */ jsx9(
|
|
1432
1904
|
GenericDataTable,
|
|
1433
1905
|
{
|
|
1434
1906
|
component_key: `nested_${record.key}`,
|
|
@@ -1449,25 +1921,25 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
1449
1921
|
);
|
|
1450
1922
|
};
|
|
1451
1923
|
const hasExpandableRows = processedData.some((item) => item.expandItem);
|
|
1452
|
-
return /* @__PURE__ */
|
|
1453
|
-
|
|
1924
|
+
return /* @__PURE__ */ jsx9(
|
|
1925
|
+
Table2,
|
|
1454
1926
|
{
|
|
1455
1927
|
size: "small",
|
|
1456
|
-
title: () => /* @__PURE__ */
|
|
1457
|
-
/* @__PURE__ */
|
|
1458
|
-
/* @__PURE__ */
|
|
1459
|
-
/* @__PURE__ */
|
|
1928
|
+
title: () => /* @__PURE__ */ jsxs3(Flex, { justify: "space-between", align: "center", children: [
|
|
1929
|
+
/* @__PURE__ */ jsx9(Space, { children: /* @__PURE__ */ jsx9(Text, { strong: true, style: { fontSize: 16 }, children: message6 || "" }) }),
|
|
1930
|
+
/* @__PURE__ */ jsxs3(Space, { children: [
|
|
1931
|
+
/* @__PURE__ */ jsx9(
|
|
1460
1932
|
Button,
|
|
1461
1933
|
{
|
|
1462
1934
|
type: "text",
|
|
1463
1935
|
size: "small",
|
|
1464
|
-
icon: /* @__PURE__ */
|
|
1936
|
+
icon: /* @__PURE__ */ jsx9(DownloadOutlined, {}),
|
|
1465
1937
|
onClick: exportToExcel,
|
|
1466
1938
|
disabled: !processedData || processedData.length === 0,
|
|
1467
1939
|
children: "\u5BFC\u51FAExcel"
|
|
1468
1940
|
}
|
|
1469
1941
|
),
|
|
1470
|
-
default_open_in_side_app && /* @__PURE__ */
|
|
1942
|
+
default_open_in_side_app && /* @__PURE__ */ jsxs3(
|
|
1471
1943
|
Button,
|
|
1472
1944
|
{
|
|
1473
1945
|
type: "link",
|
|
@@ -1475,12 +1947,12 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
1475
1947
|
onClick: () => {
|
|
1476
1948
|
openSideApp({
|
|
1477
1949
|
component_key: "generic_data_table",
|
|
1478
|
-
message:
|
|
1479
|
-
data: { dataSource, message:
|
|
1950
|
+
message: message6 || "",
|
|
1951
|
+
data: { dataSource, message: message6 }
|
|
1480
1952
|
});
|
|
1481
1953
|
},
|
|
1482
1954
|
children: [
|
|
1483
|
-
/* @__PURE__ */
|
|
1955
|
+
/* @__PURE__ */ jsx9(ExpandAltOutlined, {}),
|
|
1484
1956
|
"\u5C55\u5F00"
|
|
1485
1957
|
]
|
|
1486
1958
|
}
|
|
@@ -1520,7 +1992,7 @@ var mdComponents = {
|
|
|
1520
1992
|
};
|
|
1521
1993
|
|
|
1522
1994
|
// src/components/GenUI/MDResponse.tsx
|
|
1523
|
-
import { jsx as
|
|
1995
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1524
1996
|
var memoizedMdComponents = mdComponents;
|
|
1525
1997
|
var useStyles = createStyles2(({ token, css }) => ({
|
|
1526
1998
|
markdownTableContainer: css`
|
|
@@ -1612,7 +2084,7 @@ var MDResponse = ({
|
|
|
1612
2084
|
}) => {
|
|
1613
2085
|
const { styles } = useStyles();
|
|
1614
2086
|
const stableComponents = useMemo2(() => memoizedMdComponents, []);
|
|
1615
|
-
return /* @__PURE__ */
|
|
2087
|
+
return /* @__PURE__ */ jsx10("div", { className: styles.markdownContainer, children: /* @__PURE__ */ jsx10(
|
|
1616
2088
|
XMarkdown,
|
|
1617
2089
|
{
|
|
1618
2090
|
components: stableComponents,
|
|
@@ -1622,22 +2094,22 @@ var MDResponse = ({
|
|
|
1622
2094
|
) });
|
|
1623
2095
|
};
|
|
1624
2096
|
var MDViewFormItem = ({ value }) => {
|
|
1625
|
-
return /* @__PURE__ */
|
|
2097
|
+
return /* @__PURE__ */ jsx10(MDResponse, { content: value || "" });
|
|
1626
2098
|
};
|
|
1627
2099
|
|
|
1628
2100
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
1629
|
-
import { jsx as
|
|
2101
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1630
2102
|
var { Text: Text2 } = Typography2;
|
|
1631
2103
|
var ConfirmFeedback = ({
|
|
1632
2104
|
data,
|
|
1633
2105
|
interactive = true
|
|
1634
2106
|
}) => {
|
|
1635
|
-
const { message:
|
|
2107
|
+
const { message: message6, type, config, feedback, options } = data ?? {};
|
|
1636
2108
|
const { sendMessage } = useAgentChat();
|
|
1637
|
-
const [clicked, setClicked] =
|
|
1638
|
-
return /* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
options ? /* @__PURE__ */
|
|
2109
|
+
const [clicked, setClicked] = useState10(false);
|
|
2110
|
+
return /* @__PURE__ */ jsxs4(Space2, { direction: "vertical", style: { width: "100%" }, children: [
|
|
2111
|
+
/* @__PURE__ */ jsx11(MDResponse, { content: message6 }),
|
|
2112
|
+
options ? /* @__PURE__ */ jsx11(Space2, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ jsx11(
|
|
1641
2113
|
Button2,
|
|
1642
2114
|
{
|
|
1643
2115
|
title: option.description,
|
|
@@ -1660,8 +2132,8 @@ var ConfirmFeedback = ({
|
|
|
1660
2132
|
children: option.label
|
|
1661
2133
|
},
|
|
1662
2134
|
option.value
|
|
1663
|
-
)) }) : /* @__PURE__ */
|
|
1664
|
-
/* @__PURE__ */
|
|
2135
|
+
)) }) : /* @__PURE__ */ jsxs4(Space2, { style: { justifyContent: "flex-end", width: "100%" }, children: [
|
|
2136
|
+
/* @__PURE__ */ jsx11(
|
|
1665
2137
|
Button2,
|
|
1666
2138
|
{
|
|
1667
2139
|
disabled: !interactive || clicked || feedback,
|
|
@@ -1684,7 +2156,7 @@ var ConfirmFeedback = ({
|
|
|
1684
2156
|
children: "\u786E\u8BA4"
|
|
1685
2157
|
}
|
|
1686
2158
|
),
|
|
1687
|
-
/* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ jsx11(
|
|
1688
2160
|
Button2,
|
|
1689
2161
|
{
|
|
1690
2162
|
disabled: !interactive || clicked || feedback,
|
|
@@ -1712,9 +2184,9 @@ var ConfirmFeedback = ({
|
|
|
1712
2184
|
};
|
|
1713
2185
|
|
|
1714
2186
|
// src/components/GenUI/elements/generic_data_table_side_app.tsx
|
|
1715
|
-
import { jsx as
|
|
2187
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1716
2188
|
var GenericDataTableSideApp = (props) => {
|
|
1717
|
-
return /* @__PURE__ */
|
|
2189
|
+
return /* @__PURE__ */ jsx12(GenericDataTable, { ...props, default_open_in_side_app: false });
|
|
1718
2190
|
};
|
|
1719
2191
|
|
|
1720
2192
|
// src/components/GenUI/elements/ToolCall.tsx
|
|
@@ -1727,10 +2199,10 @@ import {
|
|
|
1727
2199
|
} from "@ant-design/icons";
|
|
1728
2200
|
|
|
1729
2201
|
// src/components/GenUI/elements/ToolCard.tsx
|
|
1730
|
-
import { Card as
|
|
2202
|
+
import { Card as Card3, Typography as Typography3, Space as Space3, Tag } from "antd";
|
|
1731
2203
|
import { createStyles as createStyles3 } from "antd-style";
|
|
1732
2204
|
import { ToolOutlined, CodeOutlined } from "@ant-design/icons";
|
|
1733
|
-
import { jsx as
|
|
2205
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1734
2206
|
var { Text: Text3, Title } = Typography3;
|
|
1735
2207
|
var useStyle2 = createStyles3(({ token, css }) => ({
|
|
1736
2208
|
card: css`
|
|
@@ -1800,7 +2272,7 @@ var ToolCard = ({
|
|
|
1800
2272
|
}) => {
|
|
1801
2273
|
const { styles } = useStyle2();
|
|
1802
2274
|
if (!data || !data.name) {
|
|
1803
|
-
return /* @__PURE__ */
|
|
2275
|
+
return /* @__PURE__ */ jsx13(Card3, { size: "small", className: styles.card, bordered: false, children: /* @__PURE__ */ jsx13(Text3, { type: "secondary", children: "Invalid tool data" }) });
|
|
1804
2276
|
}
|
|
1805
2277
|
const formatToolName = (name) => {
|
|
1806
2278
|
return name.replace(/([a-z])([A-Z])/g, "$1 $2").split(/[_-]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
@@ -1843,21 +2315,21 @@ var ToolCard = ({
|
|
|
1843
2315
|
return typeof value;
|
|
1844
2316
|
};
|
|
1845
2317
|
const hasParameters = data.parameters && Object.keys(data.parameters).length > 0;
|
|
1846
|
-
return /* @__PURE__ */
|
|
1847
|
-
|
|
2318
|
+
return /* @__PURE__ */ jsxs5(
|
|
2319
|
+
Card3,
|
|
1848
2320
|
{
|
|
1849
2321
|
size: "small",
|
|
1850
2322
|
className: styles.card,
|
|
1851
2323
|
bordered: false,
|
|
1852
2324
|
bodyStyle: { padding: "16px" },
|
|
1853
2325
|
children: [
|
|
1854
|
-
/* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
data.type && /* @__PURE__ */
|
|
2326
|
+
/* @__PURE__ */ jsxs5("div", { className: styles.header, children: [
|
|
2327
|
+
/* @__PURE__ */ jsxs5(Space3, { align: "center", children: [
|
|
2328
|
+
/* @__PURE__ */ jsx13(ToolOutlined, { style: { color: "#1890ff", fontSize: "18px" } }),
|
|
2329
|
+
/* @__PURE__ */ jsx13(Title, { level: 5, className: styles.toolName, style: { margin: 0 }, children: formatToolName(data.name) }),
|
|
2330
|
+
data.type && /* @__PURE__ */ jsx13(Tag, { color: "blue", className: styles.typeTag, children: data.type })
|
|
1859
2331
|
] }),
|
|
1860
|
-
data.description && /* @__PURE__ */
|
|
2332
|
+
data.description && /* @__PURE__ */ jsx13(
|
|
1861
2333
|
Text3,
|
|
1862
2334
|
{
|
|
1863
2335
|
type: "secondary",
|
|
@@ -1866,19 +2338,19 @@ var ToolCard = ({
|
|
|
1866
2338
|
}
|
|
1867
2339
|
)
|
|
1868
2340
|
] }),
|
|
1869
|
-
hasParameters ? /* @__PURE__ */
|
|
1870
|
-
/* @__PURE__ */
|
|
1871
|
-
/* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
2341
|
+
hasParameters ? /* @__PURE__ */ jsxs5("div", { children: [
|
|
2342
|
+
/* @__PURE__ */ jsxs5(Space3, { align: "center", style: { marginBottom: "12px" }, children: [
|
|
2343
|
+
/* @__PURE__ */ jsx13(CodeOutlined, { style: { color: "#52c41a", fontSize: "14px" } }),
|
|
2344
|
+
/* @__PURE__ */ jsxs5(Text3, { strong: true, style: { fontSize: "14px" }, children: [
|
|
1873
2345
|
"Parameters (",
|
|
1874
2346
|
Object.keys(data.parameters).length,
|
|
1875
2347
|
")"
|
|
1876
2348
|
] })
|
|
1877
2349
|
] }),
|
|
1878
|
-
/* @__PURE__ */
|
|
1879
|
-
/* @__PURE__ */
|
|
1880
|
-
/* @__PURE__ */
|
|
1881
|
-
/* @__PURE__ */
|
|
2350
|
+
/* @__PURE__ */ jsx13("div", { className: styles.parameterGrid, children: Object.entries(data.parameters).map(([key, value], index) => /* @__PURE__ */ jsxs5("div", { className: styles.parameterItem, children: [
|
|
2351
|
+
/* @__PURE__ */ jsx13("div", { className: styles.parameterName, children: /* @__PURE__ */ jsxs5(Space3, { align: "center", children: [
|
|
2352
|
+
/* @__PURE__ */ jsx13("span", { children: key }),
|
|
2353
|
+
/* @__PURE__ */ jsx13(
|
|
1882
2354
|
Tag,
|
|
1883
2355
|
{
|
|
1884
2356
|
color: getTypeColor(value),
|
|
@@ -1887,11 +2359,11 @@ var ToolCard = ({
|
|
|
1887
2359
|
}
|
|
1888
2360
|
)
|
|
1889
2361
|
] }) }),
|
|
1890
|
-
/* @__PURE__ */
|
|
2362
|
+
/* @__PURE__ */ jsx13("div", { className: styles.parameterValue, children: formatParameterValue(value) })
|
|
1891
2363
|
] }, index)) })
|
|
1892
|
-
] }) : /* @__PURE__ */
|
|
1893
|
-
/* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
2364
|
+
] }) : /* @__PURE__ */ jsxs5(Space3, { align: "center", children: [
|
|
2365
|
+
/* @__PURE__ */ jsx13(CodeOutlined, { style: { color: "#d9d9d9", fontSize: "14px" } }),
|
|
2366
|
+
/* @__PURE__ */ jsx13(Text3, { type: "secondary", style: { fontSize: "13px" }, children: "No parameters" })
|
|
1895
2367
|
] })
|
|
1896
2368
|
]
|
|
1897
2369
|
}
|
|
@@ -1899,15 +2371,15 @@ var ToolCard = ({
|
|
|
1899
2371
|
};
|
|
1900
2372
|
|
|
1901
2373
|
// src/components/GenUI/elements/ToolCall.tsx
|
|
1902
|
-
import { jsx as
|
|
2374
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1903
2375
|
function getStatusIcon(status) {
|
|
1904
2376
|
switch (status) {
|
|
1905
2377
|
case "success":
|
|
1906
|
-
return /* @__PURE__ */
|
|
2378
|
+
return /* @__PURE__ */ jsx14(CheckCircleOutlined, { style: { color: "#52c41a" } });
|
|
1907
2379
|
case "error":
|
|
1908
|
-
return /* @__PURE__ */
|
|
2380
|
+
return /* @__PURE__ */ jsx14(InfoCircleOutlined, { style: { color: "#ff4d4f" } });
|
|
1909
2381
|
default:
|
|
1910
|
-
return /* @__PURE__ */
|
|
2382
|
+
return /* @__PURE__ */ jsx14(LoadingOutlined, { style: { color: "#1890ff" } });
|
|
1911
2383
|
}
|
|
1912
2384
|
}
|
|
1913
2385
|
var ToolCall = ({ data }) => {
|
|
@@ -1930,9 +2402,9 @@ var ToolCall = ({ data }) => {
|
|
|
1930
2402
|
return "Error parsing args";
|
|
1931
2403
|
}
|
|
1932
2404
|
};
|
|
1933
|
-
const header = /* @__PURE__ */
|
|
1934
|
-
/* @__PURE__ */
|
|
1935
|
-
/* @__PURE__ */
|
|
2405
|
+
const header = /* @__PURE__ */ jsxs6(Flex2, { align: "center", wrap: "wrap", children: [
|
|
2406
|
+
/* @__PURE__ */ jsx14(Typography4.Text, { strong: true, children: formatToolName(toolCallData.name) }),
|
|
2407
|
+
/* @__PURE__ */ jsx14(
|
|
1936
2408
|
Typography4.Text,
|
|
1937
2409
|
{
|
|
1938
2410
|
type: "secondary",
|
|
@@ -1946,8 +2418,8 @@ var ToolCall = ({ data }) => {
|
|
|
1946
2418
|
parameters: toolCallData.args,
|
|
1947
2419
|
type: "tool_call"
|
|
1948
2420
|
};
|
|
1949
|
-
const content = /* @__PURE__ */
|
|
1950
|
-
/* @__PURE__ */
|
|
2421
|
+
const content = /* @__PURE__ */ jsxs6("div", { style: { marginTop: "8px" }, children: [
|
|
2422
|
+
/* @__PURE__ */ jsx14(
|
|
1951
2423
|
ToolCard,
|
|
1952
2424
|
{
|
|
1953
2425
|
data: toolCardData,
|
|
@@ -1955,8 +2427,8 @@ var ToolCall = ({ data }) => {
|
|
|
1955
2427
|
interactive: false
|
|
1956
2428
|
}
|
|
1957
2429
|
),
|
|
1958
|
-
toolCallData.response && /* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
2430
|
+
toolCallData.response && /* @__PURE__ */ jsxs6("div", { style: { marginTop: "12px" }, children: [
|
|
2431
|
+
/* @__PURE__ */ jsx14(
|
|
1960
2432
|
Typography4.Text,
|
|
1961
2433
|
{
|
|
1962
2434
|
strong: true,
|
|
@@ -1964,7 +2436,7 @@ var ToolCall = ({ data }) => {
|
|
|
1964
2436
|
children: "Response:"
|
|
1965
2437
|
}
|
|
1966
2438
|
),
|
|
1967
|
-
/* @__PURE__ */
|
|
2439
|
+
/* @__PURE__ */ jsx14(MDResponse, { content: toolCallData.response })
|
|
1968
2440
|
] })
|
|
1969
2441
|
] });
|
|
1970
2442
|
const expandIcon = ({ isActive }) => {
|
|
@@ -1977,14 +2449,14 @@ var ToolCall = ({ data }) => {
|
|
|
1977
2449
|
component_key: toolCallData.id
|
|
1978
2450
|
});
|
|
1979
2451
|
}
|
|
1980
|
-
return /* @__PURE__ */
|
|
2452
|
+
return /* @__PURE__ */ jsx14(
|
|
1981
2453
|
Collapse,
|
|
1982
2454
|
{
|
|
1983
2455
|
size: "small",
|
|
1984
2456
|
bordered: false,
|
|
1985
2457
|
defaultActiveKey: [],
|
|
1986
2458
|
expandIcon,
|
|
1987
|
-
children: /* @__PURE__ */
|
|
2459
|
+
children: /* @__PURE__ */ jsx14(
|
|
1988
2460
|
CollapsePanel,
|
|
1989
2461
|
{
|
|
1990
2462
|
header,
|
|
@@ -1998,7 +2470,7 @@ var ToolCall = ({ data }) => {
|
|
|
1998
2470
|
};
|
|
1999
2471
|
|
|
2000
2472
|
// src/components/GenUI/elements/Todo.tsx
|
|
2001
|
-
import { Card as
|
|
2473
|
+
import { Card as Card4, List, Typography as Typography5, Space as Space5, Button as Button3 } from "antd";
|
|
2002
2474
|
import { createStyles as createStyles4 } from "antd-style";
|
|
2003
2475
|
import {
|
|
2004
2476
|
ArrowRightOutlined,
|
|
@@ -2007,8 +2479,8 @@ import {
|
|
|
2007
2479
|
DownOutlined,
|
|
2008
2480
|
UpOutlined
|
|
2009
2481
|
} from "@ant-design/icons";
|
|
2010
|
-
import { useState as
|
|
2011
|
-
import { jsx as
|
|
2482
|
+
import { useState as useState11 } from "react";
|
|
2483
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2012
2484
|
var { Text: Text4 } = Typography5;
|
|
2013
2485
|
var useStyle3 = createStyles4(({ token, css }) => ({
|
|
2014
2486
|
card: css`
|
|
@@ -2043,20 +2515,20 @@ var Todo = ({
|
|
|
2043
2515
|
focusMode = false
|
|
2044
2516
|
}) => {
|
|
2045
2517
|
const { styles } = useStyle3();
|
|
2046
|
-
const [isExpanded, setIsExpanded] =
|
|
2047
|
-
const
|
|
2518
|
+
const [isExpanded, setIsExpanded] = useState11(false);
|
|
2519
|
+
const getStatusIcon3 = (status) => {
|
|
2048
2520
|
switch (status) {
|
|
2049
2521
|
case "completed":
|
|
2050
|
-
return /* @__PURE__ */
|
|
2522
|
+
return /* @__PURE__ */ jsx15(CheckCircleOutlined2, { style: { color: "#52c41a" } });
|
|
2051
2523
|
case "in_progress":
|
|
2052
|
-
return /* @__PURE__ */
|
|
2524
|
+
return /* @__PURE__ */ jsx15(ArrowRightOutlined, { style: { fontWeight: "500" } });
|
|
2053
2525
|
case "pending":
|
|
2054
|
-
return /* @__PURE__ */
|
|
2526
|
+
return /* @__PURE__ */ jsx15(ClockCircleOutlined, { style: { color: "gray" } });
|
|
2055
2527
|
default:
|
|
2056
2528
|
return null;
|
|
2057
2529
|
}
|
|
2058
2530
|
};
|
|
2059
|
-
const
|
|
2531
|
+
const getStatusColor2 = (status) => {
|
|
2060
2532
|
switch (status) {
|
|
2061
2533
|
case "completed":
|
|
2062
2534
|
return "success";
|
|
@@ -2112,49 +2584,49 @@ var Todo = ({
|
|
|
2112
2584
|
return data.slice(0, 3);
|
|
2113
2585
|
};
|
|
2114
2586
|
if (!data || !Array.isArray(data)) {
|
|
2115
|
-
return /* @__PURE__ */
|
|
2116
|
-
|
|
2587
|
+
return /* @__PURE__ */ jsx15(
|
|
2588
|
+
Card4,
|
|
2117
2589
|
{
|
|
2118
2590
|
size: "small",
|
|
2119
2591
|
className: `shadow-sm ${styles.card}`,
|
|
2120
2592
|
bordered: false,
|
|
2121
|
-
children: /* @__PURE__ */
|
|
2593
|
+
children: /* @__PURE__ */ jsx15(Text4, { type: "secondary", children: "No todo items available" })
|
|
2122
2594
|
}
|
|
2123
2595
|
);
|
|
2124
2596
|
}
|
|
2125
2597
|
const filteredData = getFilteredData();
|
|
2126
2598
|
const hasMoreItems = filteredData.length < data.length;
|
|
2127
2599
|
const displayData = isExpanded ? data : filteredData;
|
|
2128
|
-
return /* @__PURE__ */
|
|
2129
|
-
/* @__PURE__ */
|
|
2600
|
+
return /* @__PURE__ */ jsx15(Card4, { size: "small", className: `shadow-sm ${styles.card}`, bordered: false, children: /* @__PURE__ */ jsxs7(Space5, { direction: "vertical", style: { width: "100%" }, children: [
|
|
2601
|
+
/* @__PURE__ */ jsx15(
|
|
2130
2602
|
List,
|
|
2131
2603
|
{
|
|
2132
2604
|
size: "small",
|
|
2133
2605
|
dataSource: displayData,
|
|
2134
|
-
renderItem: (item, index) => /* @__PURE__ */
|
|
2606
|
+
renderItem: (item, index) => /* @__PURE__ */ jsx15(
|
|
2135
2607
|
List.Item,
|
|
2136
2608
|
{
|
|
2137
2609
|
className: `${styles.todoItem} ${getItemClassName(item.status)}`,
|
|
2138
|
-
children: /* @__PURE__ */
|
|
2139
|
-
|
|
2140
|
-
/* @__PURE__ */
|
|
2610
|
+
children: /* @__PURE__ */ jsxs7(Space5, { align: "center", style: { width: "100%" }, children: [
|
|
2611
|
+
getStatusIcon3(item.status),
|
|
2612
|
+
/* @__PURE__ */ jsx15(Text4, { style: { flex: 1 }, children: item.content })
|
|
2141
2613
|
] })
|
|
2142
2614
|
}
|
|
2143
2615
|
)
|
|
2144
2616
|
}
|
|
2145
2617
|
),
|
|
2146
|
-
hasMoreItems && /* @__PURE__ */
|
|
2618
|
+
hasMoreItems && /* @__PURE__ */ jsx15(
|
|
2147
2619
|
Button3,
|
|
2148
2620
|
{
|
|
2149
2621
|
type: "link",
|
|
2150
2622
|
size: "small",
|
|
2151
|
-
icon: isExpanded ? /* @__PURE__ */
|
|
2623
|
+
icon: isExpanded ? /* @__PURE__ */ jsx15(UpOutlined, {}) : /* @__PURE__ */ jsx15(DownOutlined, {}),
|
|
2152
2624
|
onClick: () => setIsExpanded(!isExpanded),
|
|
2153
2625
|
style: { padding: 0, height: "auto" },
|
|
2154
2626
|
children: isExpanded ? "Collapse" : `Show all ${data.length} items (${data.length - filteredData.length} hidden)`
|
|
2155
2627
|
}
|
|
2156
2628
|
),
|
|
2157
|
-
/* @__PURE__ */
|
|
2629
|
+
/* @__PURE__ */ jsxs7(Text4, { type: "secondary", style: { fontSize: 12 }, children: [
|
|
2158
2630
|
"Total items: ",
|
|
2159
2631
|
data.length,
|
|
2160
2632
|
" | Completed:",
|
|
@@ -2173,7 +2645,7 @@ var Todo = ({
|
|
|
2173
2645
|
import { Space as Space6, Collapse as Collapse2, Typography as Typography6 } from "antd";
|
|
2174
2646
|
import { UnorderedListOutlined } from "@ant-design/icons";
|
|
2175
2647
|
import CollapsePanel2 from "antd/es/collapse/CollapsePanel";
|
|
2176
|
-
import { jsx as
|
|
2648
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2177
2649
|
var { Text: Text5 } = Typography6;
|
|
2178
2650
|
var WriteTodos = ({
|
|
2179
2651
|
data,
|
|
@@ -2187,11 +2659,11 @@ var WriteTodos = ({
|
|
|
2187
2659
|
(item) => item.status === "completed"
|
|
2188
2660
|
).length;
|
|
2189
2661
|
const expandIcon = () => {
|
|
2190
|
-
return /* @__PURE__ */
|
|
2662
|
+
return /* @__PURE__ */ jsx16(UnorderedListOutlined, {});
|
|
2191
2663
|
};
|
|
2192
|
-
const header = /* @__PURE__ */
|
|
2193
|
-
/* @__PURE__ */
|
|
2194
|
-
/* @__PURE__ */
|
|
2664
|
+
const header = /* @__PURE__ */ jsxs8(Space6, { children: [
|
|
2665
|
+
/* @__PURE__ */ jsx16(Text5, { strong: true, children: "TODOs" }),
|
|
2666
|
+
/* @__PURE__ */ jsxs8(Text5, { style: { fontSize: 12 }, type: "secondary", children: [
|
|
2195
2667
|
completedCount,
|
|
2196
2668
|
"/",
|
|
2197
2669
|
totalCount,
|
|
@@ -2201,19 +2673,19 @@ var WriteTodos = ({
|
|
|
2201
2673
|
if (!toolCallData) {
|
|
2202
2674
|
return null;
|
|
2203
2675
|
}
|
|
2204
|
-
return /* @__PURE__ */
|
|
2676
|
+
return /* @__PURE__ */ jsx16(
|
|
2205
2677
|
Collapse2,
|
|
2206
2678
|
{
|
|
2207
2679
|
size: "small",
|
|
2208
2680
|
bordered: false,
|
|
2209
2681
|
defaultActiveKey: [toolCallData.id],
|
|
2210
2682
|
expandIcon,
|
|
2211
|
-
children: /* @__PURE__ */
|
|
2683
|
+
children: /* @__PURE__ */ jsx16(
|
|
2212
2684
|
CollapsePanel2,
|
|
2213
2685
|
{
|
|
2214
2686
|
header,
|
|
2215
2687
|
style: { minWidth: 400 },
|
|
2216
|
-
children: /* @__PURE__ */
|
|
2688
|
+
children: /* @__PURE__ */ jsx16(
|
|
2217
2689
|
Todo,
|
|
2218
2690
|
{
|
|
2219
2691
|
data: data.args.todos,
|
|
@@ -2230,15 +2702,19 @@ var WriteTodos = ({
|
|
|
2230
2702
|
};
|
|
2231
2703
|
|
|
2232
2704
|
// src/components/GenUI/FileExplorer.tsx
|
|
2233
|
-
import { useState as
|
|
2705
|
+
import { useState as useState12, useEffect as useEffect7, useMemo as useMemo3, useRef as useRef7 } from "react";
|
|
2234
2706
|
import { Splitter, Tree, Empty, Button as Button4, Tooltip, message } from "antd";
|
|
2235
2707
|
import {
|
|
2236
2708
|
FolderOutlined,
|
|
2237
2709
|
FolderOpenOutlined,
|
|
2238
2710
|
CopyOutlined,
|
|
2239
2711
|
DownloadOutlined as DownloadOutlined2,
|
|
2240
|
-
CheckOutlined
|
|
2712
|
+
CheckOutlined,
|
|
2713
|
+
FilePdfOutlined,
|
|
2714
|
+
PictureOutlined
|
|
2241
2715
|
} from "@ant-design/icons";
|
|
2716
|
+
import { jsPDF } from "jspdf";
|
|
2717
|
+
import html2canvas from "html2canvas";
|
|
2242
2718
|
import { createStyles as createStyles5 } from "antd-style";
|
|
2243
2719
|
|
|
2244
2720
|
// src/components/GenUI/elements/getFileIcon.tsx
|
|
@@ -2251,40 +2727,40 @@ import {
|
|
|
2251
2727
|
FileUnknownOutlined,
|
|
2252
2728
|
Html5Outlined
|
|
2253
2729
|
} from "@ant-design/icons";
|
|
2254
|
-
import { jsx as
|
|
2730
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2255
2731
|
var getFileIcon = (filename) => {
|
|
2256
2732
|
const ext = filename?.split(".")?.pop()?.toLowerCase();
|
|
2257
2733
|
const iconStyle = { fontSize: 14, marginRight: 4, verticalAlign: "middle" };
|
|
2258
2734
|
switch (ext) {
|
|
2259
2735
|
case "ts":
|
|
2260
2736
|
case "tsx":
|
|
2261
|
-
return /* @__PURE__ */
|
|
2737
|
+
return /* @__PURE__ */ jsx17(CodeOutlined2, { style: { ...iconStyle, color: "#3178c6" } });
|
|
2262
2738
|
case "js":
|
|
2263
2739
|
case "jsx":
|
|
2264
|
-
return /* @__PURE__ */
|
|
2740
|
+
return /* @__PURE__ */ jsx17(CodeOutlined2, { style: { ...iconStyle, color: "#f7df1e" } });
|
|
2265
2741
|
case "html":
|
|
2266
|
-
return /* @__PURE__ */
|
|
2742
|
+
return /* @__PURE__ */ jsx17(Html5Outlined, { style: { ...iconStyle, color: "#e34c26" } });
|
|
2267
2743
|
case "css":
|
|
2268
2744
|
case "less":
|
|
2269
2745
|
case "scss":
|
|
2270
|
-
return /* @__PURE__ */
|
|
2746
|
+
return /* @__PURE__ */ jsx17(FileUnknownOutlined, { style: { ...iconStyle, color: "#563d7c" } });
|
|
2271
2747
|
case "md":
|
|
2272
|
-
return /* @__PURE__ */
|
|
2748
|
+
return /* @__PURE__ */ jsx17(FileMarkdownOutlined, { style: { ...iconStyle, color: "#083fa1" } });
|
|
2273
2749
|
case "json":
|
|
2274
|
-
return /* @__PURE__ */
|
|
2750
|
+
return /* @__PURE__ */ jsx17(FileTextOutlined, { style: { ...iconStyle, color: "#fbc02d" } });
|
|
2275
2751
|
case "png":
|
|
2276
2752
|
case "jpg":
|
|
2277
2753
|
case "jpeg":
|
|
2278
2754
|
case "gif":
|
|
2279
2755
|
case "svg":
|
|
2280
|
-
return /* @__PURE__ */
|
|
2756
|
+
return /* @__PURE__ */ jsx17(FileImageOutlined, { style: { ...iconStyle, color: "#4caf50" } });
|
|
2281
2757
|
default:
|
|
2282
|
-
return /* @__PURE__ */
|
|
2758
|
+
return /* @__PURE__ */ jsx17(FileOutlined, { style: { ...iconStyle, color: "#9e9e9e" } });
|
|
2283
2759
|
}
|
|
2284
2760
|
};
|
|
2285
2761
|
|
|
2286
2762
|
// src/components/GenUI/FileExplorer.tsx
|
|
2287
|
-
import { jsx as
|
|
2763
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2288
2764
|
var useStyles2 = createStyles5(({ token, css }) => ({
|
|
2289
2765
|
container: css`
|
|
2290
2766
|
height: 100%;
|
|
@@ -2416,7 +2892,7 @@ var getFolderIcon = (expanded) => {
|
|
|
2416
2892
|
color: "#dcb67a",
|
|
2417
2893
|
verticalAlign: "middle"
|
|
2418
2894
|
};
|
|
2419
|
-
return expanded ? /* @__PURE__ */
|
|
2895
|
+
return expanded ? /* @__PURE__ */ jsx18(FolderOpenOutlined, { style: iconStyle }) : /* @__PURE__ */ jsx18(FolderOutlined, { style: iconStyle });
|
|
2420
2896
|
};
|
|
2421
2897
|
var sortTreeNodes = (nodes) => {
|
|
2422
2898
|
return nodes.sort((a, b) => {
|
|
@@ -2441,7 +2917,7 @@ var buildTreeData = (files, expandedKeys) => {
|
|
|
2441
2917
|
const key = parts.slice(0, index + 1).join("/");
|
|
2442
2918
|
let existingNode = currentLevel.find((node) => node.key === key);
|
|
2443
2919
|
if (!existingNode) {
|
|
2444
|
-
const title = part === "" && index === 0 ? /* @__PURE__ */
|
|
2920
|
+
const title = part === "" && index === 0 ? /* @__PURE__ */ jsx18(
|
|
2445
2921
|
"span",
|
|
2446
2922
|
{
|
|
2447
2923
|
style: {
|
|
@@ -2476,17 +2952,18 @@ var FileExplorer = ({
|
|
|
2476
2952
|
}) => {
|
|
2477
2953
|
const { files } = data ?? {};
|
|
2478
2954
|
const { styles, cx } = useStyles2();
|
|
2479
|
-
const [fileList, setFileList] =
|
|
2480
|
-
const [selectedKey, setSelectedKey] =
|
|
2481
|
-
const [expandedKeys, setExpandedKeys] =
|
|
2482
|
-
const [copied, setCopied] =
|
|
2483
|
-
|
|
2955
|
+
const [fileList, setFileList] = useState12([]);
|
|
2956
|
+
const [selectedKey, setSelectedKey] = useState12("");
|
|
2957
|
+
const [expandedKeys, setExpandedKeys] = useState12([]);
|
|
2958
|
+
const [copied, setCopied] = useState12(false);
|
|
2959
|
+
const contentRef = useRef7(null);
|
|
2960
|
+
useEffect7(() => {
|
|
2484
2961
|
if (copied) {
|
|
2485
2962
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
2486
2963
|
return () => clearTimeout(timer);
|
|
2487
2964
|
}
|
|
2488
2965
|
}, [copied]);
|
|
2489
|
-
|
|
2966
|
+
useEffect7(() => {
|
|
2490
2967
|
let list = [];
|
|
2491
2968
|
if (Array.isArray(files)) {
|
|
2492
2969
|
list = files;
|
|
@@ -2506,7 +2983,7 @@ var FileExplorer = ({
|
|
|
2506
2983
|
() => buildTreeData(fileList, expandedKeys),
|
|
2507
2984
|
[fileList, expandedKeys]
|
|
2508
2985
|
);
|
|
2509
|
-
|
|
2986
|
+
useEffect7(() => {
|
|
2510
2987
|
if (treeData.length > 0 && expandedKeys.length === 0) {
|
|
2511
2988
|
const getAllKeys = (nodes) => {
|
|
2512
2989
|
let keys = [];
|
|
@@ -2548,9 +3025,128 @@ var FileExplorer = ({
|
|
|
2548
3025
|
document.body.removeChild(a);
|
|
2549
3026
|
URL.revokeObjectURL(url);
|
|
2550
3027
|
};
|
|
3028
|
+
const handleExportImage = async () => {
|
|
3029
|
+
if (!selectedFile || !contentRef.current) return;
|
|
3030
|
+
try {
|
|
3031
|
+
message.loading({ content: "Generating image...", key: "image" });
|
|
3032
|
+
const canvas = await html2canvas(contentRef.current, {
|
|
3033
|
+
scale: 2,
|
|
3034
|
+
useCORS: true,
|
|
3035
|
+
logging: false,
|
|
3036
|
+
backgroundColor: "#ffffff",
|
|
3037
|
+
removeContainer: true
|
|
3038
|
+
});
|
|
3039
|
+
const imgData = canvas.toDataURL("image/png");
|
|
3040
|
+
const link = document.createElement("a");
|
|
3041
|
+
link.href = imgData;
|
|
3042
|
+
const fileName = selectedFile.name.split("/").pop() || selectedFile.name;
|
|
3043
|
+
const imageFileName = fileName.replace(/\.[^/.]+$/, "") + ".png";
|
|
3044
|
+
link.download = imageFileName;
|
|
3045
|
+
document.body.appendChild(link);
|
|
3046
|
+
link.click();
|
|
3047
|
+
document.body.removeChild(link);
|
|
3048
|
+
message.success({ content: "Image exported successfully", key: "image" });
|
|
3049
|
+
} catch (error) {
|
|
3050
|
+
console.error("Error generating image:", error);
|
|
3051
|
+
message.error({ content: "Failed to generate image", key: "image" });
|
|
3052
|
+
}
|
|
3053
|
+
};
|
|
3054
|
+
const handleExportPDF = async () => {
|
|
3055
|
+
if (!selectedFile || !contentRef.current) return;
|
|
3056
|
+
try {
|
|
3057
|
+
message.loading({ content: "Capturing content...", key: "pdf" });
|
|
3058
|
+
const canvas = await html2canvas(contentRef.current, {
|
|
3059
|
+
scale: 1.5,
|
|
3060
|
+
// Reduced from 2 to improve performance
|
|
3061
|
+
useCORS: true,
|
|
3062
|
+
logging: false,
|
|
3063
|
+
backgroundColor: "#ffffff",
|
|
3064
|
+
removeContainer: true
|
|
3065
|
+
// Clean up temporary elements
|
|
3066
|
+
});
|
|
3067
|
+
message.loading({ content: "Processing pages...", key: "pdf" });
|
|
3068
|
+
const A4_WIDTH = 210;
|
|
3069
|
+
const A4_HEIGHT = 297;
|
|
3070
|
+
const MARGIN = 10;
|
|
3071
|
+
const CONTENT_WIDTH = A4_WIDTH - MARGIN * 2;
|
|
3072
|
+
const CONTENT_HEIGHT = A4_HEIGHT - MARGIN * 2;
|
|
3073
|
+
const imgWidth = canvas.width;
|
|
3074
|
+
const imgHeight = canvas.height;
|
|
3075
|
+
const imgAspectRatio = imgWidth / imgHeight;
|
|
3076
|
+
const pdfContentWidth = CONTENT_WIDTH;
|
|
3077
|
+
const pdfContentHeight = pdfContentWidth / imgAspectRatio;
|
|
3078
|
+
const pdf = new jsPDF({
|
|
3079
|
+
orientation: "portrait",
|
|
3080
|
+
unit: "mm",
|
|
3081
|
+
format: "a4"
|
|
3082
|
+
});
|
|
3083
|
+
const pagesNeeded = Math.ceil(pdfContentHeight / CONTENT_HEIGHT);
|
|
3084
|
+
const pageHeightPx = imgHeight / pagesNeeded;
|
|
3085
|
+
const processPage = (index) => {
|
|
3086
|
+
return new Promise((resolve) => {
|
|
3087
|
+
setTimeout(() => {
|
|
3088
|
+
if (index > 0) {
|
|
3089
|
+
pdf.addPage();
|
|
3090
|
+
}
|
|
3091
|
+
const sourceY = index * pageHeightPx;
|
|
3092
|
+
const sourceHeight = Math.min(pageHeightPx, imgHeight - sourceY);
|
|
3093
|
+
const pageCanvas = document.createElement("canvas");
|
|
3094
|
+
pageCanvas.width = imgWidth;
|
|
3095
|
+
pageCanvas.height = Math.ceil(sourceHeight);
|
|
3096
|
+
const pageCtx = pageCanvas.getContext("2d");
|
|
3097
|
+
if (pageCtx) {
|
|
3098
|
+
pageCtx.fillStyle = "#ffffff";
|
|
3099
|
+
pageCtx.fillRect(0, 0, pageCanvas.width, pageCanvas.height);
|
|
3100
|
+
pageCtx.drawImage(
|
|
3101
|
+
canvas,
|
|
3102
|
+
0,
|
|
3103
|
+
sourceY,
|
|
3104
|
+
imgWidth,
|
|
3105
|
+
sourceHeight,
|
|
3106
|
+
0,
|
|
3107
|
+
0,
|
|
3108
|
+
imgWidth,
|
|
3109
|
+
sourceHeight
|
|
3110
|
+
);
|
|
3111
|
+
const pageImgData = pageCanvas.toDataURL("image/jpeg", 0.95);
|
|
3112
|
+
const pageImgHeightMm = pageCanvas.height / imgHeight * pdfContentHeight;
|
|
3113
|
+
pdf.addImage(
|
|
3114
|
+
pageImgData,
|
|
3115
|
+
"JPEG",
|
|
3116
|
+
MARGIN,
|
|
3117
|
+
MARGIN,
|
|
3118
|
+
pdfContentWidth,
|
|
3119
|
+
pageImgHeightMm
|
|
3120
|
+
);
|
|
3121
|
+
}
|
|
3122
|
+
resolve();
|
|
3123
|
+
}, 0);
|
|
3124
|
+
});
|
|
3125
|
+
};
|
|
3126
|
+
for (let i = 0; i < pagesNeeded; i++) {
|
|
3127
|
+
await processPage(i);
|
|
3128
|
+
if (pagesNeeded > 5 && i % Math.ceil(pagesNeeded / 5) === 0) {
|
|
3129
|
+
message.loading({
|
|
3130
|
+
content: `Processing pages... (${i + 1}/${pagesNeeded})`,
|
|
3131
|
+
key: "pdf"
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
const fileName = selectedFile.name.split("/").pop() || selectedFile.name;
|
|
3136
|
+
const pdfFileName = fileName.replace(/\.[^/.]+$/, "") + ".pdf";
|
|
3137
|
+
pdf.save(pdfFileName);
|
|
3138
|
+
message.success({
|
|
3139
|
+
content: `PDF exported successfully (${pagesNeeded} page${pagesNeeded > 1 ? "s" : ""})`,
|
|
3140
|
+
key: "pdf"
|
|
3141
|
+
});
|
|
3142
|
+
} catch (error) {
|
|
3143
|
+
console.error("Error generating PDF:", error);
|
|
3144
|
+
message.error({ content: "Failed to generate PDF", key: "pdf" });
|
|
3145
|
+
}
|
|
3146
|
+
};
|
|
2551
3147
|
const renderContent = () => {
|
|
2552
3148
|
if (!selectedFile) {
|
|
2553
|
-
return /* @__PURE__ */
|
|
3149
|
+
return /* @__PURE__ */ jsx18("div", { className: styles.emptyState, children: /* @__PURE__ */ jsx18(
|
|
2554
3150
|
Empty,
|
|
2555
3151
|
{
|
|
2556
3152
|
description: "Select a file to preview",
|
|
@@ -2559,38 +3155,56 @@ var FileExplorer = ({
|
|
|
2559
3155
|
) });
|
|
2560
3156
|
}
|
|
2561
3157
|
const content = Array.isArray(selectedFile.content) ? selectedFile.content.join("\n") : selectedFile.content;
|
|
2562
|
-
return /* @__PURE__ */
|
|
3158
|
+
return /* @__PURE__ */ jsxs9(
|
|
2563
3159
|
"div",
|
|
2564
3160
|
{
|
|
2565
3161
|
style: { minHeight: "100%", display: "flex", flexDirection: "column" },
|
|
2566
3162
|
children: [
|
|
2567
|
-
/* @__PURE__ */
|
|
2568
|
-
/* @__PURE__ */
|
|
3163
|
+
/* @__PURE__ */ jsxs9("div", { className: styles.header, children: [
|
|
3164
|
+
/* @__PURE__ */ jsx18(Tooltip, { title: "Copy Content", children: /* @__PURE__ */ jsx18(
|
|
2569
3165
|
Button4,
|
|
2570
3166
|
{
|
|
2571
3167
|
type: "text",
|
|
2572
|
-
icon: copied ? /* @__PURE__ */
|
|
3168
|
+
icon: copied ? /* @__PURE__ */ jsx18(CheckOutlined, {}) : /* @__PURE__ */ jsx18(CopyOutlined, {}),
|
|
2573
3169
|
onClick: handleCopy,
|
|
2574
3170
|
size: "small"
|
|
2575
3171
|
}
|
|
2576
3172
|
) }),
|
|
2577
|
-
/* @__PURE__ */
|
|
3173
|
+
/* @__PURE__ */ jsx18(Tooltip, { title: "Download File", children: /* @__PURE__ */ jsx18(
|
|
2578
3174
|
Button4,
|
|
2579
3175
|
{
|
|
2580
3176
|
type: "text",
|
|
2581
|
-
icon: /* @__PURE__ */
|
|
3177
|
+
icon: /* @__PURE__ */ jsx18(DownloadOutlined2, {}),
|
|
2582
3178
|
onClick: handleDownload,
|
|
2583
3179
|
size: "small"
|
|
2584
3180
|
}
|
|
3181
|
+
) }),
|
|
3182
|
+
/* @__PURE__ */ jsx18(Tooltip, { title: "Export as PDF", children: /* @__PURE__ */ jsx18(
|
|
3183
|
+
Button4,
|
|
3184
|
+
{
|
|
3185
|
+
type: "text",
|
|
3186
|
+
icon: /* @__PURE__ */ jsx18(FilePdfOutlined, {}),
|
|
3187
|
+
onClick: handleExportPDF,
|
|
3188
|
+
size: "small"
|
|
3189
|
+
}
|
|
3190
|
+
) }),
|
|
3191
|
+
/* @__PURE__ */ jsx18(Tooltip, { title: "Export as Image", children: /* @__PURE__ */ jsx18(
|
|
3192
|
+
Button4,
|
|
3193
|
+
{
|
|
3194
|
+
type: "text",
|
|
3195
|
+
icon: /* @__PURE__ */ jsx18(PictureOutlined, {}),
|
|
3196
|
+
onClick: handleExportImage,
|
|
3197
|
+
size: "small"
|
|
3198
|
+
}
|
|
2585
3199
|
) })
|
|
2586
3200
|
] }),
|
|
2587
|
-
/* @__PURE__ */
|
|
3201
|
+
/* @__PURE__ */ jsx18("div", { className: styles.contentBody, ref: contentRef, children: /* @__PURE__ */ jsx18(MDResponse, { content }) })
|
|
2588
3202
|
]
|
|
2589
3203
|
}
|
|
2590
3204
|
);
|
|
2591
3205
|
};
|
|
2592
|
-
return /* @__PURE__ */
|
|
2593
|
-
/* @__PURE__ */
|
|
3206
|
+
return /* @__PURE__ */ jsx18("div", { className: styles.container, children: /* @__PURE__ */ jsxs9(Splitter, { className: styles.splitter, children: [
|
|
3207
|
+
/* @__PURE__ */ jsx18(Splitter.Panel, { defaultSize: "25%", min: "15%", max: "40%", children: /* @__PURE__ */ jsx18("div", { className: styles.leftPanel, children: /* @__PURE__ */ jsx18(
|
|
2594
3208
|
Tree,
|
|
2595
3209
|
{
|
|
2596
3210
|
showIcon: true,
|
|
@@ -2628,14 +3242,14 @@ var FileExplorer = ({
|
|
|
2628
3242
|
}
|
|
2629
3243
|
}
|
|
2630
3244
|
) }) }),
|
|
2631
|
-
/* @__PURE__ */
|
|
3245
|
+
/* @__PURE__ */ jsx18(Splitter.Panel, { children: /* @__PURE__ */ jsx18("div", { className: styles.rightPanel, children: renderContent() }) })
|
|
2632
3246
|
] }) });
|
|
2633
3247
|
};
|
|
2634
3248
|
|
|
2635
3249
|
// src/components/GenUI/elements/attachments_card.tsx
|
|
2636
3250
|
import { FileCard } from "@ant-design/x";
|
|
2637
3251
|
import {
|
|
2638
|
-
Card as
|
|
3252
|
+
Card as Card5,
|
|
2639
3253
|
Flex as Flex3,
|
|
2640
3254
|
Space as Space7,
|
|
2641
3255
|
Typography as Typography7,
|
|
@@ -2644,8 +3258,8 @@ import {
|
|
|
2644
3258
|
Button as Button5
|
|
2645
3259
|
} from "antd";
|
|
2646
3260
|
import dayjs from "dayjs";
|
|
2647
|
-
import { useState as
|
|
2648
|
-
import { jsx as
|
|
3261
|
+
import { useState as useState13 } from "react";
|
|
3262
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2649
3263
|
var AttachmentsCard = ({
|
|
2650
3264
|
data,
|
|
2651
3265
|
component_key,
|
|
@@ -2653,8 +3267,8 @@ var AttachmentsCard = ({
|
|
|
2653
3267
|
columns = 1,
|
|
2654
3268
|
showDownloadButton = false
|
|
2655
3269
|
}) => {
|
|
2656
|
-
const { Text:
|
|
2657
|
-
const [showAll, setShowAll] =
|
|
3270
|
+
const { Text: Text15 } = Typography7;
|
|
3271
|
+
const [showAll, setShowAll] = useState13(false);
|
|
2658
3272
|
const { openSideApp } = useChatUIContext();
|
|
2659
3273
|
const getStyles = () => {
|
|
2660
3274
|
switch (size) {
|
|
@@ -2713,7 +3327,7 @@ var AttachmentsCard = ({
|
|
|
2713
3327
|
};
|
|
2714
3328
|
const DownloadButton = ({ item }) => {
|
|
2715
3329
|
if (!showDownloadButton) return null;
|
|
2716
|
-
return /* @__PURE__ */
|
|
3330
|
+
return /* @__PURE__ */ jsx19(
|
|
2717
3331
|
"div",
|
|
2718
3332
|
{
|
|
2719
3333
|
style: {
|
|
@@ -2727,8 +3341,8 @@ var AttachmentsCard = ({
|
|
|
2727
3341
|
}
|
|
2728
3342
|
);
|
|
2729
3343
|
};
|
|
2730
|
-
const renderFileDescription = (item) => /* @__PURE__ */
|
|
2731
|
-
|
|
3344
|
+
const renderFileDescription = (item) => /* @__PURE__ */ jsx19(Space7, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ jsx19(Space7, { children: /* @__PURE__ */ jsx19(
|
|
3345
|
+
Text15,
|
|
2732
3346
|
{
|
|
2733
3347
|
type: "secondary",
|
|
2734
3348
|
style: {
|
|
@@ -2741,17 +3355,17 @@ var AttachmentsCard = ({
|
|
|
2741
3355
|
const displayData2 = data || [];
|
|
2742
3356
|
const shouldShowViewMore2 = displayData2.length > 4;
|
|
2743
3357
|
const visibleData2 = showAll ? displayData2 : displayData2.slice(0, 4);
|
|
2744
|
-
return /* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
3358
|
+
return /* @__PURE__ */ jsxs10(Flex3, { vertical: true, gap: "small", children: [
|
|
3359
|
+
/* @__PURE__ */ jsx19(Row, { gutter: [8, 8], children: visibleData2.map((item) => /* @__PURE__ */ jsx19(Col, { span: 24 / columns, children: /* @__PURE__ */ jsx19(
|
|
2746
3360
|
"div",
|
|
2747
3361
|
{
|
|
2748
3362
|
onClick: (evt) => {
|
|
2749
3363
|
evt.stopPropagation();
|
|
2750
3364
|
handleItemClick(item);
|
|
2751
3365
|
},
|
|
2752
|
-
children: /* @__PURE__ */
|
|
2753
|
-
/* @__PURE__ */
|
|
2754
|
-
/* @__PURE__ */
|
|
3366
|
+
children: /* @__PURE__ */ jsxs10(Card5, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
3367
|
+
/* @__PURE__ */ jsx19(DownloadButton, { item }),
|
|
3368
|
+
/* @__PURE__ */ jsx19(
|
|
2755
3369
|
FileCard,
|
|
2756
3370
|
{
|
|
2757
3371
|
style: getFileCardStyle(item),
|
|
@@ -2760,7 +3374,7 @@ var AttachmentsCard = ({
|
|
|
2760
3374
|
description: renderFileDescription(item)
|
|
2761
3375
|
}
|
|
2762
3376
|
),
|
|
2763
|
-
item.files && /* @__PURE__ */
|
|
3377
|
+
item.files && /* @__PURE__ */ jsx19(
|
|
2764
3378
|
AttachmentsCard,
|
|
2765
3379
|
{
|
|
2766
3380
|
data: item.files,
|
|
@@ -2773,7 +3387,7 @@ var AttachmentsCard = ({
|
|
|
2773
3387
|
] })
|
|
2774
3388
|
}
|
|
2775
3389
|
) }, item.id)) }),
|
|
2776
|
-
shouldShowViewMore2 && /* @__PURE__ */
|
|
3390
|
+
shouldShowViewMore2 && /* @__PURE__ */ jsx19(
|
|
2777
3391
|
Button5,
|
|
2778
3392
|
{
|
|
2779
3393
|
type: "link",
|
|
@@ -2787,10 +3401,10 @@ var AttachmentsCard = ({
|
|
|
2787
3401
|
const displayData = data || [];
|
|
2788
3402
|
const shouldShowViewMore = displayData.length > 4;
|
|
2789
3403
|
const visibleData = showAll ? displayData : displayData.slice(0, 4);
|
|
2790
|
-
return /* @__PURE__ */
|
|
2791
|
-
visibleData.map((item) => /* @__PURE__ */
|
|
2792
|
-
/* @__PURE__ */
|
|
2793
|
-
/* @__PURE__ */
|
|
3404
|
+
return /* @__PURE__ */ jsxs10(Flex3, { vertical: true, gap: size === "small" ? "small" : "middle", children: [
|
|
3405
|
+
visibleData.map((item) => /* @__PURE__ */ jsx19("div", { onClick: () => handleItemClick(item), children: /* @__PURE__ */ jsxs10(Card5, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
3406
|
+
/* @__PURE__ */ jsx19(DownloadButton, { item }),
|
|
3407
|
+
/* @__PURE__ */ jsx19(
|
|
2794
3408
|
FileCard,
|
|
2795
3409
|
{
|
|
2796
3410
|
style: getFileCardStyle(item),
|
|
@@ -2799,13 +3413,13 @@ var AttachmentsCard = ({
|
|
|
2799
3413
|
description: renderFileDescription(item)
|
|
2800
3414
|
}
|
|
2801
3415
|
),
|
|
2802
|
-
item.files && /* @__PURE__ */
|
|
2803
|
-
/* @__PURE__ */
|
|
3416
|
+
item.files && /* @__PURE__ */ jsxs10("div", { style: { paddingLeft: "12px" }, children: [
|
|
3417
|
+
/* @__PURE__ */ jsxs10(Text15, { type: "secondary", style: { fontSize: "12px" }, children: [
|
|
2804
3418
|
"\u5305\u542B\u6587\u4EF6(",
|
|
2805
3419
|
item.files.length,
|
|
2806
3420
|
")"
|
|
2807
3421
|
] }),
|
|
2808
|
-
/* @__PURE__ */
|
|
3422
|
+
/* @__PURE__ */ jsx19(
|
|
2809
3423
|
AttachmentsCard,
|
|
2810
3424
|
{
|
|
2811
3425
|
data: item.files,
|
|
@@ -2817,7 +3431,7 @@ var AttachmentsCard = ({
|
|
|
2817
3431
|
)
|
|
2818
3432
|
] })
|
|
2819
3433
|
] }) }, item.id)),
|
|
2820
|
-
shouldShowViewMore && /* @__PURE__ */
|
|
3434
|
+
shouldShowViewMore && /* @__PURE__ */ jsx19(
|
|
2821
3435
|
Button5,
|
|
2822
3436
|
{
|
|
2823
3437
|
type: "link",
|
|
@@ -2835,17 +3449,17 @@ var AttachmentsCard = ({
|
|
|
2835
3449
|
|
|
2836
3450
|
// src/components/GenUI/elements/attachments_viewer_side_app.tsx
|
|
2837
3451
|
import { Button as Button6, Empty as Empty2, Skeleton } from "antd";
|
|
2838
|
-
import { useState as
|
|
2839
|
-
import { Fragment as Fragment2, jsx as
|
|
3452
|
+
import { useState as useState14 } from "react";
|
|
3453
|
+
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2840
3454
|
function AttachmentsViewerSideApp({
|
|
2841
3455
|
data,
|
|
2842
3456
|
component_key
|
|
2843
3457
|
}) {
|
|
2844
|
-
const [fileUri, setFileUri] =
|
|
2845
|
-
const [loading, setLoading] =
|
|
3458
|
+
const [fileUri, setFileUri] = useState14();
|
|
3459
|
+
const [loading, setLoading] = useState14(false);
|
|
2846
3460
|
const { file_id, url } = data ?? {};
|
|
2847
3461
|
if (loading) {
|
|
2848
|
-
return /* @__PURE__ */
|
|
3462
|
+
return /* @__PURE__ */ jsx20(Skeleton, { active: true });
|
|
2849
3463
|
}
|
|
2850
3464
|
const canPreviewInIframe = (fileName) => {
|
|
2851
3465
|
if (!fileName) return false;
|
|
@@ -2880,18 +3494,18 @@ function AttachmentsViewerSideApp({
|
|
|
2880
3494
|
return previewableExtensions.includes(extension);
|
|
2881
3495
|
};
|
|
2882
3496
|
const isPreviewable = fileUri?.fileName ? canPreviewInIframe(fileUri.fileName) : false;
|
|
2883
|
-
return isPreviewable || url ? /* @__PURE__ */
|
|
3497
|
+
return isPreviewable || url ? /* @__PURE__ */ jsx20(
|
|
2884
3498
|
"iframe",
|
|
2885
3499
|
{
|
|
2886
3500
|
style: { width: "100%", height: "100%", border: 0 },
|
|
2887
3501
|
src: fileUri?.url || url
|
|
2888
3502
|
}
|
|
2889
|
-
) : /* @__PURE__ */
|
|
3503
|
+
) : /* @__PURE__ */ jsx20(
|
|
2890
3504
|
Empty2,
|
|
2891
3505
|
{
|
|
2892
|
-
description: /* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
2894
|
-
/* @__PURE__ */
|
|
3506
|
+
description: /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
3507
|
+
/* @__PURE__ */ jsx20("div", { children: "\u6682\u65F6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u8BF7\u4E0B\u8F7D\u540E\u67E5\u770B\u3002" }),
|
|
3508
|
+
/* @__PURE__ */ jsxs11(Button6, { type: "link", href: fileUri?.url, download: fileUri?.fileName, children: [
|
|
2895
3509
|
"\u4E0B\u8F7D",
|
|
2896
3510
|
fileUri?.fileName
|
|
2897
3511
|
] })
|
|
@@ -2905,12 +3519,12 @@ function AttachmentsViewerSideApp({
|
|
|
2905
3519
|
import { Button as Button7, Space as Space8, Typography as Typography8 } from "antd";
|
|
2906
3520
|
|
|
2907
3521
|
// src/components/GenUI/elements/ContentPreviewCollapse.tsx
|
|
2908
|
-
import { useRef as
|
|
3522
|
+
import { useRef as useRef8, useState as useState15, useEffect as useEffect9, useCallback as useCallback6 } from "react";
|
|
2909
3523
|
import { Collapse as Collapse4 } from "antd";
|
|
2910
3524
|
import { createStyles as createStyles6 } from "antd-style";
|
|
2911
3525
|
import { DownOutlined as DownOutlined3, UpOutlined as UpOutlined2 } from "@ant-design/icons";
|
|
2912
3526
|
import CollapsePanel3 from "antd/es/collapse/CollapsePanel";
|
|
2913
|
-
import { Fragment as Fragment3, jsx as
|
|
3527
|
+
import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2914
3528
|
var DEFAULT_COLLAPSED_MAX_HEIGHT = 180;
|
|
2915
3529
|
var DEFAULT_EXPANDED_MAX_HEIGHT = 500;
|
|
2916
3530
|
var useStyle4 = createStyles6(
|
|
@@ -2975,9 +3589,9 @@ var ContentPreviewCollapse = ({
|
|
|
2975
3589
|
showAllText = "Show all content",
|
|
2976
3590
|
showLessText = "Show less"
|
|
2977
3591
|
}) => {
|
|
2978
|
-
const [showFullContent, setShowFullContent] =
|
|
2979
|
-
const [isOverflowing, setIsOverflowing] =
|
|
2980
|
-
const contentRef =
|
|
3592
|
+
const [showFullContent, setShowFullContent] = useState15(false);
|
|
3593
|
+
const [isOverflowing, setIsOverflowing] = useState15(false);
|
|
3594
|
+
const contentRef = useRef8(null);
|
|
2981
3595
|
const showShadow = isOverflowing && !showFullContent;
|
|
2982
3596
|
const { styles, cx } = useStyle4({ showShadow });
|
|
2983
3597
|
const checkOverflow = useCallback6(() => {
|
|
@@ -2986,7 +3600,7 @@ var ContentPreviewCollapse = ({
|
|
|
2986
3600
|
setIsOverflowing(scrollHeight > collapsedMaxHeight);
|
|
2987
3601
|
}
|
|
2988
3602
|
}, [collapsedMaxHeight]);
|
|
2989
|
-
|
|
3603
|
+
useEffect9(() => {
|
|
2990
3604
|
const element = contentRef.current;
|
|
2991
3605
|
if (!element) return;
|
|
2992
3606
|
checkOverflow();
|
|
@@ -3002,7 +3616,7 @@ var ContentPreviewCollapse = ({
|
|
|
3002
3616
|
e.stopPropagation();
|
|
3003
3617
|
setShowFullContent(!showFullContent);
|
|
3004
3618
|
};
|
|
3005
|
-
return /* @__PURE__ */
|
|
3619
|
+
return /* @__PURE__ */ jsx21(
|
|
3006
3620
|
Collapse4,
|
|
3007
3621
|
{
|
|
3008
3622
|
className: styles.collapse,
|
|
@@ -3010,29 +3624,29 @@ var ContentPreviewCollapse = ({
|
|
|
3010
3624
|
bordered: false,
|
|
3011
3625
|
defaultActiveKey: defaultExpanded ? [panelKey] : [],
|
|
3012
3626
|
expandIcon,
|
|
3013
|
-
children: /* @__PURE__ */
|
|
3627
|
+
children: /* @__PURE__ */ jsxs12(
|
|
3014
3628
|
CollapsePanel3,
|
|
3015
3629
|
{
|
|
3016
3630
|
header,
|
|
3017
3631
|
extra,
|
|
3018
3632
|
style: { minWidth },
|
|
3019
3633
|
children: [
|
|
3020
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsx21(
|
|
3021
3635
|
"div",
|
|
3022
3636
|
{
|
|
3023
3637
|
className: cx(styles.contentContainer, showFullContent && "expanded"),
|
|
3024
3638
|
style: {
|
|
3025
3639
|
maxHeight: showFullContent ? expandedMaxHeight : collapsedMaxHeight
|
|
3026
3640
|
},
|
|
3027
|
-
children: /* @__PURE__ */
|
|
3641
|
+
children: /* @__PURE__ */ jsx21("div", { ref: contentRef, className: styles.content, children })
|
|
3028
3642
|
}
|
|
3029
3643
|
),
|
|
3030
|
-
isOverflowing && /* @__PURE__ */
|
|
3031
|
-
/* @__PURE__ */
|
|
3032
|
-
/* @__PURE__ */
|
|
3033
|
-
] }) : /* @__PURE__ */
|
|
3034
|
-
/* @__PURE__ */
|
|
3035
|
-
/* @__PURE__ */
|
|
3644
|
+
isOverflowing && /* @__PURE__ */ jsx21("div", { className: styles.toggleButton, onClick: handleToggleContent, children: showFullContent ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3645
|
+
/* @__PURE__ */ jsx21(UpOutlined2, { style: { fontSize: 10 } }),
|
|
3646
|
+
/* @__PURE__ */ jsx21("span", { children: showLessText })
|
|
3647
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3648
|
+
/* @__PURE__ */ jsx21(DownOutlined3, { style: { fontSize: 10 } }),
|
|
3649
|
+
/* @__PURE__ */ jsx21("span", { children: showAllText })
|
|
3036
3650
|
] }) })
|
|
3037
3651
|
]
|
|
3038
3652
|
},
|
|
@@ -3043,7 +3657,7 @@ var ContentPreviewCollapse = ({
|
|
|
3043
3657
|
};
|
|
3044
3658
|
|
|
3045
3659
|
// src/components/GenUI/elements/WriteFile.tsx
|
|
3046
|
-
import { jsx as
|
|
3660
|
+
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3047
3661
|
var { Text: Text6 } = Typography8;
|
|
3048
3662
|
var WriteFile = ({
|
|
3049
3663
|
data,
|
|
@@ -3057,9 +3671,9 @@ var WriteFile = ({
|
|
|
3057
3671
|
return null;
|
|
3058
3672
|
}
|
|
3059
3673
|
const expandIcon = () => getFileIcon(file_path);
|
|
3060
|
-
const header = /* @__PURE__ */
|
|
3061
|
-
/* @__PURE__ */
|
|
3062
|
-
/* @__PURE__ */
|
|
3674
|
+
const header = /* @__PURE__ */ jsxs13(Space8, { children: [
|
|
3675
|
+
/* @__PURE__ */ jsx22(Text6, { strong: true, children: "New" }),
|
|
3676
|
+
/* @__PURE__ */ jsx22(Text6, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
3063
3677
|
] });
|
|
3064
3678
|
const handleItemClick = (toolCallData2) => {
|
|
3065
3679
|
openSideApp({
|
|
@@ -3071,13 +3685,13 @@ var WriteFile = ({
|
|
|
3071
3685
|
}
|
|
3072
3686
|
});
|
|
3073
3687
|
};
|
|
3074
|
-
return /* @__PURE__ */
|
|
3688
|
+
return /* @__PURE__ */ jsx22(
|
|
3075
3689
|
ContentPreviewCollapse,
|
|
3076
3690
|
{
|
|
3077
3691
|
panelKey: toolCallData.id,
|
|
3078
3692
|
header,
|
|
3079
3693
|
expandIcon,
|
|
3080
|
-
extra: /* @__PURE__ */
|
|
3694
|
+
extra: /* @__PURE__ */ jsx22(
|
|
3081
3695
|
Button7,
|
|
3082
3696
|
{
|
|
3083
3697
|
type: "link",
|
|
@@ -3089,7 +3703,7 @@ var WriteFile = ({
|
|
|
3089
3703
|
children: "Diff View"
|
|
3090
3704
|
}
|
|
3091
3705
|
),
|
|
3092
|
-
children: /* @__PURE__ */
|
|
3706
|
+
children: /* @__PURE__ */ jsx22(MDResponse, { content })
|
|
3093
3707
|
}
|
|
3094
3708
|
);
|
|
3095
3709
|
};
|
|
@@ -3097,10 +3711,10 @@ var WriteFile = ({
|
|
|
3097
3711
|
// src/components/GenUI/elements/file_content_diff_view.tsx
|
|
3098
3712
|
import ReactDiffViewer from "@alexbruf/react-diff-viewer";
|
|
3099
3713
|
import "@alexbruf/react-diff-viewer/index.css";
|
|
3100
|
-
import { jsx as
|
|
3714
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3101
3715
|
var FileContentDiffView = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
3102
3716
|
const { old_code, new_code } = data;
|
|
3103
|
-
return /* @__PURE__ */
|
|
3717
|
+
return /* @__PURE__ */ jsx23(
|
|
3104
3718
|
ReactDiffViewer,
|
|
3105
3719
|
{
|
|
3106
3720
|
oldValue: old_code,
|
|
@@ -3112,7 +3726,7 @@ var FileContentDiffView = ({ data, interactive = true, default_open_in_side_app
|
|
|
3112
3726
|
|
|
3113
3727
|
// src/components/GenUI/elements/EditFile.tsx
|
|
3114
3728
|
import { Button as Button8, Space as Space9, Typography as Typography9 } from "antd";
|
|
3115
|
-
import { jsx as
|
|
3729
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3116
3730
|
var { Text: Text7 } = Typography9;
|
|
3117
3731
|
var EditFile = ({
|
|
3118
3732
|
data,
|
|
@@ -3126,9 +3740,9 @@ var EditFile = ({
|
|
|
3126
3740
|
return null;
|
|
3127
3741
|
}
|
|
3128
3742
|
const expandIcon = () => getFileIcon(file_path);
|
|
3129
|
-
const header = /* @__PURE__ */
|
|
3130
|
-
/* @__PURE__ */
|
|
3131
|
-
/* @__PURE__ */
|
|
3743
|
+
const header = /* @__PURE__ */ jsxs14(Space9, { children: [
|
|
3744
|
+
/* @__PURE__ */ jsx24(Text7, { strong: true, children: "Edit" }),
|
|
3745
|
+
/* @__PURE__ */ jsx24(Text7, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
3132
3746
|
] });
|
|
3133
3747
|
const handleItemClick = (toolCallData2) => {
|
|
3134
3748
|
openSideApp({
|
|
@@ -3140,13 +3754,13 @@ var EditFile = ({
|
|
|
3140
3754
|
}
|
|
3141
3755
|
});
|
|
3142
3756
|
};
|
|
3143
|
-
return /* @__PURE__ */
|
|
3757
|
+
return /* @__PURE__ */ jsx24(
|
|
3144
3758
|
ContentPreviewCollapse,
|
|
3145
3759
|
{
|
|
3146
3760
|
panelKey: toolCallData.id,
|
|
3147
3761
|
header,
|
|
3148
3762
|
expandIcon,
|
|
3149
|
-
extra: /* @__PURE__ */
|
|
3763
|
+
extra: /* @__PURE__ */ jsx24(
|
|
3150
3764
|
Button8,
|
|
3151
3765
|
{
|
|
3152
3766
|
type: "link",
|
|
@@ -3158,13 +3772,13 @@ var EditFile = ({
|
|
|
3158
3772
|
children: "Diff View"
|
|
3159
3773
|
}
|
|
3160
3774
|
),
|
|
3161
|
-
children: /* @__PURE__ */
|
|
3775
|
+
children: /* @__PURE__ */ jsx24(MDResponse, { content: new_string })
|
|
3162
3776
|
}
|
|
3163
3777
|
);
|
|
3164
3778
|
};
|
|
3165
3779
|
|
|
3166
3780
|
// src/components/GenUI/elements/task_card.tsx
|
|
3167
|
-
import { Card as
|
|
3781
|
+
import { Card as Card6, Typography as Typography10, Tag as Tag3, Avatar } from "antd";
|
|
3168
3782
|
import { createStyles as createStyles7 } from "antd-style";
|
|
3169
3783
|
import {
|
|
3170
3784
|
CheckCircleOutlined as CheckCircleOutlined3,
|
|
@@ -3174,7 +3788,7 @@ import {
|
|
|
3174
3788
|
RightOutlined as RightOutlined2,
|
|
3175
3789
|
CarryOutOutlined
|
|
3176
3790
|
} from "@ant-design/icons";
|
|
3177
|
-
import { jsx as
|
|
3791
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3178
3792
|
var { Text: Text8 } = Typography10;
|
|
3179
3793
|
var useStyle5 = createStyles7(({ token, css }) => ({
|
|
3180
3794
|
card: css`
|
|
@@ -3342,14 +3956,14 @@ var TaskCard = ({
|
|
|
3342
3956
|
switch (status2) {
|
|
3343
3957
|
case "success":
|
|
3344
3958
|
return {
|
|
3345
|
-
icon: /* @__PURE__ */
|
|
3959
|
+
icon: /* @__PURE__ */ jsx25(CheckCircleOutlined3, { style: { fontSize: 16 } }),
|
|
3346
3960
|
color: "success",
|
|
3347
3961
|
text: "Completed",
|
|
3348
3962
|
bgColor: "rgba(82, 196, 26, 0.1)"
|
|
3349
3963
|
};
|
|
3350
3964
|
case "error":
|
|
3351
3965
|
return {
|
|
3352
|
-
icon: /* @__PURE__ */
|
|
3966
|
+
icon: /* @__PURE__ */ jsx25(CloseCircleOutlined, { style: { fontSize: 16 } }),
|
|
3353
3967
|
color: "error",
|
|
3354
3968
|
text: "Failed",
|
|
3355
3969
|
bgColor: "rgba(255, 77, 79, 0.1)"
|
|
@@ -3357,7 +3971,7 @@ var TaskCard = ({
|
|
|
3357
3971
|
case "pending":
|
|
3358
3972
|
default:
|
|
3359
3973
|
return {
|
|
3360
|
-
icon: /* @__PURE__ */
|
|
3974
|
+
icon: /* @__PURE__ */ jsx25(LoadingOutlined2, { style: { fontSize: 16 } }),
|
|
3361
3975
|
color: "processing",
|
|
3362
3976
|
text: "In Progress",
|
|
3363
3977
|
bgColor: "rgba(24, 144, 255, 0.1)"
|
|
@@ -3377,8 +3991,8 @@ var TaskCard = ({
|
|
|
3377
3991
|
}
|
|
3378
3992
|
});
|
|
3379
3993
|
};
|
|
3380
|
-
return /* @__PURE__ */
|
|
3381
|
-
|
|
3994
|
+
return /* @__PURE__ */ jsx25(
|
|
3995
|
+
Card6,
|
|
3382
3996
|
{
|
|
3383
3997
|
size: "small",
|
|
3384
3998
|
className: styles.card,
|
|
@@ -3386,28 +4000,28 @@ var TaskCard = ({
|
|
|
3386
4000
|
onClick: handleCardClick,
|
|
3387
4001
|
hoverable: interactive,
|
|
3388
4002
|
bodyStyle: { padding: 0 },
|
|
3389
|
-
children: /* @__PURE__ */
|
|
3390
|
-
/* @__PURE__ */
|
|
3391
|
-
/* @__PURE__ */
|
|
3392
|
-
/* @__PURE__ */
|
|
3393
|
-
subagent_type && /* @__PURE__ */
|
|
3394
|
-
description && /* @__PURE__ */
|
|
4003
|
+
children: /* @__PURE__ */ jsxs15("div", { className: styles.cardBody, children: [
|
|
4004
|
+
/* @__PURE__ */ jsx25("div", { className: styles.header, children: /* @__PURE__ */ jsxs15("div", { className: styles.titleSection, children: [
|
|
4005
|
+
/* @__PURE__ */ jsx25("div", { className: styles.iconWrapper, children: /* @__PURE__ */ jsx25(CarryOutOutlined, { style: { fontSize: 20, color: "#1890ff" } }) }),
|
|
4006
|
+
/* @__PURE__ */ jsxs15("div", { className: styles.titleContent, children: [
|
|
4007
|
+
subagent_type && /* @__PURE__ */ jsx25("div", { className: styles.taskType, children: subagent_type }),
|
|
4008
|
+
description && /* @__PURE__ */ jsx25(Text8, { className: styles.description, children: description })
|
|
3395
4009
|
] })
|
|
3396
4010
|
] }) }),
|
|
3397
|
-
/* @__PURE__ */
|
|
3398
|
-
/* @__PURE__ */
|
|
3399
|
-
assignee && /* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
4011
|
+
/* @__PURE__ */ jsxs15("div", { className: styles.footer, children: [
|
|
4012
|
+
/* @__PURE__ */ jsxs15("div", { className: styles.footerLeft, children: [
|
|
4013
|
+
assignee && /* @__PURE__ */ jsxs15("div", { className: styles.assigneeContainer, children: [
|
|
4014
|
+
/* @__PURE__ */ jsx25(
|
|
3401
4015
|
Avatar,
|
|
3402
4016
|
{
|
|
3403
4017
|
size: 24,
|
|
3404
|
-
icon: /* @__PURE__ */
|
|
4018
|
+
icon: /* @__PURE__ */ jsx25(UserOutlined, {}),
|
|
3405
4019
|
className: styles.assigneeAvatar
|
|
3406
4020
|
}
|
|
3407
4021
|
),
|
|
3408
|
-
/* @__PURE__ */
|
|
4022
|
+
/* @__PURE__ */ jsx25(Text8, { className: styles.assigneeName, children: assignee })
|
|
3409
4023
|
] }),
|
|
3410
|
-
/* @__PURE__ */
|
|
4024
|
+
/* @__PURE__ */ jsx25(
|
|
3411
4025
|
Tag3,
|
|
3412
4026
|
{
|
|
3413
4027
|
icon: statusConfig.icon,
|
|
@@ -3425,16 +4039,16 @@ var TaskCard = ({
|
|
|
3425
4039
|
}
|
|
3426
4040
|
)
|
|
3427
4041
|
] }),
|
|
3428
|
-
interactive && /* @__PURE__ */
|
|
4042
|
+
interactive && /* @__PURE__ */ jsx25(RightOutlined2, { className: styles.actionIcon })
|
|
3429
4043
|
] }),
|
|
3430
|
-
showResponse && /* @__PURE__ */
|
|
4044
|
+
showResponse && /* @__PURE__ */ jsxs15(
|
|
3431
4045
|
"div",
|
|
3432
4046
|
{
|
|
3433
4047
|
className: styles.responseSection,
|
|
3434
4048
|
onClick: (e) => e.stopPropagation(),
|
|
3435
4049
|
children: [
|
|
3436
|
-
/* @__PURE__ */
|
|
3437
|
-
/* @__PURE__ */
|
|
4050
|
+
/* @__PURE__ */ jsx25(Text8, { className: styles.responseHeader, children: "Response" }),
|
|
4051
|
+
/* @__PURE__ */ jsx25("div", { className: styles.responseContent, children: /* @__PURE__ */ jsx25(MDResponse, { content: response }) })
|
|
3438
4052
|
]
|
|
3439
4053
|
}
|
|
3440
4054
|
)
|
|
@@ -3465,21 +4079,21 @@ import ErrorBoundary from "antd/es/alert/ErrorBoundary";
|
|
|
3465
4079
|
import {
|
|
3466
4080
|
memo,
|
|
3467
4081
|
useCallback as useCallback7,
|
|
3468
|
-
useEffect as
|
|
4082
|
+
useEffect as useEffect10,
|
|
3469
4083
|
useMemo as useMemo4,
|
|
3470
|
-
useRef as
|
|
3471
|
-
useState as
|
|
4084
|
+
useRef as useRef9,
|
|
4085
|
+
useState as useState16
|
|
3472
4086
|
} from "react";
|
|
3473
|
-
import { jsx as
|
|
4087
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3474
4088
|
var LazyBubble = ({
|
|
3475
|
-
message:
|
|
4089
|
+
message: message6,
|
|
3476
4090
|
renderContent,
|
|
3477
4091
|
autoLoadRightPanel
|
|
3478
4092
|
}) => {
|
|
3479
|
-
const ref =
|
|
3480
|
-
const [isVisible, setIsVisible] =
|
|
3481
|
-
const [wasEverVisible, setWasEverVisible] =
|
|
3482
|
-
|
|
4093
|
+
const ref = useRef9(null);
|
|
4094
|
+
const [isVisible, setIsVisible] = useState16(false);
|
|
4095
|
+
const [wasEverVisible, setWasEverVisible] = useState16(false);
|
|
4096
|
+
useEffect10(() => {
|
|
3483
4097
|
const observer = new IntersectionObserver(
|
|
3484
4098
|
([entry]) => {
|
|
3485
4099
|
const visible = entry.isIntersecting;
|
|
@@ -3499,21 +4113,21 @@ var LazyBubble = ({
|
|
|
3499
4113
|
}
|
|
3500
4114
|
};
|
|
3501
4115
|
}, [wasEverVisible]);
|
|
3502
|
-
|
|
4116
|
+
useEffect10(() => {
|
|
3503
4117
|
autoLoadRightPanel?.();
|
|
3504
4118
|
}, []);
|
|
3505
4119
|
const getPlaceholder = () => {
|
|
3506
|
-
const estimatedHeight =
|
|
3507
|
-
return /* @__PURE__ */
|
|
4120
|
+
const estimatedHeight = message6.content ? Math.min(100, message6.content.length / 5) : 100;
|
|
4121
|
+
return /* @__PURE__ */ jsx26("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
3508
4122
|
};
|
|
3509
|
-
return /* @__PURE__ */
|
|
4123
|
+
return /* @__PURE__ */ jsx26(ErrorBoundary, { children: /* @__PURE__ */ jsx26("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message6) : getPlaceholder() }) });
|
|
3510
4124
|
};
|
|
3511
4125
|
var MemoizedBubbleList = memo(
|
|
3512
4126
|
({
|
|
3513
4127
|
items,
|
|
3514
4128
|
role,
|
|
3515
4129
|
className
|
|
3516
|
-
}) => /* @__PURE__ */
|
|
4130
|
+
}) => /* @__PURE__ */ jsx26(
|
|
3517
4131
|
Bubble.List,
|
|
3518
4132
|
{
|
|
3519
4133
|
autoScroll: true,
|
|
@@ -3531,41 +4145,41 @@ var MessageList = ({
|
|
|
3531
4145
|
}) => {
|
|
3532
4146
|
const { styles } = useStyle();
|
|
3533
4147
|
const { openSideApp } = useChatUIContext();
|
|
3534
|
-
const messageLengthRef =
|
|
3535
|
-
|
|
4148
|
+
const messageLengthRef = useRef9(messages?.length ?? 0);
|
|
4149
|
+
useEffect10(() => {
|
|
3536
4150
|
if (messages?.length) {
|
|
3537
4151
|
messageLengthRef.current = messages?.length;
|
|
3538
4152
|
}
|
|
3539
4153
|
}, [messages?.length]);
|
|
3540
|
-
const renderContent = useCallback7((
|
|
3541
|
-
const { content } =
|
|
4154
|
+
const renderContent = useCallback7((message6) => {
|
|
4155
|
+
const { content } = message6;
|
|
3542
4156
|
try {
|
|
3543
4157
|
const json = JSON.parse(content);
|
|
3544
4158
|
if (json.action && json.message) {
|
|
3545
|
-
return /* @__PURE__ */
|
|
4159
|
+
return /* @__PURE__ */ jsx26(MDResponse, { content: json.message });
|
|
3546
4160
|
}
|
|
3547
4161
|
} catch (error) {
|
|
3548
4162
|
}
|
|
3549
|
-
const tool_calls_md =
|
|
4163
|
+
const tool_calls_md = message6.tool_calls?.map((tool_call) => {
|
|
3550
4164
|
return `\`\`\`tool_call
|
|
3551
4165
|
${JSON.stringify(tool_call)}
|
|
3552
4166
|
\`\`\``;
|
|
3553
4167
|
}) || [];
|
|
3554
4168
|
const content_md = [content, ...tool_calls_md].join("\n");
|
|
3555
|
-
return /* @__PURE__ */
|
|
4169
|
+
return /* @__PURE__ */ jsx26(Space10, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ jsx26(MDResponse, { content: content_md }) });
|
|
3556
4170
|
}, []);
|
|
3557
4171
|
const items = useMemo4(
|
|
3558
|
-
() => messages.map((
|
|
3559
|
-
key:
|
|
3560
|
-
role:
|
|
4172
|
+
() => messages.map((message6, index) => ({
|
|
4173
|
+
key: message6.id,
|
|
4174
|
+
role: message6.role,
|
|
3561
4175
|
typing: false,
|
|
3562
|
-
content: /* @__PURE__ */
|
|
4176
|
+
content: /* @__PURE__ */ jsx26(
|
|
3563
4177
|
LazyBubble,
|
|
3564
4178
|
{
|
|
3565
|
-
message:
|
|
4179
|
+
message: message6,
|
|
3566
4180
|
renderContent,
|
|
3567
4181
|
autoLoadRightPanel: () => {
|
|
3568
|
-
const { content, role: role2 } =
|
|
4182
|
+
const { content, role: role2 } = message6;
|
|
3569
4183
|
const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
|
|
3570
4184
|
if (index === messages.length - 1 && isNewAddedMessage && role2 === "ai") {
|
|
3571
4185
|
try {
|
|
@@ -3619,9 +4233,9 @@ ${JSON.stringify(tool_call)}
|
|
|
3619
4233
|
}
|
|
3620
4234
|
};
|
|
3621
4235
|
if (items.length === 0) {
|
|
3622
|
-
return /* @__PURE__ */
|
|
4236
|
+
return /* @__PURE__ */ jsx26("div", { style: { flex: 1 } });
|
|
3623
4237
|
}
|
|
3624
|
-
return /* @__PURE__ */
|
|
4238
|
+
return /* @__PURE__ */ jsx26(
|
|
3625
4239
|
MemoizedBubbleList,
|
|
3626
4240
|
{
|
|
3627
4241
|
items,
|
|
@@ -3633,12 +4247,12 @@ ${JSON.stringify(tool_call)}
|
|
|
3633
4247
|
|
|
3634
4248
|
// src/components/Chat/Chating.tsx
|
|
3635
4249
|
import {
|
|
3636
|
-
Alert as
|
|
3637
|
-
Badge as
|
|
3638
|
-
Button as
|
|
4250
|
+
Alert as Alert3,
|
|
4251
|
+
Badge as Badge3,
|
|
4252
|
+
Button as Button12,
|
|
3639
4253
|
message as message3
|
|
3640
4254
|
} from "antd";
|
|
3641
|
-
import
|
|
4255
|
+
import React9, { useEffect as useEffect12, useRef as useRef10, useState as useState18 } from "react";
|
|
3642
4256
|
|
|
3643
4257
|
// src/components/GenUI/HITLContainer.tsx
|
|
3644
4258
|
import {
|
|
@@ -3649,7 +4263,7 @@ import {
|
|
|
3649
4263
|
} from "antd";
|
|
3650
4264
|
import { createStyles as createStyles8 } from "antd-style";
|
|
3651
4265
|
import CollapsePanel4 from "antd/es/collapse/CollapsePanel";
|
|
3652
|
-
import { jsx as
|
|
4266
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3653
4267
|
var { Text: Text9 } = Typography11;
|
|
3654
4268
|
var useStyle6 = createStyles8(({ token, css }) => ({
|
|
3655
4269
|
card: css`
|
|
@@ -3665,18 +4279,18 @@ var useStyle6 = createStyles8(({ token, css }) => ({
|
|
|
3665
4279
|
var HITLContainer = () => {
|
|
3666
4280
|
const { styles } = useStyle6();
|
|
3667
4281
|
const { interrupts } = useAgentChat();
|
|
3668
|
-
return interrupts && interrupts.length > 0 ? /* @__PURE__ */
|
|
4282
|
+
return interrupts && interrupts.length > 0 ? /* @__PURE__ */ jsx27(
|
|
3669
4283
|
Collapse5,
|
|
3670
4284
|
{
|
|
3671
4285
|
className: styles.card,
|
|
3672
4286
|
size: "small",
|
|
3673
4287
|
bordered: false,
|
|
3674
4288
|
defaultActiveKey: ["hitl"],
|
|
3675
|
-
children: /* @__PURE__ */
|
|
4289
|
+
children: /* @__PURE__ */ jsx27(
|
|
3676
4290
|
CollapsePanel4,
|
|
3677
4291
|
{
|
|
3678
4292
|
showArrow: false,
|
|
3679
|
-
header: /* @__PURE__ */
|
|
4293
|
+
header: /* @__PURE__ */ jsx27(
|
|
3680
4294
|
Tag4,
|
|
3681
4295
|
{
|
|
3682
4296
|
bordered: false,
|
|
@@ -3691,7 +4305,7 @@ var HITLContainer = () => {
|
|
|
3691
4305
|
children: "\u7B49\u5F85\u53CD\u9988"
|
|
3692
4306
|
}
|
|
3693
4307
|
),
|
|
3694
|
-
children: /* @__PURE__ */
|
|
4308
|
+
children: /* @__PURE__ */ jsx27(Space11, { direction: "vertical", style: { width: "100%" }, children: interrupts.map((interrupt) => /* @__PURE__ */ jsx27(MDResponse, { content: interrupt.value }, interrupt.id)) })
|
|
3695
4309
|
},
|
|
3696
4310
|
"hitl"
|
|
3697
4311
|
)
|
|
@@ -3704,7 +4318,7 @@ import { Avatar as Avatar2, Space as Space12, Typography as Typography12 } from
|
|
|
3704
4318
|
|
|
3705
4319
|
// src/components/Chat/TodoProgress.tsx
|
|
3706
4320
|
import { Popover, Tooltip as Tooltip2, Progress } from "antd";
|
|
3707
|
-
import { jsx as
|
|
4321
|
+
import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3708
4322
|
var TodoProgress = ({}) => {
|
|
3709
4323
|
const { openSideApp } = useChatUIContext();
|
|
3710
4324
|
const { todos } = useAgentChat();
|
|
@@ -3717,14 +4331,14 @@ var TodoProgress = ({}) => {
|
|
|
3717
4331
|
const totalCount = todos.length;
|
|
3718
4332
|
const hasInProgress = todos.some((item) => item.status === "in_progress");
|
|
3719
4333
|
const percent = Math.round(completedCount / totalCount * 100);
|
|
3720
|
-
return /* @__PURE__ */
|
|
4334
|
+
return /* @__PURE__ */ jsx28(
|
|
3721
4335
|
Popover,
|
|
3722
4336
|
{
|
|
3723
|
-
content: /* @__PURE__ */
|
|
4337
|
+
content: /* @__PURE__ */ jsx28("div", { style: { width: 400 }, children: /* @__PURE__ */ jsx28(Todo, { data: todos, component_key: "header_todos" }) }),
|
|
3724
4338
|
title: "Todos",
|
|
3725
4339
|
trigger: "click",
|
|
3726
4340
|
placement: "bottomRight",
|
|
3727
|
-
children: /* @__PURE__ */
|
|
4341
|
+
children: /* @__PURE__ */ jsx28(Tooltip2, { title: `${completedCount} / ${totalCount} tasks completed`, children: /* @__PURE__ */ jsx28("div", { style: { cursor: "pointer", display: "inline-flex" }, children: /* @__PURE__ */ jsx28(
|
|
3728
4342
|
Progress,
|
|
3729
4343
|
{
|
|
3730
4344
|
type: "circle",
|
|
@@ -3735,7 +4349,7 @@ var TodoProgress = ({}) => {
|
|
|
3735
4349
|
percent,
|
|
3736
4350
|
status: hasInProgress ? "active" : "normal",
|
|
3737
4351
|
width: 30,
|
|
3738
|
-
format: () => /* @__PURE__ */
|
|
4352
|
+
format: () => /* @__PURE__ */ jsx28(
|
|
3739
4353
|
"div",
|
|
3740
4354
|
{
|
|
3741
4355
|
style: {
|
|
@@ -3744,7 +4358,7 @@ var TodoProgress = ({}) => {
|
|
|
3744
4358
|
alignItems: "center",
|
|
3745
4359
|
lineHeight: 1
|
|
3746
4360
|
},
|
|
3747
|
-
children: /* @__PURE__ */
|
|
4361
|
+
children: /* @__PURE__ */ jsxs16("span", { style: { fontSize: 8 }, children: [
|
|
3748
4362
|
completedCount,
|
|
3749
4363
|
"/",
|
|
3750
4364
|
totalCount
|
|
@@ -3760,7 +4374,7 @@ var TodoProgress = ({}) => {
|
|
|
3760
4374
|
// src/components/Chat/FileExplorerButton.tsx
|
|
3761
4375
|
import { Tooltip as Tooltip3, Badge, Button as Button10 } from "antd";
|
|
3762
4376
|
import { FileTextOutlined as FileTextOutlined4 } from "@ant-design/icons";
|
|
3763
|
-
import { jsx as
|
|
4377
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3764
4378
|
var FileExplorerButton = ({}) => {
|
|
3765
4379
|
const { agentState } = useAgentChat();
|
|
3766
4380
|
const { openSideApp } = useChatUIContext();
|
|
@@ -3769,11 +4383,11 @@ var FileExplorerButton = ({}) => {
|
|
|
3769
4383
|
return null;
|
|
3770
4384
|
}
|
|
3771
4385
|
const fileCount = Object.keys(files).length;
|
|
3772
|
-
return /* @__PURE__ */
|
|
4386
|
+
return /* @__PURE__ */ jsx29(Tooltip3, { title: "File Explorer", children: /* @__PURE__ */ jsx29(Badge, { count: fileCount, size: "small", color: "blue", children: /* @__PURE__ */ jsx29(
|
|
3773
4387
|
Button10,
|
|
3774
4388
|
{
|
|
3775
4389
|
type: "text",
|
|
3776
|
-
icon: /* @__PURE__ */
|
|
4390
|
+
icon: /* @__PURE__ */ jsx29(FileTextOutlined4, {}),
|
|
3777
4391
|
onClick: () => openSideApp({
|
|
3778
4392
|
component_key: "file_explorer",
|
|
3779
4393
|
message: "File Explorer",
|
|
@@ -3783,10 +4397,72 @@ var FileExplorerButton = ({}) => {
|
|
|
3783
4397
|
) }) });
|
|
3784
4398
|
};
|
|
3785
4399
|
|
|
4400
|
+
// src/components/Chat/ScheduleButton.tsx
|
|
4401
|
+
import { useState as useState17, useCallback as useCallback8, useEffect as useEffect11 } from "react";
|
|
4402
|
+
import { Tooltip as Tooltip4, Badge as Badge2, Button as Button11, Spin } from "antd";
|
|
4403
|
+
import { CalendarOutlined } from "@ant-design/icons";
|
|
4404
|
+
import { ScheduledTaskStatus } from "@axiom-lattice/client-sdk";
|
|
4405
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4406
|
+
var ScheduleButton = ({
|
|
4407
|
+
tooltipText = "Scheduled Tasks"
|
|
4408
|
+
}) => {
|
|
4409
|
+
const { threadId, assistantId } = useAgentChat();
|
|
4410
|
+
const { openSideApp } = useChatUIContext();
|
|
4411
|
+
const client = useAxiomLattice({ assistantId });
|
|
4412
|
+
const [scheduledTasks, setScheduledTasks] = useState17([]);
|
|
4413
|
+
const [loading, setLoading] = useState17(false);
|
|
4414
|
+
const [taskCount, setTaskCount] = useState17(0);
|
|
4415
|
+
const fetchScheduledTasks = useCallback8(async () => {
|
|
4416
|
+
if (!threadId) return;
|
|
4417
|
+
setLoading(true);
|
|
4418
|
+
try {
|
|
4419
|
+
const tasks = await client.schedules.getByThread({ threadId });
|
|
4420
|
+
setScheduledTasks(tasks);
|
|
4421
|
+
const activeCount = tasks.filter(
|
|
4422
|
+
(task) => task.status === ScheduledTaskStatus.PENDING || task.status === ScheduledTaskStatus.PAUSED
|
|
4423
|
+
).length;
|
|
4424
|
+
setTaskCount(activeCount);
|
|
4425
|
+
} catch (error) {
|
|
4426
|
+
console.error("Failed to fetch scheduled tasks:", error);
|
|
4427
|
+
setScheduledTasks([]);
|
|
4428
|
+
setTaskCount(0);
|
|
4429
|
+
} finally {
|
|
4430
|
+
setLoading(false);
|
|
4431
|
+
}
|
|
4432
|
+
}, [client, threadId]);
|
|
4433
|
+
useEffect11(() => {
|
|
4434
|
+
fetchScheduledTasks();
|
|
4435
|
+
}, [fetchScheduledTasks]);
|
|
4436
|
+
if (!threadId) {
|
|
4437
|
+
return null;
|
|
4438
|
+
}
|
|
4439
|
+
const handleClick = () => {
|
|
4440
|
+
openSideApp({
|
|
4441
|
+
component_key: "schedule_viewer",
|
|
4442
|
+
message: "Scheduled Tasks",
|
|
4443
|
+
data: {
|
|
4444
|
+
threadId,
|
|
4445
|
+
assistantId,
|
|
4446
|
+
tasks: scheduledTasks,
|
|
4447
|
+
onRefresh: fetchScheduledTasks
|
|
4448
|
+
}
|
|
4449
|
+
});
|
|
4450
|
+
};
|
|
4451
|
+
return /* @__PURE__ */ jsx30(Tooltip4, { title: tooltipText, children: /* @__PURE__ */ jsx30(Badge2, { count: taskCount, size: "small", color: "blue", children: /* @__PURE__ */ jsx30(
|
|
4452
|
+
Button11,
|
|
4453
|
+
{
|
|
4454
|
+
type: "text",
|
|
4455
|
+
icon: loading ? /* @__PURE__ */ jsx30(Spin, { size: "small" }) : /* @__PURE__ */ jsx30(CalendarOutlined, {}),
|
|
4456
|
+
onClick: handleClick,
|
|
4457
|
+
disabled: loading
|
|
4458
|
+
}
|
|
4459
|
+
) }) });
|
|
4460
|
+
};
|
|
4461
|
+
|
|
3786
4462
|
// src/components/Chat/AgentHeader.tsx
|
|
3787
4463
|
import { Welcome } from "@ant-design/x";
|
|
3788
4464
|
import { useMemo as useMemo5 } from "react";
|
|
3789
|
-
import { jsx as
|
|
4465
|
+
import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3790
4466
|
var { Text: Text10 } = Typography12;
|
|
3791
4467
|
var AgentHeader = (props) => {
|
|
3792
4468
|
const { description, avatar, name, extra, extraMeta } = props;
|
|
@@ -3799,7 +4475,7 @@ var AgentHeader = (props) => {
|
|
|
3799
4475
|
try {
|
|
3800
4476
|
} catch (error) {
|
|
3801
4477
|
}
|
|
3802
|
-
return /* @__PURE__ */
|
|
4478
|
+
return /* @__PURE__ */ jsx31(
|
|
3803
4479
|
Element,
|
|
3804
4480
|
{
|
|
3805
4481
|
component_key: meta.id,
|
|
@@ -3812,14 +4488,14 @@ var AgentHeader = (props) => {
|
|
|
3812
4488
|
}
|
|
3813
4489
|
return void 0;
|
|
3814
4490
|
}, [extraMeta]);
|
|
3815
|
-
return /* @__PURE__ */
|
|
3816
|
-
/* @__PURE__ */
|
|
4491
|
+
return /* @__PURE__ */ jsxs17("div", { children: [
|
|
4492
|
+
/* @__PURE__ */ jsx31(
|
|
3817
4493
|
Welcome,
|
|
3818
4494
|
{
|
|
3819
4495
|
style: { padding: 8 },
|
|
3820
4496
|
variant: "borderless",
|
|
3821
|
-
description: description ? /* @__PURE__ */
|
|
3822
|
-
icon: /* @__PURE__ */
|
|
4497
|
+
description: description ? /* @__PURE__ */ jsx31(Text10, { ellipsis: { tooltip: description }, children: description }) : void 0,
|
|
4498
|
+
icon: /* @__PURE__ */ jsx31(
|
|
3823
4499
|
"div",
|
|
3824
4500
|
{
|
|
3825
4501
|
style: {
|
|
@@ -3827,19 +4503,20 @@ var AgentHeader = (props) => {
|
|
|
3827
4503
|
alignItems: "center",
|
|
3828
4504
|
justifyContent: "center"
|
|
3829
4505
|
},
|
|
3830
|
-
children: avatar ? /* @__PURE__ */
|
|
4506
|
+
children: avatar ? /* @__PURE__ */ jsx31(Avatar2, { src: avatar, size: 48 }) : /* @__PURE__ */ jsx31(Avatar2, { size: 48, children: name?.charAt(0).toUpperCase() })
|
|
3831
4507
|
}
|
|
3832
4508
|
),
|
|
3833
4509
|
title: name ? name : void 0,
|
|
3834
|
-
extra: /* @__PURE__ */
|
|
4510
|
+
extra: /* @__PURE__ */ jsxs17(Space12, { children: [
|
|
3835
4511
|
extra,
|
|
3836
|
-
/* @__PURE__ */
|
|
3837
|
-
/* @__PURE__ */
|
|
3838
|
-
|
|
4512
|
+
/* @__PURE__ */ jsx31(TodoProgress, {}),
|
|
4513
|
+
/* @__PURE__ */ jsx31(FileExplorerButton, {}),
|
|
4514
|
+
/* @__PURE__ */ jsx31(ScheduleButton, {}),
|
|
4515
|
+
extraMetaComponents && /* @__PURE__ */ jsx31(Space12, { align: "center", style: { marginRight: 16 }, children: extraMetaComponents })
|
|
3839
4516
|
] })
|
|
3840
4517
|
}
|
|
3841
4518
|
),
|
|
3842
|
-
/* @__PURE__ */
|
|
4519
|
+
/* @__PURE__ */ jsx31(
|
|
3843
4520
|
"div",
|
|
3844
4521
|
{
|
|
3845
4522
|
style: {
|
|
@@ -3851,7 +4528,7 @@ var AgentHeader = (props) => {
|
|
|
3851
4528
|
};
|
|
3852
4529
|
|
|
3853
4530
|
// src/components/Chat/Chating.tsx
|
|
3854
|
-
import { Fragment as Fragment4, jsx as
|
|
4531
|
+
import { Fragment as Fragment4, jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3855
4532
|
var Chating = ({
|
|
3856
4533
|
avatar,
|
|
3857
4534
|
name,
|
|
@@ -3867,12 +4544,12 @@ var Chating = ({
|
|
|
3867
4544
|
showHITL = true,
|
|
3868
4545
|
showRefreshButton = false
|
|
3869
4546
|
}) => {
|
|
3870
|
-
const [content, setContent] =
|
|
3871
|
-
const [attachedFiles, setAttachedFiles] =
|
|
4547
|
+
const [content, setContent] = useState18("");
|
|
4548
|
+
const [attachedFiles, setAttachedFiles] = useState18([]);
|
|
3872
4549
|
const { styles } = useStyle();
|
|
3873
|
-
const [headerOpen, setHeaderOpen] =
|
|
3874
|
-
const attachmentsRef =
|
|
3875
|
-
const senderRef =
|
|
4550
|
+
const [headerOpen, setHeaderOpen] = useState18(false);
|
|
4551
|
+
const attachmentsRef = useRef10(null);
|
|
4552
|
+
const senderRef = React9.useRef(null);
|
|
3876
4553
|
const {
|
|
3877
4554
|
messages,
|
|
3878
4555
|
sendMessage,
|
|
@@ -3884,7 +4561,7 @@ var Chating = ({
|
|
|
3884
4561
|
tenantId,
|
|
3885
4562
|
clearError
|
|
3886
4563
|
} = useAgentChat();
|
|
3887
|
-
|
|
4564
|
+
useEffect12(() => {
|
|
3888
4565
|
regsiterElement("action_show_attachments_uploader", {
|
|
3889
4566
|
card_view: () => null,
|
|
3890
4567
|
action: (data) => {
|
|
@@ -3969,15 +4646,15 @@ var Chating = ({
|
|
|
3969
4646
|
}
|
|
3970
4647
|
return true;
|
|
3971
4648
|
};
|
|
3972
|
-
const attachmentsNode = /* @__PURE__ */
|
|
3973
|
-
|
|
4649
|
+
const attachmentsNode = /* @__PURE__ */ jsx32(Badge3, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ jsx32(
|
|
4650
|
+
Button12,
|
|
3974
4651
|
{
|
|
3975
4652
|
type: "text",
|
|
3976
|
-
icon: /* @__PURE__ */
|
|
4653
|
+
icon: /* @__PURE__ */ jsx32(PaperClipOutlined, {}),
|
|
3977
4654
|
onClick: () => setHeaderOpen(!headerOpen)
|
|
3978
4655
|
}
|
|
3979
4656
|
) });
|
|
3980
|
-
const senderHeader = /* @__PURE__ */
|
|
4657
|
+
const senderHeader = /* @__PURE__ */ jsx32(
|
|
3981
4658
|
Sender.Header,
|
|
3982
4659
|
{
|
|
3983
4660
|
title: "Attachments",
|
|
@@ -3989,7 +4666,7 @@ var Chating = ({
|
|
|
3989
4666
|
}
|
|
3990
4667
|
},
|
|
3991
4668
|
forceRender: true,
|
|
3992
|
-
children: /* @__PURE__ */
|
|
4669
|
+
children: /* @__PURE__ */ jsx32(
|
|
3993
4670
|
Attachments,
|
|
3994
4671
|
{
|
|
3995
4672
|
ref: attachmentsRef,
|
|
@@ -4011,7 +4688,7 @@ var Chating = ({
|
|
|
4011
4688
|
multiple: true,
|
|
4012
4689
|
maxCount: 10,
|
|
4013
4690
|
placeholder: (type) => ({
|
|
4014
|
-
icon: /* @__PURE__ */
|
|
4691
|
+
icon: /* @__PURE__ */ jsx32(CloudUploadOutlined, {}),
|
|
4015
4692
|
title: "\u4E0A\u4F20\u6587\u4EF6",
|
|
4016
4693
|
description: attachment_placeholder
|
|
4017
4694
|
})
|
|
@@ -4019,19 +4696,19 @@ var Chating = ({
|
|
|
4019
4696
|
)
|
|
4020
4697
|
}
|
|
4021
4698
|
);
|
|
4022
|
-
const refreshButton = /* @__PURE__ */
|
|
4023
|
-
|
|
4699
|
+
const refreshButton = /* @__PURE__ */ jsx32(
|
|
4700
|
+
Button12,
|
|
4024
4701
|
{
|
|
4025
4702
|
type: "text",
|
|
4026
|
-
icon: /* @__PURE__ */
|
|
4703
|
+
icon: /* @__PURE__ */ jsx32(ReloadOutlined, {}),
|
|
4027
4704
|
onClick: () => {
|
|
4028
4705
|
loadMessages();
|
|
4029
4706
|
}
|
|
4030
4707
|
}
|
|
4031
4708
|
);
|
|
4032
4709
|
const headerExtra = showRefreshButton ? [refreshButton] : [];
|
|
4033
|
-
return /* @__PURE__ */
|
|
4034
|
-
/* @__PURE__ */
|
|
4710
|
+
return /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
4711
|
+
/* @__PURE__ */ jsx32("div", { className: styles.fixedHeader, children: showHeader && /* @__PURE__ */ jsx32(
|
|
4035
4712
|
AgentHeader,
|
|
4036
4713
|
{
|
|
4037
4714
|
description,
|
|
@@ -4041,10 +4718,10 @@ var Chating = ({
|
|
|
4041
4718
|
extraMeta
|
|
4042
4719
|
}
|
|
4043
4720
|
) }),
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
isLoading ? /* @__PURE__ */
|
|
4046
|
-
error && /* @__PURE__ */
|
|
4047
|
-
|
|
4721
|
+
/* @__PURE__ */ jsx32(MessageList, { messages, className: styles.messages }),
|
|
4722
|
+
isLoading ? /* @__PURE__ */ jsx32("div", {}) : /* @__PURE__ */ jsx32(Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
|
|
4723
|
+
error && /* @__PURE__ */ jsx32("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ jsx32(
|
|
4724
|
+
Alert3,
|
|
4048
4725
|
{
|
|
4049
4726
|
type: "error",
|
|
4050
4727
|
banner: true,
|
|
@@ -4053,8 +4730,8 @@ var Chating = ({
|
|
|
4053
4730
|
message: `${error.message}`
|
|
4054
4731
|
}
|
|
4055
4732
|
) }),
|
|
4056
|
-
showHITL && /* @__PURE__ */
|
|
4057
|
-
showSender && /* @__PURE__ */
|
|
4733
|
+
showHITL && /* @__PURE__ */ jsx32(HITLContainer, {}),
|
|
4734
|
+
showSender && /* @__PURE__ */ jsx32(
|
|
4058
4735
|
Sender,
|
|
4059
4736
|
{
|
|
4060
4737
|
disabled: interrupts && interrupts.length > 0,
|
|
@@ -4080,11 +4757,11 @@ var Chating = ({
|
|
|
4080
4757
|
};
|
|
4081
4758
|
|
|
4082
4759
|
// src/components/GenUI/elements/task_detail.tsx
|
|
4083
|
-
import { jsx as
|
|
4760
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
4084
4761
|
var { Text: Text11 } = Typography13;
|
|
4085
4762
|
var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
4086
4763
|
const { description, subagent_type, thread_id } = data || {};
|
|
4087
|
-
return /* @__PURE__ */
|
|
4764
|
+
return /* @__PURE__ */ jsx33(
|
|
4088
4765
|
AgentThreadProvider,
|
|
4089
4766
|
{
|
|
4090
4767
|
threadId: thread_id,
|
|
@@ -4094,7 +4771,7 @@ var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
|
4094
4771
|
enableReturnStateWhenStreamCompleted: true,
|
|
4095
4772
|
enableResumeStream: true
|
|
4096
4773
|
},
|
|
4097
|
-
children: /* @__PURE__ */
|
|
4774
|
+
children: /* @__PURE__ */ jsx33("div", { style: { overflow: "hidden" }, children: /* @__PURE__ */ jsx33(
|
|
4098
4775
|
Chating,
|
|
4099
4776
|
{
|
|
4100
4777
|
showRefreshButton: true,
|
|
@@ -4109,12 +4786,12 @@ var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
|
4109
4786
|
};
|
|
4110
4787
|
|
|
4111
4788
|
// src/components/GenUI/elements/internet_search_card.tsx
|
|
4112
|
-
import { Avatar as Avatar3, Button as
|
|
4789
|
+
import { Avatar as Avatar3, Button as Button13, List as List2, Space as Space13, Typography as Typography14 } from "antd";
|
|
4113
4790
|
import {
|
|
4114
4791
|
SearchOutlined
|
|
4115
4792
|
} from "@ant-design/icons";
|
|
4116
4793
|
import { createStyles as createStyles9 } from "antd-style";
|
|
4117
|
-
import { jsx as
|
|
4794
|
+
import { jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4118
4795
|
var { Text: Text12 } = Typography14;
|
|
4119
4796
|
var useStyle7 = createStyles9(({ token, css }) => ({
|
|
4120
4797
|
listContainer: css`
|
|
@@ -4229,17 +4906,17 @@ var InternetSearchCard = ({
|
|
|
4229
4906
|
if (!toolCallData) {
|
|
4230
4907
|
return null;
|
|
4231
4908
|
}
|
|
4232
|
-
const header = /* @__PURE__ */
|
|
4233
|
-
/* @__PURE__ */
|
|
4234
|
-
/* @__PURE__ */
|
|
4909
|
+
const header = /* @__PURE__ */ jsxs19(Space13, { children: [
|
|
4910
|
+
/* @__PURE__ */ jsx34(Text12, { strong: true, children: "Internet Search" }),
|
|
4911
|
+
/* @__PURE__ */ jsx34(Text12, { title: query, children: query })
|
|
4235
4912
|
] });
|
|
4236
|
-
return /* @__PURE__ */
|
|
4913
|
+
return /* @__PURE__ */ jsx34(
|
|
4237
4914
|
ContentPreviewCollapse,
|
|
4238
4915
|
{
|
|
4239
4916
|
panelKey: toolCallData.id,
|
|
4240
4917
|
header,
|
|
4241
|
-
expandIcon: () => /* @__PURE__ */
|
|
4242
|
-
children: /* @__PURE__ */
|
|
4918
|
+
expandIcon: () => /* @__PURE__ */ jsx34(SearchOutlined, {}),
|
|
4919
|
+
children: /* @__PURE__ */ jsx34(
|
|
4243
4920
|
List2,
|
|
4244
4921
|
{
|
|
4245
4922
|
size: "small",
|
|
@@ -4249,11 +4926,11 @@ var InternetSearchCard = ({
|
|
|
4249
4926
|
const domain = getDomainFromUrl(url);
|
|
4250
4927
|
const iconText = getIconText(domain);
|
|
4251
4928
|
const iconColor = getIconColor(domain);
|
|
4252
|
-
return /* @__PURE__ */
|
|
4253
|
-
/* @__PURE__ */
|
|
4929
|
+
return /* @__PURE__ */ jsx34(List2.Item, { extra: /* @__PURE__ */ jsx34(Text12, { className: styles.source, children: domain }), children: /* @__PURE__ */ jsxs19(Space13, { style: { width: "100%" }, children: [
|
|
4930
|
+
/* @__PURE__ */ jsx34(Avatar3, { style: { background: iconColor }, children: iconText }),
|
|
4254
4931
|
" ",
|
|
4255
|
-
/* @__PURE__ */
|
|
4256
|
-
|
|
4932
|
+
/* @__PURE__ */ jsx34(
|
|
4933
|
+
Button13,
|
|
4257
4934
|
{
|
|
4258
4935
|
type: "text",
|
|
4259
4936
|
onClick: () => {
|
|
@@ -4274,6 +4951,387 @@ var InternetSearchCard = ({
|
|
|
4274
4951
|
);
|
|
4275
4952
|
};
|
|
4276
4953
|
|
|
4954
|
+
// src/components/GenUI/elements/schedule_viewer.tsx
|
|
4955
|
+
import { useState as useState19, useEffect as useEffect13, useCallback as useCallback9 } from "react";
|
|
4956
|
+
import {
|
|
4957
|
+
Tag as Tag5,
|
|
4958
|
+
Button as Button14,
|
|
4959
|
+
Empty as Empty3,
|
|
4960
|
+
Spin as Spin2,
|
|
4961
|
+
Typography as Typography15,
|
|
4962
|
+
Space as Space14,
|
|
4963
|
+
Tooltip as Tooltip5,
|
|
4964
|
+
Popconfirm,
|
|
4965
|
+
message as message4,
|
|
4966
|
+
Card as Card8,
|
|
4967
|
+
Descriptions
|
|
4968
|
+
} from "antd";
|
|
4969
|
+
import {
|
|
4970
|
+
ClockCircleOutlined as ClockCircleOutlined2,
|
|
4971
|
+
PauseCircleOutlined,
|
|
4972
|
+
PlayCircleOutlined,
|
|
4973
|
+
StopOutlined,
|
|
4974
|
+
ReloadOutlined as ReloadOutlined2,
|
|
4975
|
+
CheckCircleOutlined as CheckCircleOutlined4,
|
|
4976
|
+
CloseCircleOutlined as CloseCircleOutlined2,
|
|
4977
|
+
ExclamationCircleOutlined,
|
|
4978
|
+
SyncOutlined as SyncOutlined2,
|
|
4979
|
+
FieldTimeOutlined
|
|
4980
|
+
} from "@ant-design/icons";
|
|
4981
|
+
import { createStyles as createStyles10 } from "antd-style";
|
|
4982
|
+
import dayjs2 from "dayjs";
|
|
4983
|
+
import relativeTime from "dayjs/plugin/relativeTime";
|
|
4984
|
+
import {
|
|
4985
|
+
ScheduledTaskStatus as ScheduledTaskStatus2,
|
|
4986
|
+
ScheduleExecutionType
|
|
4987
|
+
} from "@axiom-lattice/client-sdk";
|
|
4988
|
+
import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4989
|
+
dayjs2.extend(relativeTime);
|
|
4990
|
+
var { Text: Text13, Title: Title2 } = Typography15;
|
|
4991
|
+
var useStyles3 = createStyles10(({ token, css }) => ({
|
|
4992
|
+
container: css`
|
|
4993
|
+
height: 100%;
|
|
4994
|
+
padding: 16px;
|
|
4995
|
+
overflow: auto;
|
|
4996
|
+
background: ${token.colorBgContainer};
|
|
4997
|
+
`,
|
|
4998
|
+
header: css`
|
|
4999
|
+
display: flex;
|
|
5000
|
+
justify-content: space-between;
|
|
5001
|
+
align-items: center;
|
|
5002
|
+
margin-bottom: 16px;
|
|
5003
|
+
padding-bottom: 12px;
|
|
5004
|
+
border-bottom: 1px solid ${token.colorBorderSecondary};
|
|
5005
|
+
`,
|
|
5006
|
+
taskCard: css`
|
|
5007
|
+
margin-bottom: 12px;
|
|
5008
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
5009
|
+
transition: box-shadow 0.2s;
|
|
5010
|
+
|
|
5011
|
+
&:hover {
|
|
5012
|
+
box-shadow: ${token.boxShadowSecondary};
|
|
5013
|
+
}
|
|
5014
|
+
`,
|
|
5015
|
+
taskHeader: css`
|
|
5016
|
+
display: flex;
|
|
5017
|
+
justify-content: space-between;
|
|
5018
|
+
align-items: flex-start;
|
|
5019
|
+
margin-bottom: 8px;
|
|
5020
|
+
`,
|
|
5021
|
+
taskType: css`
|
|
5022
|
+
font-weight: 600;
|
|
5023
|
+
font-size: 14px;
|
|
5024
|
+
color: ${token.colorText};
|
|
5025
|
+
`,
|
|
5026
|
+
taskId: css`
|
|
5027
|
+
font-family: monospace;
|
|
5028
|
+
font-size: 11px;
|
|
5029
|
+
color: ${token.colorTextSecondary};
|
|
5030
|
+
word-break: break-all;
|
|
5031
|
+
`,
|
|
5032
|
+
metaRow: css`
|
|
5033
|
+
display: flex;
|
|
5034
|
+
flex-wrap: wrap;
|
|
5035
|
+
gap: 16px;
|
|
5036
|
+
margin-top: 8px;
|
|
5037
|
+
`,
|
|
5038
|
+
metaItem: css`
|
|
5039
|
+
display: flex;
|
|
5040
|
+
align-items: center;
|
|
5041
|
+
gap: 6px;
|
|
5042
|
+
font-size: 12px;
|
|
5043
|
+
color: ${token.colorTextSecondary};
|
|
5044
|
+
`,
|
|
5045
|
+
actions: css`
|
|
5046
|
+
display: flex;
|
|
5047
|
+
gap: 4px;
|
|
5048
|
+
margin-top: 12px;
|
|
5049
|
+
padding-top: 12px;
|
|
5050
|
+
border-top: 1px solid ${token.colorBorderSecondary};
|
|
5051
|
+
`,
|
|
5052
|
+
emptyContainer: css`
|
|
5053
|
+
display: flex;
|
|
5054
|
+
flex-direction: column;
|
|
5055
|
+
align-items: center;
|
|
5056
|
+
justify-content: center;
|
|
5057
|
+
height: 300px;
|
|
5058
|
+
`,
|
|
5059
|
+
cronExpression: css`
|
|
5060
|
+
font-family: monospace;
|
|
5061
|
+
background: ${token.colorFillSecondary};
|
|
5062
|
+
padding: 2px 6px;
|
|
5063
|
+
border-radius: 4px;
|
|
5064
|
+
font-size: 12px;
|
|
5065
|
+
`
|
|
5066
|
+
}));
|
|
5067
|
+
var getStatusColor = (status) => {
|
|
5068
|
+
switch (status) {
|
|
5069
|
+
case ScheduledTaskStatus2.PENDING:
|
|
5070
|
+
return "processing";
|
|
5071
|
+
case ScheduledTaskStatus2.RUNNING:
|
|
5072
|
+
return "blue";
|
|
5073
|
+
case ScheduledTaskStatus2.COMPLETED:
|
|
5074
|
+
return "success";
|
|
5075
|
+
case ScheduledTaskStatus2.FAILED:
|
|
5076
|
+
return "error";
|
|
5077
|
+
case ScheduledTaskStatus2.CANCELLED:
|
|
5078
|
+
return "default";
|
|
5079
|
+
case ScheduledTaskStatus2.PAUSED:
|
|
5080
|
+
return "warning";
|
|
5081
|
+
default:
|
|
5082
|
+
return "default";
|
|
5083
|
+
}
|
|
5084
|
+
};
|
|
5085
|
+
var getStatusIcon2 = (status) => {
|
|
5086
|
+
switch (status) {
|
|
5087
|
+
case ScheduledTaskStatus2.PENDING:
|
|
5088
|
+
return /* @__PURE__ */ jsx35(ClockCircleOutlined2, {});
|
|
5089
|
+
case ScheduledTaskStatus2.RUNNING:
|
|
5090
|
+
return /* @__PURE__ */ jsx35(SyncOutlined2, { spin: true });
|
|
5091
|
+
case ScheduledTaskStatus2.COMPLETED:
|
|
5092
|
+
return /* @__PURE__ */ jsx35(CheckCircleOutlined4, {});
|
|
5093
|
+
case ScheduledTaskStatus2.FAILED:
|
|
5094
|
+
return /* @__PURE__ */ jsx35(CloseCircleOutlined2, {});
|
|
5095
|
+
case ScheduledTaskStatus2.CANCELLED:
|
|
5096
|
+
return /* @__PURE__ */ jsx35(StopOutlined, {});
|
|
5097
|
+
case ScheduledTaskStatus2.PAUSED:
|
|
5098
|
+
return /* @__PURE__ */ jsx35(PauseCircleOutlined, {});
|
|
5099
|
+
default:
|
|
5100
|
+
return /* @__PURE__ */ jsx35(ClockCircleOutlined2, {});
|
|
5101
|
+
}
|
|
5102
|
+
};
|
|
5103
|
+
var formatTime = (timestamp) => {
|
|
5104
|
+
if (!timestamp) return "-";
|
|
5105
|
+
return dayjs2(timestamp).format("YYYY-MM-DD HH:mm:ss");
|
|
5106
|
+
};
|
|
5107
|
+
var getRelativeTime = (timestamp) => {
|
|
5108
|
+
if (!timestamp) return "";
|
|
5109
|
+
return dayjs2(timestamp).fromNow();
|
|
5110
|
+
};
|
|
5111
|
+
var ScheduleViewer = ({ data }) => {
|
|
5112
|
+
const { styles } = useStyles3();
|
|
5113
|
+
const { threadId, assistantId, tasks: initialTasks, onRefresh } = data ?? {};
|
|
5114
|
+
const client = useAxiomLattice({ assistantId });
|
|
5115
|
+
const [tasks, setTasks] = useState19(initialTasks || []);
|
|
5116
|
+
const [loading, setLoading] = useState19(false);
|
|
5117
|
+
const [actionLoading, setActionLoading] = useState19(null);
|
|
5118
|
+
const handleRefresh = useCallback9(async () => {
|
|
5119
|
+
if (!threadId) return;
|
|
5120
|
+
setLoading(true);
|
|
5121
|
+
try {
|
|
5122
|
+
const fetchedTasks = await client.schedules.getByThread({ threadId });
|
|
5123
|
+
setTasks(fetchedTasks);
|
|
5124
|
+
onRefresh?.();
|
|
5125
|
+
} catch (error) {
|
|
5126
|
+
console.error("Failed to refresh tasks:", error);
|
|
5127
|
+
message4.error("Failed to refresh scheduled tasks");
|
|
5128
|
+
} finally {
|
|
5129
|
+
setLoading(false);
|
|
5130
|
+
}
|
|
5131
|
+
}, [client, threadId, onRefresh]);
|
|
5132
|
+
const handleCancel = useCallback9(
|
|
5133
|
+
async (taskId) => {
|
|
5134
|
+
setActionLoading(taskId);
|
|
5135
|
+
try {
|
|
5136
|
+
await client.schedules.cancel(taskId);
|
|
5137
|
+
message4.success("Task cancelled successfully");
|
|
5138
|
+
await handleRefresh();
|
|
5139
|
+
} catch (error) {
|
|
5140
|
+
console.error("Failed to cancel task:", error);
|
|
5141
|
+
message4.error("Failed to cancel task");
|
|
5142
|
+
} finally {
|
|
5143
|
+
setActionLoading(null);
|
|
5144
|
+
}
|
|
5145
|
+
},
|
|
5146
|
+
[client, handleRefresh]
|
|
5147
|
+
);
|
|
5148
|
+
const handlePause = useCallback9(
|
|
5149
|
+
async (taskId) => {
|
|
5150
|
+
setActionLoading(taskId);
|
|
5151
|
+
try {
|
|
5152
|
+
await client.schedules.pause(taskId);
|
|
5153
|
+
message4.success("Task paused successfully");
|
|
5154
|
+
await handleRefresh();
|
|
5155
|
+
} catch (error) {
|
|
5156
|
+
console.error("Failed to pause task:", error);
|
|
5157
|
+
message4.error("Failed to pause task");
|
|
5158
|
+
} finally {
|
|
5159
|
+
setActionLoading(null);
|
|
5160
|
+
}
|
|
5161
|
+
},
|
|
5162
|
+
[client, handleRefresh]
|
|
5163
|
+
);
|
|
5164
|
+
const handleResume = useCallback9(
|
|
5165
|
+
async (taskId) => {
|
|
5166
|
+
setActionLoading(taskId);
|
|
5167
|
+
try {
|
|
5168
|
+
await client.schedules.resume(taskId);
|
|
5169
|
+
message4.success("Task resumed successfully");
|
|
5170
|
+
await handleRefresh();
|
|
5171
|
+
} catch (error) {
|
|
5172
|
+
console.error("Failed to resume task:", error);
|
|
5173
|
+
message4.error("Failed to resume task");
|
|
5174
|
+
} finally {
|
|
5175
|
+
setActionLoading(null);
|
|
5176
|
+
}
|
|
5177
|
+
},
|
|
5178
|
+
[client, handleRefresh]
|
|
5179
|
+
);
|
|
5180
|
+
useEffect13(() => {
|
|
5181
|
+
if (threadId && (!initialTasks || initialTasks.length === 0)) {
|
|
5182
|
+
handleRefresh();
|
|
5183
|
+
}
|
|
5184
|
+
}, [threadId]);
|
|
5185
|
+
useEffect13(() => {
|
|
5186
|
+
if (initialTasks) {
|
|
5187
|
+
setTasks(initialTasks);
|
|
5188
|
+
}
|
|
5189
|
+
}, [initialTasks]);
|
|
5190
|
+
const renderActions = (task) => {
|
|
5191
|
+
const isLoading = actionLoading === task.taskId;
|
|
5192
|
+
const isPending = task.status === ScheduledTaskStatus2.PENDING;
|
|
5193
|
+
const isPaused = task.status === ScheduledTaskStatus2.PAUSED;
|
|
5194
|
+
const isCron = task.executionType === ScheduleExecutionType.CRON;
|
|
5195
|
+
return /* @__PURE__ */ jsxs20(Space14, { className: styles.actions, children: [
|
|
5196
|
+
isPending && isCron && /* @__PURE__ */ jsx35(Tooltip5, { title: "Pause", children: /* @__PURE__ */ jsx35(
|
|
5197
|
+
Button14,
|
|
5198
|
+
{
|
|
5199
|
+
type: "text",
|
|
5200
|
+
size: "small",
|
|
5201
|
+
icon: /* @__PURE__ */ jsx35(PauseCircleOutlined, {}),
|
|
5202
|
+
onClick: () => handlePause(task.taskId),
|
|
5203
|
+
loading: isLoading
|
|
5204
|
+
}
|
|
5205
|
+
) }),
|
|
5206
|
+
isPaused && /* @__PURE__ */ jsx35(Tooltip5, { title: "Resume", children: /* @__PURE__ */ jsx35(
|
|
5207
|
+
Button14,
|
|
5208
|
+
{
|
|
5209
|
+
type: "text",
|
|
5210
|
+
size: "small",
|
|
5211
|
+
icon: /* @__PURE__ */ jsx35(PlayCircleOutlined, {}),
|
|
5212
|
+
onClick: () => handleResume(task.taskId),
|
|
5213
|
+
loading: isLoading
|
|
5214
|
+
}
|
|
5215
|
+
) }),
|
|
5216
|
+
(isPending || isPaused) && /* @__PURE__ */ jsx35(
|
|
5217
|
+
Popconfirm,
|
|
5218
|
+
{
|
|
5219
|
+
title: "Cancel this scheduled task?",
|
|
5220
|
+
description: "This action cannot be undone.",
|
|
5221
|
+
onConfirm: () => handleCancel(task.taskId),
|
|
5222
|
+
okText: "Yes",
|
|
5223
|
+
cancelText: "No",
|
|
5224
|
+
children: /* @__PURE__ */ jsx35(Tooltip5, { title: "Cancel", children: /* @__PURE__ */ jsx35(
|
|
5225
|
+
Button14,
|
|
5226
|
+
{
|
|
5227
|
+
type: "text",
|
|
5228
|
+
size: "small",
|
|
5229
|
+
danger: true,
|
|
5230
|
+
icon: /* @__PURE__ */ jsx35(StopOutlined, {}),
|
|
5231
|
+
loading: isLoading
|
|
5232
|
+
}
|
|
5233
|
+
) })
|
|
5234
|
+
}
|
|
5235
|
+
)
|
|
5236
|
+
] });
|
|
5237
|
+
};
|
|
5238
|
+
const renderTask = (task) => {
|
|
5239
|
+
const isActive = task.status === ScheduledTaskStatus2.PENDING || task.status === ScheduledTaskStatus2.PAUSED;
|
|
5240
|
+
return /* @__PURE__ */ jsxs20(
|
|
5241
|
+
Card8,
|
|
5242
|
+
{
|
|
5243
|
+
className: styles.taskCard,
|
|
5244
|
+
size: "small",
|
|
5245
|
+
bordered: true,
|
|
5246
|
+
children: [
|
|
5247
|
+
/* @__PURE__ */ jsxs20("div", { className: styles.taskHeader, children: [
|
|
5248
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
5249
|
+
/* @__PURE__ */ jsx35("div", { className: styles.taskType, children: task.taskType }),
|
|
5250
|
+
/* @__PURE__ */ jsx35("div", { className: styles.taskId, children: task.taskId })
|
|
5251
|
+
] }),
|
|
5252
|
+
/* @__PURE__ */ jsx35(Tag5, { color: getStatusColor(task.status), icon: getStatusIcon2(task.status), children: task.status.toUpperCase() })
|
|
5253
|
+
] }),
|
|
5254
|
+
/* @__PURE__ */ jsxs20("div", { className: styles.metaRow, children: [
|
|
5255
|
+
/* @__PURE__ */ jsx35(Tooltip5, { title: "Execution Type", children: /* @__PURE__ */ jsxs20("div", { className: styles.metaItem, children: [
|
|
5256
|
+
/* @__PURE__ */ jsx35(FieldTimeOutlined, {}),
|
|
5257
|
+
/* @__PURE__ */ jsx35("span", { children: task.executionType === ScheduleExecutionType.CRON ? "Recurring" : "One-time" })
|
|
5258
|
+
] }) }),
|
|
5259
|
+
task.cronExpression && /* @__PURE__ */ jsx35(Tooltip5, { title: "Cron Expression", children: /* @__PURE__ */ jsxs20("div", { className: styles.metaItem, children: [
|
|
5260
|
+
/* @__PURE__ */ jsx35(ClockCircleOutlined2, {}),
|
|
5261
|
+
/* @__PURE__ */ jsx35("code", { className: styles.cronExpression, children: task.cronExpression })
|
|
5262
|
+
] }) }),
|
|
5263
|
+
task.nextRunAt && /* @__PURE__ */ jsx35(Tooltip5, { title: `Next run: ${formatTime(task.nextRunAt)}`, children: /* @__PURE__ */ jsxs20("div", { className: styles.metaItem, children: [
|
|
5264
|
+
/* @__PURE__ */ jsx35(ClockCircleOutlined2, {}),
|
|
5265
|
+
/* @__PURE__ */ jsxs20("span", { children: [
|
|
5266
|
+
"Next: ",
|
|
5267
|
+
getRelativeTime(task.nextRunAt)
|
|
5268
|
+
] })
|
|
5269
|
+
] }) }),
|
|
5270
|
+
task.executeAt && !task.cronExpression && /* @__PURE__ */ jsx35(Tooltip5, { title: `Execute at: ${formatTime(task.executeAt)}`, children: /* @__PURE__ */ jsxs20("div", { className: styles.metaItem, children: [
|
|
5271
|
+
/* @__PURE__ */ jsx35(ClockCircleOutlined2, {}),
|
|
5272
|
+
/* @__PURE__ */ jsxs20("span", { children: [
|
|
5273
|
+
"At: ",
|
|
5274
|
+
getRelativeTime(task.executeAt)
|
|
5275
|
+
] })
|
|
5276
|
+
] }) }),
|
|
5277
|
+
task.runCount > 0 && /* @__PURE__ */ jsx35(Tooltip5, { title: "Run count", children: /* @__PURE__ */ jsxs20("div", { className: styles.metaItem, children: [
|
|
5278
|
+
/* @__PURE__ */ jsx35(SyncOutlined2, {}),
|
|
5279
|
+
/* @__PURE__ */ jsxs20("span", { children: [
|
|
5280
|
+
"Runs: ",
|
|
5281
|
+
task.runCount,
|
|
5282
|
+
task.maxRuns ? ` / ${task.maxRuns}` : ""
|
|
5283
|
+
] })
|
|
5284
|
+
] }) })
|
|
5285
|
+
] }),
|
|
5286
|
+
task.lastError && /* @__PURE__ */ jsx35("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ jsxs20(Text13, { type: "danger", style: { fontSize: 12 }, children: [
|
|
5287
|
+
/* @__PURE__ */ jsx35(ExclamationCircleOutlined, { style: { marginRight: 4 } }),
|
|
5288
|
+
task.lastError
|
|
5289
|
+
] }) }),
|
|
5290
|
+
task.metadata && Object.keys(task.metadata).length > 0 && /* @__PURE__ */ jsx35(
|
|
5291
|
+
Descriptions,
|
|
5292
|
+
{
|
|
5293
|
+
size: "small",
|
|
5294
|
+
column: 1,
|
|
5295
|
+
style: { marginTop: 12 },
|
|
5296
|
+
items: Object.entries(task.metadata).map(([key, value]) => ({
|
|
5297
|
+
key,
|
|
5298
|
+
label: key,
|
|
5299
|
+
children: typeof value === "object" ? JSON.stringify(value) : String(value)
|
|
5300
|
+
}))
|
|
5301
|
+
}
|
|
5302
|
+
),
|
|
5303
|
+
isActive && renderActions(task)
|
|
5304
|
+
]
|
|
5305
|
+
},
|
|
5306
|
+
task.taskId
|
|
5307
|
+
);
|
|
5308
|
+
};
|
|
5309
|
+
return /* @__PURE__ */ jsxs20("div", { className: styles.container, children: [
|
|
5310
|
+
/* @__PURE__ */ jsxs20("div", { className: styles.header, children: [
|
|
5311
|
+
/* @__PURE__ */ jsx35(Title2, { level: 5, style: { margin: 0 }, children: "Scheduled Tasks" }),
|
|
5312
|
+
/* @__PURE__ */ jsx35(Tooltip5, { title: "Refresh", children: /* @__PURE__ */ jsx35(
|
|
5313
|
+
Button14,
|
|
5314
|
+
{
|
|
5315
|
+
type: "text",
|
|
5316
|
+
icon: /* @__PURE__ */ jsx35(ReloadOutlined2, { spin: loading }),
|
|
5317
|
+
onClick: handleRefresh,
|
|
5318
|
+
loading
|
|
5319
|
+
}
|
|
5320
|
+
) })
|
|
5321
|
+
] }),
|
|
5322
|
+
loading && tasks.length === 0 ? /* @__PURE__ */ jsxs20("div", { className: styles.emptyContainer, children: [
|
|
5323
|
+
/* @__PURE__ */ jsx35(Spin2, { size: "large" }),
|
|
5324
|
+
/* @__PURE__ */ jsx35(Text13, { type: "secondary", style: { marginTop: 16 }, children: "Loading scheduled tasks..." })
|
|
5325
|
+
] }) : tasks.length === 0 ? /* @__PURE__ */ jsx35("div", { className: styles.emptyContainer, children: /* @__PURE__ */ jsx35(
|
|
5326
|
+
Empty3,
|
|
5327
|
+
{
|
|
5328
|
+
image: Empty3.PRESENTED_IMAGE_SIMPLE,
|
|
5329
|
+
description: "No scheduled tasks for this thread"
|
|
5330
|
+
}
|
|
5331
|
+
) }) : /* @__PURE__ */ jsx35("div", { children: tasks.map(renderTask) })
|
|
5332
|
+
] });
|
|
5333
|
+
};
|
|
5334
|
+
|
|
4277
5335
|
// src/components/GenUI/elements/builtIns.tsx
|
|
4278
5336
|
var elements = {
|
|
4279
5337
|
action_show_attachments_uploader: {
|
|
@@ -4325,6 +5383,10 @@ var elements = {
|
|
|
4325
5383
|
task: {
|
|
4326
5384
|
card_view: TaskCard,
|
|
4327
5385
|
side_app_view: TaskDetail
|
|
5386
|
+
},
|
|
5387
|
+
schedule_viewer: {
|
|
5388
|
+
card_view: () => null,
|
|
5389
|
+
side_app_view: ScheduleViewer
|
|
4328
5390
|
}
|
|
4329
5391
|
};
|
|
4330
5392
|
|
|
@@ -4342,11 +5404,11 @@ var regsiterElement = (language, ElementMeta) => {
|
|
|
4342
5404
|
};
|
|
4343
5405
|
|
|
4344
5406
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
4345
|
-
import { Button as
|
|
4346
|
-
import { createStyles as
|
|
4347
|
-
import { useEffect as
|
|
4348
|
-
import { jsx as
|
|
4349
|
-
var useStyle8 =
|
|
5407
|
+
import { Button as Button15, Tabs } from "antd";
|
|
5408
|
+
import { createStyles as createStyles11 } from "antd-style";
|
|
5409
|
+
import { useEffect as useEffect14, useState as useState20 } from "react";
|
|
5410
|
+
import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5411
|
+
var useStyle8 = createStyles11(({ token, css }) => {
|
|
4350
5412
|
return {
|
|
4351
5413
|
tabContainer: css`
|
|
4352
5414
|
.ant-tabs-content-holder {
|
|
@@ -4365,9 +5427,9 @@ var useStyle8 = createStyles10(({ token, css }) => {
|
|
|
4365
5427
|
};
|
|
4366
5428
|
});
|
|
4367
5429
|
var EmptySideAppView = ({ component_key, data }) => {
|
|
4368
|
-
return /* @__PURE__ */
|
|
4369
|
-
/* @__PURE__ */
|
|
4370
|
-
/* @__PURE__ */
|
|
5430
|
+
return /* @__PURE__ */ jsxs21("div", { children: [
|
|
5431
|
+
/* @__PURE__ */ jsx36("p", { children: "\u672A\u627E\u5230\u5BF9\u5E94\u7684\u7EC4\u4EF6\u89C6\u56FE" }),
|
|
5432
|
+
/* @__PURE__ */ jsx36("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
|
|
4371
5433
|
] });
|
|
4372
5434
|
};
|
|
4373
5435
|
var SideAppViewBrowser = () => {
|
|
@@ -4379,10 +5441,10 @@ var SideAppViewBrowser = () => {
|
|
|
4379
5441
|
openSideApp,
|
|
4380
5442
|
closeSideApp
|
|
4381
5443
|
} = useChatUIContext();
|
|
4382
|
-
const [activeKey, setActiveKey] =
|
|
5444
|
+
const [activeKey, setActiveKey] = useState20(
|
|
4383
5445
|
JSON.stringify(sideAppSelectedCard)
|
|
4384
5446
|
);
|
|
4385
|
-
const [items, setItems] =
|
|
5447
|
+
const [items, setItems] = useState20([]);
|
|
4386
5448
|
const add = (key, label, children) => {
|
|
4387
5449
|
const newActiveKey = key;
|
|
4388
5450
|
const newPanes = [...items];
|
|
@@ -4418,7 +5480,7 @@ var SideAppViewBrowser = () => {
|
|
|
4418
5480
|
remove(targetKey);
|
|
4419
5481
|
}
|
|
4420
5482
|
};
|
|
4421
|
-
|
|
5483
|
+
useEffect14(() => {
|
|
4422
5484
|
const SideAppView = getElement(sideAppSelectedCard?.component_key).side_app_view || EmptySideAppView;
|
|
4423
5485
|
const key = JSON.stringify(sideAppSelectedCard);
|
|
4424
5486
|
if (items.find((item) => item.key === key)) {
|
|
@@ -4428,7 +5490,7 @@ var SideAppViewBrowser = () => {
|
|
|
4428
5490
|
add(
|
|
4429
5491
|
key,
|
|
4430
5492
|
sideAppSelectedCard?.message || sideAppSelectedCard?.data.message || "\u672A\u547D\u540D",
|
|
4431
|
-
/* @__PURE__ */
|
|
5493
|
+
/* @__PURE__ */ jsx36(
|
|
4432
5494
|
SideAppView,
|
|
4433
5495
|
{
|
|
4434
5496
|
component_key: sideAppSelectedCard?.component_key || "",
|
|
@@ -4469,16 +5531,16 @@ var SideAppViewBrowser = () => {
|
|
|
4469
5531
|
const getSizeIcon = (size) => {
|
|
4470
5532
|
switch (size) {
|
|
4471
5533
|
case "middle":
|
|
4472
|
-
return /* @__PURE__ */
|
|
5534
|
+
return /* @__PURE__ */ jsx36(CompressOutlined, {});
|
|
4473
5535
|
case "large":
|
|
4474
|
-
return /* @__PURE__ */
|
|
5536
|
+
return /* @__PURE__ */ jsx36(ExpandOutlined, {});
|
|
4475
5537
|
case "full":
|
|
4476
|
-
return /* @__PURE__ */
|
|
5538
|
+
return /* @__PURE__ */ jsx36(FullscreenOutlined, {});
|
|
4477
5539
|
default:
|
|
4478
|
-
return /* @__PURE__ */
|
|
5540
|
+
return /* @__PURE__ */ jsx36(ExpandOutlined, {});
|
|
4479
5541
|
}
|
|
4480
5542
|
};
|
|
4481
|
-
return /* @__PURE__ */
|
|
5543
|
+
return /* @__PURE__ */ jsx36(
|
|
4482
5544
|
Tabs,
|
|
4483
5545
|
{
|
|
4484
5546
|
className: styles.tabContainer,
|
|
@@ -4486,9 +5548,9 @@ var SideAppViewBrowser = () => {
|
|
|
4486
5548
|
style: { height: "100%" },
|
|
4487
5549
|
hideAdd: true,
|
|
4488
5550
|
tabBarExtraContent: {
|
|
4489
|
-
right: /* @__PURE__ */
|
|
4490
|
-
/* @__PURE__ */
|
|
4491
|
-
|
|
5551
|
+
right: /* @__PURE__ */ jsxs21("div", { style: { display: "flex", gap: "4px" }, children: [
|
|
5552
|
+
/* @__PURE__ */ jsx36(
|
|
5553
|
+
Button15,
|
|
4492
5554
|
{
|
|
4493
5555
|
style: { margin: "8px 0" },
|
|
4494
5556
|
size: "large",
|
|
@@ -4498,13 +5560,13 @@ var SideAppViewBrowser = () => {
|
|
|
4498
5560
|
title: `\u5F53\u524D\u5C3A\u5BF8: ${getSizeLabel(sideAppSize)}, \u70B9\u51FB\u5207\u6362`
|
|
4499
5561
|
}
|
|
4500
5562
|
),
|
|
4501
|
-
/* @__PURE__ */
|
|
4502
|
-
|
|
5563
|
+
/* @__PURE__ */ jsx36(
|
|
5564
|
+
Button15,
|
|
4503
5565
|
{
|
|
4504
5566
|
style: { margin: "8px 0" },
|
|
4505
5567
|
size: "large",
|
|
4506
5568
|
type: "text",
|
|
4507
|
-
icon: /* @__PURE__ */
|
|
5569
|
+
icon: /* @__PURE__ */ jsx36(CloseOutlined, {}),
|
|
4508
5570
|
onClick: () => {
|
|
4509
5571
|
closeSideApp();
|
|
4510
5572
|
}
|
|
@@ -4521,10 +5583,10 @@ var SideAppViewBrowser = () => {
|
|
|
4521
5583
|
};
|
|
4522
5584
|
|
|
4523
5585
|
// src/components/Chat/LatticeChat.tsx
|
|
4524
|
-
import { jsx as
|
|
5586
|
+
import { jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4525
5587
|
var LatticeChat = (props) => {
|
|
4526
5588
|
const { assistant_id, thread_id = "", menu, header, ...chatingProps } = props;
|
|
4527
|
-
return /* @__PURE__ */
|
|
5589
|
+
return /* @__PURE__ */ jsx37(
|
|
4528
5590
|
AgentThreadProvider,
|
|
4529
5591
|
{
|
|
4530
5592
|
assistantId: assistant_id,
|
|
@@ -4534,7 +5596,7 @@ var LatticeChat = (props) => {
|
|
|
4534
5596
|
enableReturnStateWhenStreamCompleted: true,
|
|
4535
5597
|
enableResumeStream: true
|
|
4536
5598
|
},
|
|
4537
|
-
children: /* @__PURE__ */
|
|
5599
|
+
children: /* @__PURE__ */ jsx37(ChatUIContextProvider, { children: /* @__PURE__ */ jsxs22(
|
|
4538
5600
|
"div",
|
|
4539
5601
|
{
|
|
4540
5602
|
style: {
|
|
@@ -4545,12 +5607,12 @@ var LatticeChat = (props) => {
|
|
|
4545
5607
|
},
|
|
4546
5608
|
children: [
|
|
4547
5609
|
header,
|
|
4548
|
-
/* @__PURE__ */
|
|
5610
|
+
/* @__PURE__ */ jsx37(
|
|
4549
5611
|
ColumnLayout,
|
|
4550
5612
|
{
|
|
4551
5613
|
menu,
|
|
4552
|
-
left: thread_id ? /* @__PURE__ */
|
|
4553
|
-
right: /* @__PURE__ */
|
|
5614
|
+
left: thread_id ? /* @__PURE__ */ jsx37(Chating, { ...chatingProps }) : /* @__PURE__ */ jsx37("div", { children: "\u9700\u8981\u5148\u521B\u5EFA\u4F1A\u8BDD" }),
|
|
5615
|
+
right: /* @__PURE__ */ jsx37(SideAppViewBrowser, {})
|
|
4554
5616
|
}
|
|
4555
5617
|
)
|
|
4556
5618
|
]
|
|
@@ -4563,23 +5625,23 @@ var LatticeChat = (props) => {
|
|
|
4563
5625
|
// src/components/Chat/ConversationContext.tsx
|
|
4564
5626
|
import {
|
|
4565
5627
|
createContext as createContext6,
|
|
4566
|
-
useCallback as
|
|
5628
|
+
useCallback as useCallback12,
|
|
4567
5629
|
useContext as useContext6,
|
|
4568
|
-
useEffect as
|
|
5630
|
+
useEffect as useEffect16,
|
|
4569
5631
|
useMemo as useMemo7,
|
|
4570
|
-
useRef as
|
|
4571
|
-
useState as
|
|
5632
|
+
useRef as useRef12,
|
|
5633
|
+
useState as useState23
|
|
4572
5634
|
} from "react";
|
|
4573
5635
|
|
|
4574
5636
|
// src/components/Chat/AssistantContext.tsx
|
|
4575
5637
|
import {
|
|
4576
5638
|
createContext as createContext5,
|
|
4577
|
-
useCallback as
|
|
5639
|
+
useCallback as useCallback11,
|
|
4578
5640
|
useContext as useContext5,
|
|
4579
|
-
useEffect as
|
|
5641
|
+
useEffect as useEffect15,
|
|
4580
5642
|
useMemo as useMemo6,
|
|
4581
|
-
useRef as
|
|
4582
|
-
useState as
|
|
5643
|
+
useRef as useRef11,
|
|
5644
|
+
useState as useState22
|
|
4583
5645
|
} from "react";
|
|
4584
5646
|
import {
|
|
4585
5647
|
Client as Client2
|
|
@@ -4588,11 +5650,11 @@ import {
|
|
|
4588
5650
|
// src/components/Chat/LatticeChatShellContext.tsx
|
|
4589
5651
|
import {
|
|
4590
5652
|
createContext as createContext4,
|
|
4591
|
-
useCallback as
|
|
5653
|
+
useCallback as useCallback10,
|
|
4592
5654
|
useContext as useContext4,
|
|
4593
|
-
useState as
|
|
5655
|
+
useState as useState21
|
|
4594
5656
|
} from "react";
|
|
4595
|
-
import { jsx as
|
|
5657
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
4596
5658
|
var DEFAULT_CONFIG = {
|
|
4597
5659
|
baseURL: "http://localhost:4001",
|
|
4598
5660
|
apiKey: "",
|
|
@@ -4618,7 +5680,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4618
5680
|
persistToLocalStorage = false,
|
|
4619
5681
|
localStorageKey = "lattice_chat_shell_config"
|
|
4620
5682
|
}) => {
|
|
4621
|
-
const loadInitialConfig =
|
|
5683
|
+
const loadInitialConfig = useCallback10(() => {
|
|
4622
5684
|
if (persistToLocalStorage && typeof window !== "undefined") {
|
|
4623
5685
|
try {
|
|
4624
5686
|
const stored = localStorage.getItem(localStorageKey);
|
|
@@ -4632,9 +5694,9 @@ var LatticeChatShellContextProvider = ({
|
|
|
4632
5694
|
}
|
|
4633
5695
|
return { ...DEFAULT_CONFIG, ...initialConfig };
|
|
4634
5696
|
}, [persistToLocalStorage, localStorageKey, initialConfig]);
|
|
4635
|
-
const [config, setConfig] =
|
|
4636
|
-
const [settingsModalOpen, setSettingsModalOpen] =
|
|
4637
|
-
const saveToLocalStorage =
|
|
5697
|
+
const [config, setConfig] = useState21(loadInitialConfig);
|
|
5698
|
+
const [settingsModalOpen, setSettingsModalOpen] = useState21(false);
|
|
5699
|
+
const saveToLocalStorage = useCallback10(
|
|
4638
5700
|
(newConfig) => {
|
|
4639
5701
|
if (persistToLocalStorage && typeof window !== "undefined") {
|
|
4640
5702
|
try {
|
|
@@ -4646,7 +5708,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4646
5708
|
},
|
|
4647
5709
|
[persistToLocalStorage, localStorageKey]
|
|
4648
5710
|
);
|
|
4649
|
-
const updateConfig =
|
|
5711
|
+
const updateConfig = useCallback10(
|
|
4650
5712
|
(updates) => {
|
|
4651
5713
|
setConfig((prev) => {
|
|
4652
5714
|
const newConfig = { ...prev, ...updates };
|
|
@@ -4656,7 +5718,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4656
5718
|
},
|
|
4657
5719
|
[saveToLocalStorage]
|
|
4658
5720
|
);
|
|
4659
|
-
const updateConfigValue =
|
|
5721
|
+
const updateConfigValue = useCallback10(
|
|
4660
5722
|
(key, value) => {
|
|
4661
5723
|
setConfig((prev) => {
|
|
4662
5724
|
const newConfig = { ...prev, [key]: value };
|
|
@@ -4666,12 +5728,12 @@ var LatticeChatShellContextProvider = ({
|
|
|
4666
5728
|
},
|
|
4667
5729
|
[saveToLocalStorage]
|
|
4668
5730
|
);
|
|
4669
|
-
const resetConfig =
|
|
5731
|
+
const resetConfig = useCallback10(() => {
|
|
4670
5732
|
const defaultConfig = { ...DEFAULT_CONFIG, ...initialConfig };
|
|
4671
5733
|
setConfig(defaultConfig);
|
|
4672
5734
|
saveToLocalStorage(defaultConfig);
|
|
4673
5735
|
}, [initialConfig, saveToLocalStorage]);
|
|
4674
|
-
return /* @__PURE__ */
|
|
5736
|
+
return /* @__PURE__ */ jsx38(
|
|
4675
5737
|
LatticeChatShellContext.Provider,
|
|
4676
5738
|
{
|
|
4677
5739
|
value: {
|
|
@@ -4697,7 +5759,7 @@ var useLatticeChatShellContext = () => {
|
|
|
4697
5759
|
};
|
|
4698
5760
|
|
|
4699
5761
|
// src/components/Chat/AssistantContext.tsx
|
|
4700
|
-
import { jsx as
|
|
5762
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
4701
5763
|
var AssistantContext = createContext5({
|
|
4702
5764
|
assistants: [],
|
|
4703
5765
|
currentAssistant: null,
|
|
@@ -4740,17 +5802,17 @@ var AssistantContextProvider = ({
|
|
|
4740
5802
|
}),
|
|
4741
5803
|
[baseURL, apiKey, transport]
|
|
4742
5804
|
);
|
|
4743
|
-
const [state, setState] =
|
|
5805
|
+
const [state, setState] = useState22({
|
|
4744
5806
|
assistants: [],
|
|
4745
5807
|
currentAssistant: null,
|
|
4746
5808
|
isLoading: false,
|
|
4747
5809
|
error: null
|
|
4748
5810
|
});
|
|
4749
|
-
const assistantsRef =
|
|
4750
|
-
|
|
5811
|
+
const assistantsRef = useRef11([]);
|
|
5812
|
+
useEffect15(() => {
|
|
4751
5813
|
assistantsRef.current = state.assistants;
|
|
4752
5814
|
}, [state.assistants]);
|
|
4753
|
-
const listAssistants =
|
|
5815
|
+
const listAssistants = useCallback11(async () => {
|
|
4754
5816
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4755
5817
|
try {
|
|
4756
5818
|
const assistants = await client.assistants.list();
|
|
@@ -4767,7 +5829,7 @@ var AssistantContextProvider = ({
|
|
|
4767
5829
|
}));
|
|
4768
5830
|
}
|
|
4769
5831
|
}, [client]);
|
|
4770
|
-
const getAssistant =
|
|
5832
|
+
const getAssistant = useCallback11(
|
|
4771
5833
|
async (id) => {
|
|
4772
5834
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4773
5835
|
try {
|
|
@@ -4790,7 +5852,7 @@ var AssistantContextProvider = ({
|
|
|
4790
5852
|
},
|
|
4791
5853
|
[client]
|
|
4792
5854
|
);
|
|
4793
|
-
const createAssistant =
|
|
5855
|
+
const createAssistant = useCallback11(
|
|
4794
5856
|
async (options) => {
|
|
4795
5857
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4796
5858
|
try {
|
|
@@ -4812,7 +5874,7 @@ var AssistantContextProvider = ({
|
|
|
4812
5874
|
},
|
|
4813
5875
|
[client]
|
|
4814
5876
|
);
|
|
4815
|
-
const updateAssistant =
|
|
5877
|
+
const updateAssistant = useCallback11(
|
|
4816
5878
|
async (id, options) => {
|
|
4817
5879
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4818
5880
|
try {
|
|
@@ -4837,7 +5899,7 @@ var AssistantContextProvider = ({
|
|
|
4837
5899
|
},
|
|
4838
5900
|
[client]
|
|
4839
5901
|
);
|
|
4840
|
-
const deleteAssistant =
|
|
5902
|
+
const deleteAssistant = useCallback11(
|
|
4841
5903
|
async (id) => {
|
|
4842
5904
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4843
5905
|
try {
|
|
@@ -4859,7 +5921,7 @@ var AssistantContextProvider = ({
|
|
|
4859
5921
|
},
|
|
4860
5922
|
[client]
|
|
4861
5923
|
);
|
|
4862
|
-
const selectAssistant =
|
|
5924
|
+
const selectAssistant = useCallback11(
|
|
4863
5925
|
async (id) => {
|
|
4864
5926
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4865
5927
|
try {
|
|
@@ -4890,21 +5952,21 @@ var AssistantContextProvider = ({
|
|
|
4890
5952
|
},
|
|
4891
5953
|
[client]
|
|
4892
5954
|
);
|
|
4893
|
-
const clearCurrentAssistant =
|
|
5955
|
+
const clearCurrentAssistant = useCallback11(() => {
|
|
4894
5956
|
setState((prev) => ({
|
|
4895
5957
|
...prev,
|
|
4896
5958
|
currentAssistant: null
|
|
4897
5959
|
}));
|
|
4898
5960
|
}, []);
|
|
4899
|
-
const refresh =
|
|
5961
|
+
const refresh = useCallback11(async () => {
|
|
4900
5962
|
await listAssistants();
|
|
4901
5963
|
}, [listAssistants]);
|
|
4902
|
-
|
|
5964
|
+
useEffect15(() => {
|
|
4903
5965
|
if (autoLoad) {
|
|
4904
5966
|
listAssistants();
|
|
4905
5967
|
}
|
|
4906
5968
|
}, [autoLoad, listAssistants]);
|
|
4907
|
-
|
|
5969
|
+
useEffect15(() => {
|
|
4908
5970
|
if (state.assistants.length > 0) {
|
|
4909
5971
|
const isCurrentAssistantValid = state.currentAssistant && state.assistants.some((a) => a.id === state.currentAssistant?.id);
|
|
4910
5972
|
if (!isCurrentAssistantValid) {
|
|
@@ -4932,7 +5994,7 @@ var AssistantContextProvider = ({
|
|
|
4932
5994
|
}
|
|
4933
5995
|
}
|
|
4934
5996
|
}, [initialAssistantId, state.assistants, state.currentAssistant]);
|
|
4935
|
-
return /* @__PURE__ */
|
|
5997
|
+
return /* @__PURE__ */ jsx39(
|
|
4936
5998
|
AssistantContext.Provider,
|
|
4937
5999
|
{
|
|
4938
6000
|
value: {
|
|
@@ -4962,7 +6024,7 @@ var useAssistantContext = () => {
|
|
|
4962
6024
|
|
|
4963
6025
|
// src/components/Chat/ConversationContext.tsx
|
|
4964
6026
|
import { Client as Client3 } from "@axiom-lattice/client-sdk";
|
|
4965
|
-
import { jsx as
|
|
6027
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
4966
6028
|
var ConversationContext = createContext6({
|
|
4967
6029
|
assistantId: null,
|
|
4968
6030
|
thread: null,
|
|
@@ -5014,18 +6076,18 @@ var ConversationContextProvider = ({
|
|
|
5014
6076
|
}),
|
|
5015
6077
|
[baseURL, apiKey, assistantId, transport]
|
|
5016
6078
|
);
|
|
5017
|
-
const [threads, setThreads] =
|
|
5018
|
-
const [threadId, setThreadId] =
|
|
5019
|
-
const [isLoading, setIsLoading] =
|
|
5020
|
-
const [error, setError] =
|
|
5021
|
-
const loadedAssistantIdRef =
|
|
5022
|
-
const prevAssistantIdRef =
|
|
5023
|
-
const isLoadingRef =
|
|
5024
|
-
const clientRef =
|
|
5025
|
-
|
|
6079
|
+
const [threads, setThreads] = useState23([]);
|
|
6080
|
+
const [threadId, setThreadId] = useState23(null);
|
|
6081
|
+
const [isLoading, setIsLoading] = useState23(false);
|
|
6082
|
+
const [error, setError] = useState23(null);
|
|
6083
|
+
const loadedAssistantIdRef = useRef12(null);
|
|
6084
|
+
const prevAssistantIdRef = useRef12(null);
|
|
6085
|
+
const isLoadingRef = useRef12(false);
|
|
6086
|
+
const clientRef = useRef12(client);
|
|
6087
|
+
useEffect16(() => {
|
|
5026
6088
|
clientRef.current = client;
|
|
5027
6089
|
}, [client]);
|
|
5028
|
-
const loadThreads =
|
|
6090
|
+
const loadThreads = useCallback12(async () => {
|
|
5029
6091
|
const currentClient = clientRef.current;
|
|
5030
6092
|
if (!assistantId || !currentClient.assistantId) {
|
|
5031
6093
|
setThreads([]);
|
|
@@ -5084,7 +6146,7 @@ var ConversationContextProvider = ({
|
|
|
5084
6146
|
isLoadingRef.current = false;
|
|
5085
6147
|
}
|
|
5086
6148
|
}, [assistantId]);
|
|
5087
|
-
|
|
6149
|
+
useEffect16(() => {
|
|
5088
6150
|
const currentClient = clientRef.current;
|
|
5089
6151
|
const prevAssistantId = prevAssistantIdRef.current;
|
|
5090
6152
|
const assistantChanged = prevAssistantId !== assistantId;
|
|
@@ -5109,14 +6171,14 @@ var ConversationContextProvider = ({
|
|
|
5109
6171
|
}
|
|
5110
6172
|
return threads.find((t) => t.id === threadId) || null;
|
|
5111
6173
|
}, [assistantId, threadId, threads]);
|
|
5112
|
-
const setThread =
|
|
6174
|
+
const setThread = useCallback12((newThread) => {
|
|
5113
6175
|
if (newThread) {
|
|
5114
6176
|
setThreadId(newThread.id);
|
|
5115
6177
|
} else {
|
|
5116
6178
|
setThreadId(null);
|
|
5117
6179
|
}
|
|
5118
6180
|
}, []);
|
|
5119
|
-
const selectThread =
|
|
6181
|
+
const selectThread = useCallback12(
|
|
5120
6182
|
(targetThreadId) => {
|
|
5121
6183
|
const foundThread = threads.find((t) => t.id === targetThreadId);
|
|
5122
6184
|
if (foundThread) {
|
|
@@ -5125,7 +6187,7 @@ var ConversationContextProvider = ({
|
|
|
5125
6187
|
},
|
|
5126
6188
|
[threads]
|
|
5127
6189
|
);
|
|
5128
|
-
const createThread =
|
|
6190
|
+
const createThread = useCallback12(
|
|
5129
6191
|
async (label) => {
|
|
5130
6192
|
if (!assistantId || !client.assistantId) {
|
|
5131
6193
|
throw new Error("No assistant selected");
|
|
@@ -5150,7 +6212,7 @@ var ConversationContextProvider = ({
|
|
|
5150
6212
|
},
|
|
5151
6213
|
[assistantId, client, loadThreads]
|
|
5152
6214
|
);
|
|
5153
|
-
const listThreads =
|
|
6215
|
+
const listThreads = useCallback12(async () => {
|
|
5154
6216
|
if (!assistantId || !client.assistantId) {
|
|
5155
6217
|
return [];
|
|
5156
6218
|
}
|
|
@@ -5171,7 +6233,7 @@ var ConversationContextProvider = ({
|
|
|
5171
6233
|
setIsLoading(false);
|
|
5172
6234
|
}
|
|
5173
6235
|
}, [assistantId, client, threads]);
|
|
5174
|
-
const updateThread =
|
|
6236
|
+
const updateThread = useCallback12(
|
|
5175
6237
|
async (newThread) => {
|
|
5176
6238
|
if (!assistantId || !client.assistantId) {
|
|
5177
6239
|
throw new Error("No assistant selected");
|
|
@@ -5193,13 +6255,13 @@ var ConversationContextProvider = ({
|
|
|
5193
6255
|
},
|
|
5194
6256
|
[assistantId, client, loadThreads]
|
|
5195
6257
|
);
|
|
5196
|
-
const getThreadById =
|
|
6258
|
+
const getThreadById = useCallback12(
|
|
5197
6259
|
(targetThreadId) => {
|
|
5198
6260
|
return threads.find((t) => t.id === targetThreadId) || null;
|
|
5199
6261
|
},
|
|
5200
6262
|
[threads]
|
|
5201
6263
|
);
|
|
5202
|
-
const deleteThread =
|
|
6264
|
+
const deleteThread = useCallback12(
|
|
5203
6265
|
async (targetThreadId) => {
|
|
5204
6266
|
if (!assistantId || !client.assistantId) {
|
|
5205
6267
|
throw new Error("No assistant selected");
|
|
@@ -5222,10 +6284,10 @@ var ConversationContextProvider = ({
|
|
|
5222
6284
|
},
|
|
5223
6285
|
[threadId, assistantId, client, loadThreads]
|
|
5224
6286
|
);
|
|
5225
|
-
const clearThread =
|
|
6287
|
+
const clearThread = useCallback12(() => {
|
|
5226
6288
|
setThreadId(null);
|
|
5227
6289
|
}, []);
|
|
5228
|
-
return /* @__PURE__ */
|
|
6290
|
+
return /* @__PURE__ */ jsx40(
|
|
5229
6291
|
ConversationContext.Provider,
|
|
5230
6292
|
{
|
|
5231
6293
|
value: {
|
|
@@ -5263,7 +6325,7 @@ var useConversationContext = () => {
|
|
|
5263
6325
|
import { Conversations } from "@ant-design/x";
|
|
5264
6326
|
import { theme } from "antd";
|
|
5265
6327
|
import { useMemo as useMemo8 } from "react";
|
|
5266
|
-
import { jsx as
|
|
6328
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
5267
6329
|
var AgentConversations = () => {
|
|
5268
6330
|
const { token } = theme.useToken();
|
|
5269
6331
|
const { currentAssistant } = useAssistantContext();
|
|
@@ -5293,7 +6355,7 @@ var AgentConversations = () => {
|
|
|
5293
6355
|
}
|
|
5294
6356
|
await createThread();
|
|
5295
6357
|
};
|
|
5296
|
-
return /* @__PURE__ */
|
|
6358
|
+
return /* @__PURE__ */ jsx41(
|
|
5297
6359
|
Conversations,
|
|
5298
6360
|
{
|
|
5299
6361
|
creation: {
|
|
@@ -5311,8 +6373,8 @@ var AgentConversations = () => {
|
|
|
5311
6373
|
};
|
|
5312
6374
|
|
|
5313
6375
|
// src/components/Chat/ChatSidebar.tsx
|
|
5314
|
-
import { useState as
|
|
5315
|
-
import { Divider as Divider2, Tooltip as
|
|
6376
|
+
import { useState as useState24, useEffect as useEffect17, useRef as useRef13 } from "react";
|
|
6377
|
+
import { Divider as Divider2, Tooltip as Tooltip6 } from "antd";
|
|
5316
6378
|
import {
|
|
5317
6379
|
MenuFoldOutlined,
|
|
5318
6380
|
MenuUnfoldOutlined,
|
|
@@ -5322,7 +6384,7 @@ import {
|
|
|
5322
6384
|
// src/components/Chat/AssistantList.tsx
|
|
5323
6385
|
import { Conversations as Conversations2 } from "@ant-design/x";
|
|
5324
6386
|
import { Avatar as Avatar4, theme as theme2 } from "antd";
|
|
5325
|
-
import { jsx as
|
|
6387
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
5326
6388
|
var AssistantList = () => {
|
|
5327
6389
|
const { token } = theme2.useToken();
|
|
5328
6390
|
const { assistants, selectAssistant, currentAssistant } = useAssistantContext();
|
|
@@ -5334,7 +6396,7 @@ var AssistantList = () => {
|
|
|
5334
6396
|
const items = assistants.map((assistant) => ({
|
|
5335
6397
|
key: assistant.id,
|
|
5336
6398
|
label: assistant.name,
|
|
5337
|
-
icon: /* @__PURE__ */
|
|
6399
|
+
icon: /* @__PURE__ */ jsx42(
|
|
5338
6400
|
Avatar4,
|
|
5339
6401
|
{
|
|
5340
6402
|
size: "small",
|
|
@@ -5346,7 +6408,7 @@ var AssistantList = () => {
|
|
|
5346
6408
|
}
|
|
5347
6409
|
)
|
|
5348
6410
|
}));
|
|
5349
|
-
return /* @__PURE__ */
|
|
6411
|
+
return /* @__PURE__ */ jsx42(
|
|
5350
6412
|
Conversations2,
|
|
5351
6413
|
{
|
|
5352
6414
|
items,
|
|
@@ -5360,9 +6422,9 @@ var AssistantList = () => {
|
|
|
5360
6422
|
};
|
|
5361
6423
|
|
|
5362
6424
|
// src/components/Chat/ChatSidebar.tsx
|
|
5363
|
-
import { createStyles as
|
|
5364
|
-
import { Fragment as Fragment5, jsx as
|
|
5365
|
-
var
|
|
6425
|
+
import { createStyles as createStyles12 } from "antd-style";
|
|
6426
|
+
import { Fragment as Fragment5, jsx as jsx43, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6427
|
+
var useStyles4 = createStyles12(({ token, css }) => ({
|
|
5366
6428
|
sidebar: css`
|
|
5367
6429
|
display: flex;
|
|
5368
6430
|
flex-direction: column;
|
|
@@ -5567,12 +6629,12 @@ var ChatSidebar = ({
|
|
|
5567
6629
|
onSettingsClick,
|
|
5568
6630
|
defaultCollapsed = false
|
|
5569
6631
|
}) => {
|
|
5570
|
-
const { styles } =
|
|
6632
|
+
const { styles } = useStyles4();
|
|
5571
6633
|
const { setMenuCollapsed, menuCollapsed, sideAppVisible } = useChatUIContext();
|
|
5572
6634
|
const { setSettingsModalOpen } = useLatticeChatShellContext();
|
|
5573
|
-
const [isHovered, setIsHovered] =
|
|
5574
|
-
const [isFirstCollapse, setIsFirstCollapse] =
|
|
5575
|
-
const prevIsCollapsedRef =
|
|
6635
|
+
const [isHovered, setIsHovered] = useState24(false);
|
|
6636
|
+
const [isFirstCollapse, setIsFirstCollapse] = useState24(false);
|
|
6637
|
+
const prevIsCollapsedRef = useRef13(false);
|
|
5576
6638
|
const handleToggleCollapse = () => {
|
|
5577
6639
|
setMenuCollapsed(!menuCollapsed);
|
|
5578
6640
|
};
|
|
@@ -5581,7 +6643,7 @@ var ChatSidebar = ({
|
|
|
5581
6643
|
onSettingsClick?.();
|
|
5582
6644
|
};
|
|
5583
6645
|
const isCollapsed = menuCollapsed || sideAppVisible;
|
|
5584
|
-
|
|
6646
|
+
useEffect17(() => {
|
|
5585
6647
|
const prevIsCollapsed = prevIsCollapsedRef.current;
|
|
5586
6648
|
if (isCollapsed) {
|
|
5587
6649
|
const hasSeenFirstCollapse = localStorage.getItem(FIRST_COLLAPSE_KEY);
|
|
@@ -5610,54 +6672,54 @@ var ChatSidebar = ({
|
|
|
5610
6672
|
const handleMouseLeave = () => {
|
|
5611
6673
|
setIsHovered(false);
|
|
5612
6674
|
};
|
|
5613
|
-
return /* @__PURE__ */
|
|
5614
|
-
/* @__PURE__ */
|
|
6675
|
+
return /* @__PURE__ */ jsxs23(Fragment5, { children: [
|
|
6676
|
+
/* @__PURE__ */ jsxs23(
|
|
5615
6677
|
"div",
|
|
5616
6678
|
{
|
|
5617
6679
|
className: `${styles.sidebar} ${isFirstCollapse ? "firstTimeHighlight" : ""}`,
|
|
5618
6680
|
onMouseEnter: handleMouseEnter,
|
|
5619
6681
|
onMouseLeave: handleMouseLeave,
|
|
5620
6682
|
children: [
|
|
5621
|
-
/* @__PURE__ */
|
|
5622
|
-
|
|
6683
|
+
/* @__PURE__ */ jsx43(
|
|
6684
|
+
Tooltip6,
|
|
5623
6685
|
{
|
|
5624
6686
|
title: "Move the mouse over the collapsed sidebar to see the assistants and threads",
|
|
5625
6687
|
open: isFirstCollapse,
|
|
5626
6688
|
placement: "right",
|
|
5627
|
-
children: isFirstCollapse && /* @__PURE__ */
|
|
6689
|
+
children: isFirstCollapse && /* @__PURE__ */ jsx43("div", { style: { marginTop: "400px" } })
|
|
5628
6690
|
}
|
|
5629
6691
|
),
|
|
5630
|
-
!isCollapsed && /* @__PURE__ */
|
|
5631
|
-
/* @__PURE__ */
|
|
5632
|
-
/* @__PURE__ */
|
|
5633
|
-
/* @__PURE__ */
|
|
5634
|
-
/* @__PURE__ */
|
|
6692
|
+
!isCollapsed && /* @__PURE__ */ jsxs23(Fragment5, { children: [
|
|
6693
|
+
/* @__PURE__ */ jsxs23("div", { className: styles.content, children: [
|
|
6694
|
+
/* @__PURE__ */ jsxs23("div", { className: styles.section, children: [
|
|
6695
|
+
/* @__PURE__ */ jsx43("div", { className: styles.sectionTitle, children: "Assistants" }),
|
|
6696
|
+
/* @__PURE__ */ jsx43(AssistantList, {})
|
|
5635
6697
|
] }),
|
|
5636
|
-
/* @__PURE__ */
|
|
5637
|
-
/* @__PURE__ */
|
|
5638
|
-
/* @__PURE__ */
|
|
5639
|
-
/* @__PURE__ */
|
|
6698
|
+
/* @__PURE__ */ jsx43(Divider2, { className: styles.divider }),
|
|
6699
|
+
/* @__PURE__ */ jsxs23("div", { className: styles.section, children: [
|
|
6700
|
+
/* @__PURE__ */ jsx43("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
6701
|
+
/* @__PURE__ */ jsx43(AgentConversations, {})
|
|
5640
6702
|
] })
|
|
5641
6703
|
] }),
|
|
5642
|
-
/* @__PURE__ */
|
|
5643
|
-
/* @__PURE__ */
|
|
6704
|
+
/* @__PURE__ */ jsxs23("div", { className: styles.footer, children: [
|
|
6705
|
+
/* @__PURE__ */ jsx43(
|
|
5644
6706
|
"button",
|
|
5645
6707
|
{
|
|
5646
6708
|
className: styles.actionButton,
|
|
5647
6709
|
onClick: handleToggleCollapse,
|
|
5648
6710
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5649
6711
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5650
|
-
children: isCollapsed ? /* @__PURE__ */
|
|
6712
|
+
children: isCollapsed ? /* @__PURE__ */ jsx43(MenuUnfoldOutlined, {}) : /* @__PURE__ */ jsx43(MenuFoldOutlined, {})
|
|
5651
6713
|
}
|
|
5652
6714
|
),
|
|
5653
|
-
/* @__PURE__ */
|
|
6715
|
+
/* @__PURE__ */ jsx43(
|
|
5654
6716
|
"button",
|
|
5655
6717
|
{
|
|
5656
6718
|
className: styles.actionButton,
|
|
5657
6719
|
onClick: handleSettingsClick,
|
|
5658
6720
|
title: "Settings",
|
|
5659
6721
|
"aria-label": "Settings",
|
|
5660
|
-
children: /* @__PURE__ */
|
|
6722
|
+
children: /* @__PURE__ */ jsx43(SettingOutlined, {})
|
|
5661
6723
|
}
|
|
5662
6724
|
)
|
|
5663
6725
|
] })
|
|
@@ -5665,43 +6727,43 @@ var ChatSidebar = ({
|
|
|
5665
6727
|
]
|
|
5666
6728
|
}
|
|
5667
6729
|
),
|
|
5668
|
-
isCollapsed && /* @__PURE__ */
|
|
6730
|
+
isCollapsed && /* @__PURE__ */ jsxs23(
|
|
5669
6731
|
"div",
|
|
5670
6732
|
{
|
|
5671
6733
|
className: `${styles.hoverOverlay} ${isHovered ? "visible" : ""}`,
|
|
5672
6734
|
onMouseEnter: handleMouseEnter,
|
|
5673
6735
|
onMouseLeave: handleMouseLeave,
|
|
5674
6736
|
children: [
|
|
5675
|
-
/* @__PURE__ */
|
|
5676
|
-
/* @__PURE__ */
|
|
5677
|
-
/* @__PURE__ */
|
|
5678
|
-
/* @__PURE__ */
|
|
6737
|
+
/* @__PURE__ */ jsxs23("div", { className: styles.hoverContent, children: [
|
|
6738
|
+
/* @__PURE__ */ jsxs23("div", { className: styles.section, children: [
|
|
6739
|
+
/* @__PURE__ */ jsx43("div", { className: styles.sectionTitle, children: "Assistants" }),
|
|
6740
|
+
/* @__PURE__ */ jsx43(AssistantList, {})
|
|
5679
6741
|
] }),
|
|
5680
|
-
/* @__PURE__ */
|
|
5681
|
-
/* @__PURE__ */
|
|
5682
|
-
/* @__PURE__ */
|
|
5683
|
-
/* @__PURE__ */
|
|
6742
|
+
/* @__PURE__ */ jsx43(Divider2, { className: styles.divider }),
|
|
6743
|
+
/* @__PURE__ */ jsxs23("div", { className: styles.section, children: [
|
|
6744
|
+
/* @__PURE__ */ jsx43("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
6745
|
+
/* @__PURE__ */ jsx43(AgentConversations, {})
|
|
5684
6746
|
] })
|
|
5685
6747
|
] }),
|
|
5686
|
-
/* @__PURE__ */
|
|
5687
|
-
/* @__PURE__ */
|
|
6748
|
+
/* @__PURE__ */ jsxs23("div", { className: styles.footer, children: [
|
|
6749
|
+
/* @__PURE__ */ jsx43(
|
|
5688
6750
|
"button",
|
|
5689
6751
|
{
|
|
5690
6752
|
className: styles.actionButton,
|
|
5691
6753
|
onClick: handleToggleCollapse,
|
|
5692
6754
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5693
6755
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5694
|
-
children: isCollapsed ? /* @__PURE__ */
|
|
6756
|
+
children: isCollapsed ? /* @__PURE__ */ jsx43(MenuUnfoldOutlined, {}) : /* @__PURE__ */ jsx43(MenuFoldOutlined, {})
|
|
5695
6757
|
}
|
|
5696
6758
|
),
|
|
5697
|
-
/* @__PURE__ */
|
|
6759
|
+
/* @__PURE__ */ jsx43(
|
|
5698
6760
|
"button",
|
|
5699
6761
|
{
|
|
5700
6762
|
className: styles.actionButton,
|
|
5701
6763
|
onClick: handleSettingsClick,
|
|
5702
6764
|
title: "Settings",
|
|
5703
6765
|
"aria-label": "Settings",
|
|
5704
|
-
children: /* @__PURE__ */
|
|
6766
|
+
children: /* @__PURE__ */ jsx43(SettingOutlined, {})
|
|
5705
6767
|
}
|
|
5706
6768
|
)
|
|
5707
6769
|
] })
|
|
@@ -5712,14 +6774,14 @@ var ChatSidebar = ({
|
|
|
5712
6774
|
};
|
|
5713
6775
|
|
|
5714
6776
|
// src/components/Chat/LatticeChatView.tsx
|
|
5715
|
-
import { jsx as
|
|
6777
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
5716
6778
|
var LatticeChatView = (props) => {
|
|
5717
6779
|
const { assistantId, thread } = useConversationContext();
|
|
5718
6780
|
const { currentAssistant } = useAssistantContext();
|
|
5719
6781
|
const {
|
|
5720
6782
|
config: { baseURL }
|
|
5721
6783
|
} = useLatticeChatShellContext();
|
|
5722
|
-
return assistantId && thread ? /* @__PURE__ */
|
|
6784
|
+
return assistantId && thread ? /* @__PURE__ */ jsx44(
|
|
5723
6785
|
AxiomLatticeProvider,
|
|
5724
6786
|
{
|
|
5725
6787
|
config: {
|
|
@@ -5728,14 +6790,14 @@ var LatticeChatView = (props) => {
|
|
|
5728
6790
|
assistantId,
|
|
5729
6791
|
transport: "sse"
|
|
5730
6792
|
},
|
|
5731
|
-
children: /* @__PURE__ */
|
|
6793
|
+
children: /* @__PURE__ */ jsx44(
|
|
5732
6794
|
LatticeChat,
|
|
5733
6795
|
{
|
|
5734
6796
|
thread_id: thread?.id,
|
|
5735
6797
|
assistant_id: assistantId,
|
|
5736
6798
|
name: currentAssistant?.name,
|
|
5737
6799
|
description: currentAssistant?.description,
|
|
5738
|
-
menu: /* @__PURE__ */
|
|
6800
|
+
menu: /* @__PURE__ */ jsx44(ChatSidebar, {})
|
|
5739
6801
|
}
|
|
5740
6802
|
)
|
|
5741
6803
|
}
|
|
@@ -5743,24 +6805,24 @@ var LatticeChatView = (props) => {
|
|
|
5743
6805
|
};
|
|
5744
6806
|
|
|
5745
6807
|
// src/components/Chat/SettingsModal.tsx
|
|
5746
|
-
import { useState as
|
|
6808
|
+
import { useState as useState25, useEffect as useEffect18, useRef as useRef14 } from "react";
|
|
5747
6809
|
import {
|
|
5748
6810
|
Modal,
|
|
5749
6811
|
Input,
|
|
5750
|
-
Button as
|
|
5751
|
-
message as
|
|
5752
|
-
Typography as
|
|
5753
|
-
Alert as
|
|
6812
|
+
Button as Button16,
|
|
6813
|
+
message as message5,
|
|
6814
|
+
Typography as Typography16,
|
|
6815
|
+
Alert as Alert4,
|
|
5754
6816
|
Select,
|
|
5755
6817
|
Switch,
|
|
5756
|
-
Space as
|
|
6818
|
+
Space as Space15,
|
|
5757
6819
|
Tabs as Tabs2
|
|
5758
6820
|
} from "antd";
|
|
5759
6821
|
import {
|
|
5760
6822
|
SaveOutlined,
|
|
5761
6823
|
EnvironmentOutlined,
|
|
5762
|
-
ReloadOutlined as
|
|
5763
|
-
CheckCircleOutlined as
|
|
6824
|
+
ReloadOutlined as ReloadOutlined3,
|
|
6825
|
+
CheckCircleOutlined as CheckCircleOutlined5,
|
|
5764
6826
|
ApiOutlined,
|
|
5765
6827
|
LinkOutlined,
|
|
5766
6828
|
CheckCircleFilled,
|
|
@@ -5768,11 +6830,11 @@ import {
|
|
|
5768
6830
|
PlusOutlined,
|
|
5769
6831
|
CloudServerOutlined
|
|
5770
6832
|
} from "@ant-design/icons";
|
|
5771
|
-
import { createStyles as
|
|
5772
|
-
import { Fragment as Fragment6, jsx as
|
|
5773
|
-
var { Text:
|
|
6833
|
+
import { createStyles as createStyles13 } from "antd-style";
|
|
6834
|
+
import { Fragment as Fragment6, jsx as jsx45, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6835
|
+
var { Text: Text14, Title: Title3 } = Typography16;
|
|
5774
6836
|
var { TextArea } = Input;
|
|
5775
|
-
var
|
|
6837
|
+
var useStyles5 = createStyles13(({ token, css }) => ({
|
|
5776
6838
|
// settingsModal: css`
|
|
5777
6839
|
// .ant-modal {
|
|
5778
6840
|
// max-width: 100vw !important;
|
|
@@ -6118,21 +7180,21 @@ var SETTINGS_MENU_ITEMS = [
|
|
|
6118
7180
|
{
|
|
6119
7181
|
key: "environment",
|
|
6120
7182
|
label: "Environment Variables",
|
|
6121
|
-
icon: /* @__PURE__ */
|
|
7183
|
+
icon: /* @__PURE__ */ jsx45(EnvironmentOutlined, {})
|
|
6122
7184
|
},
|
|
6123
7185
|
{
|
|
6124
7186
|
key: "models",
|
|
6125
7187
|
label: "Model Configuration",
|
|
6126
|
-
icon: /* @__PURE__ */
|
|
7188
|
+
icon: /* @__PURE__ */ jsx45(ApiOutlined, {})
|
|
6127
7189
|
}
|
|
6128
7190
|
];
|
|
6129
7191
|
var SettingsModal = ({
|
|
6130
7192
|
open,
|
|
6131
7193
|
onClose
|
|
6132
7194
|
}) => {
|
|
6133
|
-
const { styles } =
|
|
7195
|
+
const { styles } = useStyles5();
|
|
6134
7196
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
6135
|
-
const [connections, setConnections] =
|
|
7197
|
+
const [connections, setConnections] = useState25(() => {
|
|
6136
7198
|
if (typeof window !== "undefined") {
|
|
6137
7199
|
try {
|
|
6138
7200
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -6155,21 +7217,21 @@ var SettingsModal = ({
|
|
|
6155
7217
|
}
|
|
6156
7218
|
return [];
|
|
6157
7219
|
});
|
|
6158
|
-
const [serverConfigs, setServerConfigs] =
|
|
6159
|
-
const connectionsRef =
|
|
6160
|
-
|
|
7220
|
+
const [serverConfigs, setServerConfigs] = useState25({});
|
|
7221
|
+
const connectionsRef = useRef14(connections);
|
|
7222
|
+
useEffect18(() => {
|
|
6161
7223
|
connectionsRef.current = connections;
|
|
6162
7224
|
}, [connections]);
|
|
6163
|
-
const [activeTabKey, setActiveTabKey] =
|
|
7225
|
+
const [activeTabKey, setActiveTabKey] = useState25(
|
|
6164
7226
|
connections.length > 0 ? connections[0].id : ""
|
|
6165
7227
|
);
|
|
6166
|
-
const [activeMenu, setActiveMenu] =
|
|
6167
|
-
const [loading, setLoading] =
|
|
6168
|
-
const [showAddServerModal, setShowAddServerModal] =
|
|
6169
|
-
const [newServerUrl, setNewServerUrl] =
|
|
6170
|
-
const [newServerName, setNewServerName] =
|
|
6171
|
-
const [newServerApiKey, setNewServerApiKey] =
|
|
6172
|
-
const [addingServer, setAddingServer] =
|
|
7228
|
+
const [activeMenu, setActiveMenu] = useState25("environment");
|
|
7229
|
+
const [loading, setLoading] = useState25(false);
|
|
7230
|
+
const [showAddServerModal, setShowAddServerModal] = useState25(false);
|
|
7231
|
+
const [newServerUrl, setNewServerUrl] = useState25("");
|
|
7232
|
+
const [newServerName, setNewServerName] = useState25("");
|
|
7233
|
+
const [newServerApiKey, setNewServerApiKey] = useState25("");
|
|
7234
|
+
const [addingServer, setAddingServer] = useState25(false);
|
|
6173
7235
|
const saveConnections = (newConnections) => {
|
|
6174
7236
|
setConnections(newConnections);
|
|
6175
7237
|
if (typeof window !== "undefined") {
|
|
@@ -6308,7 +7370,7 @@ var SettingsModal = ({
|
|
|
6308
7370
|
}
|
|
6309
7371
|
} catch (error) {
|
|
6310
7372
|
console.error("Failed to load configuration:", error);
|
|
6311
|
-
|
|
7373
|
+
message5.error("Failed to load current configuration");
|
|
6312
7374
|
}
|
|
6313
7375
|
};
|
|
6314
7376
|
const loadModelsConfig = async (serverId) => {
|
|
@@ -6359,7 +7421,7 @@ var SettingsModal = ({
|
|
|
6359
7421
|
console.error("Failed to load models configuration:", error);
|
|
6360
7422
|
}
|
|
6361
7423
|
};
|
|
6362
|
-
|
|
7424
|
+
useEffect18(() => {
|
|
6363
7425
|
if (open && activeTabKey) {
|
|
6364
7426
|
initializeServerConfig(activeTabKey);
|
|
6365
7427
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -6368,7 +7430,7 @@ var SettingsModal = ({
|
|
|
6368
7430
|
}
|
|
6369
7431
|
}
|
|
6370
7432
|
}, [open, activeTabKey]);
|
|
6371
|
-
|
|
7433
|
+
useEffect18(() => {
|
|
6372
7434
|
if (open && activeTabKey) {
|
|
6373
7435
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
6374
7436
|
if (connection?.connected) {
|
|
@@ -6382,7 +7444,7 @@ var SettingsModal = ({
|
|
|
6382
7444
|
}, [open, activeTabKey, activeMenu]);
|
|
6383
7445
|
const handleAddServer = async () => {
|
|
6384
7446
|
if (!newServerUrl.trim()) {
|
|
6385
|
-
|
|
7447
|
+
message5.error("Please enter a server URL");
|
|
6386
7448
|
return;
|
|
6387
7449
|
}
|
|
6388
7450
|
let normalizedUrl = newServerUrl.trim();
|
|
@@ -6408,7 +7470,7 @@ var SettingsModal = ({
|
|
|
6408
7470
|
setNewServerUrl("");
|
|
6409
7471
|
setNewServerName("");
|
|
6410
7472
|
setNewServerApiKey("");
|
|
6411
|
-
|
|
7473
|
+
message5.success("Server added successfully");
|
|
6412
7474
|
};
|
|
6413
7475
|
const handleDeleteServer = (serverId) => {
|
|
6414
7476
|
const newConnections = connections.filter((c) => c.id !== serverId);
|
|
@@ -6425,7 +7487,7 @@ var SettingsModal = ({
|
|
|
6425
7487
|
setActiveTabKey("");
|
|
6426
7488
|
}
|
|
6427
7489
|
}
|
|
6428
|
-
|
|
7490
|
+
message5.success("Server deleted");
|
|
6429
7491
|
};
|
|
6430
7492
|
const handleTabChange = (newTabKey) => {
|
|
6431
7493
|
setConnections(
|
|
@@ -6439,12 +7501,12 @@ var SettingsModal = ({
|
|
|
6439
7501
|
const handleSave = async () => {
|
|
6440
7502
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
6441
7503
|
if (!connection || !connection.connected) {
|
|
6442
|
-
|
|
7504
|
+
message5.error("Please connect to a server first");
|
|
6443
7505
|
return;
|
|
6444
7506
|
}
|
|
6445
7507
|
const url = connection.url;
|
|
6446
7508
|
if (!url) {
|
|
6447
|
-
|
|
7509
|
+
message5.error("Please connect to a server first");
|
|
6448
7510
|
return;
|
|
6449
7511
|
}
|
|
6450
7512
|
try {
|
|
@@ -6508,23 +7570,23 @@ var SettingsModal = ({
|
|
|
6508
7570
|
const data = await response.json();
|
|
6509
7571
|
if (response.ok && data.success) {
|
|
6510
7572
|
if (data.requiresRestart && data.requiresRestart.length > 0) {
|
|
6511
|
-
|
|
7573
|
+
message5.warning(
|
|
6512
7574
|
`Configuration saved. Please restart the server for ${data.requiresRestart.join(
|
|
6513
7575
|
", "
|
|
6514
7576
|
)} to take effect.`,
|
|
6515
7577
|
5
|
|
6516
7578
|
);
|
|
6517
7579
|
} else {
|
|
6518
|
-
|
|
7580
|
+
message5.success("Configuration saved and applied successfully");
|
|
6519
7581
|
}
|
|
6520
7582
|
if (data.warnings && data.warnings.length > 0) {
|
|
6521
7583
|
data.warnings.forEach((warning) => {
|
|
6522
|
-
|
|
7584
|
+
message5.warning(warning, 5);
|
|
6523
7585
|
});
|
|
6524
7586
|
}
|
|
6525
7587
|
onClose();
|
|
6526
7588
|
} else {
|
|
6527
|
-
|
|
7589
|
+
message5.error(data.error || "Failed to save configuration");
|
|
6528
7590
|
}
|
|
6529
7591
|
} else if (activeMenu === "models") {
|
|
6530
7592
|
const validModels = config.models.filter(
|
|
@@ -6543,17 +7605,17 @@ var SettingsModal = ({
|
|
|
6543
7605
|
});
|
|
6544
7606
|
const data = await response.json();
|
|
6545
7607
|
if (response.ok && data.success) {
|
|
6546
|
-
|
|
7608
|
+
message5.success(
|
|
6547
7609
|
"Model configuration saved and registered successfully"
|
|
6548
7610
|
);
|
|
6549
7611
|
onClose();
|
|
6550
7612
|
} else {
|
|
6551
|
-
|
|
7613
|
+
message5.error(data.error || "Failed to save model configuration");
|
|
6552
7614
|
}
|
|
6553
7615
|
}
|
|
6554
7616
|
} catch (error) {
|
|
6555
7617
|
console.error("Failed to save configuration:", error);
|
|
6556
|
-
|
|
7618
|
+
message5.error(error.message || "Failed to save configuration");
|
|
6557
7619
|
} finally {
|
|
6558
7620
|
setLoading(false);
|
|
6559
7621
|
}
|
|
@@ -6569,25 +7631,25 @@ var SettingsModal = ({
|
|
|
6569
7631
|
}
|
|
6570
7632
|
}));
|
|
6571
7633
|
};
|
|
6572
|
-
return /* @__PURE__ */
|
|
6573
|
-
/* @__PURE__ */
|
|
6574
|
-
|
|
7634
|
+
return /* @__PURE__ */ jsxs24("div", { className: styles.formContainer, children: [
|
|
7635
|
+
/* @__PURE__ */ jsx45(
|
|
7636
|
+
Alert4,
|
|
6575
7637
|
{
|
|
6576
7638
|
message: "Configuration Effect",
|
|
6577
|
-
description: /* @__PURE__ */
|
|
6578
|
-
/* @__PURE__ */
|
|
6579
|
-
/* @__PURE__ */
|
|
6580
|
-
|
|
7639
|
+
description: /* @__PURE__ */ jsxs24("div", { children: [
|
|
7640
|
+
/* @__PURE__ */ jsxs24("div", { style: { marginBottom: 8 }, children: [
|
|
7641
|
+
/* @__PURE__ */ jsx45(
|
|
7642
|
+
CheckCircleOutlined5,
|
|
6581
7643
|
{
|
|
6582
7644
|
style: { color: "#52c41a", marginRight: 8 }
|
|
6583
7645
|
}
|
|
6584
7646
|
),
|
|
6585
|
-
/* @__PURE__ */
|
|
7647
|
+
/* @__PURE__ */ jsx45("strong", { children: "Immediately effective:" }),
|
|
6586
7648
|
" QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
|
|
6587
7649
|
] }),
|
|
6588
|
-
/* @__PURE__ */
|
|
6589
|
-
/* @__PURE__ */
|
|
6590
|
-
/* @__PURE__ */
|
|
7650
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
7651
|
+
/* @__PURE__ */ jsx45(ReloadOutlined3, { style: { color: "#faad14", marginRight: 8 } }),
|
|
7652
|
+
/* @__PURE__ */ jsx45("strong", { children: "Requires restart:" }),
|
|
6591
7653
|
" PORT (server must be restarted to change port)"
|
|
6592
7654
|
] })
|
|
6593
7655
|
] }),
|
|
@@ -6596,8 +7658,8 @@ var SettingsModal = ({
|
|
|
6596
7658
|
className: styles.alertCard
|
|
6597
7659
|
}
|
|
6598
7660
|
),
|
|
6599
|
-
/* @__PURE__ */
|
|
6600
|
-
/* @__PURE__ */
|
|
7661
|
+
/* @__PURE__ */ jsx45("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ jsx45(Text14, { 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." }) }),
|
|
7662
|
+
/* @__PURE__ */ jsx45(
|
|
6601
7663
|
TextArea,
|
|
6602
7664
|
{
|
|
6603
7665
|
value: config.envText,
|
|
@@ -6674,10 +7736,10 @@ QUEUE_NAME=tasks`,
|
|
|
6674
7736
|
}));
|
|
6675
7737
|
}
|
|
6676
7738
|
};
|
|
6677
|
-
return /* @__PURE__ */
|
|
6678
|
-
/* @__PURE__ */
|
|
6679
|
-
config.models.map((model, index) => /* @__PURE__ */
|
|
6680
|
-
/* @__PURE__ */
|
|
7739
|
+
return /* @__PURE__ */ jsxs24("div", { className: styles.formContainer, children: [
|
|
7740
|
+
/* @__PURE__ */ jsx45("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ jsx45(Text14, { 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." }) }),
|
|
7741
|
+
config.models.map((model, index) => /* @__PURE__ */ jsxs24("div", { className: styles.card, children: [
|
|
7742
|
+
/* @__PURE__ */ jsxs24(
|
|
6681
7743
|
"div",
|
|
6682
7744
|
{
|
|
6683
7745
|
style: {
|
|
@@ -6689,13 +7751,13 @@ QUEUE_NAME=tasks`,
|
|
|
6689
7751
|
borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
|
|
6690
7752
|
},
|
|
6691
7753
|
children: [
|
|
6692
|
-
/* @__PURE__ */
|
|
6693
|
-
/* @__PURE__ */
|
|
7754
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
7755
|
+
/* @__PURE__ */ jsxs24(Text14, { strong: true, style: { fontSize: 16 }, children: [
|
|
6694
7756
|
"Model ",
|
|
6695
7757
|
index + 1
|
|
6696
7758
|
] }),
|
|
6697
|
-
model.key && /* @__PURE__ */
|
|
6698
|
-
|
|
7759
|
+
model.key && /* @__PURE__ */ jsxs24(
|
|
7760
|
+
Text14,
|
|
6699
7761
|
{
|
|
6700
7762
|
type: "secondary",
|
|
6701
7763
|
style: { marginLeft: 8, fontSize: 12 },
|
|
@@ -6707,8 +7769,8 @@ QUEUE_NAME=tasks`,
|
|
|
6707
7769
|
}
|
|
6708
7770
|
)
|
|
6709
7771
|
] }),
|
|
6710
|
-
config.models.length > 1 && /* @__PURE__ */
|
|
6711
|
-
|
|
7772
|
+
config.models.length > 1 && /* @__PURE__ */ jsx45(
|
|
7773
|
+
Button16,
|
|
6712
7774
|
{
|
|
6713
7775
|
type: "text",
|
|
6714
7776
|
danger: true,
|
|
@@ -6724,10 +7786,10 @@ QUEUE_NAME=tasks`,
|
|
|
6724
7786
|
]
|
|
6725
7787
|
}
|
|
6726
7788
|
),
|
|
6727
|
-
/* @__PURE__ */
|
|
6728
|
-
/* @__PURE__ */
|
|
6729
|
-
/* @__PURE__ */
|
|
6730
|
-
/* @__PURE__ */
|
|
7789
|
+
/* @__PURE__ */ jsxs24(Space15, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
7790
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
7791
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formLabel, children: "Key *" }),
|
|
7792
|
+
/* @__PURE__ */ jsx45(
|
|
6731
7793
|
Input,
|
|
6732
7794
|
{
|
|
6733
7795
|
placeholder: "e.g., default, gpt-4, claude",
|
|
@@ -6736,11 +7798,11 @@ QUEUE_NAME=tasks`,
|
|
|
6736
7798
|
style: { height: 40 }
|
|
6737
7799
|
}
|
|
6738
7800
|
),
|
|
6739
|
-
/* @__PURE__ */
|
|
7801
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formDescription, children: "Unique identifier for this model" })
|
|
6740
7802
|
] }),
|
|
6741
|
-
/* @__PURE__ */
|
|
6742
|
-
/* @__PURE__ */
|
|
6743
|
-
/* @__PURE__ */
|
|
7803
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
7804
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formLabel, children: "Provider *" }),
|
|
7805
|
+
/* @__PURE__ */ jsx45(
|
|
6744
7806
|
Select,
|
|
6745
7807
|
{
|
|
6746
7808
|
style: { width: "100%", height: 40 },
|
|
@@ -6756,9 +7818,9 @@ QUEUE_NAME=tasks`,
|
|
|
6756
7818
|
}
|
|
6757
7819
|
)
|
|
6758
7820
|
] }),
|
|
6759
|
-
/* @__PURE__ */
|
|
6760
|
-
/* @__PURE__ */
|
|
6761
|
-
/* @__PURE__ */
|
|
7821
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
7822
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formLabel, children: "Model Name *" }),
|
|
7823
|
+
/* @__PURE__ */ jsx45(
|
|
6762
7824
|
Input,
|
|
6763
7825
|
{
|
|
6764
7826
|
placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
|
|
@@ -6768,9 +7830,9 @@ QUEUE_NAME=tasks`,
|
|
|
6768
7830
|
}
|
|
6769
7831
|
)
|
|
6770
7832
|
] }),
|
|
6771
|
-
/* @__PURE__ */
|
|
6772
|
-
/* @__PURE__ */
|
|
6773
|
-
/* @__PURE__ */
|
|
7833
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
7834
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formLabel, children: "API Key" }),
|
|
7835
|
+
/* @__PURE__ */ jsx45(
|
|
6774
7836
|
Input.Password,
|
|
6775
7837
|
{
|
|
6776
7838
|
placeholder: "Enter your API key",
|
|
@@ -6779,11 +7841,11 @@ QUEUE_NAME=tasks`,
|
|
|
6779
7841
|
style: { height: 40 }
|
|
6780
7842
|
}
|
|
6781
7843
|
),
|
|
6782
|
-
/* @__PURE__ */
|
|
7844
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
|
|
6783
7845
|
] }),
|
|
6784
|
-
/* @__PURE__ */
|
|
6785
|
-
/* @__PURE__ */
|
|
6786
|
-
/* @__PURE__ */
|
|
7846
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
7847
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formLabel, children: "Base URL" }),
|
|
7848
|
+
/* @__PURE__ */ jsx45(
|
|
6787
7849
|
Input,
|
|
6788
7850
|
{
|
|
6789
7851
|
placeholder: "e.g., https://api.openai.com/v1",
|
|
@@ -6792,22 +7854,22 @@ QUEUE_NAME=tasks`,
|
|
|
6792
7854
|
style: { height: 40 }
|
|
6793
7855
|
}
|
|
6794
7856
|
),
|
|
6795
|
-
/* @__PURE__ */
|
|
7857
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formDescription, children: "Optional custom base URL for the API" })
|
|
6796
7858
|
] }),
|
|
6797
|
-
/* @__PURE__ */
|
|
6798
|
-
/* @__PURE__ */
|
|
7859
|
+
/* @__PURE__ */ jsx45("div", { children: /* @__PURE__ */ jsxs24(Space15, { children: [
|
|
7860
|
+
/* @__PURE__ */ jsx45(
|
|
6799
7861
|
Switch,
|
|
6800
7862
|
{
|
|
6801
7863
|
checked: model.streaming,
|
|
6802
7864
|
onChange: (checked) => handleModelChange(index, "streaming", checked)
|
|
6803
7865
|
}
|
|
6804
7866
|
),
|
|
6805
|
-
/* @__PURE__ */
|
|
7867
|
+
/* @__PURE__ */ jsx45(Text14, { children: "Enable Streaming" })
|
|
6806
7868
|
] }) }),
|
|
6807
|
-
/* @__PURE__ */
|
|
6808
|
-
/* @__PURE__ */
|
|
6809
|
-
/* @__PURE__ */
|
|
6810
|
-
/* @__PURE__ */
|
|
7869
|
+
/* @__PURE__ */ jsxs24("div", { style: { display: "flex", gap: 20 }, children: [
|
|
7870
|
+
/* @__PURE__ */ jsxs24("div", { style: { flex: 1 }, children: [
|
|
7871
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formLabel, children: "Max Tokens" }),
|
|
7872
|
+
/* @__PURE__ */ jsx45(
|
|
6811
7873
|
Input,
|
|
6812
7874
|
{
|
|
6813
7875
|
type: "number",
|
|
@@ -6822,9 +7884,9 @@ QUEUE_NAME=tasks`,
|
|
|
6822
7884
|
}
|
|
6823
7885
|
)
|
|
6824
7886
|
] }),
|
|
6825
|
-
/* @__PURE__ */
|
|
6826
|
-
/* @__PURE__ */
|
|
6827
|
-
/* @__PURE__ */
|
|
7887
|
+
/* @__PURE__ */ jsxs24("div", { style: { flex: 1 }, children: [
|
|
7888
|
+
/* @__PURE__ */ jsx45(Text14, { className: styles.formLabel, children: "Temperature" }),
|
|
7889
|
+
/* @__PURE__ */ jsx45(
|
|
6828
7890
|
Input,
|
|
6829
7891
|
{
|
|
6830
7892
|
type: "number",
|
|
@@ -6843,8 +7905,8 @@ QUEUE_NAME=tasks`,
|
|
|
6843
7905
|
] })
|
|
6844
7906
|
] })
|
|
6845
7907
|
] }, index)),
|
|
6846
|
-
/* @__PURE__ */
|
|
6847
|
-
|
|
7908
|
+
/* @__PURE__ */ jsx45(
|
|
7909
|
+
Button16,
|
|
6848
7910
|
{
|
|
6849
7911
|
type: "dashed",
|
|
6850
7912
|
onClick: handleAddModel,
|
|
@@ -6871,8 +7933,8 @@ QUEUE_NAME=tasks`,
|
|
|
6871
7933
|
);
|
|
6872
7934
|
const currentConnection = connections.find((c) => c.id === activeTabKey);
|
|
6873
7935
|
const renderTabLabel = (connection) => {
|
|
6874
|
-
return /* @__PURE__ */
|
|
6875
|
-
/* @__PURE__ */
|
|
7936
|
+
return /* @__PURE__ */ jsxs24("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
7937
|
+
/* @__PURE__ */ jsx45(
|
|
6876
7938
|
CloudServerOutlined,
|
|
6877
7939
|
{
|
|
6878
7940
|
style: {
|
|
@@ -6881,14 +7943,14 @@ QUEUE_NAME=tasks`,
|
|
|
6881
7943
|
}
|
|
6882
7944
|
}
|
|
6883
7945
|
),
|
|
6884
|
-
/* @__PURE__ */
|
|
6885
|
-
connection.connected && /* @__PURE__ */
|
|
7946
|
+
/* @__PURE__ */ jsx45("span", { children: connection.name }),
|
|
7947
|
+
connection.connected && /* @__PURE__ */ jsx45(
|
|
6886
7948
|
CheckCircleFilled,
|
|
6887
7949
|
{
|
|
6888
7950
|
style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
|
|
6889
7951
|
}
|
|
6890
7952
|
),
|
|
6891
|
-
connection.error && !connection.connecting && /* @__PURE__ */
|
|
7953
|
+
connection.error && !connection.connecting && /* @__PURE__ */ jsx45(
|
|
6892
7954
|
CloseCircleFilled,
|
|
6893
7955
|
{
|
|
6894
7956
|
style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
|
|
@@ -6899,35 +7961,35 @@ QUEUE_NAME=tasks`,
|
|
|
6899
7961
|
const tabItems = connections.map((connection) => ({
|
|
6900
7962
|
key: connection.id,
|
|
6901
7963
|
label: renderTabLabel(connection),
|
|
6902
|
-
children: /* @__PURE__ */
|
|
6903
|
-
/* @__PURE__ */
|
|
7964
|
+
children: /* @__PURE__ */ jsx45("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ jsx45(Fragment6, { children: /* @__PURE__ */ jsxs24("div", { style: { display: "flex", height: "100%" }, children: [
|
|
7965
|
+
/* @__PURE__ */ jsx45("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ jsxs24(
|
|
6904
7966
|
"div",
|
|
6905
7967
|
{
|
|
6906
7968
|
className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
|
|
6907
7969
|
onClick: () => setActiveMenu(item.key),
|
|
6908
7970
|
children: [
|
|
6909
|
-
/* @__PURE__ */
|
|
6910
|
-
/* @__PURE__ */
|
|
7971
|
+
/* @__PURE__ */ jsx45("span", { className: styles.menuItemIcon, children: item.icon }),
|
|
7972
|
+
/* @__PURE__ */ jsx45("span", { className: styles.menuItemText, children: item.label })
|
|
6911
7973
|
]
|
|
6912
7974
|
},
|
|
6913
7975
|
item.key
|
|
6914
7976
|
)) }),
|
|
6915
|
-
/* @__PURE__ */
|
|
6916
|
-
/* @__PURE__ */
|
|
6917
|
-
/* @__PURE__ */
|
|
6918
|
-
/* @__PURE__ */
|
|
6919
|
-
/* @__PURE__ */
|
|
7977
|
+
/* @__PURE__ */ jsxs24("div", { className: styles.content, children: [
|
|
7978
|
+
/* @__PURE__ */ jsxs24("div", { className: styles.contentHeader, children: [
|
|
7979
|
+
/* @__PURE__ */ jsxs24("div", { className: styles.contentHeaderLeft, children: [
|
|
7980
|
+
/* @__PURE__ */ jsx45(Title3, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
|
|
7981
|
+
/* @__PURE__ */ jsxs24(Text14, { className: styles.contentDescription, children: [
|
|
6920
7982
|
activeMenu === "environment" && "Manage environment variables for the gateway server",
|
|
6921
7983
|
activeMenu === "models" && "Configure and register model lattices for use by agents"
|
|
6922
7984
|
] })
|
|
6923
7985
|
] }),
|
|
6924
|
-
/* @__PURE__ */
|
|
6925
|
-
/* @__PURE__ */
|
|
6926
|
-
/* @__PURE__ */
|
|
6927
|
-
|
|
7986
|
+
/* @__PURE__ */ jsxs24("div", { className: styles.contentHeaderRight, children: [
|
|
7987
|
+
/* @__PURE__ */ jsx45(Button16, { onClick: onClose, children: "Cancel" }),
|
|
7988
|
+
/* @__PURE__ */ jsx45(
|
|
7989
|
+
Button16,
|
|
6928
7990
|
{
|
|
6929
7991
|
type: "primary",
|
|
6930
|
-
icon: /* @__PURE__ */
|
|
7992
|
+
icon: /* @__PURE__ */ jsx45(SaveOutlined, {}),
|
|
6931
7993
|
onClick: handleSave,
|
|
6932
7994
|
loading,
|
|
6933
7995
|
children: "Save Configuration"
|
|
@@ -6935,9 +7997,9 @@ QUEUE_NAME=tasks`,
|
|
|
6935
7997
|
)
|
|
6936
7998
|
] })
|
|
6937
7999
|
] }),
|
|
6938
|
-
/* @__PURE__ */
|
|
8000
|
+
/* @__PURE__ */ jsx45("div", { className: styles.contentBody, children: renderContent(connection.id) })
|
|
6939
8001
|
] })
|
|
6940
|
-
] }) }) : /* @__PURE__ */
|
|
8002
|
+
] }) }) : /* @__PURE__ */ jsx45(
|
|
6941
8003
|
"div",
|
|
6942
8004
|
{
|
|
6943
8005
|
style: {
|
|
@@ -6949,29 +8011,29 @@ QUEUE_NAME=tasks`,
|
|
|
6949
8011
|
gap: 16,
|
|
6950
8012
|
padding: 48
|
|
6951
8013
|
},
|
|
6952
|
-
children: connection.connecting ? /* @__PURE__ */
|
|
6953
|
-
/* @__PURE__ */
|
|
6954
|
-
/* @__PURE__ */
|
|
6955
|
-
/* @__PURE__ */
|
|
8014
|
+
children: connection.connecting ? /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
8015
|
+
/* @__PURE__ */ jsx45(LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
|
|
8016
|
+
/* @__PURE__ */ jsx45(Title3, { level: 4, children: "Connecting..." }),
|
|
8017
|
+
/* @__PURE__ */ jsxs24(Text14, { type: "secondary", style: { textAlign: "center" }, children: [
|
|
6956
8018
|
"Connecting to ",
|
|
6957
8019
|
connection.url
|
|
6958
8020
|
] })
|
|
6959
|
-
] }) : /* @__PURE__ */
|
|
6960
|
-
/* @__PURE__ */
|
|
6961
|
-
/* @__PURE__ */
|
|
6962
|
-
/* @__PURE__ */
|
|
6963
|
-
|
|
8021
|
+
] }) : /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
8022
|
+
/* @__PURE__ */ jsx45(LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
|
|
8023
|
+
/* @__PURE__ */ jsx45(Title3, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
|
|
8024
|
+
/* @__PURE__ */ jsx45(
|
|
8025
|
+
Text14,
|
|
6964
8026
|
{
|
|
6965
8027
|
type: "secondary",
|
|
6966
8028
|
style: { textAlign: "center", maxWidth: 400 },
|
|
6967
8029
|
children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
|
|
6968
8030
|
}
|
|
6969
8031
|
),
|
|
6970
|
-
/* @__PURE__ */
|
|
6971
|
-
|
|
8032
|
+
/* @__PURE__ */ jsx45(
|
|
8033
|
+
Button16,
|
|
6972
8034
|
{
|
|
6973
8035
|
type: "primary",
|
|
6974
|
-
icon: /* @__PURE__ */
|
|
8036
|
+
icon: /* @__PURE__ */ jsx45(LinkOutlined, {}),
|
|
6975
8037
|
onClick: () => checkConnection(connection.id),
|
|
6976
8038
|
loading: connection.connecting,
|
|
6977
8039
|
style: { marginTop: 16 },
|
|
@@ -6983,8 +8045,8 @@ QUEUE_NAME=tasks`,
|
|
|
6983
8045
|
) }),
|
|
6984
8046
|
closable: connections.length > 1
|
|
6985
8047
|
}));
|
|
6986
|
-
return /* @__PURE__ */
|
|
6987
|
-
/* @__PURE__ */
|
|
8048
|
+
return /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
8049
|
+
/* @__PURE__ */ jsx45(
|
|
6988
8050
|
Modal,
|
|
6989
8051
|
{
|
|
6990
8052
|
open,
|
|
@@ -6993,7 +8055,7 @@ QUEUE_NAME=tasks`,
|
|
|
6993
8055
|
width: "80%",
|
|
6994
8056
|
footer: null,
|
|
6995
8057
|
title: "Settings",
|
|
6996
|
-
children: /* @__PURE__ */
|
|
8058
|
+
children: /* @__PURE__ */ jsx45("div", { children: /* @__PURE__ */ jsx45(
|
|
6997
8059
|
Tabs2,
|
|
6998
8060
|
{
|
|
6999
8061
|
activeKey: activeTabKey,
|
|
@@ -7007,7 +8069,7 @@ QUEUE_NAME=tasks`,
|
|
|
7007
8069
|
}
|
|
7008
8070
|
},
|
|
7009
8071
|
items: tabItems,
|
|
7010
|
-
addIcon: /* @__PURE__ */
|
|
8072
|
+
addIcon: /* @__PURE__ */ jsxs24(
|
|
7011
8073
|
"div",
|
|
7012
8074
|
{
|
|
7013
8075
|
style: {
|
|
@@ -7017,8 +8079,8 @@ QUEUE_NAME=tasks`,
|
|
|
7017
8079
|
padding: "4px 8px"
|
|
7018
8080
|
},
|
|
7019
8081
|
children: [
|
|
7020
|
-
/* @__PURE__ */
|
|
7021
|
-
/* @__PURE__ */
|
|
8082
|
+
/* @__PURE__ */ jsx45(PlusOutlined, {}),
|
|
8083
|
+
/* @__PURE__ */ jsx45("span", { children: "Add Server" })
|
|
7022
8084
|
]
|
|
7023
8085
|
}
|
|
7024
8086
|
)
|
|
@@ -7026,7 +8088,7 @@ QUEUE_NAME=tasks`,
|
|
|
7026
8088
|
) })
|
|
7027
8089
|
}
|
|
7028
8090
|
),
|
|
7029
|
-
/* @__PURE__ */
|
|
8091
|
+
/* @__PURE__ */ jsx45(
|
|
7030
8092
|
Modal,
|
|
7031
8093
|
{
|
|
7032
8094
|
title: "Add New Server",
|
|
@@ -7040,10 +8102,10 @@ QUEUE_NAME=tasks`,
|
|
|
7040
8102
|
},
|
|
7041
8103
|
confirmLoading: addingServer,
|
|
7042
8104
|
className: styles.addServerModal,
|
|
7043
|
-
children: /* @__PURE__ */
|
|
7044
|
-
/* @__PURE__ */
|
|
7045
|
-
/* @__PURE__ */
|
|
7046
|
-
/* @__PURE__ */
|
|
8105
|
+
children: /* @__PURE__ */ jsxs24(Space15, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
8106
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
8107
|
+
/* @__PURE__ */ jsx45(Text14, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
|
|
8108
|
+
/* @__PURE__ */ jsx45(
|
|
7047
8109
|
Input,
|
|
7048
8110
|
{
|
|
7049
8111
|
placeholder: "e.g., Production Server",
|
|
@@ -7052,11 +8114,11 @@ QUEUE_NAME=tasks`,
|
|
|
7052
8114
|
onPressEnter: handleAddServer
|
|
7053
8115
|
}
|
|
7054
8116
|
),
|
|
7055
|
-
/* @__PURE__ */
|
|
8117
|
+
/* @__PURE__ */ jsx45(Text14, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
|
|
7056
8118
|
] }),
|
|
7057
|
-
/* @__PURE__ */
|
|
7058
|
-
/* @__PURE__ */
|
|
7059
|
-
/* @__PURE__ */
|
|
8119
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
8120
|
+
/* @__PURE__ */ jsx45(Text14, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
|
|
8121
|
+
/* @__PURE__ */ jsx45(
|
|
7060
8122
|
Input,
|
|
7061
8123
|
{
|
|
7062
8124
|
placeholder: "e.g., http://localhost:4001",
|
|
@@ -7065,11 +8127,11 @@ QUEUE_NAME=tasks`,
|
|
|
7065
8127
|
onPressEnter: handleAddServer
|
|
7066
8128
|
}
|
|
7067
8129
|
),
|
|
7068
|
-
/* @__PURE__ */
|
|
8130
|
+
/* @__PURE__ */ jsx45(Text14, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
|
|
7069
8131
|
] }),
|
|
7070
|
-
/* @__PURE__ */
|
|
7071
|
-
/* @__PURE__ */
|
|
7072
|
-
/* @__PURE__ */
|
|
8132
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
8133
|
+
/* @__PURE__ */ jsx45(Text14, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
|
|
8134
|
+
/* @__PURE__ */ jsx45(
|
|
7073
8135
|
Input.Password,
|
|
7074
8136
|
{
|
|
7075
8137
|
placeholder: "Optional: Enter API key for authentication",
|
|
@@ -7078,7 +8140,7 @@ QUEUE_NAME=tasks`,
|
|
|
7078
8140
|
onPressEnter: handleAddServer
|
|
7079
8141
|
}
|
|
7080
8142
|
),
|
|
7081
|
-
/* @__PURE__ */
|
|
8143
|
+
/* @__PURE__ */ jsx45(Text14, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
|
|
7082
8144
|
] })
|
|
7083
8145
|
] })
|
|
7084
8146
|
}
|
|
@@ -7087,10 +8149,10 @@ QUEUE_NAME=tasks`,
|
|
|
7087
8149
|
};
|
|
7088
8150
|
|
|
7089
8151
|
// src/components/Chat/AgentServerSetting.tsx
|
|
7090
|
-
import { jsx as
|
|
8152
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
7091
8153
|
var AgentServerSetting = () => {
|
|
7092
8154
|
const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
|
|
7093
|
-
return /* @__PURE__ */
|
|
8155
|
+
return /* @__PURE__ */ jsx46(
|
|
7094
8156
|
SettingsModal,
|
|
7095
8157
|
{
|
|
7096
8158
|
open: settingsModalOpen,
|
|
@@ -7100,11 +8162,11 @@ var AgentServerSetting = () => {
|
|
|
7100
8162
|
};
|
|
7101
8163
|
|
|
7102
8164
|
// src/components/Chat/LatticeChatShell.tsx
|
|
7103
|
-
import { jsx as
|
|
8165
|
+
import { jsx as jsx47, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7104
8166
|
var LatticeChatShell = (props) => {
|
|
7105
|
-
return /* @__PURE__ */
|
|
7106
|
-
/* @__PURE__ */
|
|
7107
|
-
/* @__PURE__ */
|
|
8167
|
+
return /* @__PURE__ */ jsxs25(LatticeChatShellContextProvider, { ...props, children: [
|
|
8168
|
+
/* @__PURE__ */ jsx47(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ jsx47(ConversationContextProvider, { children: /* @__PURE__ */ jsx47(LatticeChatView, {}) }) }),
|
|
8169
|
+
/* @__PURE__ */ jsx47(AgentServerSetting, {})
|
|
7108
8170
|
] });
|
|
7109
8171
|
};
|
|
7110
8172
|
export {
|
|
@@ -7126,6 +8188,7 @@ export {
|
|
|
7126
8188
|
LatticeChatShellContextProvider,
|
|
7127
8189
|
MDResponse,
|
|
7128
8190
|
MDViewFormItem,
|
|
8191
|
+
ScheduleButton,
|
|
7129
8192
|
SideAppViewBrowser,
|
|
7130
8193
|
getElement,
|
|
7131
8194
|
regsiterElement,
|