@zero-library/chat-copilot 3.1.11 → 3.1.13

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, EnterOutlined, DownloadOutlined, CloseOutlined, PlayCircleOutlined, CopyOutlined, DotChartOutlined, LoadingOutlined, RightOutlined, LikeOutlined, DislikeOutlined, ToolOutlined, SearchOutlined, UpOutlined, DownOutlined, PlusOutlined, CommentOutlined, RedoOutlined, DeleteOutlined, ClockCircleOutlined, CheckCircleOutlined, FileImageOutlined, FilePdfOutlined, FileWordOutlined, FileExcelOutlined, FilePptOutlined, FileZipOutlined, FileTextOutlined, FileUnknownOutlined } from '@ant-design/icons';
1
+ import { CloudUploadOutlined, PaperClipOutlined, createFromIconfontCN, EnterOutlined, DownloadOutlined, CloseOutlined, PlayCircleOutlined, CopyOutlined, DotChartOutlined, LoadingOutlined, RightOutlined, LikeOutlined, DislikeOutlined, ToolOutlined, SearchOutlined, UpOutlined, DownOutlined, PlusOutlined, CommentOutlined, DeleteOutlined, StarOutlined, RedoOutlined, StarFilled, ClockCircleOutlined, CheckCircleOutlined, FileImageOutlined, FilePdfOutlined, FileWordOutlined, FileExcelOutlined, FilePptOutlined, FileZipOutlined, FileTextOutlined, FileUnknownOutlined } from '@ant-design/icons';
2
2
  import { Attachments, Sender, FileCard, Bubble, Think, XProvider, Mermaid, CodeHighlighter, Welcome, Prompts, Conversations } from '@ant-design/x-v2';
3
3
  import { useRefState, useDebounce, createTokenManager, useSyncInput, isEmptyObj, markdownToText, RenderWrapper, shouldRender, isFunction, downloadFile, LuyaFilePreview, MarkdownEditor, useDeepEffect, isObject, useWebSocket, isNullOrUnDef, isNumber, getFileSuffixName, emit, FileIcon, copyText, LazyComponent, isBoolean, UserAvatar, htmlToMarkdown, buildUrlParams, isExternal, deepCopy, transforms, deepMerge, createRequest, HttpStatus, isArray, isString, isDef, isNull, transform, getWebSocketUrl, safeParseJson } from '@zero-library/common';
4
- import { App, Badge, Button, Flex, Typography, Tooltip, Layout, Tag, Spin, Splitter, Image as Image$1, Popover, Skeleton, Alert, theme, Collapse, Divider as Divider$1, Select as Select$1, Avatar, Space, Form, Drawer, Empty, Modal, Checkbox, Input, InputNumber, Switch as Switch$1, message, Upload, List, Card, Table, Progress as Progress$1 } from 'antd';
4
+ import { App, Badge, Button, Flex, Typography, Tooltip, Layout, Tag, Spin, Splitter, Image as Image$1, Popover, Skeleton, Alert, theme, Collapse, Divider as Divider$1, Select as Select$1, Avatar, Space, Form, Drawer, Empty, Modal, Checkbox, Input, Popconfirm, InputNumber, Switch as Switch$1, message, Upload, List, Card, Table, Progress as Progress$1 } from 'antd';
5
5
  import * as React10 from 'react';
6
6
  import React10__default, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, memo, useState, useContext, useCallback, useLayoutEffect } from 'react';
7
7
  import { useSnapshot, proxy } from 'valtio';
@@ -18,7 +18,7 @@ import { LexicalTypeaheadMenuPlugin, MenuOption } from '@lexical/react/LexicalTy
18
18
  import { mergeRegister } from '@lexical/utils';
19
19
  import * as ReactDOM from 'react-dom';
20
20
  import dayjs from 'dayjs';
21
- import classNames2 from 'classnames';
21
+ import classNames from 'classnames';
22
22
  import InfiniteScroll from 'react-infinite-scroll-component';
23
23
  import { XCard as XCard$1 } from '@ant-design/x-card';
24
24
  import '@ant-design/x-markdown/themes/light.css';
