@zero-library/chat-copilot 1.0.20 → 3.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/dist/index.cjs.js +222 -227
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +87 -84
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.esm.js +224 -229
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
var icons = require('@ant-design/icons');
|
|
4
4
|
var xV2 = require('@ant-design/x-v2');
|
|
5
5
|
var common = require('@zero-library/common');
|
|
6
|
-
var dayjs = require('dayjs');
|
|
7
6
|
var antd = require('antd');
|
|
8
7
|
var React7 = require('react');
|
|
9
8
|
var valtio = require('valtio');
|
|
10
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
10
|
var classNames2 = require('classnames');
|
|
11
|
+
var dayjs = require('dayjs');
|
|
12
12
|
var InfiniteScroll = require('react-infinite-scroll-component');
|
|
13
13
|
var xCard = require('@ant-design/x-card');
|
|
14
14
|
require('@ant-design/x-markdown/themes/light.css');
|
|
@@ -17,39 +17,14 @@ var Latex = require('@ant-design/x-markdown/plugins/Latex');
|
|
|
17
17
|
|
|
18
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
|
|
20
|
-
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
21
20
|
var React7__default = /*#__PURE__*/_interopDefault(React7);
|
|
22
21
|
var classNames2__default = /*#__PURE__*/_interopDefault(classNames2);
|
|
22
|
+
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
23
23
|
var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
|
|
24
24
|
var XMarkdown__default = /*#__PURE__*/_interopDefault(XMarkdown);
|
|
25
25
|
var Latex__default = /*#__PURE__*/_interopDefault(Latex);
|
|
26
26
|
|
|
27
27
|
// src/components/Attachments.tsx
|
|
28
|
-
var classifyTime = (timestamp) => {
|
|
29
|
-
const now = dayjs__default.default();
|
|
30
|
-
const target = dayjs__default.default(timestamp);
|
|
31
|
-
if (target.isSame(now, "day")) {
|
|
32
|
-
return "\u4ECA\u5929";
|
|
33
|
-
}
|
|
34
|
-
const diffInDays = now.diff(target, "day");
|
|
35
|
-
if (diffInDays < 7) {
|
|
36
|
-
return "\u6700\u8FD1 7 \u5929";
|
|
37
|
-
} else if (diffInDays < 30) {
|
|
38
|
-
return "\u6700\u8FD1 30 \u5929";
|
|
39
|
-
} else if (diffInDays < 180) {
|
|
40
|
-
return "\u6700\u8FD1\u534A\u5E74";
|
|
41
|
-
} else {
|
|
42
|
-
return "\u66F4\u65E9";
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var getChatSocketUrl = (baseURL, params) => {
|
|
46
|
-
return common.buildUrlParams(params, common.getWebSocketUrl(`${baseURL}/ws`), "comma");
|
|
47
|
-
};
|
|
48
|
-
var isDocument = (fileName) => {
|
|
49
|
-
if (!fileName) return false;
|
|
50
|
-
const ext = common.getFileSuffixName(fileName);
|
|
51
|
-
return ["pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "csv"].includes(ext);
|
|
52
|
-
};
|
|
53
28
|
var ChatContext = React7.createContext(null);
|
|
54
29
|
function ChatProvider({ store, children }) {
|
|
55
30
|
return React7__default.default.createElement(ChatContext.Provider, { value: store }, children);
|
|
@@ -65,12 +40,7 @@ function useChatStore() {
|
|
|
65
40
|
// src/components/styles.module.less
|
|
66
41
|
var styles_module_default = {
|
|
67
42
|
chatAttachments: "styles_module_chatAttachments",
|
|
68
|
-
chatSender: "styles_module_chatSender"
|
|
69
|
-
runStartedNode: "styles_module_runStartedNode",
|
|
70
|
-
chatQuoteMsg: "styles_module_chatQuoteMsg",
|
|
71
|
-
quoteTooltip: "styles_module_quoteTooltip",
|
|
72
|
-
quoteTooltipContainer: "styles_module_quoteTooltipContainer"
|
|
73
|
-
};
|
|
43
|
+
chatSender: "styles_module_chatSender"};
|
|
74
44
|
var Attachments_default = React7.forwardRef(({ fileUpload, fileUploadConfig, fileList = [], onChange, extraParams }, ref) => {
|
|
75
45
|
const { message: message2 } = antd.App.useApp();
|
|
76
46
|
const chatStore = useChatStore();
|
|
@@ -158,21 +128,7 @@ var Attachments_default = React7.forwardRef(({ fileUpload, fileUploadConfig, fil
|
|
|
158
128
|
const uploadedFile = data[0];
|
|
159
129
|
let previewUrl = uploadedFile.id;
|
|
160
130
|
if (uploadedFile.conversationId && uploadedFile.path) {
|
|
161
|
-
|
|
162
|
-
previewUrl = chatStore.config.services.request.getPreviewUrl(
|
|
163
|
-
agentState.agentInfo.id,
|
|
164
|
-
uploadedFile.conversationId,
|
|
165
|
-
uploadedFile.path,
|
|
166
|
-
"preview"
|
|
167
|
-
);
|
|
168
|
-
} else {
|
|
169
|
-
previewUrl = chatStore.config.services.request.getPreviewUrl(
|
|
170
|
-
agentState.agentInfo.id,
|
|
171
|
-
uploadedFile.conversationId,
|
|
172
|
-
uploadedFile.path,
|
|
173
|
-
"download"
|
|
174
|
-
);
|
|
175
|
-
}
|
|
131
|
+
previewUrl = chatStore.config.services.request.getPreviewUrl(agentState.agentInfo.id, uploadedFile.conversationId, uploadedFile.path);
|
|
176
132
|
}
|
|
177
133
|
setAttachedFiles(
|
|
178
134
|
getAttachedFiles().map((f) => {
|
|
@@ -356,6 +312,26 @@ var ChatSender_default = React7.forwardRef(
|
|
|
356
312
|
);
|
|
357
313
|
}
|
|
358
314
|
);
|
|
315
|
+
var classifyTime = (timestamp) => {
|
|
316
|
+
const now = dayjs__default.default();
|
|
317
|
+
const target = dayjs__default.default(timestamp);
|
|
318
|
+
if (target.isSame(now, "day")) {
|
|
319
|
+
return "\u4ECA\u5929";
|
|
320
|
+
}
|
|
321
|
+
const diffInDays = now.diff(target, "day");
|
|
322
|
+
if (diffInDays < 7) {
|
|
323
|
+
return "\u6700\u8FD1 7 \u5929";
|
|
324
|
+
} else if (diffInDays < 30) {
|
|
325
|
+
return "\u6700\u8FD1 30 \u5929";
|
|
326
|
+
} else if (diffInDays < 180) {
|
|
327
|
+
return "\u6700\u8FD1\u534A\u5E74";
|
|
328
|
+
} else {
|
|
329
|
+
return "\u66F4\u65E9";
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
var getChatSocketUrl = (baseURL, params) => {
|
|
333
|
+
return common.buildUrlParams(params, common.getWebSocketUrl(`${baseURL}/ws`), "comma");
|
|
334
|
+
};
|
|
359
335
|
|
|
360
336
|
// src/core/constants.ts
|
|
361
337
|
var CONV_MODE = {
|
|
@@ -395,9 +371,6 @@ var createChatService = (request, config) => {
|
|
|
395
371
|
const cancelMessage = (executionId) => {
|
|
396
372
|
return request.post(`/agents/executions/${executionId}/cancel`);
|
|
397
373
|
};
|
|
398
|
-
const getRecommendQuestions = (params) => {
|
|
399
|
-
return request.post(`/agents/conversations/${params.conversationId}/messages/recommend`, params);
|
|
400
|
-
};
|
|
401
374
|
const getAgentUserInput = (agentId) => {
|
|
402
375
|
return request.get(`/agents/${agentId}/workflow/params`);
|
|
403
376
|
};
|
|
@@ -413,8 +386,8 @@ var createChatService = (request, config) => {
|
|
|
413
386
|
signal
|
|
414
387
|
});
|
|
415
388
|
};
|
|
416
|
-
const getPreviewUrl = (agentId, conversationId, path
|
|
417
|
-
return `${config?.baseURL}/agents/${agentId}/${conversationId}/files
|
|
389
|
+
const getPreviewUrl = (agentId, conversationId, path) => {
|
|
390
|
+
return `${config?.baseURL}/agents/${agentId}/${conversationId}/files/download?path=${path}&${TOKEN_KEY}=${tokenManager.get()}`;
|
|
418
391
|
};
|
|
419
392
|
const docQuery = (params) => {
|
|
420
393
|
return request.get(`/library/cloud/document?${params}`);
|
|
@@ -440,7 +413,6 @@ var createChatService = (request, config) => {
|
|
|
440
413
|
fetchMessages,
|
|
441
414
|
sendMessageStream,
|
|
442
415
|
cancelMessage,
|
|
443
|
-
getRecommendQuestions,
|
|
444
416
|
getAgentUserInput,
|
|
445
417
|
feedbackUpdate,
|
|
446
418
|
chatUpload,
|
|
@@ -1166,7 +1138,8 @@ function createChatStore() {
|
|
|
1166
1138
|
const acceptMessage = async (newMessage) => {
|
|
1167
1139
|
const conversationId = newMessage.conversationId;
|
|
1168
1140
|
if (!conversation.messages[conversationId]?.message) return;
|
|
1169
|
-
const
|
|
1141
|
+
const isActive = conversation.active.id === conversationId;
|
|
1142
|
+
const canProceed = await config.hooks?.onBeforeAcceptMessage?.(newMessage, isActive);
|
|
1170
1143
|
if (canProceed === false) {
|
|
1171
1144
|
throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
|
|
1172
1145
|
}
|
|
@@ -1401,7 +1374,6 @@ var styles_module_default2 = {
|
|
|
1401
1374
|
chatTitle: "styles_module_chatTitle",
|
|
1402
1375
|
defaultLogo: "styles_module_defaultLogo",
|
|
1403
1376
|
chatHeaderBtnGroup: "styles_module_chatHeaderBtnGroup",
|
|
1404
|
-
popover: "styles_module_popover",
|
|
1405
1377
|
conversationListPanel: "styles_module_conversationListPanel",
|
|
1406
1378
|
createConversationButton: "styles_module_createConversationButton",
|
|
1407
1379
|
conversations: "styles_module_conversations",
|
|
@@ -1409,10 +1381,6 @@ var styles_module_default2 = {
|
|
|
1409
1381
|
chatWelcome: "styles_module_chatWelcome",
|
|
1410
1382
|
promptItem: "styles_module_promptItem",
|
|
1411
1383
|
bubbleList: "styles_module_bubbleList",
|
|
1412
|
-
resourceBtn: "styles_module_resourceBtn",
|
|
1413
|
-
divider: "styles_module_divider",
|
|
1414
|
-
count: "styles_module_count",
|
|
1415
|
-
resourceBtnActive: "styles_module_resourceBtnActive",
|
|
1416
1384
|
logoArea: "styles_module_logoArea",
|
|
1417
1385
|
logoContainer: "styles_module_logoContainer",
|
|
1418
1386
|
staticHalo: "styles_module_staticHalo",
|
|
@@ -1422,33 +1390,7 @@ var styles_module_default2 = {
|
|
|
1422
1390
|
gradientText: "styles_module_gradientText",
|
|
1423
1391
|
greetingSubtitle: "styles_module_greetingSubtitle",
|
|
1424
1392
|
senderReferenceHeaderTitle: "styles_module_senderReferenceHeaderTitle",
|
|
1425
|
-
senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
|
|
1426
|
-
customModal: "styles_module_customModal",
|
|
1427
|
-
layout: "styles_module_layout",
|
|
1428
|
-
sider: "styles_module_sider",
|
|
1429
|
-
categoryName: "styles_module_categoryName",
|
|
1430
|
-
siderContent: "styles_module_siderContent",
|
|
1431
|
-
categoryItem: "styles_module_categoryItem",
|
|
1432
|
-
categoryActive: "styles_module_categoryActive",
|
|
1433
|
-
roundCheckbox: "styles_module_roundCheckbox",
|
|
1434
|
-
content: "styles_module_content",
|
|
1435
|
-
searchInput: "styles_module_searchInput",
|
|
1436
|
-
selectedCount: "styles_module_selectedCount",
|
|
1437
|
-
tagsArea: "styles_module_tagsArea",
|
|
1438
|
-
tagContainer: "styles_module_tagContainer",
|
|
1439
|
-
tag: "styles_module_tag",
|
|
1440
|
-
expandBtnWrapper: "styles_module_expandBtnWrapper",
|
|
1441
|
-
expandBtn: "styles_module_expandBtn",
|
|
1442
|
-
tagsExpanded: "styles_module_tagsExpanded",
|
|
1443
|
-
listArea: "styles_module_listArea",
|
|
1444
|
-
listInner: "styles_module_listInner",
|
|
1445
|
-
listItem: "styles_module_listItem",
|
|
1446
|
-
listItemSelected: "styles_module_listItemSelected",
|
|
1447
|
-
itemIconWrapper: "styles_module_itemIconWrapper",
|
|
1448
|
-
itemInfo: "styles_module_itemInfo",
|
|
1449
|
-
itemDesc: "styles_module_itemDesc",
|
|
1450
|
-
footer: "styles_module_footer",
|
|
1451
|
-
titleContainer: "styles_module_titleContainer"
|
|
1393
|
+
senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
|
|
1452
1394
|
};
|
|
1453
1395
|
var ConversationList_default = () => {
|
|
1454
1396
|
const chatStore = useChatStore();
|
|
@@ -1498,13 +1440,48 @@ var ConversationList_default = () => {
|
|
|
1498
1440
|
}
|
|
1499
1441
|
) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) });
|
|
1500
1442
|
};
|
|
1443
|
+
|
|
1444
|
+
// src/ui/common/FeatureComponents/style.module.less
|
|
1445
|
+
var style_module_default = {
|
|
1446
|
+
popover: "style_module_popover",
|
|
1447
|
+
resourceBtn: "style_module_resourceBtn",
|
|
1448
|
+
divider: "style_module_divider",
|
|
1449
|
+
count: "style_module_count",
|
|
1450
|
+
resourceBtnActive: "style_module_resourceBtnActive",
|
|
1451
|
+
customModal: "style_module_customModal",
|
|
1452
|
+
layout: "style_module_layout",
|
|
1453
|
+
sider: "style_module_sider",
|
|
1454
|
+
categoryName: "style_module_categoryName",
|
|
1455
|
+
siderContent: "style_module_siderContent",
|
|
1456
|
+
categoryItem: "style_module_categoryItem",
|
|
1457
|
+
categoryActive: "style_module_categoryActive",
|
|
1458
|
+
roundCheckbox: "style_module_roundCheckbox",
|
|
1459
|
+
content: "style_module_content",
|
|
1460
|
+
searchInput: "style_module_searchInput",
|
|
1461
|
+
selectedCount: "style_module_selectedCount",
|
|
1462
|
+
tagsArea: "style_module_tagsArea",
|
|
1463
|
+
tagContainer: "style_module_tagContainer",
|
|
1464
|
+
tag: "style_module_tag",
|
|
1465
|
+
expandBtnWrapper: "style_module_expandBtnWrapper",
|
|
1466
|
+
expandBtn: "style_module_expandBtn",
|
|
1467
|
+
tagsExpanded: "style_module_tagsExpanded",
|
|
1468
|
+
listArea: "style_module_listArea",
|
|
1469
|
+
listInner: "style_module_listInner",
|
|
1470
|
+
listItem: "style_module_listItem",
|
|
1471
|
+
listItemSelected: "style_module_listItemSelected",
|
|
1472
|
+
itemIconWrapper: "style_module_itemIconWrapper",
|
|
1473
|
+
itemInfo: "style_module_itemInfo",
|
|
1474
|
+
itemDesc: "style_module_itemDesc",
|
|
1475
|
+
footer: "style_module_footer",
|
|
1476
|
+
titleContainer: "style_module_titleContainer"
|
|
1477
|
+
};
|
|
1501
1478
|
var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
1502
1479
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1503
1480
|
antd.Popover,
|
|
1504
1481
|
{
|
|
1505
1482
|
getPopupContainer: (e) => e,
|
|
1506
1483
|
placement: "bottom",
|
|
1507
|
-
classNames: { container:
|
|
1484
|
+
classNames: { container: style_module_default.popover },
|
|
1508
1485
|
content: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}),
|
|
1509
1486
|
trigger: ["click"],
|
|
1510
1487
|
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u5386\u53F2\u4F1A\u8BDD", size: "large", type: "text", icon: icon?.() || /* @__PURE__ */ jsxRuntime.jsx(icons.CommentOutlined, {}), ...rest })
|
|
@@ -1834,7 +1811,7 @@ function renderMiniChart(spec, opts) {
|
|
|
1834
1811
|
] }) });
|
|
1835
1812
|
}
|
|
1836
1813
|
|
|
1837
|
-
// src/components/CustomComponents/
|
|
1814
|
+
// src/components/CustomComponents/A2uiRuntime/components/artifacts/export-utils.ts
|
|
1838
1815
|
function sanitizeFileName(name) {
|
|
1839
1816
|
return name.replace(/[\\/:*?"<>|\u0000-\u001F]/g, "_").replace(/\s+/g, " ").trim();
|
|
1840
1817
|
}
|
|
@@ -2188,15 +2165,7 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2188
2165
|
}
|
|
2189
2166
|
};
|
|
2190
2167
|
const getPreviewFileUrl = (href) => {
|
|
2191
|
-
|
|
2192
|
-
const path = url.searchParams.get("path") || url.pathname;
|
|
2193
|
-
const fileName = getLinkFileName(href);
|
|
2194
|
-
console.log(path, fileName);
|
|
2195
|
-
if (isDocument(fileName)) {
|
|
2196
|
-
return chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, path, "preview");
|
|
2197
|
-
} else {
|
|
2198
|
-
return chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, path, "download");
|
|
2199
|
-
}
|
|
2168
|
+
return common.buildUrlParams({ [TOKEN_KEY]: tokenManager.get() || "" }, href);
|
|
2200
2169
|
};
|
|
2201
2170
|
const handlePreviewLink = (href) => {
|
|
2202
2171
|
const fileName = getLinkFileName(href);
|
|
@@ -2207,6 +2176,15 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2207
2176
|
suffix
|
|
2208
2177
|
});
|
|
2209
2178
|
};
|
|
2179
|
+
const handlePathToUrl = (href) => {
|
|
2180
|
+
const fileName = getLinkFileName(href);
|
|
2181
|
+
const suffix = common.getFileSuffixName(fileName);
|
|
2182
|
+
chatStore.setPreview({
|
|
2183
|
+
fileUrl: chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, href),
|
|
2184
|
+
fileName,
|
|
2185
|
+
suffix
|
|
2186
|
+
});
|
|
2187
|
+
};
|
|
2210
2188
|
const handleClick = (e) => {
|
|
2211
2189
|
rest.onClick?.(e);
|
|
2212
2190
|
const href = rest.href || e.currentTarget.href;
|
|
@@ -2218,6 +2196,10 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2218
2196
|
handlePreviewLink(href);
|
|
2219
2197
|
return;
|
|
2220
2198
|
}
|
|
2199
|
+
if (String(rest.href).startsWith("/workspace")) {
|
|
2200
|
+
handlePathToUrl(href);
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2221
2203
|
window.open(href, "_blank");
|
|
2222
2204
|
};
|
|
2223
2205
|
return /* @__PURE__ */ jsxRuntime.jsx("a", { ...rest, onClick: handleClick, children: data });
|
|
@@ -2718,7 +2700,7 @@ var A2uiComponents = {
|
|
|
2718
2700
|
ReportViewer
|
|
2719
2701
|
};
|
|
2720
2702
|
|
|
2721
|
-
// src/components/CustomComponents/
|
|
2703
|
+
// src/components/CustomComponents/A2uiRuntime/controller/meta.ts
|
|
2722
2704
|
function readProp(current, props, key) {
|
|
2723
2705
|
return current[key] ?? props?.[key];
|
|
2724
2706
|
}
|
|
@@ -2824,7 +2806,7 @@ function collectActionDisplayMeta(commands, surfaceId, context) {
|
|
|
2824
2806
|
return Object.keys(labels).length || Object.keys(valueLabels).length ? { labels, valueLabels } : null;
|
|
2825
2807
|
}
|
|
2826
2808
|
|
|
2827
|
-
// src/components/CustomComponents/
|
|
2809
|
+
// src/components/CustomComponents/A2uiRuntime/controller/action.ts
|
|
2828
2810
|
function extractPathFromRef2(value) {
|
|
2829
2811
|
if (typeof value === "string") {
|
|
2830
2812
|
if (value.startsWith("$bind:/")) return value.slice("$bind:".length);
|
|
@@ -2962,7 +2944,7 @@ function buildDispatchContext(surfaceId, rawContext, commands) {
|
|
|
2962
2944
|
};
|
|
2963
2945
|
}
|
|
2964
2946
|
|
|
2965
|
-
// src/components/CustomComponents/
|
|
2947
|
+
// src/components/CustomComponents/A2uiRuntime/controller/visibility.ts
|
|
2966
2948
|
function extractSurfaceId(cmd) {
|
|
2967
2949
|
if (!cmd || typeof cmd !== "object") return "";
|
|
2968
2950
|
return cmd.createSurface?.surfaceId ?? cmd.updateComponents?.surfaceId ?? cmd.updateDataModel?.surfaceId ?? cmd.deleteSurface?.surfaceId ?? "";
|
|
@@ -2983,7 +2965,7 @@ function resolveVisibleSurfaceIds(commands, dismissedSurfaceIds = []) {
|
|
|
2983
2965
|
return Array.from(states.entries()).filter(([sid, st]) => !st.deleted && !dismissedSurfaceIds.includes(sid)).map(([sid]) => sid);
|
|
2984
2966
|
}
|
|
2985
2967
|
|
|
2986
|
-
// src/components/CustomComponents/
|
|
2968
|
+
// src/components/CustomComponents/A2uiRuntime/controller/wizard.ts
|
|
2987
2969
|
function readString(obj, ...keys) {
|
|
2988
2970
|
for (const k of keys) {
|
|
2989
2971
|
const v = obj?.[k];
|
|
@@ -3192,7 +3174,7 @@ function buildWizardUpdateComponentsCommand(schema, stepId) {
|
|
|
3192
3174
|
};
|
|
3193
3175
|
}
|
|
3194
3176
|
|
|
3195
|
-
// src/components/CustomComponents/
|
|
3177
|
+
// src/components/CustomComponents/A2uiRuntime/controller/runtime.ts
|
|
3196
3178
|
function createA2uiRuntimeState() {
|
|
3197
3179
|
return {
|
|
3198
3180
|
processedMessageCursors: [],
|
|
@@ -3392,7 +3374,7 @@ function selectA2uiRuntimeView(state, dismissedSurfaceIds) {
|
|
|
3392
3374
|
};
|
|
3393
3375
|
}
|
|
3394
3376
|
|
|
3395
|
-
// src/components/CustomComponents/
|
|
3377
|
+
// src/components/CustomComponents/A2uiRuntime/controller/index.ts
|
|
3396
3378
|
function applyA2uiRuntimeEffects(effects) {
|
|
3397
3379
|
effects.forEach((effect) => {
|
|
3398
3380
|
if (effect.type === "reset-model-store") {
|
|
@@ -3451,7 +3433,7 @@ var A2uiRuntimeContext = React7__default.default.createContext({
|
|
|
3451
3433
|
surfaceIdsByMessageIndex: {}
|
|
3452
3434
|
});
|
|
3453
3435
|
|
|
3454
|
-
// src/components/CustomComponents/
|
|
3436
|
+
// src/components/CustomComponents/A2uiRuntime/renderer/useA2uiRuntimeView.ts
|
|
3455
3437
|
function useA2uiRuntimeView() {
|
|
3456
3438
|
return React7__default.default.useContext(A2uiRuntimeContext);
|
|
3457
3439
|
}
|
|
@@ -3462,7 +3444,7 @@ function A2uiMessageCards({ messageIndex }) {
|
|
|
3462
3444
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: surfaceIds.map((surfaceId) => /* @__PURE__ */ jsxRuntime.jsx(XCard.Card, { id: surfaceId }, surfaceId)) });
|
|
3463
3445
|
}
|
|
3464
3446
|
|
|
3465
|
-
// src/components/CustomComponents/
|
|
3447
|
+
// src/components/CustomComponents/A2uiRuntime/renderer/protocol.ts
|
|
3466
3448
|
function isSubmitLikeActionName2(name) {
|
|
3467
3449
|
const normalized = String(name || "").trim();
|
|
3468
3450
|
return normalized === "submit" || normalized === "confirm" || normalized.startsWith("submit_") || normalized.endsWith(".confirm");
|
|
@@ -3754,8 +3736,87 @@ function A2uiRuntimeProvider({ messages, children }) {
|
|
|
3754
3736
|
function A2uiRenderer(props) {
|
|
3755
3737
|
return /* @__PURE__ */ jsxRuntime.jsx(A2uiRuntimeProvider, { ...props });
|
|
3756
3738
|
}
|
|
3739
|
+
var FilesNode = React7__default.default.memo(({ item }) => {
|
|
3740
|
+
const chatStore = useChatStore();
|
|
3741
|
+
const configState = valtio.useSnapshot(chatStore.config);
|
|
3742
|
+
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
3743
|
+
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
3744
|
+
const fileItems = React7.useMemo(() => {
|
|
3745
|
+
return (item.files || []).map((file) => {
|
|
3746
|
+
const previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path);
|
|
3747
|
+
let fileType = "file";
|
|
3748
|
+
const ext = file.ext?.toLowerCase() || "";
|
|
3749
|
+
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
|
|
3750
|
+
fileType = "image";
|
|
3751
|
+
} else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
|
|
3752
|
+
fileType = "video";
|
|
3753
|
+
} else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
|
|
3754
|
+
fileType = "audio";
|
|
3755
|
+
}
|
|
3756
|
+
return {
|
|
3757
|
+
...file,
|
|
3758
|
+
src: previewUrl,
|
|
3759
|
+
type: fileType,
|
|
3760
|
+
onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
|
|
3761
|
+
};
|
|
3762
|
+
});
|
|
3763
|
+
}, [item.files]);
|
|
3764
|
+
return /* @__PURE__ */ jsxRuntime.jsx(xV2.FileCard.List, { items: fileItems });
|
|
3765
|
+
});
|
|
3766
|
+
var QuoteMsgNode = React7__default.default.memo(({ quoteMsg, role }) => {
|
|
3767
|
+
if (!quoteMsg || !quoteMsg.messageContent) return null;
|
|
3768
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3769
|
+
xV2.Bubble,
|
|
3770
|
+
{
|
|
3771
|
+
placement: role.placement,
|
|
3772
|
+
variant: "borderless",
|
|
3773
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3774
|
+
antd.Tooltip,
|
|
3775
|
+
{
|
|
3776
|
+
arrow: false,
|
|
3777
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
|
|
3778
|
+
getPopupContainer: (node) => node,
|
|
3779
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
3780
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
3781
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis-2", style: {
|
|
3782
|
+
color: "#666",
|
|
3783
|
+
background: "rgba(0,0,0,0.04)",
|
|
3784
|
+
padding: "2px 8px",
|
|
3785
|
+
borderRadius: "4px",
|
|
3786
|
+
fontSize: "12px",
|
|
3787
|
+
cursor: "pointer"
|
|
3788
|
+
}, children: quoteMsg.messageContent })
|
|
3789
|
+
] })
|
|
3790
|
+
}
|
|
3791
|
+
) })
|
|
3792
|
+
}
|
|
3793
|
+
);
|
|
3794
|
+
});
|
|
3795
|
+
var RunStartedNode = React7__default.default.memo(({ loading }) => {
|
|
3796
|
+
if (!loading) return null;
|
|
3797
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", style: { minHeight: 24 }, children: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, { style: { color: "#1677ff" } }) });
|
|
3798
|
+
});
|
|
3799
|
+
function QuestionSummary({ content }) {
|
|
3800
|
+
const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
|
|
3801
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
|
|
3802
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
|
|
3803
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
|
|
3804
|
+
] });
|
|
3805
|
+
}
|
|
3806
|
+
var TextNode = React7__default.default.memo(
|
|
3807
|
+
({ item, role, customComponents, message: message2 }) => {
|
|
3808
|
+
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
3809
|
+
if (typeof content === "string" && content.startsWith("Question:")) {
|
|
3810
|
+
return /* @__PURE__ */ jsxRuntime.jsx(QuestionSummary, { content });
|
|
3811
|
+
}
|
|
3812
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3813
|
+
!!item.reasoningContent && /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
|
|
3814
|
+
!!content && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content })
|
|
3815
|
+
] });
|
|
3816
|
+
}
|
|
3817
|
+
);
|
|
3757
3818
|
|
|
3758
|
-
// src/components/CustomComponents/
|
|
3819
|
+
// src/components/CustomComponents/ToolRenders/index.module.less
|
|
3759
3820
|
var index_module_default = {
|
|
3760
3821
|
iconContainer: "index_module_iconContainer",
|
|
3761
3822
|
toolName: "index_module_toolName",
|
|
@@ -3966,70 +4027,6 @@ var ToolCallItem = ({ item }) => {
|
|
|
3966
4027
|
};
|
|
3967
4028
|
var tool_call_item_default = ToolCallItem;
|
|
3968
4029
|
var RENDERABLE_MESSAGE_TYPES = ["runStarted", "toolCall", "toolResult", "text", "stepError", "files", "plan"];
|
|
3969
|
-
function QuestionSummary({ content }) {
|
|
3970
|
-
const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
|
|
3971
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
|
|
3972
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
|
|
3973
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
|
|
3974
|
-
] });
|
|
3975
|
-
}
|
|
3976
|
-
var RunStartedNode = React7__default.default.memo(({ loading }) => {
|
|
3977
|
-
if (!loading) return null;
|
|
3978
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", className: styles_module_default.runStartedNode, children: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, { style: { color: "#1677ff" } }) });
|
|
3979
|
-
});
|
|
3980
|
-
var ToolCallNode = React7__default.default.memo(({ item }) => {
|
|
3981
|
-
return /* @__PURE__ */ jsxRuntime.jsx(tool_call_item_default, { item });
|
|
3982
|
-
});
|
|
3983
|
-
var TextNode = React7__default.default.memo(
|
|
3984
|
-
({ item, role, customComponents, message: message2 }) => {
|
|
3985
|
-
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
3986
|
-
if (typeof content === "string" && content.startsWith("Question:")) {
|
|
3987
|
-
return /* @__PURE__ */ jsxRuntime.jsx(QuestionSummary, { content });
|
|
3988
|
-
}
|
|
3989
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3990
|
-
!!item.reasoningContent && /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
|
|
3991
|
-
!!content && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content })
|
|
3992
|
-
] });
|
|
3993
|
-
}
|
|
3994
|
-
);
|
|
3995
|
-
var StepErrorNode = React7__default.default.memo(
|
|
3996
|
-
({ item, customComponents, message: message2 }) => {
|
|
3997
|
-
if (!item.errorMessage) return null;
|
|
3998
|
-
return /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage });
|
|
3999
|
-
}
|
|
4000
|
-
);
|
|
4001
|
-
var FilesNode = React7__default.default.memo(({ item }) => {
|
|
4002
|
-
const chatStore = useChatStore();
|
|
4003
|
-
const configState = valtio.useSnapshot(chatStore.config);
|
|
4004
|
-
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
4005
|
-
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
4006
|
-
const fileItems = React7.useMemo(() => {
|
|
4007
|
-
return (item.files || []).map((file) => {
|
|
4008
|
-
let previewUrl = file.id;
|
|
4009
|
-
if (isDocument(file.name)) {
|
|
4010
|
-
previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path, "preview");
|
|
4011
|
-
} else {
|
|
4012
|
-
previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path, "download");
|
|
4013
|
-
}
|
|
4014
|
-
let fileType = "file";
|
|
4015
|
-
const ext = file.ext?.toLowerCase() || "";
|
|
4016
|
-
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
|
|
4017
|
-
fileType = "image";
|
|
4018
|
-
} else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
|
|
4019
|
-
fileType = "video";
|
|
4020
|
-
} else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
|
|
4021
|
-
fileType = "audio";
|
|
4022
|
-
}
|
|
4023
|
-
return {
|
|
4024
|
-
...file,
|
|
4025
|
-
src: previewUrl,
|
|
4026
|
-
type: fileType,
|
|
4027
|
-
onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
|
|
4028
|
-
};
|
|
4029
|
-
});
|
|
4030
|
-
}, [item.files]);
|
|
4031
|
-
return /* @__PURE__ */ jsxRuntime.jsx(xV2.FileCard.List, { items: fileItems });
|
|
4032
|
-
});
|
|
4033
4030
|
var MessageRender_default = React7__default.default.memo(({ role, message: message2, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
4034
4031
|
const content = React7.useMemo(() => {
|
|
4035
4032
|
return (message2.content || []).filter((item) => {
|
|
@@ -4069,9 +4066,9 @@ var MessageRender_default = React7__default.default.memo(({ role, message: messa
|
|
|
4069
4066
|
variant: item.type === "files" ? "borderless" : void 0,
|
|
4070
4067
|
content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4071
4068
|
item.type === "runStarted" && /* @__PURE__ */ jsxRuntime.jsx(RunStartedNode, { loading }, `flow-start-${index}`),
|
|
4072
|
-
(item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4073
|
-
item.type === "text" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4074
|
-
item.type === "stepError" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4069
|
+
(item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsxRuntime.jsx(tool_call_item_default, { item }, `tool-call-${item.toolCallId || index}`),
|
|
4070
|
+
item.type === "text" && /* @__PURE__ */ jsxRuntime.jsx(TextNode, { item, role: message2.role, customComponents, message: message2 }, `message-${index}`),
|
|
4071
|
+
item.type === "stepError" && (item.errorMessage ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage }) : null),
|
|
4075
4072
|
item.type === "files" && /* @__PURE__ */ jsxRuntime.jsx(FilesNode, { item }, `files-${index}`),
|
|
4076
4073
|
item.type === "plan" && /* @__PURE__ */ jsxRuntime.jsx(A2uiPlanNode, { item }, `plan-${index}`)
|
|
4077
4074
|
] })
|
|
@@ -4079,30 +4076,7 @@ var MessageRender_default = React7__default.default.memo(({ role, message: messa
|
|
|
4079
4076
|
`message-${index}`
|
|
4080
4077
|
);
|
|
4081
4078
|
}),
|
|
4082
|
-
quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4083
|
-
xV2.Bubble,
|
|
4084
|
-
{
|
|
4085
|
-
className: styles_module_default.chatQuoteMsg,
|
|
4086
|
-
placement: role.placement,
|
|
4087
|
-
variant: "borderless",
|
|
4088
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, children: quoteMsg.messageContent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4089
|
-
antd.Tooltip,
|
|
4090
|
-
{
|
|
4091
|
-
arrow: false,
|
|
4092
|
-
classNames: {
|
|
4093
|
-
root: styles_module_default.quoteTooltip,
|
|
4094
|
-
container: `${styles_module_default.quoteTooltipContainer} scroll-fade-in`
|
|
4095
|
-
},
|
|
4096
|
-
title: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
|
|
4097
|
-
getPopupContainer: (node) => node,
|
|
4098
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
4099
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
4100
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis-2", children: quoteMsg.messageContent })
|
|
4101
|
-
] })
|
|
4102
|
-
}
|
|
4103
|
-
) })
|
|
4104
|
-
}
|
|
4105
|
-
),
|
|
4079
|
+
quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(QuoteMsgNode, { quoteMsg, role }),
|
|
4106
4080
|
messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex }) : null
|
|
4107
4081
|
] });
|
|
4108
4082
|
});
|
|
@@ -4491,43 +4465,43 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4491
4465
|
antd.Modal,
|
|
4492
4466
|
{
|
|
4493
4467
|
open,
|
|
4494
|
-
className:
|
|
4468
|
+
className: style_module_default.customModal,
|
|
4495
4469
|
onCancel,
|
|
4496
4470
|
closeIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}),
|
|
4497
4471
|
width: 960,
|
|
4498
4472
|
centered: true,
|
|
4499
4473
|
destroyOnHidden: true,
|
|
4500
|
-
title: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className:
|
|
4501
|
-
footer: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4502
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Layout, { className:
|
|
4503
|
-
/* @__PURE__ */ jsxRuntime.jsx(Sider, { width: 220, className:
|
|
4474
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: style_module_default.titleContainer, children: /* @__PURE__ */ jsxRuntime.jsx(Title2, { level: 5, children: title }) }),
|
|
4475
|
+
footer: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.footer, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", onClick: handleConfirm, children: "\u786E\u8BA4" }) }),
|
|
4476
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Layout, { className: style_module_default.layout, children: [
|
|
4477
|
+
/* @__PURE__ */ jsxRuntime.jsx(Sider, { width: 220, className: style_module_default.sider, theme: "light", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.siderContent, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 4, vertical: true, children: categories.map((cat) => {
|
|
4504
4478
|
const isChecked = selectedCategoryIds.includes(cat.id);
|
|
4505
4479
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4506
4480
|
antd.Flex,
|
|
4507
4481
|
{
|
|
4508
|
-
className: classNames2__default.default(
|
|
4482
|
+
className: classNames2__default.default(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
|
|
4509
4483
|
onClick: () => handleCategoryChange(cat.id, !isChecked),
|
|
4510
4484
|
children: [
|
|
4511
4485
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4512
4486
|
antd.Checkbox,
|
|
4513
4487
|
{
|
|
4514
4488
|
checked: isChecked,
|
|
4515
|
-
className: cat.id === ALL_CATEGORY_ID ?
|
|
4489
|
+
className: cat.id === ALL_CATEGORY_ID ? style_module_default.roundCheckbox : "",
|
|
4516
4490
|
onClick: (e) => e.stopPropagation(),
|
|
4517
4491
|
onChange: (e) => handleCategoryChange(cat.id, e.target.checked)
|
|
4518
4492
|
}
|
|
4519
4493
|
),
|
|
4520
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
4494
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: style_module_default.categoryName, children: cat.name })
|
|
4521
4495
|
]
|
|
4522
4496
|
},
|
|
4523
4497
|
cat.id
|
|
4524
4498
|
);
|
|
4525
4499
|
}) }) }) }),
|
|
4526
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Content, { className:
|
|
4500
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Content, { className: style_module_default.content, children: [
|
|
4527
4501
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", justify: "space-between", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4528
4502
|
antd.Input,
|
|
4529
4503
|
{
|
|
4530
|
-
className:
|
|
4504
|
+
className: style_module_default.searchInput,
|
|
4531
4505
|
placeholder: `\u641C\u7D22${isSkill ? "\u6280\u80FD" : "\u77E5\u8BC6\u5E93"}\u540D\u79F0`,
|
|
4532
4506
|
prefix: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, { style: { color: token.colorTextQuaternary } }),
|
|
4533
4507
|
value: searchText,
|
|
@@ -4536,12 +4510,12 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4536
4510
|
autoFocus: true
|
|
4537
4511
|
}
|
|
4538
4512
|
) }),
|
|
4539
|
-
selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(Text4, { type: "secondary", className:
|
|
4513
|
+
selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(Text4, { type: "secondary", className: style_module_default.selectedCount, children: [
|
|
4540
4514
|
"\u5DF2\u9009 ",
|
|
4541
4515
|
selectedIds.length
|
|
4542
4516
|
] }) }),
|
|
4543
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(
|
|
4544
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className:
|
|
4517
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
|
|
4518
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
|
|
4545
4519
|
selectedIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4546
4520
|
antd.Tag,
|
|
4547
4521
|
{
|
|
@@ -4550,36 +4524,36 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4550
4524
|
e.preventDefault();
|
|
4551
4525
|
toggleItemSelection(id);
|
|
4552
4526
|
},
|
|
4553
|
-
className:
|
|
4527
|
+
className: style_module_default.tag,
|
|
4554
4528
|
children: getDisplayName(id)
|
|
4555
4529
|
},
|
|
4556
4530
|
id
|
|
4557
4531
|
)),
|
|
4558
|
-
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className:
|
|
4532
|
+
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(false), children: [
|
|
4559
4533
|
"\u6536\u8D77 ",
|
|
4560
4534
|
/* @__PURE__ */ jsxRuntime.jsx(icons.UpOutlined, {})
|
|
4561
4535
|
] })
|
|
4562
4536
|
] }),
|
|
4563
|
-
showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4537
|
+
showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.expandBtnWrapper, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(true), children: [
|
|
4564
4538
|
"\u5C55\u5F00 ",
|
|
4565
4539
|
/* @__PURE__ */ jsxRuntime.jsx(icons.DownOutlined, {})
|
|
4566
4540
|
] }) })
|
|
4567
4541
|
] }),
|
|
4568
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4542
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.listArea, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.listInner, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, vertical: true, children: filteredResources.length > 0 ? filteredResources.map((item) => {
|
|
4569
4543
|
const isSelected = selectedIds.includes(item.id);
|
|
4570
4544
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4571
4545
|
"div",
|
|
4572
4546
|
{
|
|
4573
|
-
className: classNames2__default.default(
|
|
4547
|
+
className: classNames2__default.default(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
|
|
4574
4548
|
onClick: () => toggleItemSelection(item.id),
|
|
4575
4549
|
children: [
|
|
4576
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4577
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
4550
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: iconType }) }),
|
|
4551
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: style_module_default.itemInfo, children: [
|
|
4578
4552
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", children: [
|
|
4579
4553
|
/* @__PURE__ */ jsxRuntime.jsx(Text4, { strong: true, children: getDisplayName(item.id) }),
|
|
4580
4554
|
isSelected && /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: token.colorPrimary, variant: "outlined", children: "\u5DF2\u6DFB\u52A0" })
|
|
4581
4555
|
] }),
|
|
4582
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text4, { type: "secondary", className:
|
|
4556
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text4, { type: "secondary", className: style_module_default.itemDesc, children: item.description || "\u6682\u65E0\u63CF\u8FF0" })
|
|
4583
4557
|
] })
|
|
4584
4558
|
]
|
|
4585
4559
|
},
|
|
@@ -4598,12 +4572,12 @@ var KnowledgeBtn_default = ({}) => {
|
|
|
4598
4572
|
const [modalOpen, setModalOpen] = React7.useState(false);
|
|
4599
4573
|
const knowledgeCount = conversationState.active.spec?.knowledge?.items?.length ?? 0;
|
|
4600
4574
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4601
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
4575
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
4602
4576
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-remark" }),
|
|
4603
4577
|
/* @__PURE__ */ jsxRuntime.jsx(Text5, { children: "\u77E5\u8BC6\u5E93" }),
|
|
4604
4578
|
knowledgeCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4605
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className:
|
|
4606
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className:
|
|
4579
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className: style_module_default.divider }),
|
|
4580
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: style_module_default.count, children: knowledgeCount })
|
|
4607
4581
|
] })
|
|
4608
4582
|
] }),
|
|
4609
4583
|
modalOpen && /* @__PURE__ */ jsxRuntime.jsx(ResourceSelectorModal_default, { open: modalOpen, type: "knowledge", onCancel: () => setModalOpen(false) })
|
|
@@ -4637,6 +4611,17 @@ var ModelSelect_default = ({}) => {
|
|
|
4637
4611
|
}))
|
|
4638
4612
|
}));
|
|
4639
4613
|
const selectedModelValue = modelOptions.find((item) => item.value === agentState.model.providerName)?.options.find((item) => item.value === agentState.model.modelName)?.value || void 0;
|
|
4614
|
+
React7.useEffect(() => {
|
|
4615
|
+
if (!selectedModelValue && models.length > 0 && models[0].models?.length > 0) {
|
|
4616
|
+
const firstProvider = models[0];
|
|
4617
|
+
const firstModel = firstProvider.models[0];
|
|
4618
|
+
chatStore.setAgentModel({
|
|
4619
|
+
...agentState.model,
|
|
4620
|
+
modelName: firstModel.modelName,
|
|
4621
|
+
providerName: firstProvider.providerName
|
|
4622
|
+
});
|
|
4623
|
+
}
|
|
4624
|
+
}, [selectedModelValue, models, agentState.model, chatStore]);
|
|
4640
4625
|
const handleModelChange = (_, option) => {
|
|
4641
4626
|
if (Array.isArray(option) || !option || !("providerName" in option)) return;
|
|
4642
4627
|
chatStore.setAgentModel({
|
|
@@ -4689,7 +4674,7 @@ var ReasonBtn_default = ({}) => {
|
|
|
4689
4674
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4690
4675
|
"div",
|
|
4691
4676
|
{
|
|
4692
|
-
className: classNames2__default.default(
|
|
4677
|
+
className: classNames2__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
|
|
4693
4678
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
4694
4679
|
children: [
|
|
4695
4680
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
|
|
@@ -4705,12 +4690,12 @@ var SkillBtn_default = ({}) => {
|
|
|
4705
4690
|
const [modalOpen, setModalOpen] = React7.useState(false);
|
|
4706
4691
|
const skillsCount = conversationState.active.spec?.skills?.items?.length ?? 0;
|
|
4707
4692
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4708
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
4693
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
4709
4694
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-skill" }),
|
|
4710
4695
|
/* @__PURE__ */ jsxRuntime.jsx(Text7, { children: "\u6280\u80FD" }),
|
|
4711
4696
|
skillsCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4712
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className:
|
|
4713
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className:
|
|
4697
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className: style_module_default.divider }),
|
|
4698
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: style_module_default.count, children: skillsCount })
|
|
4714
4699
|
] })
|
|
4715
4700
|
] }),
|
|
4716
4701
|
modalOpen && /* @__PURE__ */ jsxRuntime.jsx(ResourceSelectorModal_default, { open: modalOpen, type: "skill", onCancel: () => setModalOpen(false) })
|
|
@@ -4868,6 +4853,16 @@ var ChatMainPanel = React7.memo(
|
|
|
4868
4853
|
var ChatMainPanel_default = ChatMainPanel;
|
|
4869
4854
|
var ChatPreviewPanel = React7.memo(({ file }) => {
|
|
4870
4855
|
const chatStore = useChatStore();
|
|
4856
|
+
const preview = React7.useMemo(() => {
|
|
4857
|
+
const urlFile = file;
|
|
4858
|
+
if (urlFile.fileUrl) {
|
|
4859
|
+
return {
|
|
4860
|
+
...file,
|
|
4861
|
+
fileUrl: urlFile.fileUrl + "&isPreview=true"
|
|
4862
|
+
};
|
|
4863
|
+
}
|
|
4864
|
+
return file;
|
|
4865
|
+
}, [file]);
|
|
4871
4866
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4872
4867
|
file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
|
|
4873
4868
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", className: styles_module_default5.previewHeader, children: [
|
|
@@ -4885,7 +4880,7 @@ var ChatPreviewPanel = React7.memo(({ file }) => {
|
|
|
4885
4880
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}), className: styles_module_default5.actionIcon, onClick: () => chatStore.setPreview() })
|
|
4886
4881
|
] })
|
|
4887
4882
|
] }),
|
|
4888
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(common.LuyaFilePreview, { ...
|
|
4883
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(common.LuyaFilePreview, { ...preview }) })
|
|
4889
4884
|
] }),
|
|
4890
4885
|
file.content && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4891
4886
|
common.MarkdownEditor,
|