@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.cjs.js
CHANGED
|
@@ -40,12 +40,7 @@ function useChatStore() {
|
|
|
40
40
|
// src/components/styles.module.less
|
|
41
41
|
var styles_module_default = {
|
|
42
42
|
chatAttachments: "styles_module_chatAttachments",
|
|
43
|
-
chatSender: "styles_module_chatSender"
|
|
44
|
-
runStartedNode: "styles_module_runStartedNode",
|
|
45
|
-
chatQuoteMsg: "styles_module_chatQuoteMsg",
|
|
46
|
-
quoteTooltip: "styles_module_quoteTooltip",
|
|
47
|
-
quoteTooltipContainer: "styles_module_quoteTooltipContainer"
|
|
48
|
-
};
|
|
43
|
+
chatSender: "styles_module_chatSender"};
|
|
49
44
|
var Attachments_default = React7.forwardRef(({ fileUpload, fileUploadConfig, fileList = [], onChange, extraParams }, ref) => {
|
|
50
45
|
const { message: message2 } = antd.App.useApp();
|
|
51
46
|
const chatStore = useChatStore();
|
|
@@ -392,7 +387,7 @@ var createChatService = (request, config) => {
|
|
|
392
387
|
});
|
|
393
388
|
};
|
|
394
389
|
const getPreviewUrl = (agentId, conversationId, path) => {
|
|
395
|
-
return `${config?.baseURL}/agents/${agentId}/${conversationId}/files/download?path=${
|
|
390
|
+
return `${config?.baseURL}/agents/${agentId}/${conversationId}/files/download?path=${path}&${TOKEN_KEY}=${tokenManager.get()}`;
|
|
396
391
|
};
|
|
397
392
|
const docQuery = (params) => {
|
|
398
393
|
return request.get(`/library/cloud/document?${params}`);
|
|
@@ -1379,7 +1374,6 @@ var styles_module_default2 = {
|
|
|
1379
1374
|
chatTitle: "styles_module_chatTitle",
|
|
1380
1375
|
defaultLogo: "styles_module_defaultLogo",
|
|
1381
1376
|
chatHeaderBtnGroup: "styles_module_chatHeaderBtnGroup",
|
|
1382
|
-
popover: "styles_module_popover",
|
|
1383
1377
|
conversationListPanel: "styles_module_conversationListPanel",
|
|
1384
1378
|
createConversationButton: "styles_module_createConversationButton",
|
|
1385
1379
|
conversations: "styles_module_conversations",
|
|
@@ -1387,10 +1381,6 @@ var styles_module_default2 = {
|
|
|
1387
1381
|
chatWelcome: "styles_module_chatWelcome",
|
|
1388
1382
|
promptItem: "styles_module_promptItem",
|
|
1389
1383
|
bubbleList: "styles_module_bubbleList",
|
|
1390
|
-
resourceBtn: "styles_module_resourceBtn",
|
|
1391
|
-
divider: "styles_module_divider",
|
|
1392
|
-
count: "styles_module_count",
|
|
1393
|
-
resourceBtnActive: "styles_module_resourceBtnActive",
|
|
1394
1384
|
logoArea: "styles_module_logoArea",
|
|
1395
1385
|
logoContainer: "styles_module_logoContainer",
|
|
1396
1386
|
staticHalo: "styles_module_staticHalo",
|
|
@@ -1400,33 +1390,7 @@ var styles_module_default2 = {
|
|
|
1400
1390
|
gradientText: "styles_module_gradientText",
|
|
1401
1391
|
greetingSubtitle: "styles_module_greetingSubtitle",
|
|
1402
1392
|
senderReferenceHeaderTitle: "styles_module_senderReferenceHeaderTitle",
|
|
1403
|
-
senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
|
|
1404
|
-
customModal: "styles_module_customModal",
|
|
1405
|
-
layout: "styles_module_layout",
|
|
1406
|
-
sider: "styles_module_sider",
|
|
1407
|
-
categoryName: "styles_module_categoryName",
|
|
1408
|
-
siderContent: "styles_module_siderContent",
|
|
1409
|
-
categoryItem: "styles_module_categoryItem",
|
|
1410
|
-
categoryActive: "styles_module_categoryActive",
|
|
1411
|
-
roundCheckbox: "styles_module_roundCheckbox",
|
|
1412
|
-
content: "styles_module_content",
|
|
1413
|
-
searchInput: "styles_module_searchInput",
|
|
1414
|
-
selectedCount: "styles_module_selectedCount",
|
|
1415
|
-
tagsArea: "styles_module_tagsArea",
|
|
1416
|
-
tagContainer: "styles_module_tagContainer",
|
|
1417
|
-
tag: "styles_module_tag",
|
|
1418
|
-
expandBtnWrapper: "styles_module_expandBtnWrapper",
|
|
1419
|
-
expandBtn: "styles_module_expandBtn",
|
|
1420
|
-
tagsExpanded: "styles_module_tagsExpanded",
|
|
1421
|
-
listArea: "styles_module_listArea",
|
|
1422
|
-
listInner: "styles_module_listInner",
|
|
1423
|
-
listItem: "styles_module_listItem",
|
|
1424
|
-
listItemSelected: "styles_module_listItemSelected",
|
|
1425
|
-
itemIconWrapper: "styles_module_itemIconWrapper",
|
|
1426
|
-
itemInfo: "styles_module_itemInfo",
|
|
1427
|
-
itemDesc: "styles_module_itemDesc",
|
|
1428
|
-
footer: "styles_module_footer",
|
|
1429
|
-
titleContainer: "styles_module_titleContainer"
|
|
1393
|
+
senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
|
|
1430
1394
|
};
|
|
1431
1395
|
var ConversationList_default = () => {
|
|
1432
1396
|
const chatStore = useChatStore();
|
|
@@ -1476,13 +1440,48 @@ var ConversationList_default = () => {
|
|
|
1476
1440
|
}
|
|
1477
1441
|
) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) });
|
|
1478
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
|
+
};
|
|
1479
1478
|
var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
1480
1479
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1481
1480
|
antd.Popover,
|
|
1482
1481
|
{
|
|
1483
1482
|
getPopupContainer: (e) => e,
|
|
1484
1483
|
placement: "bottom",
|
|
1485
|
-
classNames: { container:
|
|
1484
|
+
classNames: { container: style_module_default.popover },
|
|
1486
1485
|
content: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}),
|
|
1487
1486
|
trigger: ["click"],
|
|
1488
1487
|
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u5386\u53F2\u4F1A\u8BDD", size: "large", type: "text", icon: icon?.() || /* @__PURE__ */ jsxRuntime.jsx(icons.CommentOutlined, {}), ...rest })
|
|
@@ -1812,7 +1811,7 @@ function renderMiniChart(spec, opts) {
|
|
|
1812
1811
|
] }) });
|
|
1813
1812
|
}
|
|
1814
1813
|
|
|
1815
|
-
// src/components/CustomComponents/
|
|
1814
|
+
// src/components/CustomComponents/A2uiRuntime/components/artifacts/export-utils.ts
|
|
1816
1815
|
function sanitizeFileName(name) {
|
|
1817
1816
|
return name.replace(/[\\/:*?"<>|\u0000-\u001F]/g, "_").replace(/\s+/g, " ").trim();
|
|
1818
1817
|
}
|
|
@@ -2135,6 +2134,18 @@ var IndexQuote_default = ({ data, loading, message: message2 }) => {
|
|
|
2135
2134
|
open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
|
|
2136
2135
|
] });
|
|
2137
2136
|
};
|
|
2137
|
+
var MarkImg_default = ({ data, loading, message: message2, ...rest }) => {
|
|
2138
|
+
const getPreviewFileUrl = (src) => {
|
|
2139
|
+
return common.buildUrlParams({ [TOKEN_KEY]: tokenManager.get() || "" }, src);
|
|
2140
|
+
};
|
|
2141
|
+
const previewSrc = React7.useMemo(() => {
|
|
2142
|
+
if (String(rest.src).startsWith("/luya")) {
|
|
2143
|
+
return getPreviewFileUrl(rest.src);
|
|
2144
|
+
}
|
|
2145
|
+
return rest.src;
|
|
2146
|
+
}, [rest.src]);
|
|
2147
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Image, { ...rest, src: previewSrc, placeholder: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, {}) });
|
|
2148
|
+
};
|
|
2138
2149
|
var MdEdit_default = ({ data, loading }) => {
|
|
2139
2150
|
const chatStore = useChatStore();
|
|
2140
2151
|
const [value, setValue] = React7.useState("");
|
|
@@ -2177,6 +2188,15 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2177
2188
|
suffix
|
|
2178
2189
|
});
|
|
2179
2190
|
};
|
|
2191
|
+
const handlePathToUrl = (href) => {
|
|
2192
|
+
const fileName = getLinkFileName(href);
|
|
2193
|
+
const suffix = common.getFileSuffixName(fileName);
|
|
2194
|
+
chatStore.setPreview({
|
|
2195
|
+
fileUrl: chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, href),
|
|
2196
|
+
fileName,
|
|
2197
|
+
suffix
|
|
2198
|
+
});
|
|
2199
|
+
};
|
|
2180
2200
|
const handleClick = (e) => {
|
|
2181
2201
|
rest.onClick?.(e);
|
|
2182
2202
|
const href = rest.href || e.currentTarget.href;
|
|
@@ -2188,6 +2208,10 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
|
|
|
2188
2208
|
handlePreviewLink(href);
|
|
2189
2209
|
return;
|
|
2190
2210
|
}
|
|
2211
|
+
if (String(rest.href).startsWith("/workspace")) {
|
|
2212
|
+
handlePathToUrl(href);
|
|
2213
|
+
return;
|
|
2214
|
+
}
|
|
2191
2215
|
window.open(href, "_blank");
|
|
2192
2216
|
};
|
|
2193
2217
|
return /* @__PURE__ */ jsxRuntime.jsx("a", { ...rest, onClick: handleClick, children: data });
|
|
@@ -2289,6 +2313,7 @@ var XMarkdown_default = ({ message: message2, components = {}, content = "", ...
|
|
|
2289
2313
|
indexquote: IndexQuote_default,
|
|
2290
2314
|
mdedit: MdEdit_default,
|
|
2291
2315
|
fileedit: FileEdit_default,
|
|
2316
|
+
img: MarkImg_default,
|
|
2292
2317
|
...components
|
|
2293
2318
|
}),
|
|
2294
2319
|
[components]
|
|
@@ -2688,7 +2713,7 @@ var A2uiComponents = {
|
|
|
2688
2713
|
ReportViewer
|
|
2689
2714
|
};
|
|
2690
2715
|
|
|
2691
|
-
// src/components/CustomComponents/
|
|
2716
|
+
// src/components/CustomComponents/A2uiRuntime/controller/meta.ts
|
|
2692
2717
|
function readProp(current, props, key) {
|
|
2693
2718
|
return current[key] ?? props?.[key];
|
|
2694
2719
|
}
|
|
@@ -2794,7 +2819,7 @@ function collectActionDisplayMeta(commands, surfaceId, context) {
|
|
|
2794
2819
|
return Object.keys(labels).length || Object.keys(valueLabels).length ? { labels, valueLabels } : null;
|
|
2795
2820
|
}
|
|
2796
2821
|
|
|
2797
|
-
// src/components/CustomComponents/
|
|
2822
|
+
// src/components/CustomComponents/A2uiRuntime/controller/action.ts
|
|
2798
2823
|
function extractPathFromRef2(value) {
|
|
2799
2824
|
if (typeof value === "string") {
|
|
2800
2825
|
if (value.startsWith("$bind:/")) return value.slice("$bind:".length);
|
|
@@ -2932,7 +2957,7 @@ function buildDispatchContext(surfaceId, rawContext, commands) {
|
|
|
2932
2957
|
};
|
|
2933
2958
|
}
|
|
2934
2959
|
|
|
2935
|
-
// src/components/CustomComponents/
|
|
2960
|
+
// src/components/CustomComponents/A2uiRuntime/controller/visibility.ts
|
|
2936
2961
|
function extractSurfaceId(cmd) {
|
|
2937
2962
|
if (!cmd || typeof cmd !== "object") return "";
|
|
2938
2963
|
return cmd.createSurface?.surfaceId ?? cmd.updateComponents?.surfaceId ?? cmd.updateDataModel?.surfaceId ?? cmd.deleteSurface?.surfaceId ?? "";
|
|
@@ -2953,7 +2978,7 @@ function resolveVisibleSurfaceIds(commands, dismissedSurfaceIds = []) {
|
|
|
2953
2978
|
return Array.from(states.entries()).filter(([sid, st]) => !st.deleted && !dismissedSurfaceIds.includes(sid)).map(([sid]) => sid);
|
|
2954
2979
|
}
|
|
2955
2980
|
|
|
2956
|
-
// src/components/CustomComponents/
|
|
2981
|
+
// src/components/CustomComponents/A2uiRuntime/controller/wizard.ts
|
|
2957
2982
|
function readString(obj, ...keys) {
|
|
2958
2983
|
for (const k of keys) {
|
|
2959
2984
|
const v = obj?.[k];
|
|
@@ -3162,7 +3187,7 @@ function buildWizardUpdateComponentsCommand(schema, stepId) {
|
|
|
3162
3187
|
};
|
|
3163
3188
|
}
|
|
3164
3189
|
|
|
3165
|
-
// src/components/CustomComponents/
|
|
3190
|
+
// src/components/CustomComponents/A2uiRuntime/controller/runtime.ts
|
|
3166
3191
|
function createA2uiRuntimeState() {
|
|
3167
3192
|
return {
|
|
3168
3193
|
processedMessageCursors: [],
|
|
@@ -3362,7 +3387,7 @@ function selectA2uiRuntimeView(state, dismissedSurfaceIds) {
|
|
|
3362
3387
|
};
|
|
3363
3388
|
}
|
|
3364
3389
|
|
|
3365
|
-
// src/components/CustomComponents/
|
|
3390
|
+
// src/components/CustomComponents/A2uiRuntime/controller/index.ts
|
|
3366
3391
|
function applyA2uiRuntimeEffects(effects) {
|
|
3367
3392
|
effects.forEach((effect) => {
|
|
3368
3393
|
if (effect.type === "reset-model-store") {
|
|
@@ -3421,7 +3446,7 @@ var A2uiRuntimeContext = React7__default.default.createContext({
|
|
|
3421
3446
|
surfaceIdsByMessageIndex: {}
|
|
3422
3447
|
});
|
|
3423
3448
|
|
|
3424
|
-
// src/components/CustomComponents/
|
|
3449
|
+
// src/components/CustomComponents/A2uiRuntime/renderer/useA2uiRuntimeView.ts
|
|
3425
3450
|
function useA2uiRuntimeView() {
|
|
3426
3451
|
return React7__default.default.useContext(A2uiRuntimeContext);
|
|
3427
3452
|
}
|
|
@@ -3432,7 +3457,7 @@ function A2uiMessageCards({ messageIndex }) {
|
|
|
3432
3457
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: surfaceIds.map((surfaceId) => /* @__PURE__ */ jsxRuntime.jsx(XCard.Card, { id: surfaceId }, surfaceId)) });
|
|
3433
3458
|
}
|
|
3434
3459
|
|
|
3435
|
-
// src/components/CustomComponents/
|
|
3460
|
+
// src/components/CustomComponents/A2uiRuntime/renderer/protocol.ts
|
|
3436
3461
|
function isSubmitLikeActionName2(name) {
|
|
3437
3462
|
const normalized = String(name || "").trim();
|
|
3438
3463
|
return normalized === "submit" || normalized === "confirm" || normalized.startsWith("submit_") || normalized.endsWith(".confirm");
|
|
@@ -3724,8 +3749,87 @@ function A2uiRuntimeProvider({ messages, children }) {
|
|
|
3724
3749
|
function A2uiRenderer(props) {
|
|
3725
3750
|
return /* @__PURE__ */ jsxRuntime.jsx(A2uiRuntimeProvider, { ...props });
|
|
3726
3751
|
}
|
|
3752
|
+
var FilesNode = React7__default.default.memo(({ item }) => {
|
|
3753
|
+
const chatStore = useChatStore();
|
|
3754
|
+
const configState = valtio.useSnapshot(chatStore.config);
|
|
3755
|
+
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
3756
|
+
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
3757
|
+
const fileItems = React7.useMemo(() => {
|
|
3758
|
+
return (item.files || []).map((file) => {
|
|
3759
|
+
const previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path);
|
|
3760
|
+
let fileType = "file";
|
|
3761
|
+
const ext = file.ext?.toLowerCase() || "";
|
|
3762
|
+
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
|
|
3763
|
+
fileType = "image";
|
|
3764
|
+
} else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
|
|
3765
|
+
fileType = "video";
|
|
3766
|
+
} else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
|
|
3767
|
+
fileType = "audio";
|
|
3768
|
+
}
|
|
3769
|
+
return {
|
|
3770
|
+
...file,
|
|
3771
|
+
src: previewUrl,
|
|
3772
|
+
type: fileType,
|
|
3773
|
+
onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
|
|
3774
|
+
};
|
|
3775
|
+
});
|
|
3776
|
+
}, [item.files]);
|
|
3777
|
+
return /* @__PURE__ */ jsxRuntime.jsx(xV2.FileCard.List, { items: fileItems });
|
|
3778
|
+
});
|
|
3779
|
+
var QuoteMsgNode = React7__default.default.memo(({ quoteMsg, role }) => {
|
|
3780
|
+
if (!quoteMsg || !quoteMsg.messageContent) return null;
|
|
3781
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3782
|
+
xV2.Bubble,
|
|
3783
|
+
{
|
|
3784
|
+
placement: role.placement,
|
|
3785
|
+
variant: "borderless",
|
|
3786
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3787
|
+
antd.Tooltip,
|
|
3788
|
+
{
|
|
3789
|
+
arrow: false,
|
|
3790
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
|
|
3791
|
+
getPopupContainer: (node) => node,
|
|
3792
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
3793
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
3794
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis-2", style: {
|
|
3795
|
+
color: "#666",
|
|
3796
|
+
background: "rgba(0,0,0,0.04)",
|
|
3797
|
+
padding: "2px 8px",
|
|
3798
|
+
borderRadius: "4px",
|
|
3799
|
+
fontSize: "12px",
|
|
3800
|
+
cursor: "pointer"
|
|
3801
|
+
}, children: quoteMsg.messageContent })
|
|
3802
|
+
] })
|
|
3803
|
+
}
|
|
3804
|
+
) })
|
|
3805
|
+
}
|
|
3806
|
+
);
|
|
3807
|
+
});
|
|
3808
|
+
var RunStartedNode = React7__default.default.memo(({ loading }) => {
|
|
3809
|
+
if (!loading) return null;
|
|
3810
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", style: { minHeight: 24 }, children: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, { style: { color: "#1677ff" } }) });
|
|
3811
|
+
});
|
|
3812
|
+
function QuestionSummary({ content }) {
|
|
3813
|
+
const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
|
|
3814
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
|
|
3815
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
|
|
3816
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
|
|
3817
|
+
] });
|
|
3818
|
+
}
|
|
3819
|
+
var TextNode = React7__default.default.memo(
|
|
3820
|
+
({ item, role, customComponents, message: message2 }) => {
|
|
3821
|
+
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
3822
|
+
if (typeof content === "string" && content.startsWith("Question:")) {
|
|
3823
|
+
return /* @__PURE__ */ jsxRuntime.jsx(QuestionSummary, { content });
|
|
3824
|
+
}
|
|
3825
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3826
|
+
!!item.reasoningContent && /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
|
|
3827
|
+
!!content && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content })
|
|
3828
|
+
] });
|
|
3829
|
+
}
|
|
3830
|
+
);
|
|
3727
3831
|
|
|
3728
|
-
// src/components/CustomComponents/
|
|
3832
|
+
// src/components/CustomComponents/ToolRenders/index.module.less
|
|
3729
3833
|
var index_module_default = {
|
|
3730
3834
|
iconContainer: "index_module_iconContainer",
|
|
3731
3835
|
toolName: "index_module_toolName",
|
|
@@ -3936,65 +4040,6 @@ var ToolCallItem = ({ item }) => {
|
|
|
3936
4040
|
};
|
|
3937
4041
|
var tool_call_item_default = ToolCallItem;
|
|
3938
4042
|
var RENDERABLE_MESSAGE_TYPES = ["runStarted", "toolCall", "toolResult", "text", "stepError", "files", "plan"];
|
|
3939
|
-
function QuestionSummary({ content }) {
|
|
3940
|
-
const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
|
|
3941
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
|
|
3942
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
|
|
3943
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
|
|
3944
|
-
] });
|
|
3945
|
-
}
|
|
3946
|
-
var RunStartedNode = React7__default.default.memo(({ loading }) => {
|
|
3947
|
-
if (!loading) return null;
|
|
3948
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", className: styles_module_default.runStartedNode, children: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, { style: { color: "#1677ff" } }) });
|
|
3949
|
-
});
|
|
3950
|
-
var ToolCallNode = React7__default.default.memo(({ item }) => {
|
|
3951
|
-
return /* @__PURE__ */ jsxRuntime.jsx(tool_call_item_default, { item });
|
|
3952
|
-
});
|
|
3953
|
-
var TextNode = React7__default.default.memo(
|
|
3954
|
-
({ item, role, customComponents, message: message2 }) => {
|
|
3955
|
-
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
3956
|
-
if (typeof content === "string" && content.startsWith("Question:")) {
|
|
3957
|
-
return /* @__PURE__ */ jsxRuntime.jsx(QuestionSummary, { content });
|
|
3958
|
-
}
|
|
3959
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3960
|
-
!!item.reasoningContent && /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
|
|
3961
|
-
!!content && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content })
|
|
3962
|
-
] });
|
|
3963
|
-
}
|
|
3964
|
-
);
|
|
3965
|
-
var StepErrorNode = React7__default.default.memo(
|
|
3966
|
-
({ item, customComponents, message: message2 }) => {
|
|
3967
|
-
if (!item.errorMessage) return null;
|
|
3968
|
-
return /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage });
|
|
3969
|
-
}
|
|
3970
|
-
);
|
|
3971
|
-
var FilesNode = React7__default.default.memo(({ item }) => {
|
|
3972
|
-
const chatStore = useChatStore();
|
|
3973
|
-
const configState = valtio.useSnapshot(chatStore.config);
|
|
3974
|
-
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
3975
|
-
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
3976
|
-
const fileItems = React7.useMemo(() => {
|
|
3977
|
-
return (item.files || []).map((file) => {
|
|
3978
|
-
const previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path);
|
|
3979
|
-
let fileType = "file";
|
|
3980
|
-
const ext = file.ext?.toLowerCase() || "";
|
|
3981
|
-
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
|
|
3982
|
-
fileType = "image";
|
|
3983
|
-
} else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
|
|
3984
|
-
fileType = "video";
|
|
3985
|
-
} else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
|
|
3986
|
-
fileType = "audio";
|
|
3987
|
-
}
|
|
3988
|
-
return {
|
|
3989
|
-
...file,
|
|
3990
|
-
src: previewUrl,
|
|
3991
|
-
type: fileType,
|
|
3992
|
-
onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
|
|
3993
|
-
};
|
|
3994
|
-
});
|
|
3995
|
-
}, [item.files]);
|
|
3996
|
-
return /* @__PURE__ */ jsxRuntime.jsx(xV2.FileCard.List, { items: fileItems });
|
|
3997
|
-
});
|
|
3998
4043
|
var MessageRender_default = React7__default.default.memo(({ role, message: message2, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
3999
4044
|
const content = React7.useMemo(() => {
|
|
4000
4045
|
return (message2.content || []).filter((item) => {
|
|
@@ -4034,9 +4079,9 @@ var MessageRender_default = React7__default.default.memo(({ role, message: messa
|
|
|
4034
4079
|
variant: item.type === "files" ? "borderless" : void 0,
|
|
4035
4080
|
content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4036
4081
|
item.type === "runStarted" && /* @__PURE__ */ jsxRuntime.jsx(RunStartedNode, { loading }, `flow-start-${index}`),
|
|
4037
|
-
(item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4038
|
-
item.type === "text" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4039
|
-
item.type === "stepError" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4082
|
+
(item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsxRuntime.jsx(tool_call_item_default, { item }, `tool-call-${item.toolCallId || index}`),
|
|
4083
|
+
item.type === "text" && /* @__PURE__ */ jsxRuntime.jsx(TextNode, { item, role: message2.role, customComponents, message: message2 }, `message-${index}`),
|
|
4084
|
+
item.type === "stepError" && (item.errorMessage ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage }) : null),
|
|
4040
4085
|
item.type === "files" && /* @__PURE__ */ jsxRuntime.jsx(FilesNode, { item }, `files-${index}`),
|
|
4041
4086
|
item.type === "plan" && /* @__PURE__ */ jsxRuntime.jsx(A2uiPlanNode, { item }, `plan-${index}`)
|
|
4042
4087
|
] })
|
|
@@ -4044,30 +4089,7 @@ var MessageRender_default = React7__default.default.memo(({ role, message: messa
|
|
|
4044
4089
|
`message-${index}`
|
|
4045
4090
|
);
|
|
4046
4091
|
}),
|
|
4047
|
-
quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4048
|
-
xV2.Bubble,
|
|
4049
|
-
{
|
|
4050
|
-
className: styles_module_default.chatQuoteMsg,
|
|
4051
|
-
placement: role.placement,
|
|
4052
|
-
variant: "borderless",
|
|
4053
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, children: quoteMsg.messageContent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4054
|
-
antd.Tooltip,
|
|
4055
|
-
{
|
|
4056
|
-
arrow: false,
|
|
4057
|
-
classNames: {
|
|
4058
|
-
root: styles_module_default.quoteTooltip,
|
|
4059
|
-
container: `${styles_module_default.quoteTooltipContainer} scroll-fade-in`
|
|
4060
|
-
},
|
|
4061
|
-
title: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
|
|
4062
|
-
getPopupContainer: (node) => node,
|
|
4063
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
4064
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
4065
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis-2", children: quoteMsg.messageContent })
|
|
4066
|
-
] })
|
|
4067
|
-
}
|
|
4068
|
-
) })
|
|
4069
|
-
}
|
|
4070
|
-
),
|
|
4092
|
+
quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(QuoteMsgNode, { quoteMsg, role }),
|
|
4071
4093
|
messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex }) : null
|
|
4072
4094
|
] });
|
|
4073
4095
|
});
|
|
@@ -4456,43 +4478,43 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4456
4478
|
antd.Modal,
|
|
4457
4479
|
{
|
|
4458
4480
|
open,
|
|
4459
|
-
className:
|
|
4481
|
+
className: style_module_default.customModal,
|
|
4460
4482
|
onCancel,
|
|
4461
4483
|
closeIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}),
|
|
4462
4484
|
width: 960,
|
|
4463
4485
|
centered: true,
|
|
4464
4486
|
destroyOnHidden: true,
|
|
4465
|
-
title: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4466
|
-
footer: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4467
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Layout, { className:
|
|
4468
|
-
/* @__PURE__ */ jsxRuntime.jsx(Sider, { width: 220, className:
|
|
4487
|
+
title: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.titleContainer, children: /* @__PURE__ */ jsxRuntime.jsx(Title2, { level: 5, children: title }) }),
|
|
4488
|
+
footer: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.footer, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", onClick: handleConfirm, children: "\u786E\u8BA4" }) }),
|
|
4489
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Layout, { className: style_module_default.layout, children: [
|
|
4490
|
+
/* @__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) => {
|
|
4469
4491
|
const isChecked = selectedCategoryIds.includes(cat.id);
|
|
4470
4492
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4471
4493
|
antd.Flex,
|
|
4472
4494
|
{
|
|
4473
|
-
className: classNames2__default.default(
|
|
4495
|
+
className: classNames2__default.default(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
|
|
4474
4496
|
onClick: () => handleCategoryChange(cat.id, !isChecked),
|
|
4475
4497
|
children: [
|
|
4476
4498
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4477
4499
|
antd.Checkbox,
|
|
4478
4500
|
{
|
|
4479
4501
|
checked: isChecked,
|
|
4480
|
-
className: cat.id === ALL_CATEGORY_ID ?
|
|
4502
|
+
className: cat.id === ALL_CATEGORY_ID ? style_module_default.roundCheckbox : "",
|
|
4481
4503
|
onClick: (e) => e.stopPropagation(),
|
|
4482
4504
|
onChange: (e) => handleCategoryChange(cat.id, e.target.checked)
|
|
4483
4505
|
}
|
|
4484
4506
|
),
|
|
4485
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
4507
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: style_module_default.categoryName, children: cat.name })
|
|
4486
4508
|
]
|
|
4487
4509
|
},
|
|
4488
4510
|
cat.id
|
|
4489
4511
|
);
|
|
4490
4512
|
}) }) }) }),
|
|
4491
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Content, { className:
|
|
4513
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Content, { className: style_module_default.content, children: [
|
|
4492
4514
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", justify: "space-between", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4493
4515
|
antd.Input,
|
|
4494
4516
|
{
|
|
4495
|
-
className:
|
|
4517
|
+
className: style_module_default.searchInput,
|
|
4496
4518
|
placeholder: `\u641C\u7D22${isSkill ? "\u6280\u80FD" : "\u77E5\u8BC6\u5E93"}\u540D\u79F0`,
|
|
4497
4519
|
prefix: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, { style: { color: token.colorTextQuaternary } }),
|
|
4498
4520
|
value: searchText,
|
|
@@ -4501,12 +4523,12 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4501
4523
|
autoFocus: true
|
|
4502
4524
|
}
|
|
4503
4525
|
) }),
|
|
4504
|
-
selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(Text4, { type: "secondary", className:
|
|
4526
|
+
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: [
|
|
4505
4527
|
"\u5DF2\u9009 ",
|
|
4506
4528
|
selectedIds.length
|
|
4507
4529
|
] }) }),
|
|
4508
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(
|
|
4509
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className:
|
|
4530
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
|
|
4531
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
|
|
4510
4532
|
selectedIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4511
4533
|
antd.Tag,
|
|
4512
4534
|
{
|
|
@@ -4515,36 +4537,36 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
4515
4537
|
e.preventDefault();
|
|
4516
4538
|
toggleItemSelection(id);
|
|
4517
4539
|
},
|
|
4518
|
-
className:
|
|
4540
|
+
className: style_module_default.tag,
|
|
4519
4541
|
children: getDisplayName(id)
|
|
4520
4542
|
},
|
|
4521
4543
|
id
|
|
4522
4544
|
)),
|
|
4523
|
-
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className:
|
|
4545
|
+
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(false), children: [
|
|
4524
4546
|
"\u6536\u8D77 ",
|
|
4525
4547
|
/* @__PURE__ */ jsxRuntime.jsx(icons.UpOutlined, {})
|
|
4526
4548
|
] })
|
|
4527
4549
|
] }),
|
|
4528
|
-
showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4550
|
+
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: [
|
|
4529
4551
|
"\u5C55\u5F00 ",
|
|
4530
4552
|
/* @__PURE__ */ jsxRuntime.jsx(icons.DownOutlined, {})
|
|
4531
4553
|
] }) })
|
|
4532
4554
|
] }),
|
|
4533
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4555
|
+
/* @__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) => {
|
|
4534
4556
|
const isSelected = selectedIds.includes(item.id);
|
|
4535
4557
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4536
4558
|
"div",
|
|
4537
4559
|
{
|
|
4538
|
-
className: classNames2__default.default(
|
|
4560
|
+
className: classNames2__default.default(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
|
|
4539
4561
|
onClick: () => toggleItemSelection(item.id),
|
|
4540
4562
|
children: [
|
|
4541
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4542
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
4563
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: iconType }) }),
|
|
4564
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: style_module_default.itemInfo, children: [
|
|
4543
4565
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", children: [
|
|
4544
4566
|
/* @__PURE__ */ jsxRuntime.jsx(Text4, { strong: true, children: getDisplayName(item.id) }),
|
|
4545
4567
|
isSelected && /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: token.colorPrimary, variant: "outlined", children: "\u5DF2\u6DFB\u52A0" })
|
|
4546
4568
|
] }),
|
|
4547
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text4, { type: "secondary", className:
|
|
4569
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text4, { type: "secondary", className: style_module_default.itemDesc, children: item.description || "\u6682\u65E0\u63CF\u8FF0" })
|
|
4548
4570
|
] })
|
|
4549
4571
|
]
|
|
4550
4572
|
},
|
|
@@ -4563,12 +4585,12 @@ var KnowledgeBtn_default = ({}) => {
|
|
|
4563
4585
|
const [modalOpen, setModalOpen] = React7.useState(false);
|
|
4564
4586
|
const knowledgeCount = conversationState.active.spec?.knowledge?.items?.length ?? 0;
|
|
4565
4587
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4566
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
4588
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
4567
4589
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-remark" }),
|
|
4568
4590
|
/* @__PURE__ */ jsxRuntime.jsx(Text5, { children: "\u77E5\u8BC6\u5E93" }),
|
|
4569
4591
|
knowledgeCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4570
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className:
|
|
4571
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className:
|
|
4592
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className: style_module_default.divider }),
|
|
4593
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: style_module_default.count, children: knowledgeCount })
|
|
4572
4594
|
] })
|
|
4573
4595
|
] }),
|
|
4574
4596
|
modalOpen && /* @__PURE__ */ jsxRuntime.jsx(ResourceSelectorModal_default, { open: modalOpen, type: "knowledge", onCancel: () => setModalOpen(false) })
|
|
@@ -4602,6 +4624,17 @@ var ModelSelect_default = ({}) => {
|
|
|
4602
4624
|
}))
|
|
4603
4625
|
}));
|
|
4604
4626
|
const selectedModelValue = modelOptions.find((item) => item.value === agentState.model.providerName)?.options.find((item) => item.value === agentState.model.modelName)?.value || void 0;
|
|
4627
|
+
React7.useEffect(() => {
|
|
4628
|
+
if (!selectedModelValue && models.length > 0 && models[0].models?.length > 0) {
|
|
4629
|
+
const firstProvider = models[0];
|
|
4630
|
+
const firstModel = firstProvider.models[0];
|
|
4631
|
+
chatStore.setAgentModel({
|
|
4632
|
+
...agentState.model,
|
|
4633
|
+
modelName: firstModel.modelName,
|
|
4634
|
+
providerName: firstProvider.providerName
|
|
4635
|
+
});
|
|
4636
|
+
}
|
|
4637
|
+
}, [selectedModelValue, models, agentState.model, chatStore]);
|
|
4605
4638
|
const handleModelChange = (_, option) => {
|
|
4606
4639
|
if (Array.isArray(option) || !option || !("providerName" in option)) return;
|
|
4607
4640
|
chatStore.setAgentModel({
|
|
@@ -4654,7 +4687,7 @@ var ReasonBtn_default = ({}) => {
|
|
|
4654
4687
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4655
4688
|
"div",
|
|
4656
4689
|
{
|
|
4657
|
-
className: classNames2__default.default(
|
|
4690
|
+
className: classNames2__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
|
|
4658
4691
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
4659
4692
|
children: [
|
|
4660
4693
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
|
|
@@ -4670,12 +4703,12 @@ var SkillBtn_default = ({}) => {
|
|
|
4670
4703
|
const [modalOpen, setModalOpen] = React7.useState(false);
|
|
4671
4704
|
const skillsCount = conversationState.active.spec?.skills?.items?.length ?? 0;
|
|
4672
4705
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4673
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
4706
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
4674
4707
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-skill" }),
|
|
4675
4708
|
/* @__PURE__ */ jsxRuntime.jsx(Text7, { children: "\u6280\u80FD" }),
|
|
4676
4709
|
skillsCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4677
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className:
|
|
4678
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className:
|
|
4710
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className: style_module_default.divider }),
|
|
4711
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: style_module_default.count, children: skillsCount })
|
|
4679
4712
|
] })
|
|
4680
4713
|
] }),
|
|
4681
4714
|
modalOpen && /* @__PURE__ */ jsxRuntime.jsx(ResourceSelectorModal_default, { open: modalOpen, type: "skill", onCancel: () => setModalOpen(false) })
|
|
@@ -4845,7 +4878,7 @@ var ChatPreviewPanel = React7.memo(({ file }) => {
|
|
|
4845
4878
|
}, [file]);
|
|
4846
4879
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4847
4880
|
file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
|
|
4848
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4881
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default5.previewHeader, children: [
|
|
4849
4882
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
|
|
4850
4883
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
|
|
4851
4884
|
/* @__PURE__ */ jsxRuntime.jsx(
|