@@ -998,6 +998,9 @@ var createChatService = (request, config) => {
998
998
  const getAgentAvatar = (path) => {
999
999
  return request.get(`/files/access?path=${path}&workspaceType=${"global" /* GLOBAL */}`, void 0, { responseType: "blob" });
1000
1000
  };
1001
+ const conversationFavorite = (conversationId, isFavorite) => {
1002
+ return request.put("/agents/conversations/favorite", { conversationIds: [conversationId], favorite: isFavorite });
1003
+ };
1001
1004
  return {
1002
1005
  fetchModelList,
1003
1006
  fetchAgentInfo,
@@ -1016,7 +1019,8 @@ var createChatService = (request, config) => {
1016
1019
  listLibrarys,
1017
1020
  listDataSources,
1018
1021
  listTags,
1019
- getAgentAvatar
1022
+ getAgentAvatar,
1023
+ conversationFavorite
1020
1024
  };
1021
1025
  };
1022
1026
 
@@ -1206,6 +1210,7 @@ function createChatStore() {
1206
1210
  id: "id",
1207
1211
  label: "title",
1208
1212
  spec: "spec",
1213
+ isFavorite: "isFavorite",
1209
1214
  group: (c) => {
1210
1215
  return classifyTime(c.updatedAt);
1211
1216
  }
@@ -1279,7 +1284,7 @@ function createChatStore() {
1279
1284
  const { data } = await config.services.request.createConversationId({ agentId: agent.agentInfo.id, convMeta: config.params.convMeta });
1280
1285
  const newSpec = {
1281
1286
  skills: { items: [] },
1282
- knowledge: { items: [] }
1287
+ knowledges: { items: [] }
1283
1288
  };
1284
1289
  updateConversations({
1285
1290
  id: data || "",
@@ -1290,6 +1295,45 @@ function createChatStore() {
1290
1295
  });
1291
1296
  await switchConversation(data);
1292
1297
  };
1298
+ const favorite = proxy({
1299
+ /** 收藏列表数据 */
1300
+ list: {
1301
+ items: []
1302
+ },
1303
+ /** 收藏列表的加载状态 */
1304
+ loading: false
1305
+ });
1306
+ const getConversationFavorite = async () => {
1307
+ try {
1308
+ favorite.loading = true;
1309
+ const { data } = await config.services.request.fetchConversations({
1310
+ agentId: agent.agentInfo?.id || "",
1311
+ convMeta: {
1312
+ ...config.params.convMeta,
1313
+ isFavorite: true
1314
+ }
1315
+ });
1316
+ favorite.list.items = data || [];
1317
+ } finally {
1318
+ favorite.loading = false;
1319
+ }
1320
+ };
1321
+ const collectConversation = async (conversationId, isFavorite) => {
1322
+ try {
1323
+ await config.services.request.conversationFavorite(conversationId, isFavorite);
1324
+ if (conversations.list.items.length) {
1325
+ const item = conversations.list.items.find((item2) => item2.id === conversationId);
1326
+ if (item) {
1327
+ item.isFavorite = isFavorite;
1328
+ }
1329
+ }
1330
+ if (!isFavorite && favorite.list.items.length) {
1331
+ favorite.list.items = favorite.list.items.filter((item) => item.id !== conversationId);
1332
+ }
1333
+ message.success(isFavorite ? "\u6536\u85CF\u6210\u529F" : "\u5DF2\u53D6\u6D88\u6536\u85CF");
1334
+ } finally {
1335
+ }
1336
+ };
1293
1337
  const conversation = proxy({
1294
1338
  /** 当前激活的会话信息 */
1295
1339
  active: {
@@ -1594,36 +1638,32 @@ function createChatStore() {
1594
1638
  messages.push(finalMsg);
1595
1639
  } else {
1596
1640
  const contents = messages[idx].content;
1597
- const existingItemIndex = contents.findIndex(
1598
- (item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId
1599
- );
1641
+ let existingItemIndex = contents.findIndex((item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId);
1642
+ if (existingItemIndex === -1 && contentItem.toolCallId) {
1643
+ existingItemIndex = contents.findIndex(
1644
+ (item) => item.type === "toolCall" && !item.toolCallId && item._streamingIndex !== void 0
1645
+ );
1646
+ }
1600
1647
  if (existingItemIndex !== -1) {
1601
- const existingItem = contents[existingItemIndex];
1648
+ const nextItem = { ...contents[existingItemIndex] };
1602
1649
  const newContent = contentItem.content || contentItem.arguments;
1603
- const nextItem = { ...existingItem };
1604
1650
  if (typeof newContent === "string") {
1605
- nextItem.content = (existingItem.content || "") + newContent;
1651
+ nextItem.content = (nextItem.content || "") + newContent;
1606
1652
  } else if (newContent !== void 0) {
1607
1653
  nextItem.arguments = newContent;
1608
1654
  }
1609
- if (contentItem.toolName) {
1610
- nextItem.toolName = contentItem.toolName;
1611
- }
1612
- if (contentItem.title) {
1613
- nextItem.title = contentItem.title;
1614
- }
1615
- if (contentItem.status) {
1616
- nextItem.status = contentItem.status;
1617
- }
1618
- if (contentItem.toolIcon) {
1619
- nextItem.toolIcon = contentItem.toolIcon;
1620
- }
1655
+ if (contentItem.toolName) nextItem.toolName = contentItem.toolName;
1656
+ if (contentItem.title) nextItem.title = contentItem.title;
1657
+ if (contentItem.status) nextItem.status = contentItem.status;
1658
+ if (contentItem.toolIcon) nextItem.toolIcon = contentItem.toolIcon;
1659
+ if (contentItem.display?.title) nextItem.title = contentItem.display.title;
1621
1660
  if (contentItem.display) {
1622
- nextItem.display = (existingItem.display || "") + contentItem.display;
1661
+ nextItem.argsDisplay = contentItem.display;
1662
+ nextItem.displayProtocol = true;
1623
1663
  }
1624
1664
  messages[idx].content = contents.map((item, i) => i === existingItemIndex ? nextItem : item);
1625
1665
  } else {
1626
- messages[idx].content = [...contents, contentItem];
1666
+ messages[idx].content = [...contents, { ...contentItem, displayProtocol: !!contentItem.display }];
1627
1667
  }
1628
1668
  }
1629
1669
  if (isMain) conversation.messages[msg.conversationId].loading = true;
@@ -1642,25 +1682,20 @@ function createChatStore() {
1642
1682
  const contents = messages[idx].content;
1643
1683
  const toolCallIndex = contents.findIndex((item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId);
1644
1684
  if (toolCallIndex !== -1) {
1645
- const toolCallItem = contents[toolCallIndex];
1646
1685
  const nextToolCallItem = {
1647
- ...toolCallItem,
1686
+ ...contents[toolCallIndex],
1648
1687
  result: contentItem.result ?? contentItem.content
1649
1688
  };
1650
- if (contentItem.status) {
1651
- nextToolCallItem.status = contentItem.status;
1652
- }
1653
- if (contentItem.errorMessage) {
1654
- nextToolCallItem.errorMessage = contentItem.errorMessage;
1655
- }
1656
- if (contentItem.duration) {
1657
- nextToolCallItem.duration = contentItem.duration;
1658
- }
1659
- if (contentItem.title) {
1660
- nextToolCallItem.title = contentItem.title;
1661
- }
1662
- if (contentItem.display !== void 0) {
1663
- nextToolCallItem.display = contentItem.display;
1689
+ if (contentItem.status) nextToolCallItem.status = contentItem.status;
1690
+ if (contentItem.isError !== void 0) nextToolCallItem.isError = contentItem.isError;
1691
+ if (contentItem.errorMessage) nextToolCallItem.errorMessage = contentItem.errorMessage;
1692
+ const dur = contentItem.durationMs ?? contentItem.duration;
1693
+ if (dur !== void 0) nextToolCallItem.duration = dur;
1694
+ if (contentItem.title) nextToolCallItem.title = contentItem.title;
1695
+ if (contentItem.display?.title) nextToolCallItem.title = contentItem.display.title;
1696
+ if (contentItem.display) {
1697
+ nextToolCallItem.resultDisplay = contentItem.display;
1698
+ nextToolCallItem.displayProtocol = true;
1664
1699
  }
1665
1700
  messages[idx].content = contents.map((item, i) => i === toolCallIndex ? nextToolCallItem : item);
1666
1701
  } else {
@@ -1686,60 +1721,73 @@ function createChatStore() {
1686
1721
  if (contentItem.type !== "toolCallDelta") return;
1687
1722
  let idx = -1;
1688
1723
  if (contentItem.toolCallId) {
1724
+ idx = messages.findLastIndex((m) => m.content?.some((c) => c.type === "toolCall" && c.toolCallId === contentItem.toolCallId));
1725
+ }
1726
+ if (idx === -1 && contentItem.index !== void 0) {
1689
1727
  idx = messages.findLastIndex(
1690
- (m) => m.content?.some((c) => (c.type === "toolCall" || c.type === "toolCallDelta") && c.toolCallId === contentItem.toolCallId)
1728
+ (m) => m.executionId === msg.executionId && m.content?.some((c) => c.type === "toolCall" && c._streamingIndex === contentItem.index && !c.toolCallId)
1691
1729
  );
1692
1730
  }
1693
1731
  if (idx === -1) idx = findExecutionMsgIndex(msg, messages);
1732
+ const buildNewItem = () => {
1733
+ const item = {
1734
+ type: "toolCall",
1735
+ toolCallId: contentItem.toolCallId || void 0,
1736
+ _streamingIndex: contentItem.index,
1737
+ toolName: contentItem.toolName || void 0,
1738
+ toolIcon: contentItem.toolIcon,
1739
+ title: contentItem.title,
1740
+ content: contentItem.displayDelta ? "" : contentItem.argumentsDelta || "",
1741
+ status: contentItem.status || "running",
1742
+ displayProtocol: !!contentItem.displayDelta
1743
+ };
1744
+ if (contentItem.displayDelta?.title) item.title = contentItem.displayDelta.title;
1745
+ if (contentItem.displayDelta?.contentAppend) {
1746
+ item.streamingArgsDisplay = {
1747
+ title: contentItem.displayDelta.title,
1748
+ content: contentItem.displayDelta.contentAppend,
1749
+ kind: contentItem.displayDelta.kind,
1750
+ lang: contentItem.displayDelta.lang
1751
+ };
1752
+ }
1753
+ return item;
1754
+ };
1694
1755
  if (idx === -1) {
1695
- messages.push({
1696
- ...msg,
1697
- content: [
1698
- {
1699
- type: "toolCall",
1700
- toolCallId: contentItem.toolCallId,
1701
- toolName: contentItem.toolName || void 0,
1702
- toolIcon: contentItem.toolIcon,
1703
- title: contentItem.title,
1704
- content: contentItem.argumentsDelta || "",
1705
- display: contentItem.display,
1706
- status: contentItem.status || "running"
1707
- }
1708
- ],
1709
- generating: true
1710
- });
1756
+ messages.push({ ...msg, content: [buildNewItem()], generating: true });
1711
1757
  } else {
1712
1758
  const contents = messages[idx].content;
1713
- const itemIdx = contents.findIndex(
1714
- (c) => (c.type === "toolCall" || c.type === "toolCallDelta") && c.toolCallId === contentItem.toolCallId
1715
- );
1759
+ let itemIdx = -1;
1760
+ if (contentItem.toolCallId) {
1761
+ itemIdx = contents.findIndex((c) => c.type === "toolCall" && c.toolCallId === contentItem.toolCallId);
1762
+ }
1763
+ if (itemIdx === -1 && contentItem.index !== void 0) {
1764
+ itemIdx = contents.findIndex((c) => c.type === "toolCall" && c._streamingIndex === contentItem.index && !c.toolCallId);
1765
+ }
1716
1766
  if (itemIdx !== -1) {
1717
1767
  const existing = contents[itemIdx];
1718
1768
  const nextItem = {
1719
1769
  ...existing,
1720
1770
  type: "toolCall",
1721
- content: (existing.content || "") + (contentItem.argumentsDelta || "")
1771
+ content: contentItem.displayDelta ? existing.content || "" : (existing.content || "") + (contentItem.argumentsDelta || "")
1722
1772
  };
1773
+ if (contentItem.toolCallId && !existing.toolCallId) nextItem.toolCallId = contentItem.toolCallId;
1723
1774
  if (contentItem.toolName) nextItem.toolName = contentItem.toolName;
1724
1775
  if (contentItem.title) nextItem.title = contentItem.title;
1725
1776
  if (contentItem.status) nextItem.status = contentItem.status;
1726
1777
  if (contentItem.toolIcon) nextItem.toolIcon = contentItem.toolIcon;
1727
- if (contentItem.display) nextItem.display = (existing.display || "") + contentItem.display;
1778
+ if (contentItem.displayDelta) nextItem.displayProtocol = true;
1779
+ if (contentItem.displayDelta?.title) nextItem.title = contentItem.displayDelta.title;
1780
+ if (contentItem.displayDelta?.contentAppend) {
1781
+ nextItem.streamingArgsDisplay = {
1782
+ title: contentItem.displayDelta.title || existing.streamingArgsDisplay?.title,
1783
+ content: (existing.streamingArgsDisplay?.content || "") + contentItem.displayDelta.contentAppend,
1784
+ kind: contentItem.displayDelta.kind || existing.streamingArgsDisplay?.kind,
1785
+ lang: contentItem.displayDelta.lang ?? existing.streamingArgsDisplay?.lang
1786
+ };
1787
+ }
1728
1788
  messages[idx].content = contents.map((c, i) => i === itemIdx ? nextItem : c);
1729
1789
  } else {
1730
- messages[idx].content = [
1731
- ...contents,
1732
- {
1733
- type: "toolCall",
1734
- toolCallId: contentItem.toolCallId,
1735
- toolName: contentItem.toolName || void 0,
1736
- toolIcon: contentItem.toolIcon,
1737
- title: contentItem.title,
1738
- content: contentItem.argumentsDelta || "",
1739
- display: contentItem.display,
1740
- status: contentItem.status || "running"
1741
- }
1742
- ];
1790
+ messages[idx].content = [...contents, buildNewItem()];
1743
1791
  }
1744
1792
  }
1745
1793
  if (isMain) conversation.messages[msg.conversationId].loading = true;
@@ -1969,6 +2017,11 @@ function createChatStore() {
1969
2017
  const dealedParams = await config.hooks?.onHandleSendParams?.(sendParams);
1970
2018
  await config.services.request.sendMessageStream(dealedParams || sendParams, agent.agentInfo?.id || "");
1971
2019
  config.hooks?.onAfterSend?.();
2020
+ } catch (err) {
2021
+ conversation.messages[conversationId].loading = false;
2022
+ const errMsg = err?.response?.data?.message || err?.message || "\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";
2023
+ message.error(errMsg);
2024
+ throw err;
1972
2025
  } finally {
1973
2026
  }
1974
2027
  };
@@ -2066,7 +2119,13 @@ function createChatStore() {
2066
2119
  /** 消息反馈 */
2067
2120
  feedback,
2068
2121
  /** 设置会话用户输入 */
2069
- setConversationUserInput
2122
+ setConversationUserInput,
2123
+ /** 收藏管理 */
2124
+ favorite,
2125
+ /** 获取会话收藏列表 */
2126
+ getConversationFavorite,
2127
+ /** 收藏会话 */
2128
+ collectConversation
2070
2129
  };
2071
2130
  }
2072
2131
  var AuthImage = ({ path, size, shape = "square" }) => {
@@ -2141,6 +2200,106 @@ window._iconfont_svg_string_5021436 = '<svg><symbol id="icon-Ollama" viewBox="0
2141
2200
  // src/components/IconFont/index.ts
2142
2201
  var IconFont = createFromIconfontCN({});
2143
2202
  var IconFont_default = IconFont;
2203
+
2204
+ // src/ui/common/FeatureComponents/style.module.less
2205
+ var style_module_default = {
2206
+ popover: "style_module_popover",
2207
+ resourceBtn: "style_module_resourceBtn",
2208
+ divider: "style_module_divider",
2209
+ count: "style_module_count",
2210
+ resourceBtnActive: "style_module_resourceBtnActive",
2211
+ customModal: "style_module_customModal",
2212
+ layout: "style_module_layout",
2213
+ sider: "style_module_sider",
2214
+ categoryName: "style_module_categoryName",
2215
+ siderContent: "style_module_siderContent",
2216
+ categoryItem: "style_module_categoryItem",
2217
+ categoryActive: "style_module_categoryActive",
2218
+ roundCheckbox: "style_module_roundCheckbox",
2219
+ content: "style_module_content",
2220
+ searchInput: "style_module_searchInput",
2221
+ selectedCount: "style_module_selectedCount",
2222
+ tagsArea: "style_module_tagsArea",
2223
+ tagContainer: "style_module_tagContainer",
2224
+ tag: "style_module_tag",
2225
+ expandBtnWrapper: "style_module_expandBtnWrapper",
2226
+ expandBtn: "style_module_expandBtn",
2227
+ tagsExpanded: "style_module_tagsExpanded",
2228
+ listArea: "style_module_listArea",
2229
+ listInner: "style_module_listInner",
2230
+ listItem: "style_module_listItem",
2231
+ listItemSelected: "style_module_listItemSelected",
2232
+ itemIconWrapper: "style_module_itemIconWrapper",
2233
+ itemInfo: "style_module_itemInfo",
2234
+ itemDesc: "style_module_itemDesc",
2235
+ footer: "style_module_footer",
2236
+ titleContainer: "style_module_titleContainer",
2237
+ favoriteCard: "style_module_favoriteCard",
2238
+ favoriteCardActive: "style_module_favoriteCardActive",
2239
+ favoriteCardTitle: "style_module_favoriteCardTitle",
2240
+ favoriteCardActions: "style_module_favoriteCardActions"};
2241
+ var ConversationFavoritesBtn_default = ({ icon, ...rest }) => {
2242
+ const chatStore = useChatStore();
2243
+ const conversationState = useSnapshot(chatStore.conversation);
2244
+ const favoriteState = useSnapshot(chatStore.favorite);
2245
+ const getFavoriteList = useDebounce(() => {
2246
+ chatStore.getConversationFavorite();
2247
+ }, 300);
2248
+ const renderFavoriteList = useMemo(() => {
2249
+ return /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 4, className: classNames("height-full", "scroll-fade-in"), children: favoriteState.list.items.length ? favoriteState.list.items.map((item) => /* @__PURE__ */ jsx(
2250
+ "div",
2251
+ {
2252
+ className: classNames(style_module_default.favoriteCard, { [style_module_default.favoriteCardActive]: conversationState.active.id === item.id }),
2253
+ onClick: () => chatStore.switchConversation(item.id),
2254
+ children: /* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", children: [
2255
+ /* @__PURE__ */ jsx(Flex, { flex: 1, className: classNames(style_module_default.favoriteCardTitle, "text-ellipsis"), children: item.title }),
2256
+ /* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", className: style_module_default.favoriteCardActions, children: /* @__PURE__ */ jsx(
2257
+ Popconfirm,
2258
+ {
2259
+ title: "\u63D0\u793A",
2260
+ okText: "\u786E\u5B9A",
2261
+ cancelText: "\u53D6\u6D88",
2262
+ description: "\u786E\u8BA4\u53D6\u6D88\u6536\u85CF\u8BE5\u4F1A\u8BDD\u5417\uFF1F",
2263
+ onConfirm: (e) => {
2264
+ e.stopPropagation();
2265
+ chatStore.collectConversation(item.id, false);
2266
+ },
2267
+ onCancel: (e) => e.stopPropagation(),
2268
+ children: /* @__PURE__ */ jsx(
2269
+ Button,
2270
+ {
2271
+ icon: /* @__PURE__ */ jsx(DeleteOutlined, {}),
2272
+ title: "\u5220\u9664",
2273
+ type: "text",
2274
+ onClick: (e) => {
2275
+ e.stopPropagation();
2276
+ }
2277
+ }
2278
+ )
2279
+ }
2280
+ ) })
2281
+ ] })
2282
+ },
2283
+ item.id
2284
+ )) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u6536\u85CF", image: Empty.PRESENTED_IMAGE_SIMPLE }) });
2285
+ }, [favoriteState.list.items, conversationState.active.id]);
2286
+ const handlePopoverVisibleChange = (visible) => {
2287
+ if (!visible) return;
2288
+ getFavoriteList();
2289
+ };
2290
+ return /* @__PURE__ */ jsx(
2291
+ Popover,
2292
+ {
2293
+ classNames: { container: style_module_default.popover },
2294
+ getPopupContainer: (e) => e,
2295
+ placement: "bottom",
2296
+ content: renderFavoriteList,
2297
+ trigger: ["click"],
2298
+ onOpenChange: handlePopoverVisibleChange,
2299
+ children: /* @__PURE__ */ jsx(Button, { title: "\u6536\u85CF\u5939", type: "text", size: "large", icon: icon?.() || /* @__PURE__ */ jsx(StarOutlined, {}), ...rest })
2300
+ }
2301
+ );
2302
+ };
2144
2303
  var CreateBtn_default = ({ icon, ...rest }) => {
2145
2304
  const chatStore = useChatStore();
2146
2305
  return /* @__PURE__ */ jsx(Button, { title: "\u65B0\u5EFA\u4F1A\u8BDD", size: "large", type: "text", icon: icon?.() || /* @__PURE__ */ jsx(PlusOutlined, {}), onClick: () => chatStore.createConversation(), ...rest });
@@ -2181,6 +2340,11 @@ var ConversationList_default = () => {
2181
2340
  }, [conversationsState.list.items]);
2182
2341
  const menuConfig = (conversation) => ({
2183
2342
  items: [
2343
+ {
2344
+ label: `${conversation.isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF"}`,
2345
+ key: "collect",
2346
+ icon: conversation?.isFavorite ? /* @__PURE__ */ jsx(StarFilled, { className: "primary-text" }) : /* @__PURE__ */ jsx(StarOutlined, {})
2347
+ },
2184
2348
  {
2185
2349
  label: "\u5220\u9664",
2186
2350
  key: "deleteChat",
@@ -2192,6 +2356,8 @@ var ConversationList_default = () => {
2192
2356
  itemInfo.domEvent.stopPropagation();
2193
2357
  if (itemInfo.key === "deleteChat") {
2194
2358
  chatStore.delConversation(conversation.key);
2359
+ } else if (itemInfo.key === "collect") {
2360
+ chatStore.collectConversation(conversation.id, !conversation.isFavorite);
2195
2361
  }
2196
2362
  }
2197
2363
  });
@@ -2220,41 +2386,6 @@ var ConversationList_default = () => {
2220
2386
  }
2221
2387
  ) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: Empty.PRESENTED_IMAGE_SIMPLE }) }) });
2222
2388
  };
2223
-
2224
- // src/ui/common/FeatureComponents/style.module.less
2225
- var style_module_default = {
2226
- popover: "style_module_popover",
2227
- resourceBtn: "style_module_resourceBtn",
2228
- divider: "style_module_divider",
2229
- count: "style_module_count",
2230
- resourceBtnActive: "style_module_resourceBtnActive",
2231
- customModal: "style_module_customModal",
2232
- layout: "style_module_layout",
2233
- sider: "style_module_sider",
2234
- categoryName: "style_module_categoryName",
2235
- siderContent: "style_module_siderContent",
2236
- categoryItem: "style_module_categoryItem",
2237
- categoryActive: "style_module_categoryActive",
2238
- roundCheckbox: "style_module_roundCheckbox",
2239
- content: "style_module_content",
2240
- searchInput: "style_module_searchInput",
2241
- selectedCount: "style_module_selectedCount",
2242
- tagsArea: "style_module_tagsArea",
2243
- tagContainer: "style_module_tagContainer",
2244
- tag: "style_module_tag",
2245
- expandBtnWrapper: "style_module_expandBtnWrapper",
2246
- expandBtn: "style_module_expandBtn",
2247
- tagsExpanded: "style_module_tagsExpanded",
2248
- listArea: "style_module_listArea",
2249
- listInner: "style_module_listInner",
2250
- listItem: "style_module_listItem",
2251
- listItemSelected: "style_module_listItemSelected",
2252
- itemIconWrapper: "style_module_itemIconWrapper",
2253
- itemInfo: "style_module_itemInfo",
2254
- itemDesc: "style_module_itemDesc",
2255
- footer: "style_module_footer",
2256
- titleContainer: "style_module_titleContainer"
2257
- };
2258
2389
  var HistoryBtn_default = ({ icon, ...rest }) => {
2259
2390
  return /* @__PURE__ */ jsx(
2260
2391
  Popover,
@@ -2268,11 +2399,18 @@ var HistoryBtn_default = ({ icon, ...rest }) => {
2268
2399
  }
2269
2400
  );
2270
2401
  };
2271
- var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newConversationBtn = true, conversationListBtn = true }) => {
2402
+ var ChatHeader_default = ({
2403
+ title = true,
2404
+ avatar = true,
2405
+ closeBtn = false,
2406
+ newConversationBtn = true,
2407
+ conversationListBtn = true,
2408
+ conversationFavoriteBtn = true
2409
+ }) => {
2272
2410
  const chatStore = useChatStore();
2273
2411
  const agentState = useSnapshot(chatStore.agent);
2274
2412
  const configState = useSnapshot(chatStore.config);
2275
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: classNames2(styles_module_default2.chatHeader, "zero-chat-header"), children: [
2413
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: classNames(styles_module_default2.chatHeader, "zero-chat-header"), children: [
2276
2414
  /* @__PURE__ */ jsxs("div", { className: styles_module_default2.chatHeaderContent, children: [
2277
2415
  /* @__PURE__ */ jsx(
2278
2416
  RenderWrapper,
@@ -2287,7 +2425,8 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
2287
2425
  /* @__PURE__ */ jsxs(Space, { size: 2, children: [
2288
2426
  /* @__PURE__ */ jsxs("div", { className: styles_module_default2.chatHeaderBtnGroup, children: [
2289
2427
  /* @__PURE__ */ jsx(RenderWrapper, { control: newConversationBtn, DefaultComponent: CreateBtn_default }),
2290
- /* @__PURE__ */ jsx(RenderWrapper, { control: conversationListBtn, DefaultComponent: HistoryBtn_default })
2428
+ /* @__PURE__ */ jsx(RenderWrapper, { control: conversationListBtn, DefaultComponent: HistoryBtn_default }),
2429
+ /* @__PURE__ */ jsx(RenderWrapper, { control: conversationFavoriteBtn, DefaultComponent: ConversationFavoritesBtn_default })
2291
2430
  ] }),
2292
2431
  /* @__PURE__ */ jsx(
2293
2432
  RenderWrapper,
@@ -2300,7 +2439,7 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
2300
2439
  ] }) });
2301
2440
  };
2302
2441
  var { Text } = Typography;
2303
- var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true }) => {
2442
+ var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true, conversationFavoriteBtn = true }) => {
2304
2443
  const chatStore = useChatStore();
2305
2444
  const agentState = useSnapshot(chatStore.agent);
2306
2445
  return /* @__PURE__ */ jsxs(Flex, { className: "p-24", gap: 16, vertical: true, children: [
@@ -2317,8 +2456,8 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2317
2456
  {
2318
2457
  control: title,
2319
2458
  DefaultComponent: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 4, flex: 1, style: { minWidth: 0 }, children: [
2320
- /* @__PURE__ */ jsx(Text, { strong: true, className: classNames2("fz-16"), children: agentState.agentInfo.name }),
2321
- /* @__PURE__ */ jsx(Text, { type: "secondary", ellipsis: true, className: classNames2("fz-12"), children: agentState.agentInfo.description })
2459
+ /* @__PURE__ */ jsx(Text, { strong: true, className: classNames("fz-16"), children: agentState.agentInfo.name }),
2460
+ /* @__PURE__ */ jsx(Text, { type: "secondary", ellipsis: true, className: classNames("fz-12"), children: agentState.agentInfo.description })
2322
2461
  ] }) })
2323
2462
  }
2324
2463
  )
@@ -2333,7 +2472,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2333
2472
  block: true,
2334
2473
  type: "primary",
2335
2474
  onClick: () => chatStore.createConversation(),
2336
- className: classNames2(styles_module_default2.createConversationButton),
2475
+ className: classNames(styles_module_default2.createConversationButton),
2337
2476
  icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
2338
2477
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
2339
2478
  }
@@ -2343,7 +2482,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2343
2482
  ] });
