@zero-library/chat-copilot 1.0.21 → 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 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=${encodeURIComponent(path)}&${TOKEN_KEY}=${tokenManager.get()}`;
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: styles_module_default2.popover },
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/a2ui-runtime/components/artifacts/export-utils.ts
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
  }
@@ -2177,6 +2176,15 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
2177
2176
  suffix
2178
2177
  });
2179
2178
  };
2179
+ const handlePathToUrl = (href) => {
2180
+ const fileName = getLinkFileName(href);
2181
+ const suffix = common.getFileSuffixName(fileName);
2182
+ chatStore.setPreview({
2183
+ fileUrl: chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, href),
2184
+ fileName,
2185
+ suffix
2186
+ });
2187
+ };
2180
2188
  const handleClick = (e) => {
2181
2189
  rest.onClick?.(e);
2182
2190
  const href = rest.href || e.currentTarget.href;
@@ -2188,6 +2196,10 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
2188
2196
  handlePreviewLink(href);
2189
2197
  return;
2190
2198
  }
2199
+ if (String(rest.href).startsWith("/workspace")) {
2200
+ handlePathToUrl(href);
2201
+ return;
2202
+ }
2191
2203
  window.open(href, "_blank");
2192
2204
  };
2193
2205
  return /* @__PURE__ */ jsxRuntime.jsx("a", { ...rest, onClick: handleClick, children: data });
@@ -2688,7 +2700,7 @@ var A2uiComponents = {
2688
2700
  ReportViewer
2689
2701
  };
2690
2702
 
2691
- // src/components/CustomComponents/a2ui-runtime/controller/meta.ts
2703
+ // src/components/CustomComponents/A2uiRuntime/controller/meta.ts
2692
2704
  function readProp(current, props, key) {
2693
2705
  return current[key] ?? props?.[key];
2694
2706
  }
@@ -2794,7 +2806,7 @@ function collectActionDisplayMeta(commands, surfaceId, context) {
2794
2806
  return Object.keys(labels).length || Object.keys(valueLabels).length ? { labels, valueLabels } : null;
2795
2807
  }
2796
2808
 
2797
- // src/components/CustomComponents/a2ui-runtime/controller/action.ts
2809
+ // src/components/CustomComponents/A2uiRuntime/controller/action.ts
2798
2810
  function extractPathFromRef2(value) {
2799
2811
  if (typeof value === "string") {
2800
2812
  if (value.startsWith("$bind:/")) return value.slice("$bind:".length);
@@ -2932,7 +2944,7 @@ function buildDispatchContext(surfaceId, rawContext, commands) {
2932
2944
  };
2933
2945
  }
2934
2946
 
2935
- // src/components/CustomComponents/a2ui-runtime/controller/visibility.ts
2947
+ // src/components/CustomComponents/A2uiRuntime/controller/visibility.ts
2936
2948
  function extractSurfaceId(cmd) {
2937
2949
  if (!cmd || typeof cmd !== "object") return "";
2938
2950
  return cmd.createSurface?.surfaceId ?? cmd.updateComponents?.surfaceId ?? cmd.updateDataModel?.surfaceId ?? cmd.deleteSurface?.surfaceId ?? "";
@@ -2953,7 +2965,7 @@ function resolveVisibleSurfaceIds(commands, dismissedSurfaceIds = []) {
2953
2965
  return Array.from(states.entries()).filter(([sid, st]) => !st.deleted && !dismissedSurfaceIds.includes(sid)).map(([sid]) => sid);
2954
2966
  }
2955
2967
 
2956
- // src/components/CustomComponents/a2ui-runtime/controller/wizard.ts
2968
+ // src/components/CustomComponents/A2uiRuntime/controller/wizard.ts
2957
2969
  function readString(obj, ...keys) {
2958
2970
  for (const k of keys) {
2959
2971
  const v = obj?.[k];
@@ -3162,7 +3174,7 @@ function buildWizardUpdateComponentsCommand(schema, stepId) {
3162
3174
  };
3163
3175
  }
3164
3176
 
3165
- // src/components/CustomComponents/a2ui-runtime/controller/runtime.ts
3177
+ // src/components/CustomComponents/A2uiRuntime/controller/runtime.ts
3166
3178
  function createA2uiRuntimeState() {
3167
3179
  return {
3168
3180
  processedMessageCursors: [],
@@ -3362,7 +3374,7 @@ function selectA2uiRuntimeView(state, dismissedSurfaceIds) {
3362
3374
  };
3363
3375
  }
3364
3376
 
3365
- // src/components/CustomComponents/a2ui-runtime/controller/index.ts
3377
+ // src/components/CustomComponents/A2uiRuntime/controller/index.ts
3366
3378
  function applyA2uiRuntimeEffects(effects) {
3367
3379
  effects.forEach((effect) => {
3368
3380
  if (effect.type === "reset-model-store") {
@@ -3421,7 +3433,7 @@ var A2uiRuntimeContext = React7__default.default.createContext({
3421
3433
  surfaceIdsByMessageIndex: {}
3422
3434
  });
3423
3435
 
3424
- // src/components/CustomComponents/a2ui-runtime/renderer/useA2uiRuntimeView.ts
3436
+ // src/components/CustomComponents/A2uiRuntime/renderer/useA2uiRuntimeView.ts
3425
3437
  function useA2uiRuntimeView() {
3426
3438
  return React7__default.default.useContext(A2uiRuntimeContext);
3427
3439
  }
@@ -3432,7 +3444,7 @@ function A2uiMessageCards({ messageIndex }) {
3432
3444
  return /* @__PURE__ */ jsxRuntime.jsx("div", { children: surfaceIds.map((surfaceId) => /* @__PURE__ */ jsxRuntime.jsx(XCard.Card, { id: surfaceId }, surfaceId)) });
3433
3445
  }
3434
3446
 
3435
- // src/components/CustomComponents/a2ui-runtime/renderer/protocol.ts
3447
+ // src/components/CustomComponents/A2uiRuntime/renderer/protocol.ts
3436
3448
  function isSubmitLikeActionName2(name) {
3437
3449
  const normalized = String(name || "").trim();
3438
3450
  return normalized === "submit" || normalized === "confirm" || normalized.startsWith("submit_") || normalized.endsWith(".confirm");
@@ -3724,8 +3736,87 @@ function A2uiRuntimeProvider({ messages, children }) {
3724
3736
  function A2uiRenderer(props) {
3725
3737
  return /* @__PURE__ */ jsxRuntime.jsx(A2uiRuntimeProvider, { ...props });
3726
3738
  }
3739
+ var FilesNode = React7__default.default.memo(({ item }) => {
3740
+ const chatStore = useChatStore();
3741
+ const configState = valtio.useSnapshot(chatStore.config);
3742
+ const agentState = valtio.useSnapshot(chatStore.agent);
3743
+ const conversationState = valtio.useSnapshot(chatStore.conversation);
3744
+ const fileItems = React7.useMemo(() => {
3745
+ return (item.files || []).map((file) => {
3746
+ const previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path);
3747
+ let fileType = "file";
3748
+ const ext = file.ext?.toLowerCase() || "";
3749
+ if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
3750
+ fileType = "image";
3751
+ } else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
3752
+ fileType = "video";
3753
+ } else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
3754
+ fileType = "audio";
3755
+ }
3756
+ return {
3757
+ ...file,
3758
+ src: previewUrl,
3759
+ type: fileType,
3760
+ onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
3761
+ };
3762
+ });
3763
+ }, [item.files]);
3764
+ return /* @__PURE__ */ jsxRuntime.jsx(xV2.FileCard.List, { items: fileItems });
3765
+ });
3766
+ var QuoteMsgNode = React7__default.default.memo(({ quoteMsg, role }) => {
3767
+ if (!quoteMsg || !quoteMsg.messageContent) return null;
3768
+ return /* @__PURE__ */ jsxRuntime.jsx(
3769
+ xV2.Bubble,
3770
+ {
3771
+ placement: role.placement,
3772
+ variant: "borderless",
3773
+ content: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsxRuntime.jsx(
3774
+ antd.Tooltip,
3775
+ {
3776
+ arrow: false,
3777
+ title: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
3778
+ getPopupContainer: (node) => node,
3779
+ children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
3780
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
3781
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis-2", style: {
3782
+ color: "#666",
3783
+ background: "rgba(0,0,0,0.04)",
3784
+ padding: "2px 8px",
3785
+ borderRadius: "4px",
3786
+ fontSize: "12px",
3787
+ cursor: "pointer"
3788
+ }, children: quoteMsg.messageContent })
3789
+ ] })
3790
+ }
3791
+ ) })
3792
+ }
3793
+ );
3794
+ });
3795
+ var RunStartedNode = React7__default.default.memo(({ loading }) => {
3796
+ if (!loading) return null;
3797
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", style: { minHeight: 24 }, children: /* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, { style: { color: "#1677ff" } }) });
3798
+ });
3799
+ function QuestionSummary({ content }) {
3800
+ const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
3801
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
3802
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
3803
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
3804
+ ] });
3805
+ }
3806
+ var TextNode = React7__default.default.memo(
3807
+ ({ item, role, customComponents, message: message2 }) => {
3808
+ const content = toA2uiDisplayText(role, item?.messageContent);
3809
+ if (typeof content === "string" && content.startsWith("Question:")) {
3810
+ return /* @__PURE__ */ jsxRuntime.jsx(QuestionSummary, { content });
3811
+ }
3812
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3813
+ !!item.reasoningContent && /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
3814
+ !!content && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content })
3815
+ ] });
3816
+ }
3817
+ );
3727
3818
 
3728
- // src/components/CustomComponents/tool-renders/index.module.less
3819
+ // src/components/CustomComponents/ToolRenders/index.module.less
3729
3820
  var index_module_default = {
3730
3821
  iconContainer: "index_module_iconContainer",
3731
3822
  toolName: "index_module_toolName",
@@ -3936,65 +4027,6 @@ var ToolCallItem = ({ item }) => {
3936
4027
  };
3937
4028
  var tool_call_item_default = ToolCallItem;
3938
4029
  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
4030
  var MessageRender_default = React7__default.default.memo(({ role, message: message2, messageIndex = -1, loading, containerRef, customComponents }) => {
3999
4031
  const content = React7.useMemo(() => {
4000
4032
  return (message2.content || []).filter((item) => {
@@ -4034,9 +4066,9 @@ var MessageRender_default = React7__default.default.memo(({ role, message: messa
4034
4066
  variant: item.type === "files" ? "borderless" : void 0,
4035
4067
  content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4036
4068
  item.type === "runStarted" && /* @__PURE__ */ jsxRuntime.jsx(RunStartedNode, { loading }, `flow-start-${index}`),
4037
- (item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsxRuntime.jsx(ToolCallNode, { item }, `tool-call-${item.toolCallId || index}`),
4038
- item.type === "text" && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(TextNode, { item, role: message2.role, customComponents, message: message2 }, `message-${index}`) }),
4039
- item.type === "stepError" && /* @__PURE__ */ jsxRuntime.jsx(StepErrorNode, { item, customComponents, message: message2 }, `step-error-${index}`),
4069
+ (item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsxRuntime.jsx(tool_call_item_default, { item }, `tool-call-${item.toolCallId || index}`),
4070
+ item.type === "text" && /* @__PURE__ */ jsxRuntime.jsx(TextNode, { item, role: message2.role, customComponents, message: message2 }, `message-${index}`),
4071
+ item.type === "stepError" && (item.errorMessage ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage }) : null),
4040
4072
  item.type === "files" && /* @__PURE__ */ jsxRuntime.jsx(FilesNode, { item }, `files-${index}`),
4041
4073
  item.type === "plan" && /* @__PURE__ */ jsxRuntime.jsx(A2uiPlanNode, { item }, `plan-${index}`)
4042
4074
  ] })
@@ -4044,30 +4076,7 @@ var MessageRender_default = React7__default.default.memo(({ role, message: messa
4044
4076
  `message-${index}`
4045
4077
  );
4046
4078
  }),
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
- ),
4079
+ quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(QuoteMsgNode, { quoteMsg, role }),
4071
4080
  messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex }) : null
4072
4081
  ] });
4073
4082
  });
@@ -4456,43 +4465,43 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
4456
4465
  antd.Modal,
4457
4466
  {
4458
4467
  open,
4459
- className: styles_module_default2.customModal,
4468
+ className: style_module_default.customModal,
4460
4469
  onCancel,
4461
4470
  closeIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}),
4462
4471
  width: 960,
4463
4472
  centered: true,
4464
4473
  destroyOnHidden: true,
4465
- title: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: styles_module_default2.titleContainer, children: /* @__PURE__ */ jsxRuntime.jsx(Title2, { level: 5, children: title }) }),
4466
- footer: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: styles_module_default2.footer, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", onClick: handleConfirm, children: "\u786E\u8BA4" }) }),
4467
- children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Layout, { className: styles_module_default2.layout, children: [
4468
- /* @__PURE__ */ jsxRuntime.jsx(Sider, { width: 220, className: styles_module_default2.sider, theme: "light", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.siderContent, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 4, vertical: true, children: categories.map((cat) => {
4474
+ title: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: style_module_default.titleContainer, children: /* @__PURE__ */ jsxRuntime.jsx(Title2, { level: 5, children: title }) }),
4475
+ footer: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.footer, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", onClick: handleConfirm, children: "\u786E\u8BA4" }) }),
4476
+ children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Layout, { className: style_module_default.layout, children: [
4477
+ /* @__PURE__ */ jsxRuntime.jsx(Sider, { width: 220, className: style_module_default.sider, theme: "light", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.siderContent, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 4, vertical: true, children: categories.map((cat) => {
4469
4478
  const isChecked = selectedCategoryIds.includes(cat.id);
4470
4479
  return /* @__PURE__ */ jsxRuntime.jsxs(
4471
4480
  antd.Flex,
4472
4481
  {
4473
- className: classNames2__default.default(styles_module_default2.categoryItem, { [styles_module_default2.categoryActive]: isChecked }),
4482
+ className: classNames2__default.default(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
4474
4483
  onClick: () => handleCategoryChange(cat.id, !isChecked),
4475
4484
  children: [
4476
4485
  /* @__PURE__ */ jsxRuntime.jsx(
4477
4486
  antd.Checkbox,
4478
4487
  {
4479
4488
  checked: isChecked,
4480
- className: cat.id === ALL_CATEGORY_ID ? styles_module_default2.roundCheckbox : "",
4489
+ className: cat.id === ALL_CATEGORY_ID ? style_module_default.roundCheckbox : "",
4481
4490
  onClick: (e) => e.stopPropagation(),
4482
4491
  onChange: (e) => handleCategoryChange(cat.id, e.target.checked)
4483
4492
  }
4484
4493
  ),
4485
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_module_default2.categoryName, children: cat.name })
4494
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: style_module_default.categoryName, children: cat.name })
4486
4495
  ]
4487
4496
  },
4488
4497
  cat.id
4489
4498
  );
4490
4499
  }) }) }) }),
4491
- /* @__PURE__ */ jsxRuntime.jsxs(Content, { className: styles_module_default2.content, children: [
4500
+ /* @__PURE__ */ jsxRuntime.jsxs(Content, { className: style_module_default.content, children: [
4492
4501
  /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", justify: "space-between", children: /* @__PURE__ */ jsxRuntime.jsx(
4493
4502
  antd.Input,
4494
4503
  {
4495
- className: styles_module_default2.searchInput,
4504
+ className: style_module_default.searchInput,
4496
4505
  placeholder: `\u641C\u7D22${isSkill ? "\u6280\u80FD" : "\u77E5\u8BC6\u5E93"}\u540D\u79F0`,
4497
4506
  prefix: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, { style: { color: token.colorTextQuaternary } }),
4498
4507
  value: searchText,
@@ -4501,12 +4510,12 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
4501
4510
  autoFocus: true
4502
4511
  }
4503
4512
  ) }),
4504
- selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(Text4, { type: "secondary", className: styles_module_default2.selectedCount, children: [
4513
+ selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(Text4, { type: "secondary", className: style_module_default.selectedCount, children: [
4505
4514
  "\u5DF2\u9009 ",
4506
4515
  selectedIds.length
4507
4516
  ] }) }),
4508
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(styles_module_default2.tagsArea, { [styles_module_default2.tagsExpanded]: tagsExpanded }), children: [
4509
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: styles_module_default2.tagContainer, wrap: true, ref: tagsContainerRef, children: [
4517
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
4518
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
4510
4519
  selectedIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
4511
4520
  antd.Tag,
4512
4521
  {
@@ -4515,36 +4524,36 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
4515
4524
  e.preventDefault();
4516
4525
  toggleItemSelection(id);
4517
4526
  },
4518
- className: styles_module_default2.tag,
4527
+ className: style_module_default.tag,
4519
4528
  children: getDisplayName(id)
4520
4529
  },
4521
4530
  id
4522
4531
  )),
4523
- showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className: styles_module_default2.expandBtn, onClick: () => setTagsExpanded(false), children: [
4532
+ showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(false), children: [
4524
4533
  "\u6536\u8D77 ",
4525
4534
  /* @__PURE__ */ jsxRuntime.jsx(icons.UpOutlined, {})
4526
4535
  ] })
4527
4536
  ] }),
4528
- showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.expandBtnWrapper, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className: styles_module_default2.expandBtn, onClick: () => setTagsExpanded(true), children: [
4537
+ showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.expandBtnWrapper, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(true), children: [
4529
4538
  "\u5C55\u5F00 ",
4530
4539
  /* @__PURE__ */ jsxRuntime.jsx(icons.DownOutlined, {})
4531
4540
  ] }) })
4532
4541
  ] }),
4533
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.listArea, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.listInner, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, vertical: true, children: filteredResources.length > 0 ? filteredResources.map((item) => {
4542
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.listArea, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.listInner, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, vertical: true, children: filteredResources.length > 0 ? filteredResources.map((item) => {
4534
4543
  const isSelected = selectedIds.includes(item.id);
4535
4544
  return /* @__PURE__ */ jsxRuntime.jsxs(
4536
4545
  "div",
4537
4546
  {
4538
- className: classNames2__default.default(styles_module_default2.listItem, { [styles_module_default2.listItemSelected]: isSelected }),
4547
+ className: classNames2__default.default(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
4539
4548
  onClick: () => toggleItemSelection(item.id),
4540
4549
  children: [
4541
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.itemIconWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: iconType }) }),
4542
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: styles_module_default2.itemInfo, children: [
4550
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: iconType }) }),
4551
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: style_module_default.itemInfo, children: [
4543
4552
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", children: [
4544
4553
  /* @__PURE__ */ jsxRuntime.jsx(Text4, { strong: true, children: getDisplayName(item.id) }),
4545
4554
  isSelected && /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: token.colorPrimary, variant: "outlined", children: "\u5DF2\u6DFB\u52A0" })
4546
4555
  ] }),
4547
- /* @__PURE__ */ jsxRuntime.jsx(Text4, { type: "secondary", className: styles_module_default2.itemDesc, children: item.description || "\u6682\u65E0\u63CF\u8FF0" })
4556
+ /* @__PURE__ */ jsxRuntime.jsx(Text4, { type: "secondary", className: style_module_default.itemDesc, children: item.description || "\u6682\u65E0\u63CF\u8FF0" })
4548
4557
  ] })
4549
4558
  ]
4550
4559
  },
@@ -4563,12 +4572,12 @@ var KnowledgeBtn_default = ({}) => {
4563
4572
  const [modalOpen, setModalOpen] = React7.useState(false);
4564
4573
  const knowledgeCount = conversationState.active.spec?.knowledge?.items?.length ?? 0;
4565
4574
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4566
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.resourceBtn, onClick: () => setModalOpen(true), children: [
4575
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
4567
4576
  /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-remark" }),
4568
4577
  /* @__PURE__ */ jsxRuntime.jsx(Text5, { children: "\u77E5\u8BC6\u5E93" }),
4569
4578
  knowledgeCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4570
- /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className: styles_module_default2.divider }),
4571
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: styles_module_default2.count, children: knowledgeCount })
4579
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className: style_module_default.divider }),
4580
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: style_module_default.count, children: knowledgeCount })
4572
4581
  ] })
4573
4582
  ] }),
4574
4583
  modalOpen && /* @__PURE__ */ jsxRuntime.jsx(ResourceSelectorModal_default, { open: modalOpen, type: "knowledge", onCancel: () => setModalOpen(false) })
@@ -4602,6 +4611,17 @@ var ModelSelect_default = ({}) => {
4602
4611
  }))
4603
4612
  }));
4604
4613
  const selectedModelValue = modelOptions.find((item) => item.value === agentState.model.providerName)?.options.find((item) => item.value === agentState.model.modelName)?.value || void 0;
4614
+ React7.useEffect(() => {
4615
+ if (!selectedModelValue && models.length > 0 && models[0].models?.length > 0) {
4616
+ const firstProvider = models[0];
4617
+ const firstModel = firstProvider.models[0];
4618
+ chatStore.setAgentModel({
4619
+ ...agentState.model,
4620
+ modelName: firstModel.modelName,
4621
+ providerName: firstProvider.providerName
4622
+ });
4623
+ }
4624
+ }, [selectedModelValue, models, agentState.model, chatStore]);
4605
4625
  const handleModelChange = (_, option) => {
4606
4626
  if (Array.isArray(option) || !option || !("providerName" in option)) return;
4607
4627
  chatStore.setAgentModel({
@@ -4654,7 +4674,7 @@ var ReasonBtn_default = ({}) => {
4654
4674
  return /* @__PURE__ */ jsxRuntime.jsxs(
4655
4675
  "div",
4656
4676
  {
4657
- className: classNames2__default.default(styles_module_default2.resourceBtn, { [styles_module_default2.resourceBtnActive]: agentState.model.reasoning }),
4677
+ className: classNames2__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
4658
4678
  onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
4659
4679
  children: [
4660
4680
  /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
@@ -4670,12 +4690,12 @@ var SkillBtn_default = ({}) => {
4670
4690
  const [modalOpen, setModalOpen] = React7.useState(false);
4671
4691
  const skillsCount = conversationState.active.spec?.skills?.items?.length ?? 0;
4672
4692
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4673
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.resourceBtn, onClick: () => setModalOpen(true), children: [
4693
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
4674
4694
  /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-skill" }),
4675
4695
  /* @__PURE__ */ jsxRuntime.jsx(Text7, { children: "\u6280\u80FD" }),
4676
4696
  skillsCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4677
- /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className: styles_module_default2.divider }),
4678
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: styles_module_default2.count, children: skillsCount })
4697
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className: style_module_default.divider }),
4698
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: style_module_default.count, children: skillsCount })
4679
4699
  ] })
4680
4700
  ] }),
4681
4701
  modalOpen && /* @__PURE__ */ jsxRuntime.jsx(ResourceSelectorModal_default, { open: modalOpen, type: "skill", onCancel: () => setModalOpen(false) })