@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.esm.js CHANGED
@@ -1,7 +1,7 @@
1
- import { CloudUploadOutlined, PaperClipOutlined, createFromIconfontCN, LoadingOutlined, EnterOutlined, DownloadOutlined, CloseOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, ToolOutlined, PlayCircleOutlined, DotChartOutlined, SearchOutlined, UpOutlined, DownOutlined, PlusOutlined, CommentOutlined, RedoOutlined, DeleteOutlined, ClockCircleOutlined, CheckCircleOutlined } from '@ant-design/icons';
2
- import { Attachments, Sender, Think, FileCard, Bubble, XProvider, Mermaid, CodeHighlighter, Welcome, Prompts, Conversations } from '@ant-design/x-v2';
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, List, Drawer, Card, Table, Progress as Progress$1, Switch as Switch$1 } from 'antd';
4
+ import { App, Badge, Button, Flex, Typography, Tooltip, Layout, Tag, Spin, Splitter, theme, Collapse, Divider as Divider$1, Select as Select$1, Avatar, Space, Popover, Skeleton, Alert, Modal, Checkbox, Input, Empty, message, Drawer, List, Card, Table, Progress as Progress$1, Switch as Switch$1 } from 'antd';
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=${encodeURIComponent(path)}&${TOKEN_KEY}=${tokenManager.get()}`;
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: styles_module_default2.popover },
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/a2ui-runtime/components/artifacts/export-utils.ts
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
  }
@@ -2166,6 +2165,15 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
2166
2165
  suffix
2167
2166
  });
2168
2167
  };
2168
+ const handlePathToUrl = (href) => {
2169
+ const fileName = getLinkFileName(href);
2170
+ const suffix = getFileSuffixName(fileName);
2171
+ chatStore.setPreview({
2172
+ fileUrl: chatStore.config.services.request.getPreviewUrl(message2.agentId, message2.conversationId, href),
2173
+ fileName,
2174
+ suffix
2175
+ });
2176
+ };
2169
2177
  const handleClick = (e) => {
2170
2178
  rest.onClick?.(e);
2171
2179
  const href = rest.href || e.currentTarget.href;
@@ -2177,6 +2185,10 @@ var PreviewLink_default = ({ data, loading, message: message2, ...rest }) => {
2177
2185
  handlePreviewLink(href);
2178
2186
  return;
2179
2187
  }
2188
+ if (String(rest.href).startsWith("/workspace")) {
2189
+ handlePathToUrl(href);
2190
+ return;
2191
+ }
2180
2192
  window.open(href, "_blank");
2181
2193
  };
2182
2194
  return /* @__PURE__ */ jsx("a", { ...rest, onClick: handleClick, children: data });
@@ -2677,7 +2689,7 @@ var A2uiComponents = {
2677
2689
  ReportViewer
2678
2690
  };
2679
2691
 
2680
- // src/components/CustomComponents/a2ui-runtime/controller/meta.ts
2692
+ // src/components/CustomComponents/A2uiRuntime/controller/meta.ts
2681
2693
  function readProp(current, props, key) {
2682
2694
  return current[key] ?? props?.[key];
2683
2695
  }
@@ -2783,7 +2795,7 @@ function collectActionDisplayMeta(commands, surfaceId, context) {
2783
2795
  return Object.keys(labels).length || Object.keys(valueLabels).length ? { labels, valueLabels } : null;
2784
2796
  }
2785
2797
 
2786
- // src/components/CustomComponents/a2ui-runtime/controller/action.ts
2798
+ // src/components/CustomComponents/A2uiRuntime/controller/action.ts
2787
2799
  function extractPathFromRef2(value) {
2788
2800
  if (typeof value === "string") {
2789
2801
  if (value.startsWith("$bind:/")) return value.slice("$bind:".length);
@@ -2921,7 +2933,7 @@ function buildDispatchContext(surfaceId, rawContext, commands) {
2921
2933
  };
2922
2934
  }
2923
2935
 
2924
- // src/components/CustomComponents/a2ui-runtime/controller/visibility.ts
2936
+ // src/components/CustomComponents/A2uiRuntime/controller/visibility.ts
2925
2937
  function extractSurfaceId(cmd) {
2926
2938
  if (!cmd || typeof cmd !== "object") return "";
2927
2939
  return cmd.createSurface?.surfaceId ?? cmd.updateComponents?.surfaceId ?? cmd.updateDataModel?.surfaceId ?? cmd.deleteSurface?.surfaceId ?? "";
@@ -2942,7 +2954,7 @@ function resolveVisibleSurfaceIds(commands, dismissedSurfaceIds = []) {
2942
2954
  return Array.from(states.entries()).filter(([sid, st]) => !st.deleted && !dismissedSurfaceIds.includes(sid)).map(([sid]) => sid);
2943
2955
  }
2944
2956
 
2945
- // src/components/CustomComponents/a2ui-runtime/controller/wizard.ts
2957
+ // src/components/CustomComponents/A2uiRuntime/controller/wizard.ts
2946
2958
  function readString(obj, ...keys) {
2947
2959
  for (const k of keys) {
2948
2960
  const v = obj?.[k];
@@ -3151,7 +3163,7 @@ function buildWizardUpdateComponentsCommand(schema, stepId) {
3151
3163
  };
3152
3164
  }
3153
3165
 
3154
- // src/components/CustomComponents/a2ui-runtime/controller/runtime.ts
3166
+ // src/components/CustomComponents/A2uiRuntime/controller/runtime.ts
3155
3167
  function createA2uiRuntimeState() {
3156
3168
  return {
3157
3169
  processedMessageCursors: [],
@@ -3351,7 +3363,7 @@ function selectA2uiRuntimeView(state, dismissedSurfaceIds) {
3351
3363
  };
3352
3364
  }
3353
3365
 
3354
- // src/components/CustomComponents/a2ui-runtime/controller/index.ts
3366
+ // src/components/CustomComponents/A2uiRuntime/controller/index.ts
3355
3367
  function applyA2uiRuntimeEffects(effects) {
3356
3368
  effects.forEach((effect) => {
3357
3369
  if (effect.type === "reset-model-store") {
@@ -3410,7 +3422,7 @@ var A2uiRuntimeContext = React7.createContext({
3410
3422
  surfaceIdsByMessageIndex: {}
3411
3423
  });
3412
3424
 
3413
- // src/components/CustomComponents/a2ui-runtime/renderer/useA2uiRuntimeView.ts
3425
+ // src/components/CustomComponents/A2uiRuntime/renderer/useA2uiRuntimeView.ts
3414
3426
  function useA2uiRuntimeView() {
3415
3427
  return React7.useContext(A2uiRuntimeContext);
3416
3428
  }
@@ -3421,7 +3433,7 @@ function A2uiMessageCards({ messageIndex }) {
3421
3433
  return /* @__PURE__ */ jsx("div", { children: surfaceIds.map((surfaceId) => /* @__PURE__ */ jsx(XCard.Card, { id: surfaceId }, surfaceId)) });
3422
3434
  }
3423
3435
 
3424
- // src/components/CustomComponents/a2ui-runtime/renderer/protocol.ts
3436
+ // src/components/CustomComponents/A2uiRuntime/renderer/protocol.ts
3425
3437
  function isSubmitLikeActionName2(name) {
3426
3438
  const normalized = String(name || "").trim();
3427
3439
  return normalized === "submit" || normalized === "confirm" || normalized.startsWith("submit_") || normalized.endsWith(".confirm");
@@ -3713,8 +3725,87 @@ function A2uiRuntimeProvider({ messages, children }) {
3713
3725
  function A2uiRenderer(props) {
3714
3726
  return /* @__PURE__ */ jsx(A2uiRuntimeProvider, { ...props });
3715
3727
  }
3728
+ var FilesNode = React7.memo(({ item }) => {
3729
+ const chatStore = useChatStore();
3730
+ const configState = useSnapshot(chatStore.config);
3731
+ const agentState = useSnapshot(chatStore.agent);
3732
+ const conversationState = useSnapshot(chatStore.conversation);
3733
+ const fileItems = useMemo(() => {
3734
+ return (item.files || []).map((file) => {
3735
+ const previewUrl = configState.services.request.getPreviewUrl(agentState.agentInfo.id, conversationState.active.id, file.path);
3736
+ let fileType = "file";
3737
+ const ext = file.ext?.toLowerCase() || "";
3738
+ if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "webp"].includes(ext)) {
3739
+ fileType = "image";
3740
+ } else if (["mp4", "webm", "ogg", "mov"].includes(ext)) {
3741
+ fileType = "video";
3742
+ } else if (["mp3", "wav", "ogg", "m4a"].includes(ext)) {
3743
+ fileType = "audio";
3744
+ }
3745
+ return {
3746
+ ...file,
3747
+ src: previewUrl,
3748
+ type: fileType,
3749
+ onClick: () => chatStore.setPreview({ fileUrl: previewUrl, fileName: file.name, suffix: ext })
3750
+ };
3751
+ });
3752
+ }, [item.files]);
3753
+ return /* @__PURE__ */ jsx(FileCard.List, { items: fileItems });
3754
+ });
3755
+ var QuoteMsgNode = React7.memo(({ quoteMsg, role }) => {
3756
+ if (!quoteMsg || !quoteMsg.messageContent) return null;
3757
+ return /* @__PURE__ */ jsx(
3758
+ Bubble,
3759
+ {
3760
+ placement: role.placement,
3761
+ variant: "borderless",
3762
+ content: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsx(
3763
+ Tooltip,
3764
+ {
3765
+ arrow: false,
3766
+ title: /* @__PURE__ */ jsx(XMarkdown_default, { content: quoteMsg.messageContent }),
3767
+ getPopupContainer: (node) => node,
3768
+ children: /* @__PURE__ */ jsxs(Flex, { children: [
3769
+ /* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
3770
+ /* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis-2", style: {
3771
+ color: "#666",
3772
+ background: "rgba(0,0,0,0.04)",
3773
+ padding: "2px 8px",
3774
+ borderRadius: "4px",
3775
+ fontSize: "12px",
3776
+ cursor: "pointer"
3777
+ }, children: quoteMsg.messageContent })
3778
+ ] })
3779
+ }
3780
+ ) })
3781
+ }
3782
+ );
3783
+ });
3784
+ var RunStartedNode = React7.memo(({ loading }) => {
3785
+ if (!loading) return null;
3786
+ return /* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", style: { minHeight: 24 }, children: /* @__PURE__ */ jsx(LoadingOutlined, { style: { color: "#1677ff" } }) });
3787
+ });
3788
+ function QuestionSummary({ content }) {
3789
+ const answer = content.replace(/^Question:\s*/, "").trim() || "\u5DF2\u56DE\u7B54";
3790
+ return /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: 4 }, children: [
3791
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 13, fontWeight: 600, color: "#1677ff", lineHeight: 1.4 }, children: "Question" }),
3792
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "#262626", lineHeight: 1.6, whiteSpace: "pre-wrap" }, children: answer })
3793
+ ] });
3794
+ }
3795
+ var TextNode = React7.memo(
3796
+ ({ item, role, customComponents, message: message2 }) => {
3797
+ const content = toA2uiDisplayText(role, item?.messageContent);
3798
+ if (typeof content === "string" && content.startsWith("Question:")) {
3799
+ return /* @__PURE__ */ jsx(QuestionSummary, { content });
3800
+ }
3801
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3802
+ !!item.reasoningContent && /* @__PURE__ */ jsx(Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
3803
+ !!content && /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content })
3804
+ ] });
3805
+ }
3806
+ );
3716
3807
 
3717
- // src/components/CustomComponents/tool-renders/index.module.less
3808
+ // src/components/CustomComponents/ToolRenders/index.module.less
3718
3809
  var index_module_default = {
3719
3810
  iconContainer: "index_module_iconContainer",
3720
3811
  toolName: "index_module_toolName",
@@ -3925,65 +4016,6 @@ var ToolCallItem = ({ item }) => {
3925
4016
  };
3926
4017
  var tool_call_item_default = ToolCallItem;
3927
4018
  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
4019
  var MessageRender_default = React7.memo(({ role, message: message2, messageIndex = -1, loading, containerRef, customComponents }) => {
3988
4020
  const content = useMemo(() => {
3989
4021
  return (message2.content || []).filter((item) => {
@@ -4023,9 +4055,9 @@ var MessageRender_default = React7.memo(({ role, message: message2, messageIndex
4023
4055
  variant: item.type === "files" ? "borderless" : void 0,
4024
4056
  content: /* @__PURE__ */ jsxs(Fragment, { children: [
4025
4057
  item.type === "runStarted" && /* @__PURE__ */ jsx(RunStartedNode, { loading }, `flow-start-${index}`),
4026
- (item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsx(ToolCallNode, { item }, `tool-call-${item.toolCallId || index}`),
4027
- item.type === "text" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(TextNode, { item, role: message2.role, customComponents, message: message2 }, `message-${index}`) }),
4028
- item.type === "stepError" && /* @__PURE__ */ jsx(StepErrorNode, { item, customComponents, message: message2 }, `step-error-${index}`),
4058
+ (item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsx(tool_call_item_default, { item }, `tool-call-${item.toolCallId || index}`),
4059
+ item.type === "text" && /* @__PURE__ */ jsx(TextNode, { item, role: message2.role, customComponents, message: message2 }, `message-${index}`),
4060
+ item.type === "stepError" && (item.errorMessage ? /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage }) : null),
4029
4061
  item.type === "files" && /* @__PURE__ */ jsx(FilesNode, { item }, `files-${index}`),
4030
4062
  item.type === "plan" && /* @__PURE__ */ jsx(A2uiPlanNode, { item }, `plan-${index}`)
4031
4063
  ] })
@@ -4033,30 +4065,7 @@ var MessageRender_default = React7.memo(({ role, message: message2, messageIndex
4033
4065
  `message-${index}`
4034
4066
  );
4035
4067
  }),
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
- ),
4068
+ quoteMsg && /* @__PURE__ */ jsx(QuoteMsgNode, { quoteMsg, role }),
4060
4069
  messageIndex >= 0 ? /* @__PURE__ */ jsx(A2uiMessageCards, { messageIndex }) : null
4061
4070
  ] });
4062
4071
  });
@@ -4445,43 +4454,43 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
4445
4454
  Modal,
4446
4455
  {
4447
4456
  open,
4448
- className: styles_module_default2.customModal,
4457
+ className: style_module_default.customModal,
4449
4458
  onCancel,
4450
4459
  closeIcon: /* @__PURE__ */ jsx(CloseOutlined, {}),
4451
4460
  width: 960,
4452
4461
  centered: true,
4453
4462
  destroyOnHidden: true,
4454
- title: /* @__PURE__ */ jsx(Flex, { className: styles_module_default2.titleContainer, children: /* @__PURE__ */ jsx(Title2, { level: 5, children: title }) }),
4455
- footer: /* @__PURE__ */ jsx(Flex, { className: styles_module_default2.footer, children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: handleConfirm, children: "\u786E\u8BA4" }) }),
4456
- children: /* @__PURE__ */ jsxs(Layout, { className: styles_module_default2.layout, children: [
4457
- /* @__PURE__ */ jsx(Sider, { width: 220, className: styles_module_default2.sider, theme: "light", children: /* @__PURE__ */ jsx("div", { className: styles_module_default2.siderContent, children: /* @__PURE__ */ jsx(Flex, { gap: 4, vertical: true, children: categories.map((cat) => {
4463
+ title: /* @__PURE__ */ jsx(Flex, { className: style_module_default.titleContainer, children: /* @__PURE__ */ jsx(Title2, { level: 5, children: title }) }),
4464
+ footer: /* @__PURE__ */ jsx("div", { className: style_module_default.footer, children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: handleConfirm, children: "\u786E\u8BA4" }) }),
4465
+ children: /* @__PURE__ */ jsxs(Layout, { className: style_module_default.layout, children: [
4466
+ /* @__PURE__ */ jsx(Sider, { width: 220, className: style_module_default.sider, theme: "light", children: /* @__PURE__ */ jsx("div", { className: style_module_default.siderContent, children: /* @__PURE__ */ jsx(Flex, { gap: 4, vertical: true, children: categories.map((cat) => {
4458
4467
  const isChecked = selectedCategoryIds.includes(cat.id);
4459
4468
  return /* @__PURE__ */ jsxs(
4460
4469
  Flex,
4461
4470
  {
4462
- className: classNames2(styles_module_default2.categoryItem, { [styles_module_default2.categoryActive]: isChecked }),
4471
+ className: classNames2(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
4463
4472
  onClick: () => handleCategoryChange(cat.id, !isChecked),
4464
4473
  children: [
4465
4474
  /* @__PURE__ */ jsx(
4466
4475
  Checkbox,
4467
4476
  {
4468
4477
  checked: isChecked,
4469
- className: cat.id === ALL_CATEGORY_ID ? styles_module_default2.roundCheckbox : "",
4478
+ className: cat.id === ALL_CATEGORY_ID ? style_module_default.roundCheckbox : "",
4470
4479
  onClick: (e) => e.stopPropagation(),
4471
4480
  onChange: (e) => handleCategoryChange(cat.id, e.target.checked)
4472
4481
  }
4473
4482
  ),
4474
- /* @__PURE__ */ jsx("span", { className: styles_module_default2.categoryName, children: cat.name })
4483
+ /* @__PURE__ */ jsx("span", { className: style_module_default.categoryName, children: cat.name })
4475
4484
  ]
4476
4485
  },
4477
4486
  cat.id
4478
4487
  );
4479
4488
  }) }) }) }),
4480
- /* @__PURE__ */ jsxs(Content, { className: styles_module_default2.content, children: [
4489
+ /* @__PURE__ */ jsxs(Content, { className: style_module_default.content, children: [
4481
4490
  /* @__PURE__ */ jsx(Flex, { align: "center", justify: "space-between", children: /* @__PURE__ */ jsx(
4482
4491
  Input,
4483
4492
  {
4484
- className: styles_module_default2.searchInput,
4493
+ className: style_module_default.searchInput,
4485
4494
  placeholder: `\u641C\u7D22${isSkill ? "\u6280\u80FD" : "\u77E5\u8BC6\u5E93"}\u540D\u79F0`,
4486
4495
  prefix: /* @__PURE__ */ jsx(SearchOutlined, { style: { color: token.colorTextQuaternary } }),
4487
4496
  value: searchText,
@@ -4490,12 +4499,12 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
4490
4499
  autoFocus: true
4491
4500
  }
4492
4501
  ) }),
4493
- selectedIds.length > 0 && /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxs(Text4, { type: "secondary", className: styles_module_default2.selectedCount, children: [
4502
+ selectedIds.length > 0 && /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxs(Text4, { type: "secondary", className: style_module_default.selectedCount, children: [
4494
4503
  "\u5DF2\u9009 ",
4495
4504
  selectedIds.length
4496
4505
  ] }) }),
4497
- /* @__PURE__ */ jsxs("div", { className: classNames2(styles_module_default2.tagsArea, { [styles_module_default2.tagsExpanded]: tagsExpanded }), children: [
4498
- /* @__PURE__ */ jsxs(Flex, { gap: 8, className: styles_module_default2.tagContainer, wrap: true, ref: tagsContainerRef, children: [
4506
+ /* @__PURE__ */ jsxs("div", { className: classNames2(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
4507
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
4499
4508
  selectedIds.map((id) => /* @__PURE__ */ jsx(
4500
4509
  Tag,
4501
4510
  {
@@ -4504,36 +4513,36 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
4504
4513
  e.preventDefault();
4505
4514
  toggleItemSelection(id);
4506
4515
  },
4507
- className: styles_module_default2.tag,
4516
+ className: style_module_default.tag,
4508
4517
  children: getDisplayName(id)
4509
4518
  },
4510
4519
  id
4511
4520
  )),
4512
- showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxs(Button, { size: "small", className: styles_module_default2.expandBtn, onClick: () => setTagsExpanded(false), children: [
4521
+ showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxs(Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(false), children: [
4513
4522
  "\u6536\u8D77 ",
4514
4523
  /* @__PURE__ */ jsx(UpOutlined, {})
4515
4524
  ] })
4516
4525
  ] }),
4517
- showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsx("div", { className: styles_module_default2.expandBtnWrapper, children: /* @__PURE__ */ jsxs(Button, { size: "small", className: styles_module_default2.expandBtn, onClick: () => setTagsExpanded(true), children: [
4526
+ showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsx("div", { className: style_module_default.expandBtnWrapper, children: /* @__PURE__ */ jsxs(Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(true), children: [
4518
4527
  "\u5C55\u5F00 ",
4519
4528
  /* @__PURE__ */ jsx(DownOutlined, {})
4520
4529
  ] }) })
4521
4530
  ] }),
4522
- /* @__PURE__ */ jsx("div", { className: styles_module_default2.listArea, children: /* @__PURE__ */ jsx(Spin, { spinning: loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsx("div", { className: styles_module_default2.listInner, children: /* @__PURE__ */ jsx(Flex, { gap: 8, vertical: true, children: filteredResources.length > 0 ? filteredResources.map((item) => {
4531
+ /* @__PURE__ */ jsx("div", { className: style_module_default.listArea, children: /* @__PURE__ */ jsx(Spin, { spinning: loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsx("div", { className: style_module_default.listInner, children: /* @__PURE__ */ jsx(Flex, { gap: 8, vertical: true, children: filteredResources.length > 0 ? filteredResources.map((item) => {
4523
4532
  const isSelected = selectedIds.includes(item.id);
4524
4533
  return /* @__PURE__ */ jsxs(
4525
4534
  "div",
4526
4535
  {
4527
- className: classNames2(styles_module_default2.listItem, { [styles_module_default2.listItemSelected]: isSelected }),
4536
+ className: classNames2(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
4528
4537
  onClick: () => toggleItemSelection(item.id),
4529
4538
  children: [
4530
- /* @__PURE__ */ jsx("div", { className: styles_module_default2.itemIconWrapper, children: /* @__PURE__ */ jsx(IconFont_default, { type: iconType }) }),
4531
- /* @__PURE__ */ jsxs(Flex, { vertical: true, className: styles_module_default2.itemInfo, children: [
4539
+ /* @__PURE__ */ jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsx(IconFont_default, { type: iconType }) }),
4540
+ /* @__PURE__ */ jsxs(Flex, { vertical: true, className: style_module_default.itemInfo, children: [
4532
4541
  /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
4533
4542
  /* @__PURE__ */ jsx(Text4, { strong: true, children: getDisplayName(item.id) }),
4534
4543
  isSelected && /* @__PURE__ */ jsx(Tag, { color: token.colorPrimary, variant: "outlined", children: "\u5DF2\u6DFB\u52A0" })
4535
4544
  ] }),
4536
- /* @__PURE__ */ jsx(Text4, { type: "secondary", className: styles_module_default2.itemDesc, children: item.description || "\u6682\u65E0\u63CF\u8FF0" })
4545
+ /* @__PURE__ */ jsx(Text4, { type: "secondary", className: style_module_default.itemDesc, children: item.description || "\u6682\u65E0\u63CF\u8FF0" })
4537
4546
  ] })
4538
4547
  ]
4539
4548
  },
@@ -4552,12 +4561,12 @@ var KnowledgeBtn_default = ({}) => {
4552
4561
  const [modalOpen, setModalOpen] = useState(false);
4553
4562
  const knowledgeCount = conversationState.active.spec?.knowledge?.items?.length ?? 0;
4554
4563
  return /* @__PURE__ */ jsxs(Fragment, { children: [
4555
- /* @__PURE__ */ jsxs("div", { className: styles_module_default2.resourceBtn, onClick: () => setModalOpen(true), children: [
4564
+ /* @__PURE__ */ jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
4556
4565
  /* @__PURE__ */ jsx(IconFont_default, { type: "icon-remark" }),
4557
4566
  /* @__PURE__ */ jsx(Text5, { children: "\u77E5\u8BC6\u5E93" }),
4558
4567
  knowledgeCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
4559
- /* @__PURE__ */ jsx(Divider$1, { vertical: true, className: styles_module_default2.divider }),
4560
- /* @__PURE__ */ jsx(Flex, { className: styles_module_default2.count, children: knowledgeCount })
4568
+ /* @__PURE__ */ jsx(Divider$1, { vertical: true, className: style_module_default.divider }),
4569
+ /* @__PURE__ */ jsx(Flex, { className: style_module_default.count, children: knowledgeCount })
4561
4570
  ] })
4562
4571
  ] }),
4563
4572
  modalOpen && /* @__PURE__ */ jsx(ResourceSelectorModal_default, { open: modalOpen, type: "knowledge", onCancel: () => setModalOpen(false) })
@@ -4591,6 +4600,17 @@ var ModelSelect_default = ({}) => {
4591
4600
  }))
4592
4601
  }));
4593
4602
  const selectedModelValue = modelOptions.find((item) => item.value === agentState.model.providerName)?.options.find((item) => item.value === agentState.model.modelName)?.value || void 0;
4603
+ useEffect(() => {
4604
+ if (!selectedModelValue && models.length > 0 && models[0].models?.length > 0) {
4605
+ const firstProvider = models[0];
4606
+ const firstModel = firstProvider.models[0];
4607
+ chatStore.setAgentModel({
4608
+ ...agentState.model,
4609
+ modelName: firstModel.modelName,
4610
+ providerName: firstProvider.providerName
4611
+ });
4612
+ }
4613
+ }, [selectedModelValue, models, agentState.model, chatStore]);
4594
4614
  const handleModelChange = (_, option) => {
4595
4615
  if (Array.isArray(option) || !option || !("providerName" in option)) return;
4596
4616
  chatStore.setAgentModel({
@@ -4643,7 +4663,7 @@ var ReasonBtn_default = ({}) => {
4643
4663
  return /* @__PURE__ */ jsxs(
4644
4664
  "div",
4645
4665
  {
4646
- className: classNames2(styles_module_default2.resourceBtn, { [styles_module_default2.resourceBtnActive]: agentState.model.reasoning }),
4666
+ className: classNames2(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
4647
4667
  onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
4648
4668
  children: [
4649
4669
  /* @__PURE__ */ jsx(IconFont_default, { type: "icon-reason" }),
@@ -4659,12 +4679,12 @@ var SkillBtn_default = ({}) => {
4659
4679
  const [modalOpen, setModalOpen] = useState(false);
4660
4680
  const skillsCount = conversationState.active.spec?.skills?.items?.length ?? 0;
4661
4681
  return /* @__PURE__ */ jsxs(Fragment, { children: [
4662
- /* @__PURE__ */ jsxs("div", { className: styles_module_default2.resourceBtn, onClick: () => setModalOpen(true), children: [
4682
+ /* @__PURE__ */ jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
4663
4683
  /* @__PURE__ */ jsx(IconFont_default, { type: "icon-skill" }),
4664
4684
  /* @__PURE__ */ jsx(Text7, { children: "\u6280\u80FD" }),
4665
4685
  skillsCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
4666
- /* @__PURE__ */ jsx(Divider$1, { vertical: true, className: styles_module_default2.divider }),
4667
- /* @__PURE__ */ jsx(Flex, { className: styles_module_default2.count, children: skillsCount })
4686
+ /* @__PURE__ */ jsx(Divider$1, { vertical: true, className: style_module_default.divider }),
4687
+ /* @__PURE__ */ jsx(Flex, { className: style_module_default.count, children: skillsCount })
4668
4688
  ] })
4669
4689
  ] }),
4670
4690
  modalOpen && /* @__PURE__ */ jsx(ResourceSelectorModal_default, { open: modalOpen, type: "skill", onCancel: () => setModalOpen(false) })