2344
2483
  };
2345
2484
  var ConversationListPanel = ({ header }) => {
2346
- return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames2("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
2485
+ return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
2347
2486
  /* @__PURE__ */ jsx(RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
2348
2487
  /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(ConversationList_default, {}) })
2349
2488
  ] });
@@ -2812,7 +2951,7 @@ var CHART_COMPONENTS = Object.fromEntries(
2812
2951
  );
2813
2952
  var Charts_default = ({ data, loading }) => {
2814
2953
  const { type, config } = data;
2815
- return /* @__PURE__ */ jsx("div", { className: classNames2(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
2954
+ return /* @__PURE__ */ jsx("div", { className: classNames(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
2816
2955
  // Antd 骨架屏
2817
2956
  /* @__PURE__ */ jsx(Skeleton.Node, { active: true, className: styles_module_default3.chartSkeleton, children: /* @__PURE__ */ jsx(DotChartOutlined, { className: styles_module_default3.chartSkeletonIcon }) })
2818
2957
  ) : /* @__PURE__ */ jsx(
@@ -3107,7 +3246,7 @@ var XMarkdown_default = memo(({ message: message3, components = {}, content = ""
3107
3246
  return /* @__PURE__ */ jsx(
3108
3247
  XMarkdown,
3109
3248
  {
3110
- className: classNames2("x-markdown-light", styles_module_default4.xMarkdownStyle),
3249
+ className: classNames("x-markdown-light", styles_module_default4.xMarkdownStyle),
3111
3250
  config,
3112
3251
  ...rest,
3113
3252
  content: processedContent,
@@ -3452,7 +3591,7 @@ var Switch = ({ id, label, value, bind_path_token, onChange, onDataChange }) =>
3452
3591
  /* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "#555" }, children: label })
3453
3592
  ] });
3454
3593
  };
3455
- var Button9 = ({ label, variant = "default", onClick, action, onAction }) => {
3594
+ var Button10 = ({ label, variant = "default", onClick, action, onAction }) => {
3456
3595
  const handleClick = () => {
3457
3596
  if (onClick) {
3458
3597
  onClick();
@@ -3482,7 +3621,7 @@ var A2uiComponents = {
3482
3621
  TextField,
3483
3622
  Select,
3484
3623
  Switch,
3485
- Button: Button9,
3624
+ Button: Button10,
3486
3625
  Divider,
3487
3626
  Tag: Tag3,
3488
3627
  Progress,
@@ -4767,10 +4906,12 @@ var TextNode2 = React10__default.memo(
4767
4906
 
4768
4907
  // src/components/CustomComponents/ToolRenders/index.module.less
4769
4908
  var index_module_default2 = {
4909
+ toolCollapse: "index_module_toolCollapse",
4770
4910
  iconContainer: "index_module_iconContainer",
4771
4911
  toolName: "index_module_toolName",
4772
4912
  toolNamePending: "index_module_toolNamePending",
4773
4913
  dot: "index_module_dot",
4914
+ dotBlink: "index_module_dotBlink",
4774
4915
  duration: "index_module_duration",
4775
4916
  statusIcon: "index_module_statusIcon",
4776
4917
  expandIcon: "index_module_expandIcon",
@@ -4778,8 +4919,30 @@ var index_module_default2 = {
4778
4919
  sectionLabel: "index_module_sectionLabel",
4779
4920
  plainTextContainer: "index_module_plainTextContainer",
4780
4921
  markdownContainer: "index_module_markdownContainer",
4922
+ summaryText: "index_module_summaryText",
4923
+ metaGrid: "index_module_metaGrid",
4924
+ metaItem: "index_module_metaItem",
4925
+ metaLabel: "index_module_metaLabel",
4926
+ metaValue: "index_module_metaValue",
4927
+ linkList: "index_module_linkList",
4928
+ linkItem: "index_module_linkItem",
4929
+ linkTitle: "index_module_linkTitle",
4930
+ linkIndex: "index_module_linkIndex",
4931
+ linkSummary: "index_module_linkSummary",
4932
+ linkUrl: "index_module_linkUrl",
4933
+ statusBlock: "index_module_statusBlock",
4934
+ status_info: "index_module_status_info",
4935
+ status_success: "index_module_status_success",
4936
+ status_warning: "index_module_status_warning",
4937
+ status_error: "index_module_status_error",
4938
+ errorDisplay: "index_module_errorDisplay",
4781
4939
  sectionBlock: "index_module_sectionBlock",
4940
+ compactSectionBlock: "index_module_compactSectionBlock",
4782
4941
  contentScrollContainer: "index_module_contentScrollContainer",
4942
+ subAgentContainer: "index_module_subAgentContainer",
4943
+ subAgentHeader: "index_module_subAgentHeader",
4944
+ subAgentName: "index_module_subAgentName",
4945
+ subAgentMessages: "index_module_subAgentMessages",
4783
4946
  todoList: "index_module_todoList",
4784
4947
  todoItem: "index_module_todoItem",
4785
4948
  statusIconWrapper: "index_module_statusIconWrapper",
@@ -4788,28 +4951,89 @@ var index_module_default2 = {
4788
4951
  completed: "index_module_completed",
4789
4952
  emptyText: "index_module_emptyText"
4790
4953
  };
4791
- var DefaultToolRender = ({ argsContent, resultContent, errorMessage, item }) => {
4792
- if (item.display) {
4793
- return /* @__PURE__ */ jsx("pre", { className: index_module_default2.plainTextContainer, children: item.display });
4954
+ var toMarkdown = (content, kind, lang) => {
4955
+ if (kind === "markdown") return content;
4956
+ if (kind === "data") return `\`\`\`json
4957
+ ${content}
4958
+ \`\`\``;
4959
+ return lang ? `\`\`\`${lang}
4960
+ ${content}
4961
+ \`\`\`` : `\`\`\`
4962
+ ${content}
4963
+ \`\`\``;
4964
+ };
4965
+ var renderBlock = (block, index) => {
4966
+ if (block.kind === "status") {
4967
+ return /* @__PURE__ */ jsx("div", { className: `${index_module_default2.statusBlock} ${index_module_default2[`status_${block.level}`] || ""}`, children: block.text }, `status-${index}`);
4794
4968
  }
4795
- return /* @__PURE__ */ jsxs(Fragment, { children: [
4796
- (item.content || item.arguments) && argsContent && /* @__PURE__ */ jsxs("div", { className: index_module_default2.sectionBlock, children: [
4797
- /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: "\u8F93\u5165\u53C2\u6570" }),
4798
- /* @__PURE__ */ jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsx(XMarkdown_default, { content: argsContent.isJson ? `\`\`\`json
4969
+ if (block.kind === "key_value") {
4970
+ return /* @__PURE__ */ jsxs("div", { className: index_module_default2.sectionBlock, children: [
4971
+ block.title && /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: block.title }),
4972
+ /* @__PURE__ */ jsx("div", { className: index_module_default2.metaGrid, children: block.items.map((item, itemIndex) => /* @__PURE__ */ jsxs("div", { className: index_module_default2.metaItem, children: [
4973
+ /* @__PURE__ */ jsx("span", { className: index_module_default2.metaLabel, children: item.label }),
4974
+ /* @__PURE__ */ jsx("span", { className: index_module_default2.metaValue, children: item.value })
4975
+ ] }, `${item.label}-${itemIndex}`)) })
4976
+ ] }, `kv-${index}`);
4977
+ }
4978
+ if (block.kind === "links") {
4979
+ return /* @__PURE__ */ jsxs("div", { className: index_module_default2.sectionBlock, children: [
4980
+ block.title && /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: block.title }),
4981
+ /* @__PURE__ */ jsx("div", { className: index_module_default2.linkList, children: block.items.map((item, itemIndex) => /* @__PURE__ */ jsxs("a", { href: item.url, target: "_blank", rel: "noreferrer", className: index_module_default2.linkItem, children: [
4982
+ /* @__PURE__ */ jsxs("span", { className: index_module_default2.linkIndex, children: [
4983
+ itemIndex + 1,
4984
+ "."
4985
+ ] }),
4986
+ /* @__PURE__ */ jsx("span", { className: index_module_default2.linkTitle, children: item.title })
4987
+ ] }, `${item.url}-${itemIndex}`)) })
4988
+ ] }, `links-${index}`);
4989
+ }
4990
+ const markdown = block.kind === "markdown" ? block.content : toMarkdown(block.content, "code", block.lang);
4991
+ return /* @__PURE__ */ jsxs("div", { className: index_module_default2.sectionBlock, children: [
4992
+ block.title && /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: block.title }),
4993
+ /* @__PURE__ */ jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsx(XMarkdown_default, { content: markdown }) })
4994
+ ] }, `${block.kind}-${index}`);
4995
+ };
4996
+ var renderDisplayView = (view, fallbackLabel) => {
4997
+ if (!view) return null;
4998
+ const hasBody = view.blocks && view.blocks.length > 0 || view.meta && view.meta.length > 0 || view.summary;
4999
+ if (!hasBody) return null;
5000
+ const hasRichBody = !!(view.blocks && view.blocks.length > 0);
5001
+ const isOnlyLinksBlock = !view.summary && (!view.meta || view.meta.length === 0) && view.blocks?.length === 1 && view.blocks[0].kind === "links";
5002
+ const label = isOnlyLinksBlock ? void 0 : (hasRichBody ? view.title : void 0);
5003
+ return /* @__PURE__ */ jsxs("div", { className: `${index_module_default2.sectionBlock} ${!hasRichBody ? index_module_default2.compactSectionBlock : ""}`, children: [
5004
+ label && /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: label }),
5005
+ view.summary && /* @__PURE__ */ jsx("div", { className: index_module_default2.summaryText, children: view.summary }),
5006
+ view.meta && view.meta.length > 0 && /* @__PURE__ */ jsx("div", { className: index_module_default2.metaGrid, children: view.meta.map((item, index) => /* @__PURE__ */ jsxs("div", { className: index_module_default2.metaItem, children: [
5007
+ /* @__PURE__ */ jsx("span", { className: index_module_default2.metaLabel, children: item.label }),
5008
+ /* @__PURE__ */ jsx("span", { className: index_module_default2.metaValue, children: item.value })
5009
+ ] }, `${item.label}-${index}`)) }),
5010
+ view.blocks?.map((block, index) => renderBlock(block, index))
5011
+ ] });
5012
+ };
5013
+ var DefaultToolRender = ({ argsContent, resultContent, item }) => {
5014
+ const sd = item.streamingArgsDisplay;
5015
+ const isError = item.isError || item.status === "error";
5016
+ const hasStructuredDisplay = !!item.displayProtocol || !!sd?.content || !!item.argsDisplay || !!item.resultDisplay;
5017
+ return /* @__PURE__ */ jsxs("div", { className: isError ? index_module_default2.errorDisplay : "", children: [
5018
+ !item.argsDisplay && sd?.content && /* @__PURE__ */ jsxs("div", { className: `${index_module_default2.sectionBlock} ${index_module_default2.compactSectionBlock}`, children: [
5019
+ /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: sd.title || "\u8F93\u5165\u751F\u6210\u4E2D" }),
5020
+ /* @__PURE__ */ jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsx(XMarkdown_default, { content: toMarkdown(sd.content, sd.kind, sd.lang) }) })
5021
+ ] }),
5022
+ renderDisplayView(item.argsDisplay),
5023
+ renderDisplayView(item.resultDisplay),
5024
+ !hasStructuredDisplay && /* @__PURE__ */ jsxs(Fragment, { children: [
5025
+ (item.content || item.arguments) && argsContent && /* @__PURE__ */ jsxs("div", { className: index_module_default2.sectionBlock, children: [
5026
+ /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: "\u8F93\u5165\u53C2\u6570" }),
5027
+ /* @__PURE__ */ jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsx(XMarkdown_default, { content: argsContent.isJson ? `\`\`\`json
4799
5028
  ${argsContent.text}
4800
5029
  \`\`\`` : argsContent.text }) })
4801
- ] }),
4802
- item.result && resultContent && /* @__PURE__ */ jsxs("div", { className: index_module_default2.sectionBlock, children: [
4803
- /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: "\u8FD4\u56DE\u7ED3\u679C" }),
4804
- /* @__PURE__ */ jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsx(XMarkdown_default, { content: resultContent.isJson ? `\`\`\`json
5030
+ ] }),
5031
+ item.result && resultContent && /* @__PURE__ */ jsxs("div", { className: index_module_default2.sectionBlock, children: [
5032
+ /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: "\u8FD4\u56DE\u7ED3\u679C" }),
5033
+ /* @__PURE__ */ jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsx(XMarkdown_default, { content: resultContent.isJson ? `\`\`\`json
4805
5034
  ${resultContent.text}
4806
5035
  \`\`\`` : resultContent.text }) })
4807
- ] }),
4808
- errorMessage && /* @__PURE__ */ jsxs("div", { className: index_module_default2.sectionBlock, children: [
4809
- /* @__PURE__ */ jsx(Typography.Text, { className: index_module_default2.sectionLabel, children: "\u9519\u8BEF\u4FE1\u606F" }),
4810
- /* @__PURE__ */ jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsx(XMarkdown_default, { content: `\`\`\`
4811
- ${errorMessage}
4812
- \`\`\`` }) })
5036
+ ] })
4813
5037
  ] })
4814
5038
  ] });
