@zero-library/chat-copilot 1.0.21 → 3.1.1
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 +198 -165
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +93 -87
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +201 -168
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 { 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,
|
|
4
|
+
import { App, Badge, Button, Flex, Typography, Tooltip, Layout, Tag, Spin, Splitter, theme, Collapse, Divider as Divider$1, Select as Select$1, Avatar, Space, Image as Image$1, Popover, Skeleton, Alert, Modal, Checkbox, Input, Empty, message, Drawer, List, Card, Table, Progress as Progress$1, Switch as Switch$1 } from 'antd';
|
|
5
5
|
import React7, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, memo, useState, useContext, useCallback } from 'react';
|
|
6
6
|
import { useSnapshot, proxy } from 'valtio';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -29,12 +29,7 @@ function useChatStore() {
|
|
|
29
29
|
// src/components/styles.module.less
|
|
30
30
|
var styles_module_default = {
|
|
31
31
|
chatAttachments: "styles_module_chatAttachments",
|
|
32
|
-
chatSender: "styles_module_chatSender"
|
|
33
|
-
runStartedNode: "styles_module_runStartedNode",
|
|
34
|
-
chatQuoteMsg: "styles_module_chatQuoteMsg",
|
|
35
|
-
quoteTooltip: "styles_module_quoteTooltip",
|
|
36
|
-
quoteTooltipContainer: "styles_module_quoteTooltipContainer"
|
|
37
|
-
};
|
|
32
|
+
chatSender: "styles_module_chatSender"};
|
|
38
33
|
var Attachments_default = forwardRef(({ fileUpload, fileUploadConfig, fileList = [], onChange, extraParams }, ref) => {
|
|
39
34
|
const { message: message2 } = App.useApp();
|
|
40
35
|
const chatStore = useChatStore();
|
|
@@ -381,7 +376,7 @@ var createChatService = (request, config) => {
|
|
|
381
376
|
});
|
|
382
377
|
};
|
|
383
378
|
const getPreviewUrl = (agentId, conversationId, path) => {
|
|
384
|
-
return `${config?.baseURL}/agents/${agentId}/${conversationId}/files/download?path=${
|
|
379
|
+
return `${config?.baseURL}/agents/${agentId}/${conversationId}/files/download?path=${path}&${TOKEN_KEY}=${tokenManager.get()}`;
|
|
385
380
|
};
|
|
386
381
|
const docQuery = (params) => {
|
|
387
382
|
return request.get(`/library/cloud/document?${params}`);
|
|
@@ -1368,7 +1363,6 @@ var styles_module_default2 = {
|
|
|
1368
1363
|
chatTitle: "styles_module_chatTitle",
|
|
1369
1364
|
defaultLogo: "styles_module_defaultLogo",
|
|
1370
1365
|
chatHeaderBtnGroup: "styles_module_chatHeaderBtnGroup",
|
|
1371
|
-
popover: "styles_module_popover",
|
|
1372
1366
|
conversationListPanel: "styles_module_conversationListPanel",
|
|
1373
1367
|
createConversationButton: "styles_module_createConversationButton",
|
|
1374
1368
|
conversations: "styles_module_conversations",
|
|
@@ -1376,10 +1370,6 @@ var styles_module_default2 = {
|
|
|
1376
1370
|
chatWelcome: "styles_module_chatWelcome",
|
|
1377
1371
|
promptItem: "styles_module_promptItem",
|
|
1378
1372
|
bubbleList: "styles_module_bubbleList",
|
|
1379
|
-
resourceBtn: "styles_module_resourceBtn",
|
|
1380
|
-
divider: "styles_module_divider",
|
|
1381
|
-
count: "styles_module_count",
|
|
1382
|
-
resourceBtnActive: "styles_module_resourceBtnActive",
|
|
1383
1373
|
logoArea: "styles_module_logoArea",
|
|
1384
1374
|
logoContainer: "styles_module_logoContainer",
|
|
1385
1375
|
staticHalo: "styles_module_staticHalo",
|
|
@@ -1389,33 +1379,7 @@ var styles_module_default2 = {
|
|
|
1389
1379
|
gradientText: "styles_module_gradientText",
|
|
1390
1380
|
greetingSubtitle: "styles_module_greetingSubtitle",
|
|
1391
1381
|
senderReferenceHeaderTitle: "styles_module_senderReferenceHeaderTitle",
|
|
1392
|
-
senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
|
|
1393
|
-
customModal: "styles_module_customModal",
|
|
1394
|
-
layout: "styles_module_layout",
|
|
1395
|
-
sider: "styles_module_sider",
|
|
1396
|
-
categoryName: "styles_module_categoryName",
|
|
1397
|
-
siderContent: "styles_module_siderContent",
|
|
1398
|
-
categoryItem: "styles_module_categoryItem",
|
|
1399
|
-
categoryActive: "styles_module_categoryActive",
|
|
1400
|
-
roundCheckbox: "styles_module_roundCheckbox",
|
|
1401
|
-
content: "styles_module_content",
|
|
1402
|
-
searchInput: "styles_module_searchInput",
|
|
1403
|
-
selectedCount: "styles_module_selectedCount",
|
|
1404
|
-
tagsArea: "styles_module_tagsArea",
|
|
1405
|
-
tagContainer: "styles_module_tagContainer",
|
|
1406
|
-
tag: "styles_module_tag",
|
|
1407
|
-
expandBtnWrapper: "styles_module_expandBtnWrapper",
|
|
1408
|
-
expandBtn: "styles_module_expandBtn",
|
|
1409
|
-
tagsExpanded: "styles_module_tagsExpanded",
|
|
1410
|
-
listArea: "styles_module_listArea",
|
|
1411
|
-
listInner: "styles_module_listInner",
|
|
1412
|
-
listItem: "styles_module_listItem",
|
|
1413
|
-
listItemSelected: "styles_module_listItemSelected",
|
|
1414
|
-
itemIconWrapper: "styles_module_itemIconWrapper",
|
|
1415
|
-
itemInfo: "styles_module_itemInfo",
|
|
1416
|
-
itemDesc: "styles_module_itemDesc",
|
|
1417
|
-
footer: "styles_module_footer",
|
|
1418
|
-
titleContainer: "styles_module_titleContainer"
|
|
1382
|
+
senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
|
|
1419
1383
|
};
|
|
1420
1384
|
var ConversationList_default = () => {
|
|
1421
1385
|
const chatStore = useChatStore();
|
|
@@ -1465,13 +1429,48 @@ var ConversationList_default = () => {
|
|
|
1465
1429
|
}
|
|
1466
1430
|
) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: Empty.PRESENTED_IMAGE_SIMPLE }) }) });
|
|
1467
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
|
+
};
|
|
1468
1467
|
var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
1469
1468
|
return /* @__PURE__ */ jsx(
|
|
1470
1469
|
Popover,
|
|
1471
1470
|
{
|
|
1472
1471
|
getPopupContainer: (e) => e,
|
|
1473
1472
|
placement: "bottom",
|
|
1474
|
-
classNames: { container:
|
|
1473
|
+
classNames: { container: style_module_default.popover },
|
|
1475
1474
|
content: /* @__PURE__ */ jsx(ConversationList_default, {}),
|
|
1476
1475
|
trigger: ["click"],
|
|
1477
1476
|
children: /* @__PURE__ */ jsx(Button, { title: "\u5386\u53F2\u4F1A\u8BDD", size: "large", type: "text", icon: icon?.() || /* @__PURE__ */ jsx(CommentOutlined, {}), ...rest })
|
|
@@ -1801,7 +1800,7 @@ function renderMiniChart(spec, opts) {
|
|
|
1801
1800
|
] }) });
|
|
1802
1801
|
}
|
|
1803
1802
|
|
|
1804
|
-
// src/components/CustomComponents/
|
|
1803
|
+
// src/components/CustomComponents/A2uiRuntime/components/artifacts/export-utils.ts
|
|
1805
1804
|
function sanitizeFileName(name) {
|
|
1806
1805
|
return name.replace(/[\\/:*?"<>|\u0000-\u001F]/g, "_").replace(/\s+/g, " ").trim();
|
|
1807
1806
|
}
|
|
@@ -2124,6 +2123,18 @@ var IndexQuote_default = ({ data, loading, message: message2 }) => {
|
|
|
2124
2123
|
open && /* @__PURE__ */ jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
|
|
2125
2124
|
] });
|
|
2126
2125
|
};
|
|
2126
|
+
var MarkImg_default = ({ data, loading, message: message2, ...rest }) => {
|
|
2127
|
+
const getPreviewFileUrl = (src) => {
|
|
2128
|
+
return buildUrlParams({ [TOKEN_KEY]: tokenManager.get() || "" }, src);
|
|
2129
|
+
};
|
|
2130
|
+
const previewSrc = useMemo(() => {
|
|
2131
|
+
if (String(rest.src).startsWith("/luya")) {
|
|
2132
|
+
return getPreviewFileUrl(rest.src);
|
|
2133
|
+
}
|
|
2134
|
+
return rest.src;
|
|
2135
|
+
}, [rest.src]);
|
|
2136
|
+
return /* @__PURE__ */ jsx(Image$1, { ...rest, src: previewSrc, placeholder: /* @__PURE__ */ jsx(Spin, {}) });
|
|
2137
|
+
};
|
|
2127
2138
|
var MdEdit_default = ({ data, loading }) => {
|
|
2128
2139
|
const chatStore = useChatStore();
|
|
2129
2140
|
const [value, setValue] = useState("");
|
|
@@ -2166,6 +2177,15 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2166
2177
|
suffix
|
|
2167
2178
|
});
|
|
2168
2179
|
};
|
|
2180
|
+
const handlePathToUrl = (href) => {
|
|
2181
|
+
const fileName = getLinkFileName(href);
|
|
2182
|
+
const suffix = getFileSuffixName(fileName);
|
|
2183
|
+
chatStore.setPreview({
|
|
2184
|
+
fileUrl: chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, href),
|
|
2185
|
+
fileName,
|
|
2186
|
+
suffix
|
|
2187
|
+
});
|
|
2188
|
+
};
|
|
2169
2189
|
const handleClick = (e) => {
|
|
2170
2190
|
rest.onClick?.(e);
|
|
2171
2191
|
const href = rest.href || e.currentTarget.href;
|
|
@@ -2177,6 +2197,10 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2177
2197
|
handlePreviewLink(href);
|
|
2178
2198
|
return;
|
|
2179
2199
|
}
|
|
2200
|
+
if (String(rest.href).startsWith("/workspace")) {
|
|
2201
|
+
handlePathToUrl(href);
|
|
2202
|
+
return;
|
|
2203
|
+
}
|
|
2180
2204
|
window.open(href, "_blank");
|
|
2181
2205
|
};
|
|
2182
2206
|
return /* @__PURE__ */ jsx("a", { ...rest, onClick: handleClick, children: data });
|
|
@@ -2278,6 +2302,7 @@ var XMarkdown_default = ({ message: message2, components = {}, content = "", ...
|
|
|
2278
2302
|
indexquote: IndexQuote_default,
|
|
2279
2303
|
mdedit: MdEdit_default,
|
|
2280
2304
|
fileedit: FileEdit_default,
|
|
2305
|
+
img: MarkImg_default,
|
|
2281
2306
|
...components
|
|
2282
2307
|
}),
|
|
2283
2308
|
[components]
|
|
@@ -2677,7 +2702,7 @@ var A2uiComponents = {
|
|
|
2677
2702
|
ReportViewer
|
|
2678
2703
|
};
|
|
2679
2704
|
|
|
2680
|
-
// src/components/CustomComponents/
|
|
2705
|
+
// src/components/CustomComponents/A2uiRuntime/controller/meta.ts
|
|
2681
2706
|
function readProp(current, props, key) {
|
|
2682
2707
|
return current[key] ?? props?.[key];
|
|
2683
2708
|
}
|
|
@@ -2783,7 +2808,7 @@ function collectActionDisplayMeta(commands, surfaceId, context) {
|
|
|
2783
2808
|
return Object.keys(labels).length || Object.keys(valueLabels).length ? { labels, valueLabels } : null;
|
|
2784
2809
|
}
|
|
2785
2810
|
|
|
2786
|
-
// src/components/CustomComponents/
|
|
2811
|
+
// src/components/CustomComponents/A2uiRuntime/controller/action.ts
|
|
2787
2812
|
function extractPathFromRef2(value) {
|
|
2788
2813
|
if (typeof value === "string") {
|
|
2789
2814
|
if (value.startsWith("$bind:/")) return value.slice("$bind:".length);
|
|
@@ -2921,7 +2946,7 @@ function buildDispatchContext(surfaceId, rawContext, commands) {
|
|
|
2921
2946
|
};
|
|
2922
2947
|
}
|
|
2923
2948
|
|
|
2924
|
-
// src/components/CustomComponents/
|
|
2949
|
+
// src/components/CustomComponents/A2uiRuntime/controller/visibility.ts
|
|
2925
2950
|
function extractSurfaceId(cmd) {
|
|
2926
2951
|
if (!cmd || typeof cmd !== "object") return "";
|
|
2927
2952
|
return cmd.createSurface?.surfaceId ?? cmd.updateComponents?.surfaceId ?? cmd.updateDataModel?.surfaceId ?? cmd.deleteSurface?.surfaceId ?? "";
|
|
@@ -2942,7 +2967,7 @@ function resolveVisibleSurfaceIds(commands, dismissedSurfaceIds = []) {
|
|
|
2942
2967
|
return Array.from(states.entries()).filter(([sid, st]) => !st.deleted && !dismissedSurfaceIds.includes(sid)).map(([sid]) => sid);
|
|
2943
2968
|
}
|
|
2944
2969
|
|
|
2945
|
-
// src/components/CustomComponents/
|
|
2970
|
+
// src/components/CustomComponents/A2uiRuntime/controller/wizard.ts
|
|
2946
2971
|
function readString(obj, ...keys) {
|
|
2947
2972
|
for (const k of keys) {
|
|
2948
2973
|
const v = obj?.[k];
|
|
@@ -3151,7 +3176,7 @@ function buildWizardUpdateComponentsCommand(schema, stepId) {
|
|
|
3151
3176
|
};
|
|
3152
3177
|
}
|
|
3153
3178
|
|
|
3154
|
-
// src/components/CustomComponents/
|
|
3179
|
+
// src/components/CustomComponents/A2uiRuntime/controller/runtime.ts
|
|
3155
3180
|
function createA2uiRuntimeState() {
|
|
3156
3181
|
return {
|
|
3157
3182
|
processedMessageCursors: [],
|
|
@@ -3351,7 +3376,7 @@ function selectA2uiRuntimeView(state, dismissedSurfaceIds) {
|
|
|
3351
3376
|
};
|
|
3352
3377
|
}
|
|
3353
3378
|
|
|
3354
|
-
// src/components/CustomComponents/
|
|
3379
|
+
// src/components/CustomComponents/A2uiRuntime/controller/index.ts
|
|
3355
3380
|
function applyA2uiRuntimeEffects(effects) {
|
|
3356
3381
|
effects.forEach((effect) => {
|
|
3357
3382
|
if (effect.type === "reset-model-store") {
|
|
@@ -3410,7 +3435,7 @@ var A2uiRuntimeContext = React7.createContext({
|
|
|
3410
3435
|
surfaceIdsByMessageIndex: {}
|
|
3411
3436
|
});
|
|
3412
3437
|
|
|
3413
|
-
// src/components/CustomComponents/
|
|
3438
|
+
// src/components/CustomComponents/A2uiRuntime/renderer/useA2uiRuntimeView.ts
|
|
3414
3439
|
function useA2uiRuntimeView() {
|
|
3415
3440
|
return React7.useContext(A2uiRuntimeContext);
|
|
3416
3441
|
}
|
|
@@ -3421,7 +3446,7 @@ function A2uiMessageCards({ messageIndex }) {
|
|
|
3421
3446
|
return /* @__PURE__ */ jsx("div", { children: surfaceIds.map((surfaceId) => /* @__PURE__ */ jsx(XCard.Card, { id: surfaceId }, surfaceId)) });
|
|
3422
3447
|
}
|
|
3423
3448
|
|
|
3424
|
-
// src/components/CustomComponents/
|
|
3449
|
+
// src/components/CustomComponents/A2uiRuntime/renderer/protocol.ts
|
|
3425
3450
|
function isSubmitLikeActionName2(name) {
|
|
3426
3451
|
const normalized = String(name || "").trim();
|
|
3427
3452
|
return normalized === "submit" || normalized === "confirm" || normalized.startsWith("submit_") || normalized.endsWith(".confirm");
|
|
@@ -3713,8 +3738,87 @@ function A2uiRuntimeProvider({ messages, children }) {
|
|
|
3713
3738
|
function A2uiRenderer(props) {
|
|
3714
3739
|
return /* @__PURE__ */ jsx(A2uiRuntimeProvider, { ...props });
|
|
3715
3740
|
}
|
|
3741
|
+
var FilesNode = React7.memo(({ item }) => {
|
|
3742
|
+
const chatStore = useChatStore();
|
|
3743
|
+
const configState = useSnapshot(chatStore.config);
|
|
3744
|
+
const agentState = useSnapshot(chatStore.agent);
|
|
3745
|
+
const conversationState = useSnapshot(chatStore.conversation);
|
|
3746
|
+
const fileItems = useMemo(() => {
|
|
3747
|
+
return (item.files || []).map((file) => {
|
|
3748
|
+
const previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path);
|
|
3749
|
+
let fileType = "file";
|
|
3750
|
+
const ext = file.ext?.toLowerCase() || "";
|
|
3751
|
+
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
|
|
3752
|
+
fileType = "image";
|
|
3753
|
+
} else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
|
|
3754
|
+
fileType = "video";
|
|
3755
|
+
} else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
|
|
3756
|
+
fileType = "audio";
|
|
3757
|
+
}
|
|
3758
|
+
return {
|
|
3759
|
+
...file,
|
|
3760
|
+
src: previewUrl,
|
|
3761
|
+
type: fileType,
|
|
3762
|
+
onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
|
|
3763
|
+
};
|
|
3764
|
+
});
|
|
3765
|
+
}, [item.files]);
|
|
3766
|
+
return /* @__PURE__ */ jsx(FileCard.List, { items: fileItems });
|
|
3767
|
+
});
|
|
3768
|
+
var QuoteMsgNode = React7.memo(({ quoteMsg, role }) => {
|
|
3769
|
+
if (!quoteMsg || !quoteMsg.messageContent) return null;
|
|
3770
|
+
return /* @__PURE__ */ jsx(
|
|
3771
|
+
Bubble,
|
|
3772
|
+
{
|
|
3773
|
+
placement: role.placement,
|
|
3774
|
+
variant: "borderless",
|
|
3775
|
+
content: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsx(
|
|
3776
|
+
Tooltip,
|
|
3777
|
+
{
|
|
3778
|
+
arrow: false,
|
|
3779
|
+
title: /* @__PURE__ */ jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
|
|
3780
|
+
getPopupContainer: (node) => node,
|
|
3781
|
+
children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
3782
|
+
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
3783
|
+
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis-2", style: {
|
|
3784
|
+
color: "#666",
|
|
3785
|
+
background: "rgba(0,0,0,0.04)",
|
|
3786
|
+
padding: "2px 8px",
|
|
3787
|
+
borderRadius: "4px",
|
|
3788
|
+
fontSize: "12px",
|
|
3789
|
+
cursor: "pointer"
|
|
3790
|
+
}, children: quoteMsg.messageContent })
|
|
3791
|
+
] })
|
|
3792
|
+
}
|
|
3793
|
+
) })
|
|
3794
|
+
}
|
|
3795
|
+
);
|
|
3796
|
+
});
|
|
3797
|
+
var RunStartedNode = React7.memo(({ loading }) => {
|
|
3798
|
+
if (!loading) return null;
|
|
3799
|
+
return /* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", style: { minHeight: 24 }, children: /* @__PURE__ */ jsx(LoadingOutlined, { style: { color: "#1677ff" } }) });
|
|
3800
|
+
});
|
|
3801
|
+
function QuestionSummary({ content }) {
|
|
3802
|
+
const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
|
|
3803
|
+
return /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
|
|
3804
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
|
|
3805
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
|
|
3806
|
+
] });
|
|
3807
|
+
}
|
|
3808
|
+
var TextNode = React7.memo(
|
|
3809
|
+
({ item, role, customComponents, message: message2 }) => {
|
|
3810
|
+
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
3811
|
+
if (typeof content === "string" && content.startsWith("Question:")) {
|
|
3812
|
+
return /* @__PURE__ */ jsx(QuestionSummary, { content });
|
|
3813
|
+
}
|
|
3814
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3815
|
+
!!item.reasoningContent && /* @__PURE__ */ jsx(Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
|
|
3816
|
+
!!content && /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content })
|
|
3817
|
+
] });
|
|
3818
|
+
}
|
|
3819
|
+
);
|
|
3716
3820
|
|
|
3717
|
-
// src/components/CustomComponents/
|
|
3821
|
+
// src/components/CustomComponents/ToolRenders/index.module.less
|
|
3718
3822
|
var index_module_default = {
|
|
3719
3823
|
iconContainer: "index_module_iconContainer",
|
|
3720
3824
|
toolName: "index_module_toolName",
|
|
@@ -3925,65 +4029,6 @@ var ToolCallItem = ({ item }) => {
|
|
|
3925
4029
|
};
|
|
3926
4030
|
var tool_call_item_default = ToolCallItem;
|
|
3927
4031
|
var RENDERABLE_MESSAGE_TYPES = ["runStarted", "toolCall", "toolResult", "text", "stepError", "files", "plan"];
|
|
3928
|
-
function QuestionSummary({ content }) {
|
|
3929
|
-
const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
|
|
3930
|
-
return /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
|
|
3931
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
|
|
3932
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
|
|
3933
|
-
] });
|
|
3934
|
-
}
|
|
3935
|
-
var RunStartedNode = React7.memo(({ loading }) => {
|
|
3936
|
-
if (!loading) return null;
|
|
3937
|
-
return /* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", className: styles_module_default.runStartedNode, children: /* @__PURE__ */ jsx(LoadingOutlined, { style: { color: "#1677ff" } }) });
|
|
3938
|
-
});
|
|
3939
|
-
var ToolCallNode = React7.memo(({ item }) => {
|
|
3940
|
-
return /* @__PURE__ */ jsx(tool_call_item_default, { item });
|
|
3941
|
-
});
|
|
3942
|
-
var TextNode = React7.memo(
|
|
3943
|
-
({ item, role, customComponents, message: message2 }) => {
|
|
3944
|
-
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
3945
|
-
if (typeof content === "string" && content.startsWith("Question:")) {
|
|
3946
|
-
return /* @__PURE__ */ jsx(QuestionSummary, { content });
|
|
3947
|
-
}
|
|
3948
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3949
|
-
!!item.reasoningContent && /* @__PURE__ */ jsx(Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
|
|
3950
|
-
!!content && /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content })
|
|
3951
|
-
] });
|
|
3952
|
-
}
|
|
3953
|
-
);
|
|
3954
|
-
var StepErrorNode = React7.memo(
|
|
3955
|
-
({ item, customComponents, message: message2 }) => {
|
|
3956
|
-
if (!item.errorMessage) return null;
|
|
3957
|
-
return /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage });
|
|
3958
|
-
}
|
|
3959
|
-
);
|
|
3960
|
-
var FilesNode = React7.memo(({ item }) => {
|
|
3961
|
-
const chatStore = useChatStore();
|
|
3962
|
-
const configState = useSnapshot(chatStore.config);
|
|
3963
|
-
const agentState = useSnapshot(chatStore.agent);
|
|
3964
|
-
const conversationState = useSnapshot(chatStore.conversation);
|
|
3965
|
-
const fileItems = useMemo(() => {
|
|
3966
|
-
return (item.files || []).map((file) => {
|
|
3967
|
-
const previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path);
|
|
3968
|
-
let fileType = "file";
|
|
3969
|
-
const ext = file.ext?.toLowerCase() || "";
|
|
3970
|
-
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
|
|
3971
|
-
fileType = "image";
|
|
3972
|
-
} else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
|
|
3973
|
-
fileType = "video";
|
|
3974
|
-
} else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
|
|
3975
|
-
fileType = "audio";
|
|
3976
|
-
}
|
|
3977
|
-
return {
|
|
3978
|
-
...file,
|
|
3979
|
-
src: previewUrl,
|
|
3980
|
-
type: fileType,
|
|
3981
|
-
onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
|
|
3982
|
-
};
|
|
3983
|
-
});
|
|
3984
|
-
}, [item.files]);
|
|
3985
|
-
return /* @__PURE__ */ jsx(FileCard.List, { items: fileItems });
|
|
3986
|
-
});
|
|
3987
4032
|
var MessageRender_default = React7.memo(({ role, message: message2, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
3988
4033
|
const content = useMemo(() => {
|
|
3989
4034
|
return (message2.content || []).filter((item) => {
|
|
@@ -4023,9 +4068,9 @@ var MessageRender_default = React7.memo(({ role, message: message2, messageIndex
|
|
|
4023
4068
|
variant: item.type === "files" ? "borderless" : void 0,
|
|
4024
4069
|
content: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4025
4070
|
item.type === "runStarted" && /* @__PURE__ */ jsx(RunStartedNode, { loading }, `flow-start-${index}`),
|
|
4026
|
-
(item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsx(
|
|
4027
|
-
item.type === "text" && /* @__PURE__ */ jsx(
|
|
4028
|
-
item.type === "stepError" && /* @__PURE__ */ jsx(
|
|
4071
|
+
(item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsx(tool_call_item_default, { item }, `tool-call-${item.toolCallId || index}`),
|
|
4072
|
+
item.type === "text" && /* @__PURE__ */ jsx(TextNode, { item, role: message2.role, customComponents, message: message2 }, `message-${index}`),
|
|
4073
|
+
item.type === "stepError" && (item.errorMessage ? /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage }) : null),
|
|
4029
4074
|
item.type === "files" && /* @__PURE__ */ jsx(FilesNode, { item }, `files-${index}`),
|
|
4030
4075
|
item.type === "plan" && /* @__PURE__ */ jsx(A2uiPlanNode, { item }, `plan-${index}`)
|
|
4031
4076
|
] })
|
|
@@ -4033,30 +4078,7 @@ var MessageRender_default = React7.memo(({ role, message: message2, messageIndex
|
|
|
4033
4078
|
`message-${index}`
|
|
4034
4079
|
);
|
|
4035
4080
|
}),
|
|
4036
|
-
quoteMsg && /* @__PURE__ */ jsx(
|
|
4037
|
-
Bubble,
|
|
4038
|
-
{
|
|
4039
|
-
className: styles_module_default.chatQuoteMsg,
|
|
4040
|
-
placement: role.placement,
|
|
4041
|
-
variant: "borderless",
|
|
4042
|
-
content: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, children: quoteMsg.messageContent && /* @__PURE__ */ jsx(
|
|
4043
|
-
Tooltip,
|
|
4044
|
-
{
|
|
4045
|
-
arrow: false,
|
|
4046
|
-
classNames: {
|
|
4047
|
-
root: styles_module_default.quoteTooltip,
|
|
4048
|
-
container: `${styles_module_default.quoteTooltipContainer} scroll-fade-in`
|
|
4049
|
-
},
|
|
4050
|
-
title: /* @__PURE__ */ jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
|
|
4051
|
-
getPopupContainer: (node) => node,
|
|
4052
|
-
children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
4053
|
-
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
4054
|
-
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis-2", children: quoteMsg.messageContent })
|
|
4055
|
-
] })
|
|
4056
|
-
}
|
|
4057
|
-
) })
|
|
4058
|
-
}
|
|
4059
|
-
),
|
|
4081
|
+
quoteMsg && /* @__PURE__ */ jsx(QuoteMsgNode, { quoteMsg, role }),
|
|
4060
4082
|
messageIndex >= 0 ? /* @__PURE__ */ jsx(A2uiMessageCards, { messageIndex }) : null
|
|
4061
4083
|
] });
|
|
4062
4084
|
});
|
|
@@ -4445,43 +4467,43 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4445
4467
|
Modal,
|
|
4446
4468
|
{
|
|
4447
4469
|
open,
|
|
4448
|
-
className:
|
|
4470
|
+
className: style_module_default.customModal,
|
|
4449
4471
|
onCancel,
|
|
4450
4472
|
closeIcon: /* @__PURE__ */ jsx(CloseOutlined, {}),
|
|
4451
4473
|
width: 960,
|
|
4452
4474
|
centered: true,
|
|
4453
4475
|
destroyOnHidden: true,
|
|
4454
|
-
title: /* @__PURE__ */ jsx(
|
|
4455
|
-
footer: /* @__PURE__ */ jsx(
|
|
4456
|
-
children: /* @__PURE__ */ jsxs(Layout, { className:
|
|
4457
|
-
/* @__PURE__ */ jsx(Sider, { width: 220, className:
|
|
4476
|
+
title: /* @__PURE__ */ jsx("div", { className: style_module_default.titleContainer, children: /* @__PURE__ */ jsx(Title2, { level: 5, children: title }) }),
|
|
4477
|
+
footer: /* @__PURE__ */ jsx("div", { className: style_module_default.footer, children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: handleConfirm, children: "\u786E\u8BA4" }) }),
|
|
4478
|
+
children: /* @__PURE__ */ jsxs(Layout, { className: style_module_default.layout, children: [
|
|
4479
|
+
/* @__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) => {
|
|
4458
4480
|
const isChecked = selectedCategoryIds.includes(cat.id);
|
|
4459
4481
|
return /* @__PURE__ */ jsxs(
|
|
4460
4482
|
Flex,
|
|
4461
4483
|
{
|
|
4462
|
-
className: classNames2(
|
|
4484
|
+
className: classNames2(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
|
|
4463
4485
|
onClick: () => handleCategoryChange(cat.id, !isChecked),
|
|
4464
4486
|
children: [
|
|
4465
4487
|
/* @__PURE__ */ jsx(
|
|
4466
4488
|
Checkbox,
|
|
4467
4489
|
{
|
|
4468
4490
|
checked: isChecked,
|
|
4469
|
-
className: cat.id === ALL_CATEGORY_ID ?
|
|
4491
|
+
className: cat.id === ALL_CATEGORY_ID ? style_module_default.roundCheckbox : "",
|
|
4470
4492
|
onClick: (e) => e.stopPropagation(),
|
|
4471
4493
|
onChange: (e) => handleCategoryChange(cat.id, e.target.checked)
|
|
4472
4494
|
}
|
|
4473
4495
|
),
|
|
4474
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
4496
|
+
/* @__PURE__ */ jsx("span", { className: style_module_default.categoryName, children: cat.name })
|
|
4475
4497
|
]
|
|
4476
4498
|
},
|
|
4477
4499
|
cat.id
|
|
4478
4500
|
);
|
|
4479
4501
|
}) }) }) }),
|
|
4480
|
-
/* @__PURE__ */ jsxs(Content, { className:
|
|
4502
|
+
/* @__PURE__ */ jsxs(Content, { className: style_module_default.content, children: [
|
|
4481
4503
|
/* @__PURE__ */ jsx(Flex, { align: "center", justify: "space-between", children: /* @__PURE__ */ jsx(
|
|
4482
4504
|
Input,
|
|
4483
4505
|
{
|
|
4484
|
-
className:
|
|
4506
|
+
className: style_module_default.searchInput,
|
|
4485
4507
|
placeholder: `\u641C\u7D22${isSkill ? "\u6280\u80FD" : "\u77E5\u8BC6\u5E93"}\u540D\u79F0`,
|
|
4486
4508
|
prefix: /* @__PURE__ */ jsx(SearchOutlined, { style: { color: token.colorTextQuaternary } }),
|
|
4487
4509
|
value: searchText,
|
|
@@ -4490,12 +4512,12 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4490
4512
|
autoFocus: true
|
|
4491
4513
|
}
|
|
4492
4514
|
) }),
|
|
4493
|
-
selectedIds.length > 0 && /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxs(Text4, { type: "secondary", className:
|
|
4515
|
+
selectedIds.length > 0 && /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxs(Text4, { type: "secondary", className: style_module_default.selectedCount, children: [
|
|
4494
4516
|
"\u5DF2\u9009 ",
|
|
4495
4517
|
selectedIds.length
|
|
4496
4518
|
] }) }),
|
|
4497
|
-
/* @__PURE__ */ jsxs("div", { className: classNames2(
|
|
4498
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 8, className:
|
|
4519
|
+
/* @__PURE__ */ jsxs("div", { className: classNames2(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
|
|
4520
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
|
|
4499
4521
|
selectedIds.map((id) => /* @__PURE__ */ jsx(
|
|
4500
4522
|
Tag,
|
|
4501
4523
|
{
|
|
@@ -4504,36 +4526,36 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4504
4526
|
e.preventDefault();
|
|
4505
4527
|
toggleItemSelection(id);
|
|
4506
4528
|
},
|
|
4507
|
-
className:
|
|
4529
|
+
className: style_module_default.tag,
|
|
4508
4530
|
children: getDisplayName(id)
|
|
4509
4531
|
},
|
|
4510
4532
|
id
|
|
4511
4533
|
)),
|
|
4512
|
-
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxs(Button, { size: "small", className:
|
|
4534
|
+
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxs(Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(false), children: [
|
|
4513
4535
|
"\u6536\u8D77 ",
|
|
4514
4536
|
/* @__PURE__ */ jsx(UpOutlined, {})
|
|
4515
4537
|
] })
|
|
4516
4538
|
] }),
|
|
4517
|
-
showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsx("div", { className:
|
|
4539
|
+
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: [
|
|
4518
4540
|
"\u5C55\u5F00 ",
|
|
4519
4541
|
/* @__PURE__ */ jsx(DownOutlined, {})
|
|
4520
4542
|
] }) })
|
|
4521
4543
|
] }),
|
|
4522
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
4544
|
+
/* @__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) => {
|
|
4523
4545
|
const isSelected = selectedIds.includes(item.id);
|
|
4524
4546
|
return /* @__PURE__ */ jsxs(
|
|
4525
4547
|
"div",
|
|
4526
4548
|
{
|
|
4527
|
-
className: classNames2(
|
|
4549
|
+
className: classNames2(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
|
|
4528
4550
|
onClick: () => toggleItemSelection(item.id),
|
|
4529
4551
|
children: [
|
|
4530
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
4531
|
-
/* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
4552
|
+
/* @__PURE__ */ jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsx(IconFont_default, { type: iconType }) }),
|
|
4553
|
+
/* @__PURE__ */ jsxs(Flex, { vertical: true, className: style_module_default.itemInfo, children: [
|
|
4532
4554
|
/* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
4533
4555
|
/* @__PURE__ */ jsx(Text4, { strong: true, children: getDisplayName(item.id) }),
|
|
4534
4556
|
isSelected && /* @__PURE__ */ jsx(Tag, { color: token.colorPrimary, variant: "outlined", children: "\u5DF2\u6DFB\u52A0" })
|
|
4535
4557
|
] }),
|
|
4536
|
-
/* @__PURE__ */ jsx(Text4, { type: "secondary", className:
|
|
4558
|
+
/* @__PURE__ */ jsx(Text4, { type: "secondary", className: style_module_default.itemDesc, children: item.description || "\u6682\u65E0\u63CF\u8FF0" })
|
|
4537
4559
|
] })
|
|
4538
4560
|
]
|
|
4539
4561
|
},
|
|
@@ -4552,12 +4574,12 @@ var KnowledgeBtn_default = ({}) => {
|
|
|
4552
4574
|
const [modalOpen, setModalOpen] = useState(false);
|
|
4553
4575
|
const knowledgeCount = conversationState.active.spec?.knowledge?.items?.length ?? 0;
|
|
4554
4576
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4555
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
4577
|
+
/* @__PURE__ */ jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
4556
4578
|
/* @__PURE__ */ jsx(IconFont_default, { type: "icon-remark" }),
|
|
4557
4579
|
/* @__PURE__ */ jsx(Text5, { children: "\u77E5\u8BC6\u5E93" }),
|
|
4558
4580
|
knowledgeCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4559
|
-
/* @__PURE__ */ jsx(Divider$1, { vertical: true, className:
|
|
4560
|
-
/* @__PURE__ */ jsx(Flex, { className:
|
|
4581
|
+
/* @__PURE__ */ jsx(Divider$1, { vertical: true, className: style_module_default.divider }),
|
|
4582
|
+
/* @__PURE__ */ jsx(Flex, { className: style_module_default.count, children: knowledgeCount })
|
|
4561
4583
|
] })
|
|
4562
4584
|
] }),
|
|
4563
4585
|
modalOpen && /* @__PURE__ */ jsx(ResourceSelectorModal_default, { open: modalOpen, type: "knowledge", onCancel: () => setModalOpen(false) })
|
|
@@ -4591,6 +4613,17 @@ var ModelSelect_default = ({}) => {
|
|
|
4591
4613
|
}))
|
|
4592
4614
|
}));
|
|
4593
4615
|
const selectedModelValue = modelOptions.find((item) => item.value === agentState.model.providerName)?.options.find((item) => item.value === agentState.model.modelName)?.value || void 0;
|
|
4616
|
+
useEffect(() => {
|
|
4617
|
+
if (!selectedModelValue && models.length > 0 && models[0].models?.length > 0) {
|
|
4618
|
+
const firstProvider = models[0];
|
|
4619
|
+
const firstModel = firstProvider.models[0];
|
|
4620
|
+
chatStore.setAgentModel({
|
|
4621
|
+
...agentState.model,
|
|
4622
|
+
modelName: firstModel.modelName,
|
|
4623
|
+
providerName: firstProvider.providerName
|
|
4624
|
+
});
|
|
4625
|
+
}
|
|
4626
|
+
}, [selectedModelValue, models, agentState.model, chatStore]);
|
|
4594
4627
|
const handleModelChange = (_, option) => {
|
|
4595
4628
|
if (Array.isArray(option) || !option || !("providerName" in option)) return;
|
|
4596
4629
|
chatStore.setAgentModel({
|
|
@@ -4643,7 +4676,7 @@ var ReasonBtn_default = ({}) => {
|
|
|
4643
4676
|
return /* @__PURE__ */ jsxs(
|
|
4644
4677
|
"div",
|
|
4645
4678
|
{
|
|
4646
|
-
className: classNames2(
|
|
4679
|
+
className: classNames2(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
|
|
4647
4680
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
4648
4681
|
children: [
|
|
4649
4682
|
/* @__PURE__ */ jsx(IconFont_default, { type: "icon-reason" }),
|
|
@@ -4659,12 +4692,12 @@ var SkillBtn_default = ({}) => {
|
|
|
4659
4692
|
const [modalOpen, setModalOpen] = useState(false);
|
|
4660
4693
|
const skillsCount = conversationState.active.spec?.skills?.items?.length ?? 0;
|
|
4661
4694
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4662
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
4695
|
+
/* @__PURE__ */ jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
4663
4696
|
/* @__PURE__ */ jsx(IconFont_default, { type: "icon-skill" }),
|
|
4664
4697
|
/* @__PURE__ */ jsx(Text7, { children: "\u6280\u80FD" }),
|
|
4665
4698
|
skillsCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4666
|
-
/* @__PURE__ */ jsx(Divider$1, { vertical: true, className:
|
|
4667
|
-
/* @__PURE__ */ jsx(Flex, { className:
|
|
4699
|
+
/* @__PURE__ */ jsx(Divider$1, { vertical: true, className: style_module_default.divider }),
|
|
4700
|
+
/* @__PURE__ */ jsx(Flex, { className: style_module_default.count, children: skillsCount })
|
|
4668
4701
|
] })
|
|
4669
4702
|
] }),
|
|
4670
4703
|
modalOpen && /* @__PURE__ */ jsx(ResourceSelectorModal_default, { open: modalOpen, type: "skill", onCancel: () => setModalOpen(false) })
|
|
@@ -4834,7 +4867,7 @@ var ChatPreviewPanel = memo(({ file }) => {
|
|
|
4834
4867
|
}, [file]);
|
|
4835
4868
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4836
4869
|
file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
|
|
4837
|
-
/* @__PURE__ */ jsxs(
|
|
4870
|
+
/* @__PURE__ */ jsxs("div", { className: styles_module_default5.previewHeader, children: [
|
|
4838
4871
|
/* @__PURE__ */ jsx("div", { className: classNames2(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
|
|
4839
4872
|
/* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
|
|
4840
4873
|
/* @__PURE__ */ jsx(
|