@axiom-lattice/react-sdk 2.0.3 → 2.1.0
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/README.md +27 -0
- package/dist/index.d.mts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.js +1302 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1323 -171
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ var index_exports = {};
|
|
|
33
33
|
__export(index_exports, {
|
|
34
34
|
AxiomLatticeProvider: () => AxiomLatticeProvider,
|
|
35
35
|
Chating: () => Chating,
|
|
36
|
+
FileExplorer: () => FileExplorer,
|
|
36
37
|
MDMermaid: () => MDMermaid,
|
|
37
38
|
MDResponse: () => MDResponse,
|
|
38
39
|
MDViewFormItem: () => MDViewFormItem,
|
|
@@ -40,7 +41,6 @@ __export(index_exports, {
|
|
|
40
41
|
ThinkingChain: () => ThinkingChain,
|
|
41
42
|
ThinkingChainGroup: () => ThinkingChainGroup,
|
|
42
43
|
chatContext: () => chatContext,
|
|
43
|
-
elements: () => elements,
|
|
44
44
|
getElement: () => getElement,
|
|
45
45
|
regsiterElement: () => regsiterElement,
|
|
46
46
|
useAgentGraph: () => useAgentGraph,
|
|
@@ -124,9 +124,22 @@ function useChat(threadId, options = {}) {
|
|
|
124
124
|
}, [options.initialMessages]);
|
|
125
125
|
const handleStreamEvent = (0, import_react2.useCallback)((chunk) => {
|
|
126
126
|
chunkMessageMerger.current.push(chunk);
|
|
127
|
+
let todos;
|
|
128
|
+
if (chunk.type === "tool" && chunk.data && typeof chunk.data.content === "string" && chunk.data.content.startsWith("```todo_list")) {
|
|
129
|
+
try {
|
|
130
|
+
const content = chunk.data.content;
|
|
131
|
+
const match = content.match(/```todo_list\s*([\s\S]*?)\s*```/);
|
|
132
|
+
if (match && match[1]) {
|
|
133
|
+
todos = JSON.parse(match[1]);
|
|
134
|
+
}
|
|
135
|
+
} catch (e) {
|
|
136
|
+
console.error("Failed to parse todo list from chunk", e);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
127
139
|
const updatedMessages = chunkMessageMerger.current.getMessages();
|
|
128
140
|
setState((prev) => ({
|
|
129
141
|
...prev,
|
|
142
|
+
todos: todos || prev.todos,
|
|
130
143
|
messages: updatedMessages,
|
|
131
144
|
isLoading: true,
|
|
132
145
|
streamingMessage: null
|
|
@@ -142,7 +155,7 @@ function useChat(threadId, options = {}) {
|
|
|
142
155
|
stopStreamingRef.current = null;
|
|
143
156
|
}
|
|
144
157
|
const { input, command, streaming = true } = data;
|
|
145
|
-
const { message:
|
|
158
|
+
const { message: message3, files, ...rest } = input || {};
|
|
146
159
|
setState((prev) => ({
|
|
147
160
|
...prev,
|
|
148
161
|
isLoading: true,
|
|
@@ -151,7 +164,7 @@ function useChat(threadId, options = {}) {
|
|
|
151
164
|
}));
|
|
152
165
|
const userMessage = {
|
|
153
166
|
id: Date.now().toString(),
|
|
154
|
-
content:
|
|
167
|
+
content: message3 || command?.resume?.message || "",
|
|
155
168
|
files,
|
|
156
169
|
role: "human"
|
|
157
170
|
};
|
|
@@ -257,14 +270,14 @@ function useChat(threadId, options = {}) {
|
|
|
257
270
|
}
|
|
258
271
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
259
272
|
try {
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
limit
|
|
263
|
-
});
|
|
273
|
+
const agentState = await client.getAgentState(threadId);
|
|
274
|
+
const fetchedMessages = await client.getMessages({ threadId });
|
|
264
275
|
chunkMessageMerger.current.reset();
|
|
265
276
|
chunkMessageMerger.current.initialMessages(fetchedMessages);
|
|
266
277
|
setState((prev) => ({
|
|
267
278
|
...prev,
|
|
279
|
+
agentState,
|
|
280
|
+
todos: agentState?.values?.todos,
|
|
268
281
|
messages: chunkMessageMerger.current.getMessages(),
|
|
269
282
|
isLoading: false
|
|
270
283
|
}));
|
|
@@ -593,8 +606,8 @@ var import_react_markdown = __toESM(require("react-markdown"));
|
|
|
593
606
|
var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
594
607
|
var import_prism = require("react-syntax-highlighter/dist/cjs/styles/prism");
|
|
595
608
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
596
|
-
var
|
|
597
|
-
var
|
|
609
|
+
var import_react13 = require("react");
|
|
610
|
+
var import_antd_style6 = require("antd-style");
|
|
598
611
|
var import_rehype_raw = __toESM(require("rehype-raw"));
|
|
599
612
|
|
|
600
613
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
@@ -618,7 +631,7 @@ var ConfirmFeedback = ({
|
|
|
618
631
|
eventHandler,
|
|
619
632
|
interactive = true
|
|
620
633
|
}) => {
|
|
621
|
-
const { message:
|
|
634
|
+
const { message: message3, type, config, feedback, options } = data ?? {};
|
|
622
635
|
const [clicked, setClicked] = (0, import_react6.useState)(false);
|
|
623
636
|
const { styles } = useStyle();
|
|
624
637
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd.Card, { size: "small", className: `shadow-sm ${styles.card}`, bordered: false, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_antd.Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
@@ -637,7 +650,7 @@ var ConfirmFeedback = ({
|
|
|
637
650
|
children: "\u8BF7\u6C42\u786E\u8BA4"
|
|
638
651
|
}
|
|
639
652
|
),
|
|
640
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MDResponse, { content:
|
|
653
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MDResponse, { content: message3 }),
|
|
641
654
|
options ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
642
655
|
import_antd.Button,
|
|
643
656
|
{
|
|
@@ -718,7 +731,7 @@ var GenericDataTable = ({
|
|
|
718
731
|
interactive = true,
|
|
719
732
|
default_open_in_side_app = true
|
|
720
733
|
}) => {
|
|
721
|
-
const { dataSource, message:
|
|
734
|
+
const { dataSource, message: message3 } = data ?? {};
|
|
722
735
|
const [expandedRowKeys, setExpandedRowKeys] = (0, import_react7.useState)([]);
|
|
723
736
|
const processedData = dataSource?.map((item, index) => ({
|
|
724
737
|
...item,
|
|
@@ -800,7 +813,7 @@ var GenericDataTable = ({
|
|
|
800
813
|
{
|
|
801
814
|
size: "small",
|
|
802
815
|
title: () => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_antd2.Flex, { justify: "space-between", align: "center", children: [
|
|
803
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd2.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { strong: true, style: { fontSize: 16 }, children:
|
|
816
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd2.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { strong: true, style: { fontSize: 16 }, children: message3 || "" }) }),
|
|
804
817
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_antd2.Space, { children: [
|
|
805
818
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
806
819
|
import_antd2.Button,
|
|
@@ -823,8 +836,8 @@ var GenericDataTable = ({
|
|
|
823
836
|
"__open_side_app",
|
|
824
837
|
{
|
|
825
838
|
component_key: "generic_data_table",
|
|
826
|
-
message:
|
|
827
|
-
data: { dataSource, message:
|
|
839
|
+
message: message3 || "",
|
|
840
|
+
data: { dataSource, message: message3 },
|
|
828
841
|
size: "large"
|
|
829
842
|
},
|
|
830
843
|
""
|
|
@@ -1055,9 +1068,12 @@ function getStatusIcon(status) {
|
|
|
1055
1068
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons3.LoadingOutlined, { style: { color: "#1890ff" } });
|
|
1056
1069
|
}
|
|
1057
1070
|
}
|
|
1058
|
-
var ToolCall = ({ data }) => {
|
|
1071
|
+
var ToolCall = ({ data, eventHandler }) => {
|
|
1059
1072
|
const toolCallData = data;
|
|
1060
1073
|
const formatToolName = (name) => {
|
|
1074
|
+
if (!name) {
|
|
1075
|
+
return "";
|
|
1076
|
+
}
|
|
1061
1077
|
return name.replace(/([a-z])([A-Z])/g, "$1 $2").split(/[_-]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
1062
1078
|
};
|
|
1063
1079
|
const formatArgsPreview = (args) => {
|
|
@@ -1114,6 +1130,14 @@ var ToolCall = ({ data }) => {
|
|
|
1114
1130
|
const expandIcon = ({ isActive }) => {
|
|
1115
1131
|
return getStatusIcon(toolCallData.status);
|
|
1116
1132
|
};
|
|
1133
|
+
const toolCallElement = getElement(toolCallData.name.toLowerCase());
|
|
1134
|
+
if (toolCallElement) {
|
|
1135
|
+
return toolCallElement.card_view({
|
|
1136
|
+
data: toolCallData,
|
|
1137
|
+
component_key: toolCallData.id,
|
|
1138
|
+
eventHandler
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1117
1141
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1118
1142
|
import_antd4.Collapse,
|
|
1119
1143
|
{
|
|
@@ -1145,8 +1169,8 @@ var useStyle3 = (0, import_antd_style3.createStyles)(({ token, css }) => ({
|
|
|
1145
1169
|
max-width: 1200px;
|
|
1146
1170
|
background: linear-gradient(
|
|
1147
1171
|
919deg,
|
|
1148
|
-
rgb(67 232
|
|
1149
|
-
rgb(
|
|
1172
|
+
rgb(67 81 232 / 8%),
|
|
1173
|
+
rgb(249 249 249 / 28%) 43%
|
|
1150
1174
|
);
|
|
1151
1175
|
`,
|
|
1152
1176
|
todoItem: css`
|
|
@@ -1265,7 +1289,1006 @@ var Todo = ({
|
|
|
1265
1289
|
] }) });
|
|
1266
1290
|
};
|
|
1267
1291
|
|
|
1268
|
-
// src/components/GenUI/elements/
|
|
1292
|
+
// src/components/GenUI/elements/WriteTodos.tsx
|
|
1293
|
+
var import_antd6 = require("antd");
|
|
1294
|
+
var import_icons5 = require("@ant-design/icons");
|
|
1295
|
+
var import_CollapsePanel2 = __toESM(require("antd/es/collapse/CollapsePanel"));
|
|
1296
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1297
|
+
var { Text: Text5 } = import_antd6.Typography;
|
|
1298
|
+
var WriteTodos = ({
|
|
1299
|
+
data,
|
|
1300
|
+
component_key,
|
|
1301
|
+
eventHandler,
|
|
1302
|
+
interactive = true
|
|
1303
|
+
}) => {
|
|
1304
|
+
const toolCallData = data;
|
|
1305
|
+
const todos = toolCallData?.args?.todos || [];
|
|
1306
|
+
const totalCount = todos.length;
|
|
1307
|
+
const completedCount = todos.filter(
|
|
1308
|
+
(item) => item.status === "completed"
|
|
1309
|
+
).length;
|
|
1310
|
+
const expandIcon = () => {
|
|
1311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.UnorderedListOutlined, {});
|
|
1312
|
+
};
|
|
1313
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd6.Space, { children: [
|
|
1314
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text5, { strong: true, children: "Todos" }),
|
|
1315
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text5, { style: { fontSize: 12 }, type: "secondary", children: [
|
|
1316
|
+
completedCount,
|
|
1317
|
+
"/",
|
|
1318
|
+
totalCount,
|
|
1319
|
+
" Done"
|
|
1320
|
+
] })
|
|
1321
|
+
] });
|
|
1322
|
+
if (!toolCallData) {
|
|
1323
|
+
return null;
|
|
1324
|
+
}
|
|
1325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1326
|
+
import_antd6.Collapse,
|
|
1327
|
+
{
|
|
1328
|
+
size: "small",
|
|
1329
|
+
bordered: false,
|
|
1330
|
+
defaultActiveKey: [],
|
|
1331
|
+
expandIcon,
|
|
1332
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1333
|
+
import_CollapsePanel2.default,
|
|
1334
|
+
{
|
|
1335
|
+
header,
|
|
1336
|
+
style: { minWidth: 400 },
|
|
1337
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1338
|
+
Todo,
|
|
1339
|
+
{
|
|
1340
|
+
data: data.args.todos,
|
|
1341
|
+
component_key,
|
|
1342
|
+
eventHandler,
|
|
1343
|
+
interactive
|
|
1344
|
+
}
|
|
1345
|
+
)
|
|
1346
|
+
},
|
|
1347
|
+
toolCallData.id
|
|
1348
|
+
)
|
|
1349
|
+
}
|
|
1350
|
+
);
|
|
1351
|
+
};
|
|
1352
|
+
|
|
1353
|
+
// src/components/GenUI/FileExplorer.tsx
|
|
1354
|
+
var import_react8 = require("react");
|
|
1355
|
+
var import_antd7 = require("antd");
|
|
1356
|
+
var import_icons7 = require("@ant-design/icons");
|
|
1357
|
+
var import_antd_style4 = require("antd-style");
|
|
1358
|
+
|
|
1359
|
+
// src/components/GenUI/elements/getFileIcon.tsx
|
|
1360
|
+
var import_icons6 = require("@ant-design/icons");
|
|
1361
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1362
|
+
var getFileIcon = (filename) => {
|
|
1363
|
+
const ext = filename?.split(".")?.pop()?.toLowerCase();
|
|
1364
|
+
const iconStyle = { fontSize: 14, marginRight: 4, verticalAlign: "middle" };
|
|
1365
|
+
switch (ext) {
|
|
1366
|
+
case "ts":
|
|
1367
|
+
case "tsx":
|
|
1368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons6.CodeOutlined, { style: { ...iconStyle, color: "#3178c6" } });
|
|
1369
|
+
case "js":
|
|
1370
|
+
case "jsx":
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons6.CodeOutlined, { style: { ...iconStyle, color: "#f7df1e" } });
|
|
1372
|
+
case "html":
|
|
1373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons6.Html5Outlined, { style: { ...iconStyle, color: "#e34c26" } });
|
|
1374
|
+
case "css":
|
|
1375
|
+
case "less":
|
|
1376
|
+
case "scss":
|
|
1377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons6.FileUnknownOutlined, { style: { ...iconStyle, color: "#563d7c" } });
|
|
1378
|
+
case "md":
|
|
1379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons6.FileMarkdownOutlined, { style: { ...iconStyle, color: "#083fa1" } });
|
|
1380
|
+
case "json":
|
|
1381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons6.FileTextOutlined, { style: { ...iconStyle, color: "#fbc02d" } });
|
|
1382
|
+
case "png":
|
|
1383
|
+
case "jpg":
|
|
1384
|
+
case "jpeg":
|
|
1385
|
+
case "gif":
|
|
1386
|
+
case "svg":
|
|
1387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons6.FileImageOutlined, { style: { ...iconStyle, color: "#4caf50" } });
|
|
1388
|
+
default:
|
|
1389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons6.FileOutlined, { style: { ...iconStyle, color: "#9e9e9e" } });
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
|
|
1393
|
+
// src/components/GenUI/FileExplorer.tsx
|
|
1394
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1395
|
+
var useStyles = (0, import_antd_style4.createStyles)(({ token, css }) => ({
|
|
1396
|
+
container: css`
|
|
1397
|
+
height: 100%;
|
|
1398
|
+
background: ${token.colorBgContainer};
|
|
1399
|
+
border: 1px solid ${token.colorBorder};
|
|
1400
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
1401
|
+
overflow: hidden;
|
|
1402
|
+
display: flex;
|
|
1403
|
+
flex-direction: column;
|
|
1404
|
+
`,
|
|
1405
|
+
splitter: css`
|
|
1406
|
+
height: 100%;
|
|
1407
|
+
.ant-splitter-bar-dragger {
|
|
1408
|
+
background: transparent !important;
|
|
1409
|
+
&:hover {
|
|
1410
|
+
background: ${token.colorPrimary} !important;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
`,
|
|
1414
|
+
leftPanel: css`
|
|
1415
|
+
height: 100%;
|
|
1416
|
+
overflow: auto;
|
|
1417
|
+
padding: 0;
|
|
1418
|
+
background: ${token.colorBgContainer};
|
|
1419
|
+
border-right: 1px solid ${token.colorBorderSecondary};
|
|
1420
|
+
|
|
1421
|
+
/* Custom scrollbar for tree */
|
|
1422
|
+
&::-webkit-scrollbar {
|
|
1423
|
+
width: 6px;
|
|
1424
|
+
height: 6px;
|
|
1425
|
+
}
|
|
1426
|
+
&::-webkit-scrollbar-thumb {
|
|
1427
|
+
background: ${token.colorBorder};
|
|
1428
|
+
border-radius: 3px;
|
|
1429
|
+
}
|
|
1430
|
+
`,
|
|
1431
|
+
rightPanel: css`
|
|
1432
|
+
height: 100%;
|
|
1433
|
+
overflow: auto;
|
|
1434
|
+
padding: 0;
|
|
1435
|
+
background: ${token.colorBgLayout};
|
|
1436
|
+
position: relative;
|
|
1437
|
+
`,
|
|
1438
|
+
header: css`
|
|
1439
|
+
display: flex;
|
|
1440
|
+
justify-content: flex-end;
|
|
1441
|
+
padding: 8px 16px;
|
|
1442
|
+
background: ${token.colorBgContainer + "30"};
|
|
1443
|
+
backdrop-filter: blur(4px);
|
|
1444
|
+
-webkit-backdrop-filter: blur(4px);
|
|
1445
|
+
gap: 8px;
|
|
1446
|
+
position: sticky;
|
|
1447
|
+
top: 0;
|
|
1448
|
+
z-index: 10;
|
|
1449
|
+
`,
|
|
1450
|
+
contentBody: css`
|
|
1451
|
+
padding: 24px;
|
|
1452
|
+
min-height: 100%;
|
|
1453
|
+
|
|
1454
|
+
pre {
|
|
1455
|
+
margin: 0 !important;
|
|
1456
|
+
border-radius: ${token.borderRadius}px !important;
|
|
1457
|
+
}
|
|
1458
|
+
`,
|
|
1459
|
+
emptyState: css`
|
|
1460
|
+
display: flex;
|
|
1461
|
+
flex-direction: column;
|
|
1462
|
+
align-items: center;
|
|
1463
|
+
justify-content: center;
|
|
1464
|
+
height: 100%;
|
|
1465
|
+
color: ${token.colorTextQuaternary};
|
|
1466
|
+
`,
|
|
1467
|
+
fileTree: css`
|
|
1468
|
+
background: transparent;
|
|
1469
|
+
font-size: 13px;
|
|
1470
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
1471
|
+
"Helvetica Neue", Arial, sans-serif;
|
|
1472
|
+
|
|
1473
|
+
.ant-tree-treenode {
|
|
1474
|
+
padding-bottom: 0 !important;
|
|
1475
|
+
width: 100%;
|
|
1476
|
+
&:hover {
|
|
1477
|
+
background-color: ${token.colorFillQuaternary};
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
.ant-tree-node-content-wrapper {
|
|
1482
|
+
padding: 0 4px;
|
|
1483
|
+
border-radius: 0;
|
|
1484
|
+
transition: none;
|
|
1485
|
+
line-height: 24px;
|
|
1486
|
+
min-height: 24px;
|
|
1487
|
+
|
|
1488
|
+
&:hover {
|
|
1489
|
+
background-color: transparent;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
&.ant-tree-node-selected {
|
|
1493
|
+
background-color: ${token.controlItemBgActive} !important;
|
|
1494
|
+
color: ${token.colorText};
|
|
1495
|
+
font-weight: 500;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
.ant-tree-indent-unit {
|
|
1500
|
+
width: 16px;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
.ant-tree-switcher {
|
|
1504
|
+
width: 20px;
|
|
1505
|
+
line-height: 24px;
|
|
1506
|
+
|
|
1507
|
+
.anticon {
|
|
1508
|
+
font-size: 10px;
|
|
1509
|
+
color: ${token.colorTextSecondary};
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
.ant-tree-title {
|
|
1514
|
+
display: inline-block;
|
|
1515
|
+
margin-left: 4px;
|
|
1516
|
+
}
|
|
1517
|
+
`
|
|
1518
|
+
}));
|
|
1519
|
+
var getFolderIcon = (expanded) => {
|
|
1520
|
+
const iconStyle = {
|
|
1521
|
+
fontSize: 14,
|
|
1522
|
+
marginRight: 4,
|
|
1523
|
+
color: "#dcb67a",
|
|
1524
|
+
verticalAlign: "middle"
|
|
1525
|
+
};
|
|
1526
|
+
return expanded ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons7.FolderOpenOutlined, { style: iconStyle }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons7.FolderOutlined, { style: iconStyle });
|
|
1527
|
+
};
|
|
1528
|
+
var sortTreeNodes = (nodes) => {
|
|
1529
|
+
return nodes.sort((a, b) => {
|
|
1530
|
+
if (!!a.isLeaf === !!b.isLeaf) {
|
|
1531
|
+
return a.title.localeCompare(b.title);
|
|
1532
|
+
}
|
|
1533
|
+
return a.isLeaf ? 1 : -1;
|
|
1534
|
+
}).map((node) => {
|
|
1535
|
+
if (node.children) {
|
|
1536
|
+
return { ...node, children: sortTreeNodes(node.children) };
|
|
1537
|
+
}
|
|
1538
|
+
return node;
|
|
1539
|
+
});
|
|
1540
|
+
};
|
|
1541
|
+
var buildTreeData = (files, expandedKeys) => {
|
|
1542
|
+
const root = [];
|
|
1543
|
+
files.forEach((file) => {
|
|
1544
|
+
const parts = file.name.split("/");
|
|
1545
|
+
let currentLevel = root;
|
|
1546
|
+
parts.forEach((part, index) => {
|
|
1547
|
+
const isFile = index === parts.length - 1;
|
|
1548
|
+
const key = parts.slice(0, index + 1).join("/");
|
|
1549
|
+
let existingNode = currentLevel.find((node) => node.key === key);
|
|
1550
|
+
if (!existingNode) {
|
|
1551
|
+
const title = part === "" && index === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1552
|
+
"span",
|
|
1553
|
+
{
|
|
1554
|
+
style: {
|
|
1555
|
+
color: "rgba(0, 0, 0, 0.45)",
|
|
1556
|
+
fontStyle: "italic",
|
|
1557
|
+
fontSize: 12
|
|
1558
|
+
},
|
|
1559
|
+
children: "<root>"
|
|
1560
|
+
}
|
|
1561
|
+
) : part;
|
|
1562
|
+
const newNode = {
|
|
1563
|
+
title,
|
|
1564
|
+
key,
|
|
1565
|
+
isLeaf: isFile,
|
|
1566
|
+
icon: isFile ? getFileIcon(part) : getFolderIcon(expandedKeys.includes(key)),
|
|
1567
|
+
children: isFile ? void 0 : []
|
|
1568
|
+
};
|
|
1569
|
+
currentLevel.push(newNode);
|
|
1570
|
+
existingNode = newNode;
|
|
1571
|
+
}
|
|
1572
|
+
if (!isFile && existingNode.children) {
|
|
1573
|
+
currentLevel = existingNode.children;
|
|
1574
|
+
}
|
|
1575
|
+
});
|
|
1576
|
+
});
|
|
1577
|
+
return sortTreeNodes(root);
|
|
1578
|
+
};
|
|
1579
|
+
var FileExplorer = ({
|
|
1580
|
+
data,
|
|
1581
|
+
eventHandler,
|
|
1582
|
+
interactive = true,
|
|
1583
|
+
default_open_in_side_app = true
|
|
1584
|
+
}) => {
|
|
1585
|
+
const { files } = data ?? {};
|
|
1586
|
+
const { styles, cx } = useStyles();
|
|
1587
|
+
const [fileList, setFileList] = (0, import_react8.useState)([]);
|
|
1588
|
+
const [selectedKey, setSelectedKey] = (0, import_react8.useState)("");
|
|
1589
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react8.useState)([]);
|
|
1590
|
+
const [copied, setCopied] = (0, import_react8.useState)(false);
|
|
1591
|
+
(0, import_react8.useEffect)(() => {
|
|
1592
|
+
if (copied) {
|
|
1593
|
+
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
1594
|
+
return () => clearTimeout(timer);
|
|
1595
|
+
}
|
|
1596
|
+
}, [copied]);
|
|
1597
|
+
(0, import_react8.useEffect)(() => {
|
|
1598
|
+
let list = [];
|
|
1599
|
+
if (Array.isArray(files)) {
|
|
1600
|
+
list = files;
|
|
1601
|
+
} else {
|
|
1602
|
+
list = Object.keys(files).map((key) => ({
|
|
1603
|
+
...files[key],
|
|
1604
|
+
name: key
|
|
1605
|
+
}));
|
|
1606
|
+
}
|
|
1607
|
+
setFileList(list);
|
|
1608
|
+
if (list.length > 0 && !selectedKey) {
|
|
1609
|
+
const firstFile = list[0];
|
|
1610
|
+
setSelectedKey(list[0].name);
|
|
1611
|
+
}
|
|
1612
|
+
}, [files]);
|
|
1613
|
+
const treeData = (0, import_react8.useMemo)(
|
|
1614
|
+
() => buildTreeData(fileList, expandedKeys),
|
|
1615
|
+
[fileList, expandedKeys]
|
|
1616
|
+
);
|
|
1617
|
+
(0, import_react8.useEffect)(() => {
|
|
1618
|
+
if (treeData.length > 0 && expandedKeys.length === 0) {
|
|
1619
|
+
const getAllKeys = (nodes) => {
|
|
1620
|
+
let keys = [];
|
|
1621
|
+
nodes.forEach((node) => {
|
|
1622
|
+
if (!node.isLeaf) {
|
|
1623
|
+
keys.push(node.key);
|
|
1624
|
+
if (node.children) {
|
|
1625
|
+
keys = keys.concat(getAllKeys(node.children));
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
});
|
|
1629
|
+
return keys;
|
|
1630
|
+
};
|
|
1631
|
+
setExpandedKeys(getAllKeys(treeData));
|
|
1632
|
+
}
|
|
1633
|
+
}, [treeData.length]);
|
|
1634
|
+
const selectedFile = (0, import_react8.useMemo)(() => {
|
|
1635
|
+
return fileList.find((f) => f.name === selectedKey);
|
|
1636
|
+
}, [fileList, selectedKey]);
|
|
1637
|
+
const handleCopy = () => {
|
|
1638
|
+
if (!selectedFile) return;
|
|
1639
|
+
const content = Array.isArray(selectedFile.content) ? selectedFile.content.join("\n") : selectedFile.content;
|
|
1640
|
+
navigator.clipboard.writeText(content).then(() => {
|
|
1641
|
+
setCopied(true);
|
|
1642
|
+
import_antd7.message.success("Copied to clipboard");
|
|
1643
|
+
});
|
|
1644
|
+
};
|
|
1645
|
+
const handleDownload = () => {
|
|
1646
|
+
if (!selectedFile) return;
|
|
1647
|
+
const content = Array.isArray(selectedFile.content) ? selectedFile.content.join("\n") : selectedFile.content;
|
|
1648
|
+
const blob = new Blob([content], { type: "text/plain" });
|
|
1649
|
+
const url = URL.createObjectURL(blob);
|
|
1650
|
+
const a = document.createElement("a");
|
|
1651
|
+
a.href = url;
|
|
1652
|
+
const fileName = selectedFile.name.split("/").pop() || selectedFile.name;
|
|
1653
|
+
a.download = fileName;
|
|
1654
|
+
document.body.appendChild(a);
|
|
1655
|
+
a.click();
|
|
1656
|
+
document.body.removeChild(a);
|
|
1657
|
+
URL.revokeObjectURL(url);
|
|
1658
|
+
};
|
|
1659
|
+
const renderContent = () => {
|
|
1660
|
+
if (!selectedFile) {
|
|
1661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: styles.emptyState, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1662
|
+
import_antd7.Empty,
|
|
1663
|
+
{
|
|
1664
|
+
description: "Select a file to preview",
|
|
1665
|
+
image: import_antd7.Empty.PRESENTED_IMAGE_SIMPLE
|
|
1666
|
+
}
|
|
1667
|
+
) });
|
|
1668
|
+
}
|
|
1669
|
+
const content = Array.isArray(selectedFile.content) ? selectedFile.content.join("\n") : selectedFile.content;
|
|
1670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1671
|
+
"div",
|
|
1672
|
+
{
|
|
1673
|
+
style: { minHeight: "100%", display: "flex", flexDirection: "column" },
|
|
1674
|
+
children: [
|
|
1675
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: styles.header, children: [
|
|
1676
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd7.Tooltip, { title: "Copy Content", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1677
|
+
import_antd7.Button,
|
|
1678
|
+
{
|
|
1679
|
+
type: "text",
|
|
1680
|
+
icon: copied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons7.CheckOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons7.CopyOutlined, {}),
|
|
1681
|
+
onClick: handleCopy,
|
|
1682
|
+
size: "small"
|
|
1683
|
+
}
|
|
1684
|
+
) }),
|
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd7.Tooltip, { title: "Download File", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1686
|
+
import_antd7.Button,
|
|
1687
|
+
{
|
|
1688
|
+
type: "text",
|
|
1689
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons7.DownloadOutlined, {}),
|
|
1690
|
+
onClick: handleDownload,
|
|
1691
|
+
size: "small"
|
|
1692
|
+
}
|
|
1693
|
+
) })
|
|
1694
|
+
] }),
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: styles.contentBody, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MDResponse, { content }) })
|
|
1696
|
+
]
|
|
1697
|
+
}
|
|
1698
|
+
);
|
|
1699
|
+
};
|
|
1700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd7.Splitter, { className: styles.splitter, children: [
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd7.Splitter.Panel, { defaultSize: "25%", min: "15%", max: "40%", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: styles.leftPanel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1702
|
+
import_antd7.Tree,
|
|
1703
|
+
{
|
|
1704
|
+
showIcon: true,
|
|
1705
|
+
blockNode: true,
|
|
1706
|
+
showLine: true,
|
|
1707
|
+
className: styles.fileTree,
|
|
1708
|
+
treeData,
|
|
1709
|
+
selectedKeys: selectedKey ? [selectedKey] : [],
|
|
1710
|
+
expandedKeys,
|
|
1711
|
+
onExpand: setExpandedKeys,
|
|
1712
|
+
onSelect: (keys, info) => {
|
|
1713
|
+
if (keys.length > 0) {
|
|
1714
|
+
const key = keys[0];
|
|
1715
|
+
const file = fileList.find((f) => f.name === key);
|
|
1716
|
+
if (file) {
|
|
1717
|
+
setSelectedKey(key);
|
|
1718
|
+
} else {
|
|
1719
|
+
if (expandedKeys.includes(key)) {
|
|
1720
|
+
setExpandedKeys(expandedKeys.filter((k) => k !== key));
|
|
1721
|
+
} else {
|
|
1722
|
+
setExpandedKeys([...expandedKeys, key]);
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
} else if (info.node.key) {
|
|
1726
|
+
const key = info.node.key;
|
|
1727
|
+
const file = fileList.find((f) => f.name === key);
|
|
1728
|
+
if (!file) {
|
|
1729
|
+
if (expandedKeys.includes(key)) {
|
|
1730
|
+
setExpandedKeys(expandedKeys.filter((k) => k !== key));
|
|
1731
|
+
} else {
|
|
1732
|
+
setExpandedKeys([...expandedKeys, key]);
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
) }) }),
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd7.Splitter.Panel, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: styles.rightPanel, children: renderContent() }) })
|
|
1740
|
+
] }) });
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1743
|
+
// src/components/GenUI/elements/attachments_card.tsx
|
|
1744
|
+
var import_x = require("@ant-design/x");
|
|
1745
|
+
var import_antd8 = require("antd");
|
|
1746
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
1747
|
+
var import_react9 = require("react");
|
|
1748
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1749
|
+
var AttachmentsCard = ({
|
|
1750
|
+
data,
|
|
1751
|
+
eventHandler,
|
|
1752
|
+
component_key,
|
|
1753
|
+
size = "medium",
|
|
1754
|
+
columns = 1,
|
|
1755
|
+
showDownloadButton = false
|
|
1756
|
+
}) => {
|
|
1757
|
+
const { Text: Text8 } = import_antd8.Typography;
|
|
1758
|
+
const [showAll, setShowAll] = (0, import_react9.useState)(false);
|
|
1759
|
+
const getStyles = () => {
|
|
1760
|
+
switch (size) {
|
|
1761
|
+
case "small":
|
|
1762
|
+
return {
|
|
1763
|
+
padding: "0px",
|
|
1764
|
+
fontSize: "10px",
|
|
1765
|
+
cardSize: "small"
|
|
1766
|
+
};
|
|
1767
|
+
case "large":
|
|
1768
|
+
return {
|
|
1769
|
+
padding: "16px",
|
|
1770
|
+
fontSize: "16px",
|
|
1771
|
+
cardSize: "default"
|
|
1772
|
+
};
|
|
1773
|
+
default:
|
|
1774
|
+
return {
|
|
1775
|
+
padding: "8px",
|
|
1776
|
+
fontSize: "14px",
|
|
1777
|
+
cardSize: "small"
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
const styles = getStyles();
|
|
1782
|
+
const handleItemClick = (item) => {
|
|
1783
|
+
eventHandler?.(
|
|
1784
|
+
"__open_side_app",
|
|
1785
|
+
{
|
|
1786
|
+
component_key: "attachments",
|
|
1787
|
+
data: { file_id: item.id, message: "\u9884\u89C8\uFF1A" + item.name }
|
|
1788
|
+
},
|
|
1789
|
+
""
|
|
1790
|
+
);
|
|
1791
|
+
};
|
|
1792
|
+
const getCardStyle = (item) => {
|
|
1793
|
+
if (item.is_failure && columns > 1) {
|
|
1794
|
+
return {
|
|
1795
|
+
padding: 0
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1798
|
+
return { padding: 0, cursor: "pointer" };
|
|
1799
|
+
};
|
|
1800
|
+
const getFileCardStyle = (item) => {
|
|
1801
|
+
const baseStyle = {
|
|
1802
|
+
width: "100%",
|
|
1803
|
+
backgroundColor: "transparent",
|
|
1804
|
+
fontSize: styles.fontSize,
|
|
1805
|
+
padding: styles.padding,
|
|
1806
|
+
position: "relative"
|
|
1807
|
+
// 添加相对定位,用于绝对定位下载按钮
|
|
1808
|
+
};
|
|
1809
|
+
if (item.is_failure && columns > 1) {
|
|
1810
|
+
return {
|
|
1811
|
+
...baseStyle,
|
|
1812
|
+
color: "gray"
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
return baseStyle;
|
|
1816
|
+
};
|
|
1817
|
+
const DownloadButton = ({ item }) => {
|
|
1818
|
+
if (!showDownloadButton) return null;
|
|
1819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1820
|
+
"div",
|
|
1821
|
+
{
|
|
1822
|
+
style: {
|
|
1823
|
+
position: "absolute",
|
|
1824
|
+
top: "50%",
|
|
1825
|
+
right: 8,
|
|
1826
|
+
transform: "translateY(-50%)",
|
|
1827
|
+
zIndex: 10
|
|
1828
|
+
},
|
|
1829
|
+
onClick: (e) => e.stopPropagation()
|
|
1830
|
+
}
|
|
1831
|
+
);
|
|
1832
|
+
};
|
|
1833
|
+
const renderFileDescription = (item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Space, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1834
|
+
Text8,
|
|
1835
|
+
{
|
|
1836
|
+
type: "secondary",
|
|
1837
|
+
style: {
|
|
1838
|
+
fontSize: size === "small" ? "10px" : void 0
|
|
1839
|
+
},
|
|
1840
|
+
children: item.created_at && (0, import_dayjs.default)(item.created_at).format("YYYY-MM-DD HH:mm:ss")
|
|
1841
|
+
}
|
|
1842
|
+
) }) });
|
|
1843
|
+
if (columns > 1) {
|
|
1844
|
+
const displayData2 = data || [];
|
|
1845
|
+
const shouldShowViewMore2 = displayData2.length > 4;
|
|
1846
|
+
const visibleData2 = showAll ? displayData2 : displayData2.slice(0, 4);
|
|
1847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_antd8.Flex, { vertical: true, gap: "small", children: [
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Row, { gutter: [8, 8], children: visibleData2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd8.Col, { span: 24 / columns, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1849
|
+
"div",
|
|
1850
|
+
{
|
|
1851
|
+
onClick: (evt) => {
|
|
1852
|
+
evt.stopPropagation();
|
|
1853
|
+
handleItemClick(item);
|
|
1854
|
+
},
|
|
1855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_antd8.Card, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
1856
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DownloadButton, { item }),
|
|
1857
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1858
|
+
import_x.Attachments.FileCard,
|
|
1859
|
+
{
|
|
1860
|
+
style: getFileCardStyle(item),
|
|
1861
|
+
item: {
|
|
1862
|
+
name: item.name,
|
|
1863
|
+
size: item.size,
|
|
1864
|
+
uid: item.id,
|
|
1865
|
+
description: renderFileDescription(item)
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
),
|
|
1869
|
+
item.files && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1870
|
+
AttachmentsCard,
|
|
1871
|
+
{
|
|
1872
|
+
data: item.files,
|
|
1873
|
+
component_key: `${component_key}_${item.id}`,
|
|
1874
|
+
eventHandler,
|
|
1875
|
+
size: "small",
|
|
1876
|
+
columns: 2,
|
|
1877
|
+
showDownloadButton
|
|
1878
|
+
}
|
|
1879
|
+
)
|
|
1880
|
+
] })
|
|
1881
|
+
}
|
|
1882
|
+
) }, item.id)) }),
|
|
1883
|
+
shouldShowViewMore2 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1884
|
+
import_antd8.Button,
|
|
1885
|
+
{
|
|
1886
|
+
type: "link",
|
|
1887
|
+
onClick: () => setShowAll(!showAll),
|
|
1888
|
+
style: { alignSelf: "center" },
|
|
1889
|
+
children: showAll ? "\u663E\u793A\u66F4\u5C11" : `\u663E\u793A\u66F4\u591A (${displayData2.length - 4})`
|
|
1890
|
+
}
|
|
1891
|
+
)
|
|
1892
|
+
] });
|
|
1893
|
+
}
|
|
1894
|
+
const displayData = data || [];
|
|
1895
|
+
const shouldShowViewMore = displayData.length > 4;
|
|
1896
|
+
const visibleData = showAll ? displayData : displayData.slice(0, 4);
|
|
1897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_antd8.Flex, { vertical: true, gap: size === "small" ? "small" : "middle", children: [
|
|
1898
|
+
visibleData.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { onClick: () => handleItemClick(item), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_antd8.Card, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DownloadButton, { item }),
|
|
1900
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1901
|
+
import_x.Attachments.FileCard,
|
|
1902
|
+
{
|
|
1903
|
+
style: getFileCardStyle(item),
|
|
1904
|
+
item: {
|
|
1905
|
+
name: item.name,
|
|
1906
|
+
size: item.size,
|
|
1907
|
+
uid: item.id,
|
|
1908
|
+
description: renderFileDescription(item)
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
),
|
|
1912
|
+
item.files && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { paddingLeft: "12px" }, children: [
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text8, { type: "secondary", style: { fontSize: "12px" }, children: [
|
|
1914
|
+
"\u5305\u542B\u6587\u4EF6(",
|
|
1915
|
+
item.files.length,
|
|
1916
|
+
")"
|
|
1917
|
+
] }),
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1919
|
+
AttachmentsCard,
|
|
1920
|
+
{
|
|
1921
|
+
data: item.files,
|
|
1922
|
+
component_key: `${component_key}_${item.id}`,
|
|
1923
|
+
eventHandler,
|
|
1924
|
+
size: "small",
|
|
1925
|
+
columns: 2,
|
|
1926
|
+
showDownloadButton
|
|
1927
|
+
}
|
|
1928
|
+
)
|
|
1929
|
+
] })
|
|
1930
|
+
] }) }, item.id)),
|
|
1931
|
+
shouldShowViewMore && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1932
|
+
import_antd8.Button,
|
|
1933
|
+
{
|
|
1934
|
+
type: "link",
|
|
1935
|
+
size: "small",
|
|
1936
|
+
onClick: (evt) => {
|
|
1937
|
+
evt.stopPropagation();
|
|
1938
|
+
setShowAll(!showAll);
|
|
1939
|
+
},
|
|
1940
|
+
style: { alignSelf: "center" },
|
|
1941
|
+
children: showAll ? "\u663E\u793A\u66F4\u5C11" : `\u663E\u793A\u66F4\u591A (${displayData.length - 4})`
|
|
1942
|
+
}
|
|
1943
|
+
)
|
|
1944
|
+
] });
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1947
|
+
// src/components/GenUI/elements/attachments_viewer_side_app.tsx
|
|
1948
|
+
var import_antd9 = require("antd");
|
|
1949
|
+
var import_react10 = require("react");
|
|
1950
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1951
|
+
function AttachmentsViewerSideApp({
|
|
1952
|
+
data,
|
|
1953
|
+
eventHandler,
|
|
1954
|
+
component_key
|
|
1955
|
+
}) {
|
|
1956
|
+
const [fileUri, setFileUri] = (0, import_react10.useState)();
|
|
1957
|
+
const [loading, setLoading] = (0, import_react10.useState)(true);
|
|
1958
|
+
const { file_id } = data ?? {};
|
|
1959
|
+
if (loading) {
|
|
1960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_antd9.Skeleton, { active: true });
|
|
1961
|
+
}
|
|
1962
|
+
const canPreviewInIframe = (fileName) => {
|
|
1963
|
+
if (!fileName) return false;
|
|
1964
|
+
const extension = fileName?.split(".").pop()?.toLowerCase() || "";
|
|
1965
|
+
const previewableExtensions = [
|
|
1966
|
+
// PDF文档
|
|
1967
|
+
"pdf",
|
|
1968
|
+
// 图片类型
|
|
1969
|
+
"jpg",
|
|
1970
|
+
"jpeg",
|
|
1971
|
+
"png",
|
|
1972
|
+
"gif",
|
|
1973
|
+
"svg",
|
|
1974
|
+
"bmp",
|
|
1975
|
+
"webp",
|
|
1976
|
+
// 文本类型
|
|
1977
|
+
"txt",
|
|
1978
|
+
"csv",
|
|
1979
|
+
"json",
|
|
1980
|
+
"xml",
|
|
1981
|
+
// 网页类型
|
|
1982
|
+
"html",
|
|
1983
|
+
"htm",
|
|
1984
|
+
// 音频类型
|
|
1985
|
+
"mp3",
|
|
1986
|
+
"wav",
|
|
1987
|
+
"ogg",
|
|
1988
|
+
// 视频类型
|
|
1989
|
+
"mp4",
|
|
1990
|
+
"webm"
|
|
1991
|
+
];
|
|
1992
|
+
return previewableExtensions.includes(extension);
|
|
1993
|
+
};
|
|
1994
|
+
const isPreviewable = fileUri?.fileName ? canPreviewInIframe(fileUri.fileName) : false;
|
|
1995
|
+
return isPreviewable ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1996
|
+
"iframe",
|
|
1997
|
+
{
|
|
1998
|
+
style: { width: "100%", height: "100%", border: 0 },
|
|
1999
|
+
src: fileUri?.url
|
|
2000
|
+
}
|
|
2001
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2002
|
+
import_antd9.Empty,
|
|
2003
|
+
{
|
|
2004
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2005
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: "\u6682\u65F6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u8BF7\u4E0B\u8F7D\u540E\u67E5\u770B\u3002" }),
|
|
2006
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_antd9.Button, { type: "link", href: fileUri?.url, download: fileUri?.fileName, children: [
|
|
2007
|
+
"\u4E0B\u8F7D",
|
|
2008
|
+
fileUri?.fileName
|
|
2009
|
+
] })
|
|
2010
|
+
] }),
|
|
2011
|
+
image: import_antd9.Empty.PRESENTED_IMAGE_DEFAULT
|
|
2012
|
+
}
|
|
2013
|
+
);
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
// src/components/GenUI/elements/WriteFile.tsx
|
|
2017
|
+
var import_antd11 = require("antd");
|
|
2018
|
+
|
|
2019
|
+
// src/components/GenUI/elements/ContentPreviewCollapse.tsx
|
|
2020
|
+
var import_react11 = require("react");
|
|
2021
|
+
var import_antd10 = require("antd");
|
|
2022
|
+
var import_antd_style5 = require("antd-style");
|
|
2023
|
+
var import_icons8 = require("@ant-design/icons");
|
|
2024
|
+
var import_CollapsePanel3 = __toESM(require("antd/es/collapse/CollapsePanel"));
|
|
2025
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2026
|
+
var DEFAULT_COLLAPSED_MAX_HEIGHT = 180;
|
|
2027
|
+
var DEFAULT_EXPANDED_MAX_HEIGHT = 500;
|
|
2028
|
+
var useStyle4 = (0, import_antd_style5.createStyles)(
|
|
2029
|
+
({ css }, { showShadow }) => ({
|
|
2030
|
+
collapse: css`
|
|
2031
|
+
.ant-collapse-header {
|
|
2032
|
+
position: relative;
|
|
2033
|
+
z-index: 1;
|
|
2034
|
+
transition: box-shadow 0.2s ease;
|
|
2035
|
+
box-shadow: ${showShadow ? "0 4px 8px -2px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)" : "none"};
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
.ant-collapse-content-box {
|
|
2039
|
+
padding-top: 0 !important;
|
|
2040
|
+
}
|
|
2041
|
+
`,
|
|
2042
|
+
contentContainer: css`
|
|
2043
|
+
position: relative;
|
|
2044
|
+
overflow: hidden;
|
|
2045
|
+
display: flex;
|
|
2046
|
+
flex-direction: column;
|
|
2047
|
+
justify-content: flex-end;
|
|
2048
|
+
|
|
2049
|
+
&.expanded {
|
|
2050
|
+
overflow: auto;
|
|
2051
|
+
display: block;
|
|
2052
|
+
}
|
|
2053
|
+
`,
|
|
2054
|
+
content: css`
|
|
2055
|
+
flex-shrink: 0;
|
|
2056
|
+
`,
|
|
2057
|
+
toggleButton: css`
|
|
2058
|
+
display: flex;
|
|
2059
|
+
align-items: center;
|
|
2060
|
+
justify-content: center;
|
|
2061
|
+
gap: 4px;
|
|
2062
|
+
padding: 8px 0;
|
|
2063
|
+
margin-top: 8px;
|
|
2064
|
+
border-top: 1px solid rgba(0, 0, 0, 0.06);
|
|
2065
|
+
cursor: pointer;
|
|
2066
|
+
color: #1890ff;
|
|
2067
|
+
font-size: 12px;
|
|
2068
|
+
user-select: none;
|
|
2069
|
+
transition: color 0.2s;
|
|
2070
|
+
|
|
2071
|
+
&:hover {
|
|
2072
|
+
color: #40a9ff;
|
|
2073
|
+
}
|
|
2074
|
+
`
|
|
2075
|
+
})
|
|
2076
|
+
);
|
|
2077
|
+
var ContentPreviewCollapse = ({
|
|
2078
|
+
panelKey,
|
|
2079
|
+
header,
|
|
2080
|
+
extra,
|
|
2081
|
+
expandIcon,
|
|
2082
|
+
children,
|
|
2083
|
+
collapsedMaxHeight = DEFAULT_COLLAPSED_MAX_HEIGHT,
|
|
2084
|
+
expandedMaxHeight = DEFAULT_EXPANDED_MAX_HEIGHT,
|
|
2085
|
+
defaultExpanded = true,
|
|
2086
|
+
minWidth = 400,
|
|
2087
|
+
showAllText = "Show all content",
|
|
2088
|
+
showLessText = "Show less"
|
|
2089
|
+
}) => {
|
|
2090
|
+
const [showFullContent, setShowFullContent] = (0, import_react11.useState)(false);
|
|
2091
|
+
const [isOverflowing, setIsOverflowing] = (0, import_react11.useState)(false);
|
|
2092
|
+
const contentRef = (0, import_react11.useRef)(null);
|
|
2093
|
+
const showShadow = isOverflowing && !showFullContent;
|
|
2094
|
+
const { styles, cx } = useStyle4({ showShadow });
|
|
2095
|
+
const checkOverflow = (0, import_react11.useCallback)(() => {
|
|
2096
|
+
if (contentRef.current) {
|
|
2097
|
+
const scrollHeight = contentRef.current.scrollHeight;
|
|
2098
|
+
setIsOverflowing(scrollHeight > collapsedMaxHeight);
|
|
2099
|
+
}
|
|
2100
|
+
}, [collapsedMaxHeight]);
|
|
2101
|
+
(0, import_react11.useEffect)(() => {
|
|
2102
|
+
const element = contentRef.current;
|
|
2103
|
+
if (!element) return;
|
|
2104
|
+
checkOverflow();
|
|
2105
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
2106
|
+
checkOverflow();
|
|
2107
|
+
});
|
|
2108
|
+
resizeObserver.observe(element);
|
|
2109
|
+
return () => {
|
|
2110
|
+
resizeObserver.disconnect();
|
|
2111
|
+
};
|
|
2112
|
+
}, [children, checkOverflow]);
|
|
2113
|
+
const handleToggleContent = (e) => {
|
|
2114
|
+
e.stopPropagation();
|
|
2115
|
+
setShowFullContent(!showFullContent);
|
|
2116
|
+
};
|
|
2117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2118
|
+
import_antd10.Collapse,
|
|
2119
|
+
{
|
|
2120
|
+
className: styles.collapse,
|
|
2121
|
+
size: "small",
|
|
2122
|
+
bordered: false,
|
|
2123
|
+
defaultActiveKey: defaultExpanded ? [panelKey] : [],
|
|
2124
|
+
expandIcon,
|
|
2125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2126
|
+
import_CollapsePanel3.default,
|
|
2127
|
+
{
|
|
2128
|
+
header,
|
|
2129
|
+
extra,
|
|
2130
|
+
style: { minWidth },
|
|
2131
|
+
children: [
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2133
|
+
"div",
|
|
2134
|
+
{
|
|
2135
|
+
className: cx(styles.contentContainer, showFullContent && "expanded"),
|
|
2136
|
+
style: {
|
|
2137
|
+
maxHeight: showFullContent ? expandedMaxHeight : collapsedMaxHeight
|
|
2138
|
+
},
|
|
2139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref: contentRef, className: styles.content, children })
|
|
2140
|
+
}
|
|
2141
|
+
),
|
|
2142
|
+
isOverflowing && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: styles.toggleButton, onClick: handleToggleContent, children: showFullContent ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons8.UpOutlined, { style: { fontSize: 10 } }),
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: showLessText })
|
|
2145
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2146
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons8.DownOutlined, { style: { fontSize: 10 } }),
|
|
2147
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: showAllText })
|
|
2148
|
+
] }) })
|
|
2149
|
+
]
|
|
2150
|
+
},
|
|
2151
|
+
panelKey
|
|
2152
|
+
)
|
|
2153
|
+
}
|
|
2154
|
+
);
|
|
2155
|
+
};
|
|
2156
|
+
|
|
2157
|
+
// src/components/GenUI/elements/WriteFile.tsx
|
|
2158
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2159
|
+
var { Text: Text6 } = import_antd11.Typography;
|
|
2160
|
+
var WriteFile = ({
|
|
2161
|
+
data,
|
|
2162
|
+
component_key,
|
|
2163
|
+
eventHandler,
|
|
2164
|
+
interactive = true
|
|
2165
|
+
}) => {
|
|
2166
|
+
const toolCallData = data;
|
|
2167
|
+
const { file_path, content } = toolCallData?.args || {};
|
|
2168
|
+
if (!toolCallData) {
|
|
2169
|
+
return null;
|
|
2170
|
+
}
|
|
2171
|
+
const expandIcon = () => getFileIcon(file_path);
|
|
2172
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_antd11.Space, { children: [
|
|
2173
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text6, { strong: true, children: "New" }),
|
|
2174
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text6, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
2175
|
+
] });
|
|
2176
|
+
const handleItemClick = (toolCallData2) => {
|
|
2177
|
+
eventHandler?.(
|
|
2178
|
+
"__open_side_app",
|
|
2179
|
+
{
|
|
2180
|
+
component_key: "file_content_diff_view",
|
|
2181
|
+
message: file_path,
|
|
2182
|
+
data: {
|
|
2183
|
+
old_code: "",
|
|
2184
|
+
new_code: content
|
|
2185
|
+
}
|
|
2186
|
+
},
|
|
2187
|
+
""
|
|
2188
|
+
);
|
|
2189
|
+
};
|
|
2190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2191
|
+
ContentPreviewCollapse,
|
|
2192
|
+
{
|
|
2193
|
+
panelKey: toolCallData.id,
|
|
2194
|
+
header,
|
|
2195
|
+
expandIcon,
|
|
2196
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2197
|
+
import_antd11.Button,
|
|
2198
|
+
{
|
|
2199
|
+
type: "link",
|
|
2200
|
+
size: "small",
|
|
2201
|
+
onClick: (evt) => {
|
|
2202
|
+
evt.stopPropagation();
|
|
2203
|
+
handleItemClick(toolCallData);
|
|
2204
|
+
},
|
|
2205
|
+
children: "Diff View"
|
|
2206
|
+
}
|
|
2207
|
+
),
|
|
2208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MDResponse, { content })
|
|
2209
|
+
}
|
|
2210
|
+
);
|
|
2211
|
+
};
|
|
2212
|
+
|
|
2213
|
+
// src/components/GenUI/elements/file_content_diff_view.tsx
|
|
2214
|
+
var import_react_diff_viewer = __toESM(require("@alexbruf/react-diff-viewer"));
|
|
2215
|
+
var import_react_diff_viewer2 = require("@alexbruf/react-diff-viewer/index.css");
|
|
2216
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2217
|
+
var FileContentDiffView = ({
|
|
2218
|
+
data,
|
|
2219
|
+
eventHandler,
|
|
2220
|
+
interactive = true,
|
|
2221
|
+
default_open_in_side_app = true
|
|
2222
|
+
}) => {
|
|
2223
|
+
const { old_code, new_code } = data;
|
|
2224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2225
|
+
import_react_diff_viewer.default,
|
|
2226
|
+
{
|
|
2227
|
+
oldValue: old_code,
|
|
2228
|
+
newValue: new_code,
|
|
2229
|
+
splitView: false
|
|
2230
|
+
}
|
|
2231
|
+
);
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2234
|
+
// src/components/GenUI/elements/EditFile.tsx
|
|
2235
|
+
var import_antd12 = require("antd");
|
|
2236
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2237
|
+
var { Text: Text7 } = import_antd12.Typography;
|
|
2238
|
+
var EditFile = ({
|
|
2239
|
+
data,
|
|
2240
|
+
component_key,
|
|
2241
|
+
eventHandler,
|
|
2242
|
+
interactive = true
|
|
2243
|
+
}) => {
|
|
2244
|
+
const toolCallData = data;
|
|
2245
|
+
const { file_path, new_string, old_string } = toolCallData?.args || {};
|
|
2246
|
+
if (!toolCallData) {
|
|
2247
|
+
return null;
|
|
2248
|
+
}
|
|
2249
|
+
const expandIcon = () => getFileIcon(file_path);
|
|
2250
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_antd12.Space, { children: [
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text7, { strong: true, children: "Edit" }),
|
|
2252
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text7, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
2253
|
+
] });
|
|
2254
|
+
const handleItemClick = (toolCallData2) => {
|
|
2255
|
+
eventHandler?.(
|
|
2256
|
+
"__open_side_app",
|
|
2257
|
+
{
|
|
2258
|
+
component_key: "file_content_diff_view",
|
|
2259
|
+
message: file_path,
|
|
2260
|
+
data: {
|
|
2261
|
+
old_code: old_string,
|
|
2262
|
+
new_code: new_string
|
|
2263
|
+
}
|
|
2264
|
+
},
|
|
2265
|
+
""
|
|
2266
|
+
);
|
|
2267
|
+
};
|
|
2268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2269
|
+
ContentPreviewCollapse,
|
|
2270
|
+
{
|
|
2271
|
+
panelKey: toolCallData.id,
|
|
2272
|
+
header,
|
|
2273
|
+
expandIcon,
|
|
2274
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2275
|
+
import_antd12.Button,
|
|
2276
|
+
{
|
|
2277
|
+
type: "link",
|
|
2278
|
+
size: "small",
|
|
2279
|
+
onClick: (evt) => {
|
|
2280
|
+
evt.stopPropagation();
|
|
2281
|
+
handleItemClick(toolCallData);
|
|
2282
|
+
},
|
|
2283
|
+
children: "Diff View"
|
|
2284
|
+
}
|
|
2285
|
+
),
|
|
2286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MDResponse, { content: new_string })
|
|
2287
|
+
}
|
|
2288
|
+
);
|
|
2289
|
+
};
|
|
2290
|
+
|
|
2291
|
+
// src/components/GenUI/elements/builtIns.tsx
|
|
1269
2292
|
var elements = {
|
|
1270
2293
|
action_show_attachments_uploader: {
|
|
1271
2294
|
card_view: () => null,
|
|
@@ -1288,8 +2311,31 @@ var elements = {
|
|
|
1288
2311
|
},
|
|
1289
2312
|
todo_list: {
|
|
1290
2313
|
card_view: Todo
|
|
2314
|
+
},
|
|
2315
|
+
write_todos: {
|
|
2316
|
+
card_view: WriteTodos
|
|
2317
|
+
},
|
|
2318
|
+
write_file: {
|
|
2319
|
+
card_view: WriteFile
|
|
2320
|
+
},
|
|
2321
|
+
edit_file: {
|
|
2322
|
+
card_view: EditFile
|
|
2323
|
+
},
|
|
2324
|
+
file_explorer: {
|
|
2325
|
+
card_view: () => null,
|
|
2326
|
+
side_app_view: FileExplorer
|
|
2327
|
+
},
|
|
2328
|
+
attachments: {
|
|
2329
|
+
card_view: AttachmentsCard,
|
|
2330
|
+
side_app_view: AttachmentsViewerSideApp
|
|
2331
|
+
},
|
|
2332
|
+
file_content_diff_view: {
|
|
2333
|
+
card_view: FileContentDiffView,
|
|
2334
|
+
side_app_view: FileContentDiffView
|
|
1291
2335
|
}
|
|
1292
2336
|
};
|
|
2337
|
+
|
|
2338
|
+
// src/components/GenUI/elements/index.tsx
|
|
1293
2339
|
var getElement = (language) => {
|
|
1294
2340
|
if (language && elements[language]) {
|
|
1295
2341
|
return elements[language];
|
|
@@ -1304,15 +2350,15 @@ var regsiterElement = (language, ElementMeta) => {
|
|
|
1304
2350
|
|
|
1305
2351
|
// src/components/GenUI/MDMermaid.tsx
|
|
1306
2352
|
var import_mermaid = __toESM(require("mermaid"));
|
|
1307
|
-
var
|
|
2353
|
+
var import_react12 = require("react");
|
|
1308
2354
|
var import_uuid = require("uuid");
|
|
1309
|
-
var
|
|
2355
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1310
2356
|
var MDMermaid = ({ children = [] }) => {
|
|
1311
|
-
const domId = (0,
|
|
2357
|
+
const domId = (0, import_react12.useRef)(`dom${(0, import_uuid.v4)()}`);
|
|
1312
2358
|
const code = String(children);
|
|
1313
|
-
const target = (0,
|
|
1314
|
-
const targetInternal = (0,
|
|
1315
|
-
(0,
|
|
2359
|
+
const target = (0, import_react12.useRef)(null);
|
|
2360
|
+
const targetInternal = (0, import_react12.useRef)(null);
|
|
2361
|
+
(0, import_react12.useEffect)(() => {
|
|
1316
2362
|
if (target.current && code) {
|
|
1317
2363
|
import_mermaid.default.initialize({
|
|
1318
2364
|
startOnLoad: true,
|
|
@@ -1374,13 +2420,13 @@ var MDMermaid = ({ children = [] }) => {
|
|
|
1374
2420
|
});
|
|
1375
2421
|
}
|
|
1376
2422
|
}, [code]);
|
|
1377
|
-
return /* @__PURE__ */ (0,
|
|
2423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { minWidth: 750 }, ref: target, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { id: domId.current, style: { display: "none" } }) });
|
|
1378
2424
|
};
|
|
1379
2425
|
|
|
1380
2426
|
// src/components/GenUI/MDResponse.tsx
|
|
1381
|
-
var
|
|
2427
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1382
2428
|
var SyntaxHighlighter = import_react_syntax_highlighter.Prism;
|
|
1383
|
-
var
|
|
2429
|
+
var useStyles2 = (0, import_antd_style6.createStyles)(({ token, css }) => ({
|
|
1384
2430
|
markdownTableContainer: css`
|
|
1385
2431
|
overflow-x: auto;
|
|
1386
2432
|
width: 100%;
|
|
@@ -1469,26 +2515,26 @@ var MDResponse = ({
|
|
|
1469
2515
|
noGenUI,
|
|
1470
2516
|
eventHandler
|
|
1471
2517
|
}) => {
|
|
1472
|
-
const { styles } =
|
|
1473
|
-
const config = (0,
|
|
2518
|
+
const { styles } = useStyles2();
|
|
2519
|
+
const config = (0, import_react13.useMemo)(
|
|
1474
2520
|
() => ({
|
|
1475
2521
|
components: {
|
|
1476
2522
|
a({ node, ...props }) {
|
|
1477
2523
|
if (embeddedLink) {
|
|
1478
|
-
return /* @__PURE__ */ (0,
|
|
1479
|
-
} else return /* @__PURE__ */ (0,
|
|
2524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IFrameCard, { src: props.href });
|
|
2525
|
+
} else return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("a", { ...props });
|
|
1480
2526
|
},
|
|
1481
2527
|
table({ node, ...props }) {
|
|
1482
|
-
return /* @__PURE__ */ (0,
|
|
2528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: styles.markdownTableContainer, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("table", { className: styles.markdownTable, ...props }) });
|
|
1483
2529
|
},
|
|
1484
2530
|
th({ node, ...props }) {
|
|
1485
|
-
return /* @__PURE__ */ (0,
|
|
2531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("th", { className: styles.markdownTh, ...props });
|
|
1486
2532
|
},
|
|
1487
2533
|
td({ node, ...props }) {
|
|
1488
|
-
return /* @__PURE__ */ (0,
|
|
2534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: styles.markdownTd, ...props });
|
|
1489
2535
|
},
|
|
1490
2536
|
tr({ node, ...props }) {
|
|
1491
|
-
return /* @__PURE__ */ (0,
|
|
2537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: styles.markdownTr, ...props });
|
|
1492
2538
|
},
|
|
1493
2539
|
code({ children, className, node, ...rest }) {
|
|
1494
2540
|
const match = /language-(\w+)/.exec(className || "");
|
|
@@ -1501,23 +2547,23 @@ var MDResponse = ({
|
|
|
1501
2547
|
childrenData = JSON.parse(children);
|
|
1502
2548
|
} catch (error) {
|
|
1503
2549
|
}
|
|
1504
|
-
return /* @__PURE__ */ (0,
|
|
2550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1505
2551
|
Element,
|
|
1506
2552
|
{
|
|
1507
2553
|
interactive,
|
|
1508
2554
|
component_key: language,
|
|
1509
2555
|
data: childrenData,
|
|
1510
|
-
eventHandler: (e, data,
|
|
1511
|
-
eventHandler?.(e, data,
|
|
2556
|
+
eventHandler: (e, data, message3, agent) => {
|
|
2557
|
+
eventHandler?.(e, data, message3, agent);
|
|
1512
2558
|
}
|
|
1513
2559
|
}
|
|
1514
2560
|
);
|
|
1515
2561
|
}
|
|
1516
2562
|
switch (language) {
|
|
1517
2563
|
case "mermaid":
|
|
1518
|
-
return /* @__PURE__ */ (0,
|
|
2564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MDMermaid, { children });
|
|
1519
2565
|
default:
|
|
1520
|
-
return /* @__PURE__ */ (0,
|
|
2566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1521
2567
|
SyntaxHighlighter,
|
|
1522
2568
|
{
|
|
1523
2569
|
...rest,
|
|
@@ -1529,7 +2575,7 @@ var MDResponse = ({
|
|
|
1529
2575
|
);
|
|
1530
2576
|
}
|
|
1531
2577
|
} else {
|
|
1532
|
-
return /* @__PURE__ */ (0,
|
|
2578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { ...rest, className, children });
|
|
1533
2579
|
}
|
|
1534
2580
|
}
|
|
1535
2581
|
},
|
|
@@ -1538,15 +2584,15 @@ var MDResponse = ({
|
|
|
1538
2584
|
}),
|
|
1539
2585
|
[userData, interactive, embeddedLink, styles]
|
|
1540
2586
|
);
|
|
1541
|
-
return /* @__PURE__ */ (0,
|
|
2587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: styles.markdownContainer, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_markdown.default, { ...config, children: content }) });
|
|
1542
2588
|
};
|
|
1543
2589
|
var MDViewFormItem = ({ value }) => {
|
|
1544
|
-
return /* @__PURE__ */ (0,
|
|
2590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MDResponse, { content: value || "" });
|
|
1545
2591
|
};
|
|
1546
2592
|
var IFrameCard = ({ src }) => {
|
|
1547
|
-
const containerRef = (0,
|
|
1548
|
-
const [width, setWidth] = (0,
|
|
1549
|
-
const [height, setHeight] = (0,
|
|
2593
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
2594
|
+
const [width, setWidth] = (0, import_react13.useState)("640px");
|
|
2595
|
+
const [height, setHeight] = (0, import_react13.useState)("320px");
|
|
1550
2596
|
const valid_images = [
|
|
1551
2597
|
"jpg",
|
|
1552
2598
|
"jpeg",
|
|
@@ -1563,29 +2609,29 @@ var IFrameCard = ({ src }) => {
|
|
|
1563
2609
|
}
|
|
1564
2610
|
const spitedSrc = src.split(".");
|
|
1565
2611
|
if (valid_images.includes(spitedSrc[spitedSrc.length - 1].toLowerCase())) {
|
|
1566
|
-
return /* @__PURE__ */ (0,
|
|
2612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src, style: { width: "100%" } }) });
|
|
1567
2613
|
} else {
|
|
1568
|
-
return /* @__PURE__ */ (0,
|
|
2614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("a", { href: src, target: "_black", children: src }) });
|
|
1569
2615
|
}
|
|
1570
2616
|
};
|
|
1571
2617
|
|
|
1572
2618
|
// src/components/Chat/Chating.tsx
|
|
1573
|
-
var
|
|
1574
|
-
var
|
|
1575
|
-
var
|
|
2619
|
+
var import_icons9 = require("@ant-design/icons");
|
|
2620
|
+
var import_x2 = require("@ant-design/x");
|
|
2621
|
+
var import_antd13 = require("antd");
|
|
1576
2622
|
var import_ErrorBoundary = __toESM(require("antd/es/alert/ErrorBoundary"));
|
|
1577
|
-
var
|
|
2623
|
+
var import_react14 = __toESM(require("react"));
|
|
1578
2624
|
var import_react_i18next = require("react-i18next");
|
|
1579
|
-
var
|
|
2625
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1580
2626
|
var LazyBubble = ({
|
|
1581
|
-
message:
|
|
2627
|
+
message: message3,
|
|
1582
2628
|
renderContent,
|
|
1583
2629
|
autoLoadRightPanel
|
|
1584
2630
|
}) => {
|
|
1585
|
-
const ref = (0,
|
|
1586
|
-
const [isVisible, setIsVisible] = (0,
|
|
1587
|
-
const [wasEverVisible, setWasEverVisible] = (0,
|
|
1588
|
-
(0,
|
|
2631
|
+
const ref = (0, import_react14.useRef)(null);
|
|
2632
|
+
const [isVisible, setIsVisible] = (0, import_react14.useState)(false);
|
|
2633
|
+
const [wasEverVisible, setWasEverVisible] = (0, import_react14.useState)(false);
|
|
2634
|
+
(0, import_react14.useEffect)(() => {
|
|
1589
2635
|
const observer = new IntersectionObserver(
|
|
1590
2636
|
([entry]) => {
|
|
1591
2637
|
const visible = entry.isIntersecting;
|
|
@@ -1605,22 +2651,22 @@ var LazyBubble = ({
|
|
|
1605
2651
|
}
|
|
1606
2652
|
};
|
|
1607
2653
|
}, [wasEverVisible]);
|
|
1608
|
-
(0,
|
|
2654
|
+
(0, import_react14.useEffect)(() => {
|
|
1609
2655
|
autoLoadRightPanel?.();
|
|
1610
2656
|
}, []);
|
|
1611
2657
|
const getPlaceholder = () => {
|
|
1612
|
-
const estimatedHeight =
|
|
1613
|
-
return /* @__PURE__ */ (0,
|
|
2658
|
+
const estimatedHeight = message3.content ? Math.min(100, message3.content.length / 5) : 100;
|
|
2659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
1614
2660
|
};
|
|
1615
|
-
return /* @__PURE__ */ (0,
|
|
2661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message3) : getPlaceholder() }) });
|
|
1616
2662
|
};
|
|
1617
|
-
var MemoizedBubbleList = (0,
|
|
2663
|
+
var MemoizedBubbleList = (0, import_react14.memo)(
|
|
1618
2664
|
({
|
|
1619
2665
|
items,
|
|
1620
2666
|
roles,
|
|
1621
2667
|
className
|
|
1622
|
-
}) => /* @__PURE__ */ (0,
|
|
1623
|
-
|
|
2668
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2669
|
+
import_x2.Bubble.List,
|
|
1624
2670
|
{
|
|
1625
2671
|
autoScroll: true,
|
|
1626
2672
|
items,
|
|
@@ -1652,15 +2698,17 @@ var Chating = ({
|
|
|
1652
2698
|
extra,
|
|
1653
2699
|
attachment_placeholder,
|
|
1654
2700
|
extraMeta = [],
|
|
1655
|
-
uploadAction = "/api/file_storage/upload?path=temp"
|
|
2701
|
+
uploadAction = "/api/file_storage/upload?path=temp",
|
|
2702
|
+
files,
|
|
2703
|
+
todos
|
|
1656
2704
|
}) => {
|
|
1657
2705
|
const { t } = (0, import_react_i18next.useTranslation)();
|
|
1658
|
-
const [content, setContent] = (0,
|
|
1659
|
-
const [attachedFiles, setAttachedFiles] = (0,
|
|
1660
|
-
const [headerOpen, setHeaderOpen] = (0,
|
|
1661
|
-
const attachmentsRef = (0,
|
|
1662
|
-
const senderRef =
|
|
1663
|
-
(0,
|
|
2706
|
+
const [content, setContent] = (0, import_react14.useState)("");
|
|
2707
|
+
const [attachedFiles, setAttachedFiles] = (0, import_react14.useState)([]);
|
|
2708
|
+
const [headerOpen, setHeaderOpen] = (0, import_react14.useState)(false);
|
|
2709
|
+
const attachmentsRef = (0, import_react14.useRef)(null);
|
|
2710
|
+
const senderRef = import_react14.default.useRef(null);
|
|
2711
|
+
(0, import_react14.useEffect)(() => {
|
|
1664
2712
|
regsiterElement("action_show_attachments_uploader", {
|
|
1665
2713
|
card_view: () => null,
|
|
1666
2714
|
action: (data) => {
|
|
@@ -1669,19 +2717,19 @@ var Chating = ({
|
|
|
1669
2717
|
}
|
|
1670
2718
|
});
|
|
1671
2719
|
}, []);
|
|
1672
|
-
const messageLengthRef = (0,
|
|
1673
|
-
(0,
|
|
2720
|
+
const messageLengthRef = (0, import_react14.useRef)(messages?.length ?? 0);
|
|
2721
|
+
(0, import_react14.useEffect)(() => {
|
|
1674
2722
|
if (messages?.length) {
|
|
1675
2723
|
messageLengthRef.current = messages?.length;
|
|
1676
2724
|
}
|
|
1677
2725
|
}, [messages?.length]);
|
|
1678
|
-
const renderContent = (0,
|
|
1679
|
-
(
|
|
1680
|
-
const { content: content2, files, id } =
|
|
2726
|
+
const renderContent = (0, import_react14.useCallback)(
|
|
2727
|
+
(message3) => {
|
|
2728
|
+
const { content: content2, files: files2, id } = message3;
|
|
1681
2729
|
try {
|
|
1682
2730
|
const json = JSON.parse(content2);
|
|
1683
2731
|
if (json.action && json.message) {
|
|
1684
|
-
return /* @__PURE__ */ (0,
|
|
2732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1685
2733
|
MDResponse,
|
|
1686
2734
|
{
|
|
1687
2735
|
content: json.message,
|
|
@@ -1691,13 +2739,13 @@ var Chating = ({
|
|
|
1691
2739
|
}
|
|
1692
2740
|
} catch (error2) {
|
|
1693
2741
|
}
|
|
1694
|
-
const tool_calls_md =
|
|
2742
|
+
const tool_calls_md = message3.tool_calls?.map((tool_call) => {
|
|
1695
2743
|
return `\`\`\`tool_call
|
|
1696
2744
|
${JSON.stringify(tool_call)}
|
|
1697
2745
|
\`\`\``;
|
|
1698
2746
|
}) || [];
|
|
1699
2747
|
const content_md = [content2, ...tool_calls_md].join("\n");
|
|
1700
|
-
return /* @__PURE__ */ (0,
|
|
2748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd13.Space, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1701
2749
|
MDResponse,
|
|
1702
2750
|
{
|
|
1703
2751
|
content: content_md,
|
|
@@ -1707,18 +2755,18 @@ ${JSON.stringify(tool_call)}
|
|
|
1707
2755
|
},
|
|
1708
2756
|
[handleMDResponseEvent]
|
|
1709
2757
|
);
|
|
1710
|
-
const items = (0,
|
|
1711
|
-
() => messages.map((
|
|
1712
|
-
key:
|
|
1713
|
-
role:
|
|
2758
|
+
const items = (0, import_react14.useMemo)(
|
|
2759
|
+
() => messages.map((message3, index) => ({
|
|
2760
|
+
key: message3.id,
|
|
2761
|
+
role: message3.role,
|
|
1714
2762
|
typing: false,
|
|
1715
|
-
content: /* @__PURE__ */ (0,
|
|
2763
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1716
2764
|
LazyBubble,
|
|
1717
2765
|
{
|
|
1718
|
-
message:
|
|
2766
|
+
message: message3,
|
|
1719
2767
|
renderContent,
|
|
1720
2768
|
autoLoadRightPanel: () => {
|
|
1721
|
-
const { content: content2, role } =
|
|
2769
|
+
const { content: content2, role } = message3;
|
|
1722
2770
|
const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
|
|
1723
2771
|
if (index === messages.length - 1 && isNewAddedMessage && role === "ai") {
|
|
1724
2772
|
try {
|
|
@@ -1762,13 +2810,13 @@ ${JSON.stringify(tool_call)}
|
|
|
1762
2810
|
const onSubmit = (nextContent) => {
|
|
1763
2811
|
if (!nextContent && attachedFiles.length === 0) return;
|
|
1764
2812
|
if (attachedFiles.filter((f) => f.status !== "done").length > 0) {
|
|
1765
|
-
|
|
2813
|
+
import_antd13.message.warning("\u6587\u4EF6\u8FD8\u5728\u4E0A\u4F20\u4E2D...");
|
|
1766
2814
|
return;
|
|
1767
2815
|
}
|
|
1768
2816
|
if (!nextContent && attachedFiles.length > 0) {
|
|
1769
2817
|
nextContent = default_submit_message || "\u8BB0\u8D26";
|
|
1770
2818
|
}
|
|
1771
|
-
const
|
|
2819
|
+
const files2 = attachedFiles.map(
|
|
1772
2820
|
(file) => isArchiveFile(file) ? {
|
|
1773
2821
|
name: file.response.zipFileName || file.response.rarFileName,
|
|
1774
2822
|
id: file.response.zipFileId || file.response.rarFileId,
|
|
@@ -1786,14 +2834,14 @@ ${JSON.stringify(tool_call)}
|
|
|
1786
2834
|
id: file.response.id
|
|
1787
2835
|
}
|
|
1788
2836
|
);
|
|
1789
|
-
const files_md =
|
|
2837
|
+
const files_md = files2.length > 0 ? [
|
|
1790
2838
|
"",
|
|
1791
2839
|
"\u6211\u5DF2\u7ECF\u63D0\u4EA4\u4E86\u4EE5\u4E0B\u6587\u4EF6\uFF1A",
|
|
1792
2840
|
"```attachments",
|
|
1793
|
-
JSON.stringify(
|
|
2841
|
+
JSON.stringify(files2),
|
|
1794
2842
|
"```"
|
|
1795
2843
|
].join("\n") : "";
|
|
1796
|
-
sendMessage({ input: { message: nextContent + files_md, files } });
|
|
2844
|
+
sendMessage({ input: { message: nextContent + files_md, files: files2 } });
|
|
1797
2845
|
setContent("");
|
|
1798
2846
|
setAttachedFiles([]);
|
|
1799
2847
|
setHeaderOpen(false);
|
|
@@ -1806,7 +2854,7 @@ ${JSON.stringify(tool_call)}
|
|
|
1806
2854
|
setHeaderOpen(true);
|
|
1807
2855
|
}
|
|
1808
2856
|
if (info.file?.response?.error || info.file.status === "error") {
|
|
1809
|
-
|
|
2857
|
+
import_antd13.message.error(
|
|
1810
2858
|
`${info.file.name} file upload failed.${info.file?.response?.message}`
|
|
1811
2859
|
);
|
|
1812
2860
|
}
|
|
@@ -1818,23 +2866,23 @@ ${JSON.stringify(tool_call)}
|
|
|
1818
2866
|
const beforeUpload = (file) => {
|
|
1819
2867
|
const isLessThan20MB = file.size / 1024 / 1024 < 20;
|
|
1820
2868
|
if (!isLessThan20MB) {
|
|
1821
|
-
|
|
2869
|
+
import_antd13.message.error(
|
|
1822
2870
|
`File must be smaller than 20MB! ${file.name} is too large.`
|
|
1823
2871
|
);
|
|
1824
2872
|
return false;
|
|
1825
2873
|
}
|
|
1826
2874
|
return true;
|
|
1827
2875
|
};
|
|
1828
|
-
const attachmentsNode = /* @__PURE__ */ (0,
|
|
1829
|
-
|
|
2876
|
+
const attachmentsNode = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd13.Badge, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2877
|
+
import_antd13.Button,
|
|
1830
2878
|
{
|
|
1831
2879
|
type: "text",
|
|
1832
|
-
icon: /* @__PURE__ */ (0,
|
|
2880
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons9.PaperClipOutlined, {}),
|
|
1833
2881
|
onClick: () => setHeaderOpen(!headerOpen)
|
|
1834
2882
|
}
|
|
1835
2883
|
) });
|
|
1836
|
-
const senderHeader = /* @__PURE__ */ (0,
|
|
1837
|
-
|
|
2884
|
+
const senderHeader = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2885
|
+
import_x2.Sender.Header,
|
|
1838
2886
|
{
|
|
1839
2887
|
title: "Attachments",
|
|
1840
2888
|
open: headerOpen,
|
|
@@ -1845,8 +2893,8 @@ ${JSON.stringify(tool_call)}
|
|
|
1845
2893
|
}
|
|
1846
2894
|
},
|
|
1847
2895
|
forceRender: true,
|
|
1848
|
-
children: /* @__PURE__ */ (0,
|
|
1849
|
-
|
|
2896
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2897
|
+
import_x2.Attachments,
|
|
1850
2898
|
{
|
|
1851
2899
|
ref: attachmentsRef,
|
|
1852
2900
|
items: attachedFiles,
|
|
@@ -1867,7 +2915,7 @@ ${JSON.stringify(tool_call)}
|
|
|
1867
2915
|
multiple: true,
|
|
1868
2916
|
maxCount: 10,
|
|
1869
2917
|
placeholder: (type) => ({
|
|
1870
|
-
icon: /* @__PURE__ */ (0,
|
|
2918
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons9.CloudUploadOutlined, {}),
|
|
1871
2919
|
title: "\u4E0A\u4F20\u6587\u4EF6",
|
|
1872
2920
|
description: attachment_placeholder
|
|
1873
2921
|
})
|
|
@@ -1899,7 +2947,7 @@ ${JSON.stringify(tool_call)}
|
|
|
1899
2947
|
}
|
|
1900
2948
|
}
|
|
1901
2949
|
};
|
|
1902
|
-
const extraMetaComponents = (0,
|
|
2950
|
+
const extraMetaComponents = (0, import_react14.useMemo)(() => {
|
|
1903
2951
|
if (extraMeta?.length > 0) {
|
|
1904
2952
|
return extraMeta.map((meta) => {
|
|
1905
2953
|
const Element = getElement(meta.id)?.card_view;
|
|
@@ -1908,13 +2956,13 @@ ${JSON.stringify(tool_call)}
|
|
|
1908
2956
|
try {
|
|
1909
2957
|
} catch (error2) {
|
|
1910
2958
|
}
|
|
1911
|
-
return /* @__PURE__ */ (0,
|
|
2959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1912
2960
|
Element,
|
|
1913
2961
|
{
|
|
1914
2962
|
component_key: meta.id,
|
|
1915
2963
|
data: childrenData,
|
|
1916
|
-
eventHandler: (e, data,
|
|
1917
|
-
handleMDResponseEvent?.(e, data,
|
|
2964
|
+
eventHandler: (e, data, message3, agent) => {
|
|
2965
|
+
handleMDResponseEvent?.(e, data, message3, agent);
|
|
1918
2966
|
}
|
|
1919
2967
|
},
|
|
1920
2968
|
meta.id
|
|
@@ -1924,20 +2972,98 @@ ${JSON.stringify(tool_call)}
|
|
|
1924
2972
|
}
|
|
1925
2973
|
return void 0;
|
|
1926
2974
|
}, [extraMeta]);
|
|
1927
|
-
return /* @__PURE__ */ (0,
|
|
1928
|
-
/* @__PURE__ */ (0,
|
|
1929
|
-
/* @__PURE__ */ (0,
|
|
1930
|
-
|
|
2975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2978
|
+
import_x2.Welcome,
|
|
1931
2979
|
{
|
|
1932
2980
|
style: { padding: 8 },
|
|
1933
2981
|
variant: "borderless",
|
|
1934
2982
|
description,
|
|
1935
|
-
icon: /* @__PURE__ */ (0,
|
|
2983
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd13.Avatar, { src: avatar || "/images/avatar.jpeg", size: 48 }),
|
|
1936
2984
|
title: name || "Fina",
|
|
1937
|
-
extra:
|
|
2985
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_antd13.Space, { children: [
|
|
2986
|
+
extra,
|
|
2987
|
+
todos && todos.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2988
|
+
import_antd13.Popover,
|
|
2989
|
+
{
|
|
2990
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { width: 400 }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2991
|
+
Todo,
|
|
2992
|
+
{
|
|
2993
|
+
data: todos,
|
|
2994
|
+
component_key: "header_todos",
|
|
2995
|
+
eventHandler: handleMDResponseEvent
|
|
2996
|
+
}
|
|
2997
|
+
) }),
|
|
2998
|
+
title: "Todos",
|
|
2999
|
+
trigger: "click",
|
|
3000
|
+
placement: "bottomRight",
|
|
3001
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3002
|
+
import_antd13.Tooltip,
|
|
3003
|
+
{
|
|
3004
|
+
title: `${todos.filter((item) => item.status === "completed").length} / ${todos.length} tasks completed`,
|
|
3005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { cursor: "pointer", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3006
|
+
import_antd13.Progress,
|
|
3007
|
+
{
|
|
3008
|
+
type: "circle",
|
|
3009
|
+
strokeColor: {
|
|
3010
|
+
"0%": "#91caff",
|
|
3011
|
+
"100%": "#003eb3"
|
|
3012
|
+
},
|
|
3013
|
+
percent: Math.round(
|
|
3014
|
+
todos.filter((item) => item.status === "completed").length / todos.length * 100
|
|
3015
|
+
),
|
|
3016
|
+
status: todos.some((item) => item.status === "in_progress") ? "active" : "normal",
|
|
3017
|
+
width: 30,
|
|
3018
|
+
format: () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3019
|
+
"div",
|
|
3020
|
+
{
|
|
3021
|
+
style: {
|
|
3022
|
+
display: "flex",
|
|
3023
|
+
flexDirection: "column",
|
|
3024
|
+
alignItems: "center",
|
|
3025
|
+
lineHeight: 1
|
|
3026
|
+
},
|
|
3027
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { style: { fontSize: 8 }, children: [
|
|
3028
|
+
todos.filter(
|
|
3029
|
+
(item) => item.status === "completed"
|
|
3030
|
+
).length,
|
|
3031
|
+
"/",
|
|
3032
|
+
todos.length
|
|
3033
|
+
] })
|
|
3034
|
+
}
|
|
3035
|
+
)
|
|
3036
|
+
}
|
|
3037
|
+
) })
|
|
3038
|
+
}
|
|
3039
|
+
)
|
|
3040
|
+
}
|
|
3041
|
+
),
|
|
3042
|
+
files && Object.keys(files).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd13.Tooltip, { title: "File Explorer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3043
|
+
import_antd13.Badge,
|
|
3044
|
+
{
|
|
3045
|
+
count: Object.keys(files).length,
|
|
3046
|
+
size: "small",
|
|
3047
|
+
color: "blue",
|
|
3048
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3049
|
+
import_antd13.Button,
|
|
3050
|
+
{
|
|
3051
|
+
type: "text",
|
|
3052
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons9.FileTextOutlined, {}),
|
|
3053
|
+
onClick: () => onOpenSidePanel({
|
|
3054
|
+
component_key: "file_explorer",
|
|
3055
|
+
message: "File Explorer",
|
|
3056
|
+
data: { files }
|
|
3057
|
+
})
|
|
3058
|
+
}
|
|
3059
|
+
)
|
|
3060
|
+
}
|
|
3061
|
+
) }),
|
|
3062
|
+
extraMetaComponents && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd13.Space, { align: "center", style: { marginRight: 16 }, children: extraMetaComponents })
|
|
3063
|
+
] })
|
|
1938
3064
|
}
|
|
1939
3065
|
),
|
|
1940
|
-
/* @__PURE__ */ (0,
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1941
3067
|
"div",
|
|
1942
3068
|
{
|
|
1943
3069
|
style: {
|
|
@@ -1946,17 +3072,17 @@ ${JSON.stringify(tool_call)}
|
|
|
1946
3072
|
}
|
|
1947
3073
|
)
|
|
1948
3074
|
] }),
|
|
1949
|
-
items.length > 0 ? /* @__PURE__ */ (0,
|
|
3075
|
+
items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1950
3076
|
MemoizedBubbleList,
|
|
1951
3077
|
{
|
|
1952
3078
|
items,
|
|
1953
3079
|
roles,
|
|
1954
3080
|
className: styles.messages
|
|
1955
3081
|
}
|
|
1956
|
-
) : /* @__PURE__ */ (0,
|
|
1957
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
1958
|
-
error && /* @__PURE__ */ (0,
|
|
1959
|
-
|
|
3082
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { flex: 1 } }),
|
|
3083
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_x2.Bubble, { loading: isLoading, variant: "borderless" }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_x2.Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
|
|
3084
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3085
|
+
import_antd13.Alert,
|
|
1960
3086
|
{
|
|
1961
3087
|
type: "error",
|
|
1962
3088
|
banner: true,
|
|
@@ -1965,8 +3091,8 @@ ${JSON.stringify(tool_call)}
|
|
|
1965
3091
|
message: `${error.message}`
|
|
1966
3092
|
}
|
|
1967
3093
|
) }),
|
|
1968
|
-
/* @__PURE__ */ (0,
|
|
1969
|
-
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3095
|
+
import_x2.Sender,
|
|
1970
3096
|
{
|
|
1971
3097
|
allowSpeech: true,
|
|
1972
3098
|
ref: senderRef,
|
|
@@ -1980,7 +3106,7 @@ ${JSON.stringify(tool_call)}
|
|
|
1980
3106
|
className: styles.sender,
|
|
1981
3107
|
actions: (ori, { components }) => {
|
|
1982
3108
|
const { SendButton, LoadingButton } = components;
|
|
1983
|
-
return /* @__PURE__ */ (0,
|
|
3109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd13.Flex, { justify: "space-between", align: "center", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LoadingButton, { type: "default" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1984
3110
|
SendButton,
|
|
1985
3111
|
{
|
|
1986
3112
|
type: "primary",
|
|
@@ -1989,8 +3115,8 @@ ${JSON.stringify(tool_call)}
|
|
|
1989
3115
|
}
|
|
1990
3116
|
) });
|
|
1991
3117
|
},
|
|
1992
|
-
onPasteFile: (_,
|
|
1993
|
-
Array.from(
|
|
3118
|
+
onPasteFile: (_, files2) => {
|
|
3119
|
+
Array.from(files2).forEach((file) => {
|
|
1994
3120
|
attachmentsRef.current?.upload(file);
|
|
1995
3121
|
});
|
|
1996
3122
|
setHeaderOpen(true);
|
|
@@ -2001,60 +3127,60 @@ ${JSON.stringify(tool_call)}
|
|
|
2001
3127
|
};
|
|
2002
3128
|
|
|
2003
3129
|
// src/components/Chat/ThinkingChain.tsx
|
|
2004
|
-
var
|
|
2005
|
-
var
|
|
2006
|
-
var
|
|
3130
|
+
var import_icons10 = require("@ant-design/icons");
|
|
3131
|
+
var import_x3 = require("@ant-design/x");
|
|
3132
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2007
3133
|
function getStatusIcon2(status) {
|
|
2008
3134
|
switch (status) {
|
|
2009
3135
|
case "success":
|
|
2010
|
-
return /* @__PURE__ */ (0,
|
|
3136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons10.CheckCircleOutlined, {});
|
|
2011
3137
|
case "error":
|
|
2012
|
-
return /* @__PURE__ */ (0,
|
|
3138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons10.InfoCircleOutlined, {});
|
|
2013
3139
|
case "pending":
|
|
2014
|
-
return /* @__PURE__ */ (0,
|
|
3140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons10.LoadingOutlined, {});
|
|
2015
3141
|
default:
|
|
2016
|
-
return /* @__PURE__ */ (0,
|
|
3142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons10.CheckCircleOutlined, {});
|
|
2017
3143
|
}
|
|
2018
3144
|
}
|
|
2019
|
-
var ThinkingChain = ({ message:
|
|
2020
|
-
const title =
|
|
3145
|
+
var ThinkingChain = ({ message: message3 }) => {
|
|
3146
|
+
const title = message3.name || message3.content.split("\n")[0];
|
|
2021
3147
|
const items = [
|
|
2022
3148
|
{
|
|
2023
|
-
key:
|
|
3149
|
+
key: message3.id,
|
|
2024
3150
|
title,
|
|
2025
|
-
content: /* @__PURE__ */ (0,
|
|
2026
|
-
status:
|
|
2027
|
-
icon: getStatusIcon2(
|
|
3151
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MDResponse, { content: message3.content }),
|
|
3152
|
+
status: message3.status,
|
|
3153
|
+
icon: getStatusIcon2(message3.status)
|
|
2028
3154
|
}
|
|
2029
3155
|
];
|
|
2030
|
-
return /* @__PURE__ */ (0,
|
|
2031
|
-
|
|
3156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3157
|
+
import_x3.ThoughtChain,
|
|
2032
3158
|
{
|
|
2033
3159
|
items,
|
|
2034
|
-
collapsible:
|
|
3160
|
+
collapsible: message3.status === "success" ? true : false,
|
|
2035
3161
|
size: "small"
|
|
2036
3162
|
}
|
|
2037
3163
|
);
|
|
2038
3164
|
};
|
|
2039
|
-
var ThinkingChainGroup = ({ message:
|
|
3165
|
+
var ThinkingChainGroup = ({ message: message3 }) => {
|
|
2040
3166
|
const title = "\u601D\u8003\u8FC7\u7A0B";
|
|
2041
|
-
const children =
|
|
3167
|
+
const children = message3.items?.map((item) => ({
|
|
2042
3168
|
key: item.id,
|
|
2043
3169
|
title: item.name || item.content.split("\n")[0],
|
|
2044
|
-
content: /* @__PURE__ */ (0,
|
|
3170
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MDResponse, { content: item.content }),
|
|
2045
3171
|
status: item.status,
|
|
2046
3172
|
icon: getStatusIcon2(item.status)
|
|
2047
3173
|
}));
|
|
2048
|
-
return /* @__PURE__ */ (0,
|
|
3174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_x3.ThoughtChain, { items: children, collapsible: true, size: "small" });
|
|
2049
3175
|
};
|
|
2050
3176
|
|
|
2051
3177
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
2052
|
-
var
|
|
2053
|
-
var
|
|
2054
|
-
var
|
|
2055
|
-
var
|
|
2056
|
-
var
|
|
2057
|
-
var
|
|
3178
|
+
var import_icons11 = require("@ant-design/icons");
|
|
3179
|
+
var import_antd14 = require("antd");
|
|
3180
|
+
var import_antd_style7 = require("antd-style");
|
|
3181
|
+
var import_react15 = require("react");
|
|
3182
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3183
|
+
var useStyle5 = (0, import_antd_style7.createStyles)(({ token, css }) => {
|
|
2058
3184
|
return {
|
|
2059
3185
|
tabContainer: css`
|
|
2060
3186
|
.ant-tabs-content-holder {
|
|
@@ -2073,9 +3199,9 @@ var useStyle4 = (0, import_antd_style5.createStyles)(({ token, css }) => {
|
|
|
2073
3199
|
};
|
|
2074
3200
|
});
|
|
2075
3201
|
var EmptySideAppView = ({ component_key, data }) => {
|
|
2076
|
-
return /* @__PURE__ */ (0,
|
|
2077
|
-
/* @__PURE__ */ (0,
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
3202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3203
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: "\u672A\u627E\u5230\u5BF9\u5E94\u7684\u7EC4\u4EF6\u89C6\u56FE" }),
|
|
3204
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
|
|
2079
3205
|
] });
|
|
2080
3206
|
};
|
|
2081
3207
|
var SideAppViewBrowser = ({
|
|
@@ -2084,10 +3210,10 @@ var SideAppViewBrowser = ({
|
|
|
2084
3210
|
onClose,
|
|
2085
3211
|
onChangeSize
|
|
2086
3212
|
}) => {
|
|
2087
|
-
const { styles } =
|
|
2088
|
-
const [activeKey, setActiveKey] = (0,
|
|
2089
|
-
const [currentSize, setCurrentSize] = (0,
|
|
2090
|
-
const [items, setItems] = (0,
|
|
3213
|
+
const { styles } = useStyle5();
|
|
3214
|
+
const [activeKey, setActiveKey] = (0, import_react15.useState)(JSON.stringify(open_uri));
|
|
3215
|
+
const [currentSize, setCurrentSize] = (0, import_react15.useState)(open_uri.size || "large");
|
|
3216
|
+
const [items, setItems] = (0, import_react15.useState)([]);
|
|
2091
3217
|
const add = (key, label, children) => {
|
|
2092
3218
|
const newActiveKey = key;
|
|
2093
3219
|
const newPanes = [...items];
|
|
@@ -2123,7 +3249,7 @@ var SideAppViewBrowser = ({
|
|
|
2123
3249
|
remove(targetKey);
|
|
2124
3250
|
}
|
|
2125
3251
|
};
|
|
2126
|
-
(0,
|
|
3252
|
+
(0, import_react15.useEffect)(() => {
|
|
2127
3253
|
const SideAppView = getElement(open_uri.component_key).side_app_view || EmptySideAppView;
|
|
2128
3254
|
const key = JSON.stringify(open_uri);
|
|
2129
3255
|
if (items.find((item) => item.key === key)) {
|
|
@@ -2133,7 +3259,7 @@ var SideAppViewBrowser = ({
|
|
|
2133
3259
|
add(
|
|
2134
3260
|
key,
|
|
2135
3261
|
open_uri.message || open_uri.data.message || "\u672A\u547D\u540D",
|
|
2136
|
-
/* @__PURE__ */ (0,
|
|
3262
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2137
3263
|
SideAppView,
|
|
2138
3264
|
{
|
|
2139
3265
|
component_key: open_uri.component_key,
|
|
@@ -2143,7 +3269,7 @@ var SideAppViewBrowser = ({
|
|
|
2143
3269
|
)
|
|
2144
3270
|
);
|
|
2145
3271
|
}, [open_uri]);
|
|
2146
|
-
(0,
|
|
3272
|
+
(0, import_react15.useEffect)(() => {
|
|
2147
3273
|
if (open_uri.size && open_uri.size !== currentSize) {
|
|
2148
3274
|
setCurrentSize(open_uri.size);
|
|
2149
3275
|
}
|
|
@@ -2181,26 +3307,26 @@ var SideAppViewBrowser = ({
|
|
|
2181
3307
|
const getSizeIcon = (size) => {
|
|
2182
3308
|
switch (size) {
|
|
2183
3309
|
case "middle":
|
|
2184
|
-
return /* @__PURE__ */ (0,
|
|
3310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_icons11.CompressOutlined, {});
|
|
2185
3311
|
case "large":
|
|
2186
|
-
return /* @__PURE__ */ (0,
|
|
3312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_icons11.ExpandOutlined, {});
|
|
2187
3313
|
case "full":
|
|
2188
|
-
return /* @__PURE__ */ (0,
|
|
3314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_icons11.FullscreenOutlined, {});
|
|
2189
3315
|
default:
|
|
2190
|
-
return /* @__PURE__ */ (0,
|
|
3316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_icons11.ExpandOutlined, {});
|
|
2191
3317
|
}
|
|
2192
3318
|
};
|
|
2193
|
-
return /* @__PURE__ */ (0,
|
|
2194
|
-
|
|
3319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3320
|
+
import_antd14.Tabs,
|
|
2195
3321
|
{
|
|
2196
3322
|
className: styles.tabContainer,
|
|
2197
3323
|
type: "editable-card",
|
|
2198
3324
|
style: { height: "100%" },
|
|
2199
3325
|
hideAdd: true,
|
|
2200
3326
|
tabBarExtraContent: {
|
|
2201
|
-
right: /* @__PURE__ */ (0,
|
|
2202
|
-
/* @__PURE__ */ (0,
|
|
2203
|
-
|
|
3327
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", gap: "4px" }, children: [
|
|
3328
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3329
|
+
import_antd14.Button,
|
|
2204
3330
|
{
|
|
2205
3331
|
style: { margin: "8px 0" },
|
|
2206
3332
|
size: "large",
|
|
@@ -2210,13 +3336,13 @@ var SideAppViewBrowser = ({
|
|
|
2210
3336
|
title: `\u5F53\u524D\u5C3A\u5BF8: ${getSizeLabel(currentSize)}, \u70B9\u51FB\u5207\u6362`
|
|
2211
3337
|
}
|
|
2212
3338
|
),
|
|
2213
|
-
/* @__PURE__ */ (0,
|
|
2214
|
-
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3340
|
+
import_antd14.Button,
|
|
2215
3341
|
{
|
|
2216
3342
|
style: { margin: "8px 0" },
|
|
2217
3343
|
size: "large",
|
|
2218
3344
|
type: "text",
|
|
2219
|
-
icon: /* @__PURE__ */ (0,
|
|
3345
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_icons11.CloseOutlined, {}),
|
|
2220
3346
|
onClick: () => {
|
|
2221
3347
|
onClose();
|
|
2222
3348
|
}
|
|
@@ -2233,15 +3359,16 @@ var SideAppViewBrowser = ({
|
|
|
2233
3359
|
};
|
|
2234
3360
|
|
|
2235
3361
|
// src/components/Chat/context.tsx
|
|
2236
|
-
var
|
|
2237
|
-
var chatContext = (0,
|
|
2238
|
-
eventHandler: (component_key, data,
|
|
3362
|
+
var import_react16 = require("react");
|
|
3363
|
+
var chatContext = (0, import_react16.createContext)({
|
|
3364
|
+
eventHandler: (component_key, data, message3) => {
|
|
2239
3365
|
}
|
|
2240
3366
|
});
|
|
2241
3367
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2242
3368
|
0 && (module.exports = {
|
|
2243
3369
|
AxiomLatticeProvider,
|
|
2244
3370
|
Chating,
|
|
3371
|
+
FileExplorer,
|
|
2245
3372
|
MDMermaid,
|
|
2246
3373
|
MDResponse,
|
|
2247
3374
|
MDViewFormItem,
|
|
@@ -2249,7 +3376,6 @@ var chatContext = (0, import_react12.createContext)({
|
|
|
2249
3376
|
ThinkingChain,
|
|
2250
3377
|
ThinkingChainGroup,
|
|
2251
3378
|
chatContext,
|
|
2252
|
-
elements,
|
|
2253
3379
|
getElement,
|
|
2254
3380
|
regsiterElement,
|
|
2255
3381
|
useAgentGraph,
|