@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.esm.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CloudUploadOutlined, PaperClipOutlined, createFromIconfontCN, LoadingOutlined, EnterOutlined, DownloadOutlined, CloseOutlined, CopyOutlined, LikeOutlined, DislikeOutlined,
|
|
2
|
-
import { Attachments, Sender,
|
|
1
|
+
import { CloudUploadOutlined, PaperClipOutlined, createFromIconfontCN, LoadingOutlined, EnterOutlined, DownloadOutlined, CloseOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, PlayCircleOutlined, DotChartOutlined, ToolOutlined, SearchOutlined, UpOutlined, DownOutlined, PlusOutlined, CommentOutlined, RedoOutlined, DeleteOutlined, ClockCircleOutlined, CheckCircleOutlined } from '@ant-design/icons';
|
|
2
|
+
import { Attachments, Sender, FileCard, Bubble, Think, XProvider, Mermaid, CodeHighlighter, Welcome, Prompts, Conversations } from '@ant-design/x-v2';
|
|
3
3
|
import { useRefState, useDebounce, useSyncInput, createTokenManager, isEmptyObj, markdownToText, RenderWrapper, shouldRender, isFunction, downloadFile, LuyaFilePreview, MarkdownEditor, useDeepEffect, isObject, useWebSocket, isNullOrUnDef, isNumber, getFileSuffixName, isBoolean, UserAvatar, htmlToMarkdown, copyText, FileIcon, LazyComponent, deepCopy, transforms, deepMerge, buildUrlParams, createRequest, HttpStatus, isArray, isString, isExternal, transform, emit, getWebSocketUrl, safeParseJson } from '@zero-library/common';
|
|
4
|
-
import
|
|
5
|
-
import { App, Badge, Button, Flex, Typography, Tooltip, Layout, Tag, Spin, Splitter, theme, Collapse, Divider as Divider$1, Select as Select$1, Avatar, Space, Popover, Skeleton, Alert, Modal, Checkbox, Input, Empty, message, List, Drawer, Card, Table, Progress as Progress$1, Switch as Switch$1 } from 'antd';
|
|
4
|
+
import { App, Badge, Button, Flex, Typography, Tooltip, Layout, Tag, Spin, Splitter, theme, Collapse, Divider as Divider$1, Select as Select$1, Avatar, Space, Popover, Skeleton, Alert, Modal, Checkbox, Input, Empty, message, Drawer, List, Card, Table, Progress as Progress$1, Switch as Switch$1 } from 'antd';
|
|
6
5
|
import React7, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, memo, useState, useContext, useCallback } from 'react';
|
|
7
6
|
import { useSnapshot, proxy } from 'valtio';
|
|
8
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
8
|
import classNames2 from 'classnames';
|
|
9
|
+
import dayjs from 'dayjs';
|
|
10
10
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
11
11
|
import { XCard as XCard$1 } from '@ant-design/x-card';
|
|
12
12
|
import '@ant-design/x-markdown/themes/light.css';
|
|
@@ -14,31 +14,6 @@ import XMarkdown from '@ant-design/x-markdown';
|
|
|
14
14
|
import Latex from '@ant-design/x-markdown/plugins/Latex';
|
|
15
15
|
|
|
16
16
|
// src/components/Attachments.tsx
|
|
17
|
-
var classifyTime = (timestamp) => {
|
|
18
|
-
const now = dayjs();
|
|
19
|
-
const target = dayjs(timestamp);
|
|
20
|
-
if (target.isSame(now, "day")) {
|
|
21
|
-
return "\u4ECA\u5929";
|
|
22
|
-
}
|
|
23
|
-
const diffInDays = now.diff(target, "day");
|
|
24
|
-
if (diffInDays < 7) {
|
|
25
|
-
return "\u6700\u8FD1 7 \u5929";
|
|
26
|
-
} else if (diffInDays < 30) {
|
|
27
|
-
return "\u6700\u8FD1 30 \u5929";
|
|
28
|
-
} else if (diffInDays < 180) {
|
|
29
|
-
return "\u6700\u8FD1\u534A\u5E74";
|
|
30
|
-
} else {
|
|
31
|
-
return "\u66F4\u65E9";
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
var getChatSocketUrl = (baseURL, params) => {
|
|
35
|
-
return buildUrlParams(params, getWebSocketUrl(`${baseURL}/ws`), "comma");
|
|
36
|
-
};
|
|
37
|
-
var isDocument = (fileName) => {
|
|
38
|
-
if (!fileName) return false;
|
|
39
|
-
const ext = getFileSuffixName(fileName);
|
|
40
|
-
return ["pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "csv"].includes(ext);
|
|
41
|
-
};
|
|
42
17
|
var ChatContext = createContext(null);
|
|
43
18
|
function ChatProvider({ store, children }) {
|
|
44
19
|
return React7.createElement(ChatContext.Provider, { value: store }, children);
|
|
@@ -54,12 +29,7 @@ function useChatStore() {
|
|
|
54
29
|
// src/components/styles.module.less
|
|
55
30
|
var styles_module_default = {
|
|
56
31
|
chatAttachments: "styles_module_chatAttachments",
|
|
57
|
-
chatSender: "styles_module_chatSender"
|
|
58
|
-
runStartedNode: "styles_module_runStartedNode",
|
|
59
|
-
chatQuoteMsg: "styles_module_chatQuoteMsg",
|
|
60
|
-
quoteTooltip: "styles_module_quoteTooltip",
|
|
61
|
-
quoteTooltipContainer: "styles_module_quoteTooltipContainer"
|
|
62
|
-
};
|
|
32
|
+
chatSender: "styles_module_chatSender"};
|
|
63
33
|
var Attachments_default = forwardRef(({ fileUpload, fileUploadConfig, fileList = [], onChange, extraParams }, ref) => {
|
|
64
34
|
const { message: message2 } = App.useApp();
|
|
65
35
|
const chatStore = useChatStore();
|
|
@@ -147,21 +117,7 @@ var Attachments_default = forwardRef(({ fileUpload, fileUploadConfig, fileList =
|
|
|
147
117
|
const uploadedFile = data[0];
|
|
148
118
|
let previewUrl = uploadedFile.id;
|
|
149
119
|
if (uploadedFile.conversationId && uploadedFile.path) {
|
|
150
|
-
|
|
151
|
-
previewUrl = chatStore.config.services.request.getPreviewUrl(
|
|
152
|
-
agentState.agentInfo.id,
|
|
153
|
-
uploadedFile.conversationId,
|
|
154
|
-
uploadedFile.path,
|
|
155
|
-
"preview"
|
|
156
|
-
);
|
|
157
|
-
} else {
|
|
158
|
-
previewUrl = chatStore.config.services.request.getPreviewUrl(
|
|
159
|
-
agentState.agentInfo.id,
|
|
160
|
-
uploadedFile.conversationId,
|
|
161
|
-
uploadedFile.path,
|
|
162
|
-
"download"
|
|
163
|
-
);
|
|
164
|
-
}
|
|
120
|
+
previewUrl = chatStore.config.services.request.getPreviewUrl(agentState.agentInfo.id, uploadedFile.conversationId, uploadedFile.path);
|
|
165
121
|
}
|
|
166
122
|
setAttachedFiles(
|
|
167
123
|
getAttachedFiles().map((f) => {
|
|
@@ -345,6 +301,26 @@ var ChatSender_default = forwardRef(
|
|
|
345
301
|
);
|
|
346
302
|
}
|
|
347
303
|
);
|
|
304
|
+
var classifyTime = (timestamp) => {
|
|
305
|
+
const now = dayjs();
|
|
306
|
+
const target = dayjs(timestamp);
|
|
307
|
+
if (target.isSame(now, "day")) {
|
|
308
|
+
return "\u4ECA\u5929";
|
|
309
|
+
}
|
|
310
|
+
const diffInDays = now.diff(target, "day");
|
|
311
|
+
if (diffInDays < 7) {
|
|
312
|
+
return "\u6700\u8FD1 7 \u5929";
|
|
313
|
+
} else if (diffInDays < 30) {
|
|
314
|
+
return "\u6700\u8FD1 30 \u5929";
|
|
315
|
+
} else if (diffInDays < 180) {
|
|
316
|
+
return "\u6700\u8FD1\u534A\u5E74";
|
|
317
|
+
} else {
|
|
318
|
+
return "\u66F4\u65E9";
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
var getChatSocketUrl = (baseURL, params) => {
|
|
322
|
+
return buildUrlParams(params, getWebSocketUrl(`${baseURL}/ws`), "comma");
|
|
323
|
+
};
|
|
348
324
|
|
|
349
325
|
// src/core/constants.ts
|
|
350
326
|
var CONV_MODE = {
|
|
@@ -384,9 +360,6 @@ var createChatService = (request, config) => {
|
|
|
384
360
|
const cancelMessage = (executionId) => {
|
|
385
361
|
return request.post(`/agents/executions/${executionId}/cancel`);
|
|
386
362
|
};
|
|
387
|
-
const getRecommendQuestions = (params) => {
|
|
388
|
-
return request.post(`/agents/conversations/${params.conversationId}/messages/recommend`, params);
|
|
389
|
-
};
|
|
390
363
|
const getAgentUserInput = (agentId) => {
|
|
391
364
|
return request.get(`/agents/${agentId}/workflow/params`);
|
|
392
365
|
};
|
|
@@ -402,8 +375,8 @@ var createChatService = (request, config) => {
|
|
|
402
375
|
signal
|
|
403
376
|
});
|
|
404
377
|
};
|
|
405
|
-
const getPreviewUrl = (agentId, conversationId, path
|
|
406
|
-
return `${config?.baseURL}/agents/${agentId}/${conversationId}/files
|
|
378
|
+
const getPreviewUrl = (agentId, conversationId, path) => {
|
|
379
|
+
return `${config?.baseURL}/agents/${agentId}/${conversationId}/files/download?path=${path}&${TOKEN_KEY}=${tokenManager.get()}`;
|
|
407
380
|
};
|
|
408
381
|
const docQuery = (params) => {
|
|
409
382
|
return request.get(`/library/cloud/document?${params}`);
|
|
@@ -429,7 +402,6 @@ var createChatService = (request, config) => {
|
|
|
429
402
|
fetchMessages,
|
|
430
403
|
sendMessageStream,
|
|
431
404
|
cancelMessage,
|
|
432
|
-
getRecommendQuestions,
|
|
433
405
|
getAgentUserInput,
|
|
434
406
|
feedbackUpdate,
|
|
435
407
|
chatUpload,
|
|
@@ -1155,7 +1127,8 @@ function createChatStore() {
|
|
|
1155
1127
|
const acceptMessage = async (newMessage) => {
|
|
1156
1128
|
const conversationId = newMessage.conversationId;
|
|
1157
1129
|
if (!conversation.messages[conversationId]?.message) return;
|
|
1158
|
-
const
|
|
1130
|
+
const isActive = conversation.active.id === conversationId;
|
|
1131
|
+
const canProceed = await config.hooks?.onBeforeAcceptMessage?.(newMessage, isActive);
|
|
1159
1132
|
if (canProceed === false) {
|
|
1160
1133
|
throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
|
|
1161
1134
|
}
|
|
@@ -1390,7 +1363,6 @@ var styles_module_default2 = {
|
|
|
1390
1363
|
chatTitle: "styles_module_chatTitle",
|
|
1391
1364
|
defaultLogo: "styles_module_defaultLogo",
|
|
1392
1365
|
chatHeaderBtnGroup: "styles_module_chatHeaderBtnGroup",
|
|
1393
|
-
popover: "styles_module_popover",
|
|
1394
1366
|
conversationListPanel: "styles_module_conversationListPanel",
|
|
1395
1367
|
createConversationButton: "styles_module_createConversationButton",
|
|
1396
1368
|
conversations: "styles_module_conversations",
|
|
@@ -1398,10 +1370,6 @@ var styles_module_default2 = {
|
|
|
1398
1370
|
chatWelcome: "styles_module_chatWelcome",
|
|
1399
1371
|
promptItem: "styles_module_promptItem",
|
|
1400
1372
|
bubbleList: "styles_module_bubbleList",
|
|
1401
|
-
resourceBtn: "styles_module_resourceBtn",
|
|
1402
|
-
divider: "styles_module_divider",
|
|
1403
|
-
count: "styles_module_count",
|
|
1404
|
-
resourceBtnActive: "styles_module_resourceBtnActive",
|
|
1405
1373
|
logoArea: "styles_module_logoArea",
|
|
1406
1374
|
logoContainer: "styles_module_logoContainer",
|
|
1407
1375
|
staticHalo: "styles_module_staticHalo",
|
|
@@ -1411,33 +1379,7 @@ var styles_module_default2 = {
|
|
|
1411
1379
|
gradientText: "styles_module_gradientText",
|
|
1412
1380
|
greetingSubtitle: "styles_module_greetingSubtitle",
|
|
1413
1381
|
senderReferenceHeaderTitle: "styles_module_senderReferenceHeaderTitle",
|
|
1414
|
-
senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
|
|
1415
|
-
customModal: "styles_module_customModal",
|
|
1416
|
-
layout: "styles_module_layout",
|
|
1417
|
-
sider: "styles_module_sider",
|
|
1418
|
-
categoryName: "styles_module_categoryName",
|
|
1419
|
-
siderContent: "styles_module_siderContent",
|
|
1420
|
-
categoryItem: "styles_module_categoryItem",
|
|
1421
|
-
categoryActive: "styles_module_categoryActive",
|
|
1422
|
-
roundCheckbox: "styles_module_roundCheckbox",
|
|
1423
|
-
content: "styles_module_content",
|
|
1424
|
-
searchInput: "styles_module_searchInput",
|
|
1425
|
-
selectedCount: "styles_module_selectedCount",
|
|
1426
|
-
tagsArea: "styles_module_tagsArea",
|
|
1427
|
-
tagContainer: "styles_module_tagContainer",
|
|
1428
|
-
tag: "styles_module_tag",
|
|
1429
|
-
expandBtnWrapper: "styles_module_expandBtnWrapper",
|
|
1430
|
-
expandBtn: "styles_module_expandBtn",
|
|
1431
|
-
tagsExpanded: "styles_module_tagsExpanded",
|
|
1432
|
-
listArea: "styles_module_listArea",
|
|
1433
|
-
listInner: "styles_module_listInner",
|
|
1434
|
-
listItem: "styles_module_listItem",
|
|
1435
|
-
listItemSelected: "styles_module_listItemSelected",
|
|
1436
|
-
itemIconWrapper: "styles_module_itemIconWrapper",
|
|
1437
|
-
itemInfo: "styles_module_itemInfo",
|
|
1438
|
-
itemDesc: "styles_module_itemDesc",
|
|
1439
|
-
footer: "styles_module_footer",
|
|
1440
|
-
titleContainer: "styles_module_titleContainer"
|
|
1382
|
+
senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
|
|
1441
1383
|
};
|
|
1442
1384
|
var ConversationList_default = () => {
|
|
1443
1385
|
const chatStore = useChatStore();
|
|
@@ -1487,13 +1429,48 @@ var ConversationList_default = () => {
|
|
|
1487
1429
|
}
|
|
1488
1430
|
) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: Empty.PRESENTED_IMAGE_SIMPLE }) }) });
|
|
1489
1431
|
};
|
|
1432
|
+
|
|
1433
|
+
// src/ui/common/FeatureComponents/style.module.less
|
|
1434
|
+
var style_module_default = {
|
|
1435
|
+
popover: "style_module_popover",
|
|
1436
|
+
resourceBtn: "style_module_resourceBtn",
|
|
1437
|
+
divider: "style_module_divider",
|
|
1438
|
+
count: "style_module_count",
|
|
1439
|
+
resourceBtnActive: "style_module_resourceBtnActive",
|
|
1440
|
+
customModal: "style_module_customModal",
|
|
1441
|
+
layout: "style_module_layout",
|
|
1442
|
+
sider: "style_module_sider",
|
|
1443
|
+
categoryName: "style_module_categoryName",
|
|
1444
|
+
siderContent: "style_module_siderContent",
|
|
1445
|
+
categoryItem: "style_module_categoryItem",
|
|
1446
|
+
categoryActive: "style_module_categoryActive",
|
|
1447
|
+
roundCheckbox: "style_module_roundCheckbox",
|
|
1448
|
+
content: "style_module_content",
|
|
1449
|
+
searchInput: "style_module_searchInput",
|
|
1450
|
+
selectedCount: "style_module_selectedCount",
|
|
1451
|
+
tagsArea: "style_module_tagsArea",
|
|
1452
|
+
tagContainer: "style_module_tagContainer",
|
|
1453
|
+
tag: "style_module_tag",
|
|
1454
|
+
expandBtnWrapper: "style_module_expandBtnWrapper",
|
|
1455
|
+
expandBtn: "style_module_expandBtn",
|
|
1456
|
+
tagsExpanded: "style_module_tagsExpanded",
|
|
1457
|
+
listArea: "style_module_listArea",
|
|
1458
|
+
listInner: "style_module_listInner",
|
|
1459
|
+
listItem: "style_module_listItem",
|
|
1460
|
+
listItemSelected: "style_module_listItemSelected",
|
|
1461
|
+
itemIconWrapper: "style_module_itemIconWrapper",
|
|
1462
|
+
itemInfo: "style_module_itemInfo",
|
|
1463
|
+
itemDesc: "style_module_itemDesc",
|
|
1464
|
+
footer: "style_module_footer",
|
|
1465
|
+
titleContainer: "style_module_titleContainer"
|
|
1466
|
+
};
|
|
1490
1467
|
var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
1491
1468
|
return /* @__PURE__ */ jsx(
|
|
1492
1469
|
Popover,
|
|
1493
1470
|
{
|
|
1494
1471
|
getPopupContainer: (e) => e,
|
|
1495
1472
|
placement: "bottom",
|
|
1496
|
-
classNames: { container:
|
|
1473
|
+
classNames: { container: style_module_default.popover },
|
|
1497
1474
|
content: /* @__PURE__ */ jsx(ConversationList_default, {}),
|
|
1498
1475
|
trigger: ["click"],
|
|
1499
1476
|
children: /* @__PURE__ */ jsx(Button, { title: "\u5386\u53F2\u4F1A\u8BDD", size: "large", type: "text", icon: icon?.() || /* @__PURE__ */ jsx(CommentOutlined, {}), ...rest })
|
|
@@ -1823,7 +1800,7 @@ function renderMiniChart(spec, opts) {
|
|
|
1823
1800
|
] }) });
|
|
1824
1801
|
}
|
|
1825
1802
|
|
|
1826
|
-
// src/components/CustomComponents/
|
|
1803
|
+
// src/components/CustomComponents/A2uiRuntime/components/artifacts/export-utils.ts
|
|
1827
1804
|
function sanitizeFileName(name) {
|
|
1828
1805
|
return name.replace(/[\\/:*?"<>|\u0000-\u001F]/g, "_").replace(/\s+/g, " ").trim();
|
|
1829
1806
|
}
|
|
@@ -2177,15 +2154,7 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2177
2154
|
}
|
|
2178
2155
|
};
|
|
2179
2156
|
const getPreviewFileUrl = (href) => {
|
|
2180
|
-
|
|
2181
|
-
const path = url.searchParams.get("path") || url.pathname;
|
|
2182
|
-
const fileName = getLinkFileName(href);
|
|
2183
|
-
console.log(path, fileName);
|
|
2184
|
-
if (isDocument(fileName)) {
|
|
2185
|
-
return chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, path, "preview");
|
|
2186
|
-
} else {
|
|
2187
|
-
return chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, path, "download");
|
|
2188
|
-
}
|
|
2157
|
+
return buildUrlParams({ [TOKEN_KEY]: tokenManager.get() || "" }, href);
|
|
2189
2158
|
};
|
|
2190
2159
|
const handlePreviewLink = (href) => {
|
|
2191
2160
|
const fileName = getLinkFileName(href);
|
|
@@ -2196,6 +2165,15 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2196
2165
|
suffix
|
|
2197
2166
|
});
|
|
2198
2167
|
};
|
|
2168
|
+
const handlePathToUrl = (href) => {
|
|
2169
|
+
const fileName = getLinkFileName(href);
|
|
2170
|
+
const suffix = getFileSuffixName(fileName);
|
|
2171
|
+
chatStore.setPreview({
|
|
2172
|
+
fileUrl: chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, href),
|
|
2173
|
+
fileName,
|
|
2174
|
+
suffix
|
|
2175
|
+
});
|
|
2176
|
+
};
|
|
2199
2177
|
const handleClick = (e) => {
|
|
2200
2178
|
rest.onClick?.(e);
|
|
2201
2179
|
const href = rest.href || e.currentTarget.href;
|
|
@@ -2207,6 +2185,10 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2207
2185
|
handlePreviewLink(href);
|
|
2208
2186
|
return;
|
|
2209
2187
|
}
|
|
2188
|
+
if (String(rest.href).startsWith("/workspace")) {
|
|
2189
|
+
handlePathToUrl(href);
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2210
2192
|
window.open(href, "_blank");
|
|
2211
2193
|
};
|
|
2212
2194
|
return /* @__PURE__ */ jsx("a", { ...rest, onClick: handleClick, children: data });
|
|
@@ -2707,7 +2689,7 @@ var A2uiComponents = {
|
|
|
2707
2689
|
ReportViewer
|
|
2708
2690
|
};
|
|
2709
2691
|
|
|
2710
|
-
// src/components/CustomComponents/
|
|
2692
|
+
// src/components/CustomComponents/A2uiRuntime/controller/meta.ts
|
|
2711
2693
|
function readProp(current, props, key) {
|
|
2712
2694
|
return current[key] ?? props?.[key];
|
|
2713
2695
|
}
|
|
@@ -2813,7 +2795,7 @@ function collectActionDisplayMeta(commands, surfaceId, context) {
|
|
|
2813
2795
|
return Object.keys(labels).length || Object.keys(valueLabels).length ? { labels, valueLabels } : null;
|
|
2814
2796
|
}
|
|
2815
2797
|
|
|
2816
|
-
// src/components/CustomComponents/
|
|
2798
|
+
// src/components/CustomComponents/A2uiRuntime/controller/action.ts
|
|
2817
2799
|
function extractPathFromRef2(value) {
|
|
2818
2800
|
if (typeof value === "string") {
|
|
2819
2801
|
if (value.startsWith("$bind:/")) return value.slice("$bind:".length);
|
|
@@ -2951,7 +2933,7 @@ function buildDispatchContext(surfaceId, rawContext, commands) {
|
|
|
2951
2933
|
};
|
|
2952
2934
|
}
|
|
2953
2935
|
|
|
2954
|
-
// src/components/CustomComponents/
|
|
2936
|
+
// src/components/CustomComponents/A2uiRuntime/controller/visibility.ts
|
|
2955
2937
|
function extractSurfaceId(cmd) {
|
|
2956
2938
|
if (!cmd || typeof cmd !== "object") return "";
|
|
2957
2939
|
return cmd.createSurface?.surfaceId ?? cmd.updateComponents?.surfaceId ?? cmd.updateDataModel?.surfaceId ?? cmd.deleteSurface?.surfaceId ?? "";
|
|
@@ -2972,7 +2954,7 @@ function resolveVisibleSurfaceIds(commands, dismissedSurfaceIds = []) {
|
|
|
2972
2954
|
return Array.from(states.entries()).filter(([sid, st]) => !st.deleted && !dismissedSurfaceIds.includes(sid)).map(([sid]) => sid);
|
|
2973
2955
|
}
|
|
2974
2956
|
|
|
2975
|
-
// src/components/CustomComponents/
|
|
2957
|
+
// src/components/CustomComponents/A2uiRuntime/controller/wizard.ts
|
|
2976
2958
|
function readString(obj, ...keys) {
|
|
2977
2959
|
for (const k of keys) {
|
|
2978
2960
|
const v = obj?.[k];
|
|
@@ -3181,7 +3163,7 @@ function buildWizardUpdateComponentsCommand(schema, stepId) {
|
|
|
3181
3163
|
};
|
|
3182
3164
|
}
|
|
3183
3165
|
|
|
3184
|
-
// src/components/CustomComponents/
|
|
3166
|
+
// src/components/CustomComponents/A2uiRuntime/controller/runtime.ts
|
|
3185
3167
|
function createA2uiRuntimeState() {
|
|
3186
3168
|
return {
|
|
3187
3169
|
processedMessageCursors: [],
|
|
@@ -3381,7 +3363,7 @@ function selectA2uiRuntimeView(state, dismissedSurfaceIds) {
|
|
|
3381
3363
|
};
|
|
3382
3364
|
}
|
|
3383
3365
|
|
|
3384
|
-
// src/components/CustomComponents/
|
|
3366
|
+
// src/components/CustomComponents/A2uiRuntime/controller/index.ts
|
|
3385
3367
|
function applyA2uiRuntimeEffects(effects) {
|
|
3386
3368
|
effects.forEach((effect) => {
|
|
3387
3369
|
if (effect.type === "reset-model-store") {
|
|
@@ -3440,7 +3422,7 @@ var A2uiRuntimeContext = React7.createContext({
|
|
|
3440
3422
|
surfaceIdsByMessageIndex: {}
|
|
3441
3423
|
});
|
|
3442
3424
|
|
|
3443
|
-
// src/components/CustomComponents/
|
|
3425
|
+
// src/components/CustomComponents/A2uiRuntime/renderer/useA2uiRuntimeView.ts
|
|
3444
3426
|
function useA2uiRuntimeView() {
|
|
3445
3427
|
return React7.useContext(A2uiRuntimeContext);
|
|
3446
3428
|
}
|
|
@@ -3451,7 +3433,7 @@ function A2uiMessageCards({ messageIndex }) {
|
|
|
3451
3433
|
return /* @__PURE__ */ jsx("div", { children: surfaceIds.map((surfaceId) => /* @__PURE__ */ jsx(XCard.Card, { id: surfaceId }, surfaceId)) });
|
|
3452
3434
|
}
|
|
3453
3435
|
|
|
3454
|
-
// src/components/CustomComponents/
|
|
3436
|
+
// src/components/CustomComponents/A2uiRuntime/renderer/protocol.ts
|
|
3455
3437
|
function isSubmitLikeActionName2(name) {
|
|
3456
3438
|
const normalized = String(name || "").trim();
|
|
3457
3439
|
return normalized === "submit" || normalized === "confirm" || normalized.startsWith("submit_") || normalized.endsWith(".confirm");
|
|
@@ -3743,8 +3725,87 @@ function A2uiRuntimeProvider({ messages, children }) {
|
|
|
3743
3725
|
function A2uiRenderer(props) {
|
|
3744
3726
|
return /* @__PURE__ */ jsx(A2uiRuntimeProvider, { ...props });
|
|
3745
3727
|
}
|
|
3728
|
+
var FilesNode = React7.memo(({ item }) => {
|
|
3729
|
+
const chatStore = useChatStore();
|
|
3730
|
+
const configState = useSnapshot(chatStore.config);
|
|
3731
|
+
const agentState = useSnapshot(chatStore.agent);
|
|
3732
|
+
const conversationState = useSnapshot(chatStore.conversation);
|
|
3733
|
+
const fileItems = useMemo(() => {
|
|
3734
|
+
return (item.files || []).map((file) => {
|
|
3735
|
+
const previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path);
|
|
3736
|
+
let fileType = "file";
|
|
3737
|
+
const ext = file.ext?.toLowerCase() || "";
|
|
3738
|
+
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
|
|
3739
|
+
fileType = "image";
|
|
3740
|
+
} else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
|
|
3741
|
+
fileType = "video";
|
|
3742
|
+
} else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
|
|
3743
|
+
fileType = "audio";
|
|
3744
|
+
}
|
|
3745
|
+
return {
|
|
3746
|
+
...file,
|
|
3747
|
+
src: previewUrl,
|
|
3748
|
+
type: fileType,
|
|
3749
|
+
onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
|
|
3750
|
+
};
|
|
3751
|
+
});
|
|
3752
|
+
}, [item.files]);
|
|
3753
|
+
return /* @__PURE__ */ jsx(FileCard.List, { items: fileItems });
|
|
3754
|
+
});
|
|
3755
|
+
var QuoteMsgNode = React7.memo(({ quoteMsg, role }) => {
|
|
3756
|
+
if (!quoteMsg || !quoteMsg.messageContent) return null;
|
|
3757
|
+
return /* @__PURE__ */ jsx(
|
|
3758
|
+
Bubble,
|
|
3759
|
+
{
|
|
3760
|
+
placement: role.placement,
|
|
3761
|
+
variant: "borderless",
|
|
3762
|
+
content: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsx(
|
|
3763
|
+
Tooltip,
|
|
3764
|
+
{
|
|
3765
|
+
arrow: false,
|
|
3766
|
+
title: /* @__PURE__ */ jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
|
|
3767
|
+
getPopupContainer: (node) => node,
|
|
3768
|
+
children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
3769
|
+
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
3770
|
+
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis-2", style: {
|
|
3771
|
+
color: "#666",
|
|
3772
|
+
background: "rgba(0,0,0,0.04)",
|
|
3773
|
+
padding: "2px 8px",
|
|
3774
|
+
borderRadius: "4px",
|
|
3775
|
+
fontSize: "12px",
|
|
3776
|
+
cursor: "pointer"
|
|
3777
|
+
}, children: quoteMsg.messageContent })
|
|
3778
|
+
] })
|
|
3779
|
+
}
|
|
3780
|
+
) })
|
|
3781
|
+
}
|
|
3782
|
+
);
|
|
3783
|
+
});
|
|
3784
|
+
var RunStartedNode = React7.memo(({ loading }) => {
|
|
3785
|
+
if (!loading) return null;
|
|
3786
|
+
return /* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", style: { minHeight: 24 }, children: /* @__PURE__ */ jsx(LoadingOutlined, { style: { color: "#1677ff" } }) });
|
|
3787
|
+
});
|
|
3788
|
+
function QuestionSummary({ content }) {
|
|
3789
|
+
const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
|
|
3790
|
+
return /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
|
|
3791
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
|
|
3792
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
|
|
3793
|
+
] });
|
|
3794
|
+
}
|
|
3795
|
+
var TextNode = React7.memo(
|
|
3796
|
+
({ item, role, customComponents, message: message2 }) => {
|
|
3797
|
+
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
3798
|
+
if (typeof content === "string" && content.startsWith("Question:")) {
|
|
3799
|
+
return /* @__PURE__ */ jsx(QuestionSummary, { content });
|
|
3800
|
+
}
|
|
3801
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3802
|
+
!!item.reasoningContent && /* @__PURE__ */ jsx(Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
|
|
3803
|
+
!!content && /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content })
|
|
3804
|
+
] });
|
|
3805
|
+
}
|
|
3806
|
+
);
|
|
3746
3807
|
|
|
3747
|
-
// src/components/CustomComponents/
|
|
3808
|
+
// src/components/CustomComponents/ToolRenders/index.module.less
|
|
3748
3809
|
var index_module_default = {
|
|
3749
3810
|
iconContainer: "index_module_iconContainer",
|
|
3750
3811
|
toolName: "index_module_toolName",
|
|
@@ -3955,70 +4016,6 @@ var ToolCallItem = ({ item }) => {
|
|
|
3955
4016
|
};
|
|
3956
4017
|
var tool_call_item_default = ToolCallItem;
|
|
3957
4018
|
var RENDERABLE_MESSAGE_TYPES = ["runStarted", "toolCall", "toolResult", "text", "stepError", "files", "plan"];
|
|
3958
|
-
function QuestionSummary({ content }) {
|
|
3959
|
-
const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
|
|
3960
|
-
return /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
|
|
3961
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
|
|
3962
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
|
|
3963
|
-
] });
|
|
3964
|
-
}
|
|
3965
|
-
var RunStartedNode = React7.memo(({ loading }) => {
|
|
3966
|
-
if (!loading) return null;
|
|
3967
|
-
return /* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", className: styles_module_default.runStartedNode, children: /* @__PURE__ */ jsx(LoadingOutlined, { style: { color: "#1677ff" } }) });
|
|
3968
|
-
});
|
|
3969
|
-
var ToolCallNode = React7.memo(({ item }) => {
|
|
3970
|
-
return /* @__PURE__ */ jsx(tool_call_item_default, { item });
|
|
3971
|
-
});
|
|
3972
|
-
var TextNode = React7.memo(
|
|
3973
|
-
({ item, role, customComponents, message: message2 }) => {
|
|
3974
|
-
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
3975
|
-
if (typeof content === "string" && content.startsWith("Question:")) {
|
|
3976
|
-
return /* @__PURE__ */ jsx(QuestionSummary, { content });
|
|
3977
|
-
}
|
|
3978
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3979
|
-
!!item.reasoningContent && /* @__PURE__ */ jsx(Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
|
|
3980
|
-
!!content && /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content })
|
|
3981
|
-
] });
|
|
3982
|
-
}
|
|
3983
|
-
);
|
|
3984
|
-
var StepErrorNode = React7.memo(
|
|
3985
|
-
({ item, customComponents, message: message2 }) => {
|
|
3986
|
-
if (!item.errorMessage) return null;
|
|
3987
|
-
return /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage });
|
|
3988
|
-
}
|
|
3989
|
-
);
|
|
3990
|
-
var FilesNode = React7.memo(({ item }) => {
|
|
3991
|
-
const chatStore = useChatStore();
|
|
3992
|
-
const configState = useSnapshot(chatStore.config);
|
|
3993
|
-
const agentState = useSnapshot(chatStore.agent);
|
|
3994
|
-
const conversationState = useSnapshot(chatStore.conversation);
|
|
3995
|
-
const fileItems = useMemo(() => {
|
|
3996
|
-
return (item.files || []).map((file) => {
|
|
3997
|
-
let previewUrl = file.id;
|
|
3998
|
-
if (isDocument(file.name)) {
|
|
3999
|
-
previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path, "preview");
|
|
4000
|
-
} else {
|
|
4001
|
-
previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path, "download");
|
|
4002
|
-
}
|
|
4003
|
-
let fileType = "file";
|
|
4004
|
-
const ext = file.ext?.toLowerCase() || "";
|
|
4005
|
-
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
|
|
4006
|
-
fileType = "image";
|
|
4007
|
-
} else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
|
|
4008
|
-
fileType = "video";
|
|
4009
|
-
} else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
|
|
4010
|
-
fileType = "audio";
|
|
4011
|
-
}
|
|
4012
|
-
return {
|
|
4013
|
-
...file,
|
|
4014
|
-
src: previewUrl,
|
|
4015
|
-
type: fileType,
|
|
4016
|
-
onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
|
|
4017
|
-
};
|
|
4018
|
-
});
|
|
4019
|
-
}, [item.files]);
|
|
4020
|
-
return /* @__PURE__ */ jsx(FileCard.List, { items: fileItems });
|
|
4021
|
-
});
|
|
4022
4019
|
var MessageRender_default = React7.memo(({ role, message: message2, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
4023
4020
|
const content = useMemo(() => {
|
|
4024
4021
|
return (message2.content || []).filter((item) => {
|
|
@@ -4058,9 +4055,9 @@ var MessageRender_default = React7.memo(({ role, message: message2, messageIndex
|
|
|
4058
4055
|
variant: item.type === "files" ? "borderless" : void 0,
|
|
4059
4056
|
content: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4060
4057
|
item.type === "runStarted" && /* @__PURE__ */ jsx(RunStartedNode, { loading }, `flow-start-${index}`),
|
|
4061
|
-
(item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsx(
|
|
4062
|
-
item.type === "text" && /* @__PURE__ */ jsx(
|
|
4063
|
-
item.type === "stepError" && /* @__PURE__ */ jsx(
|
|
4058
|
+
(item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsx(tool_call_item_default, { item }, `tool-call-${item.toolCallId || index}`),
|
|
4059
|
+
item.type === "text" && /* @__PURE__ */ jsx(TextNode, { item, role: message2.role, customComponents, message: message2 }, `message-${index}`),
|
|
4060
|
+
item.type === "stepError" && (item.errorMessage ? /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage }) : null),
|
|
4064
4061
|
item.type === "files" && /* @__PURE__ */ jsx(FilesNode, { item }, `files-${index}`),
|
|
4065
4062
|
item.type === "plan" && /* @__PURE__ */ jsx(A2uiPlanNode, { item }, `plan-${index}`)
|
|
4066
4063
|
] })
|
|
@@ -4068,30 +4065,7 @@ var MessageRender_default = React7.memo(({ role, message: message2, messageIndex
|
|
|
4068
4065
|
`message-${index}`
|
|
4069
4066
|
);
|
|
4070
4067
|
}),
|
|
4071
|
-
quoteMsg && /* @__PURE__ */ jsx(
|
|
4072
|
-
Bubble,
|
|
4073
|
-
{
|
|
4074
|
-
className: styles_module_default.chatQuoteMsg,
|
|
4075
|
-
placement: role.placement,
|
|
4076
|
-
variant: "borderless",
|
|
4077
|
-
content: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, children: quoteMsg.messageContent && /* @__PURE__ */ jsx(
|
|
4078
|
-
Tooltip,
|
|
4079
|
-
{
|
|
4080
|
-
arrow: false,
|
|
4081
|
-
classNames: {
|
|
4082
|
-
root: styles_module_default.quoteTooltip,
|
|
4083
|
-
container: `${styles_module_default.quoteTooltipContainer} scroll-fade-in`
|
|
4084
|
-
},
|
|
4085
|
-
title: /* @__PURE__ */ jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
|
|
4086
|
-
getPopupContainer: (node) => node,
|
|
4087
|
-
children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
4088
|
-
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
4089
|
-
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis-2", children: quoteMsg.messageContent })
|
|
4090
|
-
] })
|
|
4091
|
-
}
|
|
4092
|
-
) })
|
|
4093
|
-
}
|
|
4094
|
-
),
|
|
4068
|
+
quoteMsg && /* @__PURE__ */ jsx(QuoteMsgNode, { quoteMsg, role }),
|
|
4095
4069
|
messageIndex >= 0 ? /* @__PURE__ */ jsx(A2uiMessageCards, { messageIndex }) : null
|
|
4096
4070
|
] });
|
|
4097
4071
|
});
|
|
@@ -4480,43 +4454,43 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4480
4454
|
Modal,
|
|
4481
4455
|
{
|
|
4482
4456
|
open,
|
|
4483
|
-
className:
|
|
4457
|
+
className: style_module_default.customModal,
|
|
4484
4458
|
onCancel,
|
|
4485
4459
|
closeIcon: /* @__PURE__ */ jsx(CloseOutlined, {}),
|
|
4486
4460
|
width: 960,
|
|
4487
4461
|
centered: true,
|
|
4488
4462
|
destroyOnHidden: true,
|
|
4489
|
-
title: /* @__PURE__ */ jsx(Flex, { className:
|
|
4490
|
-
footer: /* @__PURE__ */ jsx(
|
|
4491
|
-
children: /* @__PURE__ */ jsxs(Layout, { className:
|
|
4492
|
-
/* @__PURE__ */ jsx(Sider, { width: 220, className:
|
|
4463
|
+
title: /* @__PURE__ */ jsx(Flex, { className: style_module_default.titleContainer, children: /* @__PURE__ */ jsx(Title2, { level: 5, children: title }) }),
|
|
4464
|
+
footer: /* @__PURE__ */ jsx("div", { className: style_module_default.footer, children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: handleConfirm, children: "\u786E\u8BA4" }) }),
|
|
4465
|
+
children: /* @__PURE__ */ jsxs(Layout, { className: style_module_default.layout, children: [
|
|
4466
|
+
/* @__PURE__ */ jsx(Sider, { width: 220, className: style_module_default.sider, theme: "light", children: /* @__PURE__ */ jsx("div", { className: style_module_default.siderContent, children: /* @__PURE__ */ jsx(Flex, { gap: 4, vertical: true, children: categories.map((cat) => {
|
|
4493
4467
|
const isChecked = selectedCategoryIds.includes(cat.id);
|
|
4494
4468
|
return /* @__PURE__ */ jsxs(
|
|
4495
4469
|
Flex,
|
|
4496
4470
|
{
|
|
4497
|
-
className: classNames2(
|
|
4471
|
+
className: classNames2(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
|
|
4498
4472
|
onClick: () => handleCategoryChange(cat.id, !isChecked),
|
|
4499
4473
|
children: [
|
|
4500
4474
|
/* @__PURE__ */ jsx(
|
|
4501
4475
|
Checkbox,
|
|
4502
4476
|
{
|
|
4503
4477
|
checked: isChecked,
|
|
4504
|
-
className: cat.id === ALL_CATEGORY_ID ?
|
|
4478
|
+
className: cat.id === ALL_CATEGORY_ID ? style_module_default.roundCheckbox : "",
|
|
4505
4479
|
onClick: (e) => e.stopPropagation(),
|
|
4506
4480
|
onChange: (e) => handleCategoryChange(cat.id, e.target.checked)
|
|
4507
4481
|
}
|
|
4508
4482
|
),
|
|
4509
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
4483
|
+
/* @__PURE__ */ jsx("span", { className: style_module_default.categoryName, children: cat.name })
|
|
4510
4484
|
]
|
|
4511
4485
|
},
|
|
4512
4486
|
cat.id
|
|
4513
4487
|
);
|
|
4514
4488
|
}) }) }) }),
|
|
4515
|
-
/* @__PURE__ */ jsxs(Content, { className:
|
|
4489
|
+
/* @__PURE__ */ jsxs(Content, { className: style_module_default.content, children: [
|
|
4516
4490
|
/* @__PURE__ */ jsx(Flex, { align: "center", justify: "space-between", children: /* @__PURE__ */ jsx(
|
|
4517
4491
|
Input,
|
|
4518
4492
|
{
|
|
4519
|
-
className:
|
|
4493
|
+
className: style_module_default.searchInput,
|
|
4520
4494
|
placeholder: `\u641C\u7D22${isSkill ? "\u6280\u80FD" : "\u77E5\u8BC6\u5E93"}\u540D\u79F0`,
|
|
4521
4495
|
prefix: /* @__PURE__ */ jsx(SearchOutlined, { style: { color: token.colorTextQuaternary } }),
|
|
4522
4496
|
value: searchText,
|
|
@@ -4525,12 +4499,12 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4525
4499
|
autoFocus: true
|
|
4526
4500
|
}
|
|
4527
4501
|
) }),
|
|
4528
|
-
selectedIds.length > 0 && /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxs(Text4, { type: "secondary", className:
|
|
4502
|
+
selectedIds.length > 0 && /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxs(Text4, { type: "secondary", className: style_module_default.selectedCount, children: [
|
|
4529
4503
|
"\u5DF2\u9009 ",
|
|
4530
4504
|
selectedIds.length
|
|
4531
4505
|
] }) }),
|
|
4532
|
-
/* @__PURE__ */ jsxs("div", { className: classNames2(
|
|
4533
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 8, className:
|
|
4506
|
+
/* @__PURE__ */ jsxs("div", { className: classNames2(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
|
|
4507
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
|
|
4534
4508
|
selectedIds.map((id) => /* @__PURE__ */ jsx(
|
|
4535
4509
|
Tag,
|
|
4536
4510
|
{
|
|
@@ -4539,36 +4513,36 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4539
4513
|
e.preventDefault();
|
|
4540
4514
|
toggleItemSelection(id);
|
|
4541
4515
|
},
|
|
4542
|
-
className:
|
|
4516
|
+
className: style_module_default.tag,
|
|
4543
4517
|
children: getDisplayName(id)
|
|
4544
4518
|
},
|
|
4545
4519
|
id
|
|
4546
4520
|
)),
|
|
4547
|
-
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxs(Button, { size: "small", className:
|
|
4521
|
+
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxs(Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(false), children: [
|
|
4548
4522
|
"\u6536\u8D77 ",
|
|
4549
4523
|
/* @__PURE__ */ jsx(UpOutlined, {})
|
|
4550
4524
|
] })
|
|
4551
4525
|
] }),
|
|
4552
|
-
showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsx("div", { className:
|
|
4526
|
+
showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsx("div", { className: style_module_default.expandBtnWrapper, children: /* @__PURE__ */ jsxs(Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(true), children: [
|
|
4553
4527
|
"\u5C55\u5F00 ",
|
|
4554
4528
|
/* @__PURE__ */ jsx(DownOutlined, {})
|
|
4555
4529
|
] }) })
|
|
4556
4530
|
] }),
|
|
4557
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
4531
|
+
/* @__PURE__ */ jsx("div", { className: style_module_default.listArea, children: /* @__PURE__ */ jsx(Spin, { spinning: loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsx("div", { className: style_module_default.listInner, children: /* @__PURE__ */ jsx(Flex, { gap: 8, vertical: true, children: filteredResources.length > 0 ? filteredResources.map((item) => {
|
|
4558
4532
|
const isSelected = selectedIds.includes(item.id);
|
|
4559
4533
|
return /* @__PURE__ */ jsxs(
|
|
4560
4534
|
"div",
|
|
4561
4535
|
{
|
|
4562
|
-
className: classNames2(
|
|
4536
|
+
className: classNames2(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
|
|
4563
4537
|
onClick: () => toggleItemSelection(item.id),
|
|
4564
4538
|
children: [
|
|
4565
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
4566
|
-
/* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
4539
|
+
/* @__PURE__ */ jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsx(IconFont_default, { type: iconType }) }),
|
|
4540
|
+
/* @__PURE__ */ jsxs(Flex, { vertical: true, className: style_module_default.itemInfo, children: [
|
|
4567
4541
|
/* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
4568
4542
|
/* @__PURE__ */ jsx(Text4, { strong: true, children: getDisplayName(item.id) }),
|
|
4569
4543
|
isSelected && /* @__PURE__ */ jsx(Tag, { color: token.colorPrimary, variant: "outlined", children: "\u5DF2\u6DFB\u52A0" })
|
|
4570
4544
|
] }),
|
|
4571
|
-
/* @__PURE__ */ jsx(Text4, { type: "secondary", className:
|
|
4545
|
+
/* @__PURE__ */ jsx(Text4, { type: "secondary", className: style_module_default.itemDesc, children: item.description || "\u6682\u65E0\u63CF\u8FF0" })
|
|
4572
4546
|
] })
|
|
4573
4547
|
]
|
|
4574
4548
|
},
|
|
@@ -4587,12 +4561,12 @@ var KnowledgeBtn_default = ({}) => {
|
|
|
4587
4561
|
const [modalOpen, setModalOpen] = useState(false);
|
|
4588
4562
|
const knowledgeCount = conversationState.active.spec?.knowledge?.items?.length ?? 0;
|
|
4589
4563
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4590
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
4564
|
+
/* @__PURE__ */ jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
4591
4565
|
/* @__PURE__ */ jsx(IconFont_default, { type: "icon-remark" }),
|
|
4592
4566
|
/* @__PURE__ */ jsx(Text5, { children: "\u77E5\u8BC6\u5E93" }),
|
|
4593
4567
|
knowledgeCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4594
|
-
/* @__PURE__ */ jsx(Divider$1, { vertical: true, className:
|
|
4595
|
-
/* @__PURE__ */ jsx(Flex, { className:
|
|
4568
|
+
/* @__PURE__ */ jsx(Divider$1, { vertical: true, className: style_module_default.divider }),
|
|
4569
|
+
/* @__PURE__ */ jsx(Flex, { className: style_module_default.count, children: knowledgeCount })
|
|
4596
4570
|
] })
|
|
4597
4571
|
] }),
|
|
4598
4572
|
modalOpen && /* @__PURE__ */ jsx(ResourceSelectorModal_default, { open: modalOpen, type: "knowledge", onCancel: () => setModalOpen(false) })
|
|
@@ -4626,6 +4600,17 @@ var ModelSelect_default = ({}) => {
|
|
|
4626
4600
|
}))
|
|
4627
4601
|
}));
|
|
4628
4602
|
const selectedModelValue = modelOptions.find((item) => item.value === agentState.model.providerName)?.options.find((item) => item.value === agentState.model.modelName)?.value || void 0;
|
|
4603
|
+
useEffect(() => {
|
|
4604
|
+
if (!selectedModelValue && models.length > 0 && models[0].models?.length > 0) {
|
|
4605
|
+
const firstProvider = models[0];
|
|
4606
|
+
const firstModel = firstProvider.models[0];
|
|
4607
|
+
chatStore.setAgentModel({
|
|
4608
|
+
...agentState.model,
|
|
4609
|
+
modelName: firstModel.modelName,
|
|
4610
|
+
providerName: firstProvider.providerName
|
|
4611
|
+
});
|
|
4612
|
+
}
|
|
4613
|
+
}, [selectedModelValue, models, agentState.model, chatStore]);
|
|
4629
4614
|
const handleModelChange = (_, option) => {
|
|
4630
4615
|
if (Array.isArray(option) || !option || !("providerName" in option)) return;
|
|
4631
4616
|
chatStore.setAgentModel({
|
|
@@ -4678,7 +4663,7 @@ var ReasonBtn_default = ({}) => {
|
|
|
4678
4663
|
return /* @__PURE__ */ jsxs(
|
|
4679
4664
|
"div",
|
|
4680
4665
|
{
|
|
4681
|
-
className: classNames2(
|
|
4666
|
+
className: classNames2(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
|
|
4682
4667
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
4683
4668
|
children: [
|
|
4684
4669
|
/* @__PURE__ */ jsx(IconFont_default, { type: "icon-reason" }),
|
|
@@ -4694,12 +4679,12 @@ var SkillBtn_default = ({}) => {
|
|
|
4694
4679
|
const [modalOpen, setModalOpen] = useState(false);
|
|
4695
4680
|
const skillsCount = conversationState.active.spec?.skills?.items?.length ?? 0;
|
|
4696
4681
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4697
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
4682
|
+
/* @__PURE__ */ jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
4698
4683
|
/* @__PURE__ */ jsx(IconFont_default, { type: "icon-skill" }),
|
|
4699
4684
|
/* @__PURE__ */ jsx(Text7, { children: "\u6280\u80FD" }),
|
|
4700
4685
|
skillsCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4701
|
-
/* @__PURE__ */ jsx(Divider$1, { vertical: true, className:
|
|
4702
|
-
/* @__PURE__ */ jsx(Flex, { className:
|
|
4686
|
+
/* @__PURE__ */ jsx(Divider$1, { vertical: true, className: style_module_default.divider }),
|
|
4687
|
+
/* @__PURE__ */ jsx(Flex, { className: style_module_default.count, children: skillsCount })
|
|
4703
4688
|
] })
|
|
4704
4689
|
] }),
|
|
4705
4690
|
modalOpen && /* @__PURE__ */ jsx(ResourceSelectorModal_default, { open: modalOpen, type: "skill", onCancel: () => setModalOpen(false) })
|
|
@@ -4857,6 +4842,16 @@ var ChatMainPanel = memo(
|
|
|
4857
4842
|
var ChatMainPanel_default = ChatMainPanel;
|
|
4858
4843
|
var ChatPreviewPanel = memo(({ file }) => {
|
|
4859
4844
|
const chatStore = useChatStore();
|
|
4845
|
+
const preview = useMemo(() => {
|
|
4846
|
+
const urlFile = file;
|
|
4847
|
+
if (urlFile.fileUrl) {
|
|
4848
|
+
return {
|
|
4849
|
+
...file,
|
|
4850
|
+
fileUrl: urlFile.fileUrl + "&isPreview=true"
|
|
4851
|
+
};
|
|
4852
|
+
}
|
|
4853
|
+
return file;
|
|
4854
|
+
}, [file]);
|
|
4860
4855
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4861
4856
|
file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
|
|
4862
4857
|
/* @__PURE__ */ jsxs(Flex, { justify: "space-between", className: styles_module_default5.previewHeader, children: [
|
|
@@ -4874,7 +4869,7 @@ var ChatPreviewPanel = memo(({ file }) => {
|
|
|
4874
4869
|
/* @__PURE__ */ jsx(Button, { type: "text", icon: /* @__PURE__ */ jsx(CloseOutlined, {}), className: styles_module_default5.actionIcon, onClick: () => chatStore.setPreview() })
|
|
4875
4870
|
] })
|
|
4876
4871
|
] }),
|
|
4877
|
-
/* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(LuyaFilePreview, { ...
|
|
4872
|
+
/* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(LuyaFilePreview, { ...preview }) })
|
|
4878
4873
|
] }),
|
|
4879
4874
|
file.content && /* @__PURE__ */ jsx(
|
|
4880
4875
|
MarkdownEditor,
|