4815
5039
  };
@@ -4893,6 +5117,9 @@ var formatContent = (content) => {
4893
5117
  return { text, isJson: false, parsed: null };
4894
5118
  }
4895
5119
  };
5120
+ var hasDisplayViewBody = (view) => {
5121
+ return !!(view?.summary || view?.blocks?.length || view?.meta?.length);
5122
+ };
4896
5123
  var ToolCallItem = ({ item }) => {
4897
5124
  const { token } = theme.useToken();
4898
5125
  const renderConfig = getToolRenderConfig(item);
@@ -4919,16 +5146,22 @@ var ToolCallItem = ({ item }) => {
4919
5146
  alwaysShow = renderConfig.alwaysShowContent;
4920
5147
  }
4921
5148
  if (alwaysShow) return true;
4922
- if (item.display) return true;
4923
- if (item.errorMessage) return true;
5149
+ if (item.displayProtocol) {
5150
+ if (item.streamingArgsDisplay?.content) return true;
5151
+ if (hasDisplayViewBody(item.argsDisplay)) return true;
5152
+ if (hasDisplayViewBody(item.resultDisplay)) return true;
5153
+ return false;
5154
+ }
4924
5155
  if (argsContent.text) return true;
4925
5156
  if (resultContent?.text) return true;
4926
5157
  return false;
4927
5158
  }, [
4928
5159
  renderConfig.disableExpandOnError,
4929
5160
  renderConfig.alwaysShowContent,
4930
- item.display,
4931
- item.errorMessage,
5161
+ item.displayProtocol,
5162
+ item.streamingArgsDisplay,
5163
+ item.argsDisplay,
5164
+ item.resultDisplay,
4932
5165
  status,
4933
5166
  argsContent.parsed,
4934
5167
  resultContent?.parsed,
@@ -4956,15 +5189,19 @@ var ToolCallItem = ({ item }) => {
4956
5189
  return /* @__PURE__ */ jsx(
4957
5190
  Collapse,
4958
5191
  {
4959
- style: { width: "70%" },
5192
+ className: index_module_default2.toolCollapse,
5193
+ style: { width: "100%" },
4960
5194
  collapsible: hasContent ? void 0 : "disabled",
4961
5195
  defaultActiveKey: isDefaultExpanded && hasContent ? [item.toolCallId || "fallback-key"] : void 0,
4962
5196
  expandIconPlacement: "end",
4963
5197
  expandIcon: ({ isActive }) => hasContent ? /* @__PURE__ */ jsx(RightOutlined, { className: `${index_module_default2.expandIcon} ${isActive ? index_module_default2.expanded : ""}` }) : null,
4964
5198
  styles: {
4965
5199
  header: {
4966
- padding: "6px 10px",
5200
+ padding: "4px 8px",
4967
5201
  overflow: "hidden"
5202
+ },
5203
+ body: {
5204
+ padding: "0 8px 8px"
4968
5205
  }
4969
5206
  },
4970
5207
  items: [
@@ -5086,7 +5323,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
5086
5323
  /* @__PURE__ */ jsx(
5087
5324
  Welcome,
5088
5325
  {
5089
- className: classNames2(styles_module_default2.chatWelcome, "p-t-32"),
5326
+ className: classNames(styles_module_default2.chatWelcome, "p-t-32"),
5090
5327
  variant: "borderless",
5091
5328
  icon: /* @__PURE__ */ jsx(
5092
5329
  RenderWrapper,
@@ -5112,7 +5349,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
5112
5349
  DefaultComponent: /* @__PURE__ */ jsx(
5113
5350
  Prompts,
5114
5351
  {
5115
- className: classNames2("m-t-16", styles_module_default2.promptItem),
5352
+ className: classNames("m-t-16", styles_module_default2.promptItem),
5116
5353
  wrap: true,
5117
5354
  onItemClick: (info) => chatStore.sendMessage(info.data.description),
5118
5355
  items: recommendQuestions
@@ -5321,7 +5558,7 @@ var BubbleListItems_default = ({
5321
5558
  autoScroll: false,
5322
5559
  ref: listRef,
5323
5560
  items: bubbleListItems,
5324
- className: classNames2(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
5561
+ className: classNames(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
5325
5562
  onScroll: handleScroll
5326
5563
  },
5327
5564
  conversationState.active.id
@@ -5369,7 +5606,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5369
5606
  setCategories([{ id: ALL_CATEGORY_ID, name: "\u5168\u90E8" }, ...tagsRes.data || []]);
5370
5607
  setResources(fetchedResources);
5371
5608
  const spec = conversationState.active.spec;
5372
- const initialItems = isSkill ? spec?.skills?.items : spec?.knowledge?.items;
5609
+ const initialItems = isSkill ? spec?.skills?.items : spec?.knowledges?.items;
5373
5610
  const validIds = new Set(fetchedResources.map((r) => r.id));
5374
5611
  const validSelectedIds = (initialItems || []).map((item) => item.id).filter((id) => validIds.has(id));
5375
5612
  setSelectedIds(validSelectedIds);
@@ -5416,7 +5653,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5416
5653
  items: ids.map((id) => ({ id }))
5417
5654
  };
5418
5655
  } else {
5419
- nextSpec.knowledge = {
5656
+ nextSpec.knowledges = {
5420
5657
  items: ids.map((id) => {
5421
5658
  const resource = resourceList.find((r) => r.id === id);
5422
5659
  return { id, name: resource?.name || "" };
@@ -5472,7 +5709,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5472
5709
  return /* @__PURE__ */ jsxs(
5473
5710
  Flex,
5474
5711
  {
5475
- className: classNames2(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
5712
+ className: classNames(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
5476
5713
  onClick: () => handleCategoryChange(cat.id, !isChecked),
5477
5714
  children: [
5478
5715
  /* @__PURE__ */ jsx(
@@ -5507,7 +5744,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5507
5744
  "\u5DF2\u9009 ",
5508
5745
  selectedIds.length
5509
5746
  ] }) }),
5510
- /* @__PURE__ */ jsxs("div", { className: classNames2(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
5747
+ /* @__PURE__ */ jsxs("div", { className: classNames(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
5511
5748
  /* @__PURE__ */ jsxs(Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
5512
5749
  selectedIds.map((id) => /* @__PURE__ */ jsx(
5513
5750
  Tag,
@@ -5537,7 +5774,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5537
5774
  return /* @__PURE__ */ jsxs(
5538
5775
  "div",
5539
5776
  {
5540
- className: classNames2(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
5777
+ className: classNames(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
5541
5778
  onClick: () => toggleItemSelection(item.id),
5542
5779
  children: [
5543
5780
  /* @__PURE__ */ jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsx(IconFont_default, { type: iconType }) }),
@@ -5563,7 +5800,7 @@ var KnowledgeBtn_default = ({}) => {
5563
5800
  const chatStore = useChatStore();
5564
5801
  const conversationState = useSnapshot(chatStore.conversation);
5565
5802
  const [modalOpen, setModalOpen] = useState(false);
5566
- const knowledgeCount = conversationState.active.spec?.knowledge?.items?.length ?? 0;
5803
+ const knowledgeCount = conversationState.active.spec?.knowledges?.items?.length ?? 0;
5567
5804
  return /* @__PURE__ */ jsxs(Fragment, { children: [
5568
5805
  /* @__PURE__ */ jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
5569
5806
  /* @__PURE__ */ jsx(IconFont_default, { type: "icon-remark" }),
@@ -5667,7 +5904,7 @@ var ReasonBtn_default = ({}) => {
5667
5904
  return /* @__PURE__ */ jsxs(
5668
5905
  "div",
5669
5906
  {
5670
- className: classNames2(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
5907
+ className: classNames(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
5671
5908
  onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
5672
5909
  children: [
5673
5910
  /* @__PURE__ */ jsx(IconFont_default, { type: "icon-reason" }),
@@ -6140,9 +6377,9 @@ var ChatMainPanel = memo(
6140
6377
  );
6141
6378
  const configState = useSnapshot(chatStore.config);
6142
6379
  const agentState = useSnapshot(chatStore.agent);
6143
- return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames2("height-full"), children: [
6380
+ return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames("height-full"), children: [
6144
6381
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
6145
- /* @__PURE__ */ jsxs(Flex, { align: "center", vertical: true, gap: 24, className: classNames2("height-full", styles_module_default5.bodyWidth), children: [
6382
+ /* @__PURE__ */ jsxs(Flex, { align: "center", vertical: true, gap: 24, className: classNames("height-full", styles_module_default5.bodyWidth), children: [
6146
6383
  shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.userInput, DefaultComponent: UserInputPanel_default }),
6147
6384
  shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", style: { width: "100%" }, children: /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
6148
6385
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsx(ChatSenderHeader_default, {}) }),
@@ -6177,7 +6414,7 @@ var ChatPreviewPanel = memo(({ file }) => {
6177
6414
  return /* @__PURE__ */ jsxs(Fragment, { children: [
6178
6415
  file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
6179
6416
  /* @__PURE__ */ jsxs("div", { className: styles_module_default5.previewHeader, children: [
6180
- /* @__PURE__ */ jsx("div", { className: classNames2(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
6417
+ /* @__PURE__ */ jsx("div", { className: classNames(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
6181
6418
  /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
6182
6419
  /* @__PURE__ */ jsx(
6183
6420
  Button,
@@ -6313,12 +6550,12 @@ var layouts_default = forwardRef(({ theme: theme5, params, hooks, layout, config
6313
6550
  useEffect(() => {
6314
6551
  hooks?.onBeforeInit?.();
6315
6552
  }, []);
6316
- return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: {}, ...theme5 }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames2(index_module_default3.chatLayout, "zero-chat-layout", "height-full"), children: [
6553
+ return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: {}, ...theme5 }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames(index_module_default3.chatLayout, "zero-chat-layout", "height-full"), children: [
6317
6554
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
6318
6555
  /* @__PURE__ */ jsxs(Flex, { ref: containerRef, className: "full-scroll", children: [
6319
6556
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel }),
6320
6557
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
6321
- /* @__PURE__ */ jsxs(Splitter, { className: classNames2("flex-1", index_module_default3.animatedSplitter, { [index_module_default3.hideSplitterBar]: !hasPreView }), children: [
6558
+ /* @__PURE__ */ jsxs(Splitter, { className: classNames("flex-1", index_module_default3.animatedSplitter, { [index_module_default3.hideSplitterBar]: !hasPreView }), children: [
6322
6559
  /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsx(ChatMainPanel_default, { ref: senderRef }) }),
6323
6560
  /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: /* @__PURE__ */ jsx(ChatPreviewPanel_default, { file: configState.preview.file }) })
6324
6561
  ] })