@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.cjs.js CHANGED
@@ -19,7 +19,7 @@ var LexicalTypeaheadMenuPlugin = require('@lexical/react/LexicalTypeaheadMenuPlu
19
19
  var utils = require('@lexical/utils');
20
20
  var ReactDOM = require('react-dom');
21
21
  var dayjs = require('dayjs');
22
- var classNames2 = require('classnames');
22
+ var classNames = require('classnames');
23
23
  var InfiniteScroll = require('react-infinite-scroll-component');
24
24
  var xCard = require('@ant-design/x-card');
25
25
  require('@ant-design/x-markdown/themes/light.css');
@@ -49,7 +49,7 @@ function _interopNamespace(e) {
49
49
  var React10__namespace = /*#__PURE__*/_interopNamespace(React10);
50
50
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
51
51
  var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
52
- var classNames2__default = /*#__PURE__*/_interopDefault(classNames2);
52
+ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
53
53
  var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
54
54
  var XMarkdown__default = /*#__PURE__*/_interopDefault(XMarkdown);
55
55
  var Latex__default = /*#__PURE__*/_interopDefault(Latex);
@@ -1027,6 +1027,9 @@ var createChatService = (request, config) => {
1027
1027
  const getAgentAvatar = (path) => {
1028
1028
  return request.get(`/files/access?path=${path}&workspaceType=${"global" /* GLOBAL */}`, void 0, { responseType: "blob" });
1029
1029
  };
1030
+ const conversationFavorite = (conversationId, isFavorite) => {
1031
+ return request.put("/agents/conversations/favorite", { conversationIds: [conversationId], favorite: isFavorite });
1032
+ };
1030
1033
  return {
1031
1034
  fetchModelList,
1032
1035
  fetchAgentInfo,
@@ -1045,7 +1048,8 @@ var createChatService = (request, config) => {
1045
1048
  listLibrarys,
1046
1049
  listDataSources,
1047
1050
  listTags,
1048
- getAgentAvatar
1051
+ getAgentAvatar,
1052
+ conversationFavorite
1049
1053
  };
1050
1054
  };
1051
1055
 
@@ -1235,6 +1239,7 @@ function createChatStore() {
1235
1239
  id: "id",
1236
1240
  label: "title",
1237
1241
  spec: "spec",
1242
+ isFavorite: "isFavorite",
1238
1243
  group: (c) => {
1239
1244
  return classifyTime(c.updatedAt);
1240
1245
  }
@@ -1308,7 +1313,7 @@ function createChatStore() {
1308
1313
  const { data } = await config.services.request.createConversationId({ agentId: agent.agentInfo.id, convMeta: config.params.convMeta });
1309
1314
  const newSpec = {
1310
1315
  skills: { items: [] },
1311
- knowledge: { items: [] }
1316
+ knowledges: { items: [] }
1312
1317
  };
1313
1318
  updateConversations({
1314
1319
  id: data || "",
@@ -1319,6 +1324,45 @@ function createChatStore() {
1319
1324
  });
1320
1325
  await switchConversation(data);
1321
1326
  };
1327
+ const favorite = valtio.proxy({
1328
+ /** 收藏列表数据 */
1329
+ list: {
1330
+ items: []
1331
+ },
1332
+ /** 收藏列表的加载状态 */
1333
+ loading: false
1334
+ });
1335
+ const getConversationFavorite = async () => {
1336
+ try {
1337
+ favorite.loading = true;
1338
+ const { data } = await config.services.request.fetchConversations({
1339
+ agentId: agent.agentInfo?.id || "",
1340
+ convMeta: {
1341
+ ...config.params.convMeta,
1342
+ isFavorite: true
1343
+ }
1344
+ });
1345
+ favorite.list.items = data || [];
1346
+ } finally {
1347
+ favorite.loading = false;
1348
+ }
1349
+ };
1350
+ const collectConversation = async (conversationId, isFavorite) => {
1351
+ try {
1352
+ await config.services.request.conversationFavorite(conversationId, isFavorite);
1353
+ if (conversations.list.items.length) {
1354
+ const item = conversations.list.items.find((item2) => item2.id === conversationId);
1355
+ if (item) {
1356
+ item.isFavorite = isFavorite;
1357
+ }
1358
+ }
1359
+ if (!isFavorite && favorite.list.items.length) {
1360
+ favorite.list.items = favorite.list.items.filter((item) => item.id !== conversationId);
1361
+ }
1362
+ antd.message.success(isFavorite ? "\u6536\u85CF\u6210\u529F" : "\u5DF2\u53D6\u6D88\u6536\u85CF");
1363
+ } finally {
1364
+ }
1365
+ };
1322
1366
  const conversation = valtio.proxy({
1323
1367
  /** 当前激活的会话信息 */
1324
1368
  active: {
@@ -1623,36 +1667,32 @@ function createChatStore() {
1623
1667
  messages.push(finalMsg);
1624
1668
  } else {
1625
1669
  const contents = messages[idx].content;
1626
- const existingItemIndex = contents.findIndex(
1627
- (item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId
1628
- );
1670
+ let existingItemIndex = contents.findIndex((item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId);
1671
+ if (existingItemIndex === -1 && contentItem.toolCallId) {
1672
+ existingItemIndex = contents.findIndex(
1673
+ (item) => item.type === "toolCall" && !item.toolCallId && item._streamingIndex !== void 0
1674
+ );
1675
+ }
1629
1676
  if (existingItemIndex !== -1) {
1630
- const existingItem = contents[existingItemIndex];
1677
+ const nextItem = { ...contents[existingItemIndex] };
1631
1678
  const newContent = contentItem.content || contentItem.arguments;
1632
- const nextItem = { ...existingItem };
1633
1679
  if (typeof newContent === "string") {
1634
- nextItem.content = (existingItem.content || "") + newContent;
1680
+ nextItem.content = (nextItem.content || "") + newContent;
1635
1681
  } else if (newContent !== void 0) {
1636
1682
  nextItem.arguments = newContent;
1637
1683
  }
1638
- if (contentItem.toolName) {
1639
- nextItem.toolName = contentItem.toolName;
1640
- }
1641
- if (contentItem.title) {
1642
- nextItem.title = contentItem.title;
1643
- }
1644
- if (contentItem.status) {
1645
- nextItem.status = contentItem.status;
1646
- }
1647
- if (contentItem.toolIcon) {
1648
- nextItem.toolIcon = contentItem.toolIcon;
1649
- }
1684
+ if (contentItem.toolName) nextItem.toolName = contentItem.toolName;
1685
+ if (contentItem.title) nextItem.title = contentItem.title;
1686
+ if (contentItem.status) nextItem.status = contentItem.status;
1687
+ if (contentItem.toolIcon) nextItem.toolIcon = contentItem.toolIcon;
1688
+ if (contentItem.display?.title) nextItem.title = contentItem.display.title;
1650
1689
  if (contentItem.display) {
1651
- nextItem.display = (existingItem.display || "") + contentItem.display;
1690
+ nextItem.argsDisplay = contentItem.display;
1691
+ nextItem.displayProtocol = true;
1652
1692
  }
1653
1693
  messages[idx].content = contents.map((item, i) => i === existingItemIndex ? nextItem : item);
1654
1694
  } else {
1655
- messages[idx].content = [...contents, contentItem];
1695
+ messages[idx].content = [...contents, { ...contentItem, displayProtocol: !!contentItem.display }];
1656
1696
  }
1657
1697
  }
1658
1698
  if (isMain) conversation.messages[msg.conversationId].loading = true;
@@ -1671,25 +1711,20 @@ function createChatStore() {
1671
1711
  const contents = messages[idx].content;
1672
1712
  const toolCallIndex = contents.findIndex((item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId);
1673
1713
  if (toolCallIndex !== -1) {
1674
- const toolCallItem = contents[toolCallIndex];
1675
1714
  const nextToolCallItem = {
1676
- ...toolCallItem,
1715
+ ...contents[toolCallIndex],
1677
1716
  result: contentItem.result ?? contentItem.content
1678
1717
  };
1679
- if (contentItem.status) {
1680
- nextToolCallItem.status = contentItem.status;
1681
- }
1682
- if (contentItem.errorMessage) {
1683
- nextToolCallItem.errorMessage = contentItem.errorMessage;
1684
- }
1685
- if (contentItem.duration) {
1686
- nextToolCallItem.duration = contentItem.duration;
1687
- }
1688
- if (contentItem.title) {
1689
- nextToolCallItem.title = contentItem.title;
1690
- }
1691
- if (contentItem.display !== void 0) {
1692
- nextToolCallItem.display = contentItem.display;
1718
+ if (contentItem.status) nextToolCallItem.status = contentItem.status;
1719
+ if (contentItem.isError !== void 0) nextToolCallItem.isError = contentItem.isError;
1720
+ if (contentItem.errorMessage) nextToolCallItem.errorMessage = contentItem.errorMessage;
1721
+ const dur = contentItem.durationMs ?? contentItem.duration;
1722
+ if (dur !== void 0) nextToolCallItem.duration = dur;
1723
+ if (contentItem.title) nextToolCallItem.title = contentItem.title;
1724
+ if (contentItem.display?.title) nextToolCallItem.title = contentItem.display.title;
1725
+ if (contentItem.display) {
1726
+ nextToolCallItem.resultDisplay = contentItem.display;
1727
+ nextToolCallItem.displayProtocol = true;
1693
1728
  }
1694
1729
  messages[idx].content = contents.map((item, i) => i === toolCallIndex ? nextToolCallItem : item);
1695
1730
  } else {
@@ -1715,60 +1750,73 @@ function createChatStore() {
1715
1750
  if (contentItem.type !== "toolCallDelta") return;
1716
1751
  let idx = -1;
1717
1752
  if (contentItem.toolCallId) {
1753
+ idx = messages.findLastIndex((m) => m.content?.some((c) => c.type === "toolCall" && c.toolCallId === contentItem.toolCallId));
1754
+ }
1755
+ if (idx === -1 && contentItem.index !== void 0) {
1718
1756
  idx = messages.findLastIndex(
1719
- (m) => m.content?.some((c) => (c.type === "toolCall" || c.type === "toolCallDelta") && c.toolCallId === contentItem.toolCallId)
1757
+ (m) => m.executionId === msg.executionId && m.content?.some((c) => c.type === "toolCall" && c._streamingIndex === contentItem.index && !c.toolCallId)
1720
1758
  );
1721
1759
  }
1722
1760
  if (idx === -1) idx = findExecutionMsgIndex(msg, messages);
1761
+ const buildNewItem = () => {
1762
+ const item = {
1763
+ type: "toolCall",
1764
+ toolCallId: contentItem.toolCallId || void 0,
1765
+ _streamingIndex: contentItem.index,
1766
+ toolName: contentItem.toolName || void 0,
1767
+ toolIcon: contentItem.toolIcon,
1768
+ title: contentItem.title,
1769
+ content: contentItem.displayDelta ? "" : contentItem.argumentsDelta || "",
1770
+ status: contentItem.status || "running",
1771
+ displayProtocol: !!contentItem.displayDelta
1772
+ };
1773
+ if (contentItem.displayDelta?.title) item.title = contentItem.displayDelta.title;
1774
+ if (contentItem.displayDelta?.contentAppend) {
1775
+ item.streamingArgsDisplay = {
1776
+ title: contentItem.displayDelta.title,
1777
+ content: contentItem.displayDelta.contentAppend,
1778
+ kind: contentItem.displayDelta.kind,
1779
+ lang: contentItem.displayDelta.lang
1780
+ };
1781
+ }
1782
+ return item;
1783
+ };
1723
1784
  if (idx === -1) {
1724
- messages.push({
1725
- ...msg,
1726
- content: [
1727
- {
1728
- type: "toolCall",
1729
- toolCallId: contentItem.toolCallId,
1730
- toolName: contentItem.toolName || void 0,
1731
- toolIcon: contentItem.toolIcon,
1732
- title: contentItem.title,
1733
- content: contentItem.argumentsDelta || "",
1734
- display: contentItem.display,
1735
- status: contentItem.status || "running"
1736
- }
1737
- ],
1738
- generating: true
1739
- });
1785
+ messages.push({ ...msg, content: [buildNewItem()], generating: true });
1740
1786
  } else {
1741
1787
  const contents = messages[idx].content;
1742
- const itemIdx = contents.findIndex(
1743
- (c) => (c.type === "toolCall" || c.type === "toolCallDelta") && c.toolCallId === contentItem.toolCallId
1744
- );
1788
+ let itemIdx = -1;
1789
+ if (contentItem.toolCallId) {
1790
+ itemIdx = contents.findIndex((c) => c.type === "toolCall" && c.toolCallId === contentItem.toolCallId);
1791
+ }
1792
+ if (itemIdx === -1 && contentItem.index !== void 0) {
1793
+ itemIdx = contents.findIndex((c) => c.type === "toolCall" && c._streamingIndex === contentItem.index && !c.toolCallId);
1794
+ }
1745
1795
  if (itemIdx !== -1) {
1746
1796
  const existing = contents[itemIdx];
1747
1797
  const nextItem = {
1748
1798
  ...existing,
1749
1799
  type: "toolCall",
1750
- content: (existing.content || "") + (contentItem.argumentsDelta || "")
1800
+ content: contentItem.displayDelta ? existing.content || "" : (existing.content || "") + (contentItem.argumentsDelta || "")
1751
1801
  };
1802
+ if (contentItem.toolCallId && !existing.toolCallId) nextItem.toolCallId = contentItem.toolCallId;
1752
1803
  if (contentItem.toolName) nextItem.toolName = contentItem.toolName;
1753
1804
  if (contentItem.title) nextItem.title = contentItem.title;
1754
1805
  if (contentItem.status) nextItem.status = contentItem.status;
1755
1806
  if (contentItem.toolIcon) nextItem.toolIcon = contentItem.toolIcon;
1756
- if (contentItem.display) nextItem.display = (existing.display || "") + contentItem.display;
1807
+ if (contentItem.displayDelta) nextItem.displayProtocol = true;
1808
+ if (contentItem.displayDelta?.title) nextItem.title = contentItem.displayDelta.title;
1809
+ if (contentItem.displayDelta?.contentAppend) {
1810
+ nextItem.streamingArgsDisplay = {
1811
+ title: contentItem.displayDelta.title || existing.streamingArgsDisplay?.title,
1812
+ content: (existing.streamingArgsDisplay?.content || "") + contentItem.displayDelta.contentAppend,
1813
+ kind: contentItem.displayDelta.kind || existing.streamingArgsDisplay?.kind,
1814
+ lang: contentItem.displayDelta.lang ?? existing.streamingArgsDisplay?.lang
1815
+ };
1816
+ }
1757
1817
  messages[idx].content = contents.map((c, i) => i === itemIdx ? nextItem : c);
1758
1818
  } else {
1759
- messages[idx].content = [
1760
- ...contents,
1761
- {
1762
- type: "toolCall",
1763
- toolCallId: contentItem.toolCallId,
1764
- toolName: contentItem.toolName || void 0,
1765
- toolIcon: contentItem.toolIcon,
1766
- title: contentItem.title,
1767
- content: contentItem.argumentsDelta || "",
1768
- display: contentItem.display,
1769
- status: contentItem.status || "running"
1770
- }
1771
- ];
1819
+ messages[idx].content = [...contents, buildNewItem()];
1772
1820
  }
1773
1821
  }
1774
1822
  if (isMain) conversation.messages[msg.conversationId].loading = true;
@@ -1998,6 +2046,11 @@ function createChatStore() {
1998
2046
  const dealedParams = await config.hooks?.onHandleSendParams?.(sendParams);
1999
2047
  await config.services.request.sendMessageStream(dealedParams || sendParams, agent.agentInfo?.id || "");
2000
2048
  config.hooks?.onAfterSend?.();
2049
+ } catch (err) {
2050
+ conversation.messages[conversationId].loading = false;
2051
+ const errMsg = err?.response?.data?.message || err?.message || "\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";
2052
+ antd.message.error(errMsg);
2053
+ throw err;
2001
2054
  } finally {
2002
2055
  }
2003
2056
  };
@@ -2095,7 +2148,13 @@ function createChatStore() {
2095
2148
  /** 消息反馈 */
2096
2149
  feedback,
2097
2150
  /** 设置会话用户输入 */
2098
- setConversationUserInput
2151
+ setConversationUserInput,
2152
+ /** 收藏管理 */
2153
+ favorite,
2154
+ /** 获取会话收藏列表 */
2155
+ getConversationFavorite,
2156
+ /** 收藏会话 */
2157
+ collectConversation
2099
2158
  };
2100
2159
  }
2101
2160
  var AuthImage = ({ path, size, shape = "square" }) => {
@@ -2170,6 +2229,106 @@ window._iconfont_svg_string_5021436 = '<svg><symbol id="icon-Ollama" viewBox="0
2170
2229
  // src/components/IconFont/index.ts
2171
2230
  var IconFont = icons.createFromIconfontCN({});
2172
2231
  var IconFont_default = IconFont;
2232
+
2233
+ // src/ui/common/FeatureComponents/style.module.less
2234
+ var style_module_default = {
2235
+ popover: "style_module_popover",
2236
+ resourceBtn: "style_module_resourceBtn",
2237
+ divider: "style_module_divider",
2238
+ count: "style_module_count",
2239
+ resourceBtnActive: "style_module_resourceBtnActive",
2240
+ customModal: "style_module_customModal",
2241
+ layout: "style_module_layout",
2242
+ sider: "style_module_sider",
2243
+ categoryName: "style_module_categoryName",
2244
+ siderContent: "style_module_siderContent",
2245
+ categoryItem: "style_module_categoryItem",
2246
+ categoryActive: "style_module_categoryActive",
2247
+ roundCheckbox: "style_module_roundCheckbox",
2248
+ content: "style_module_content",
2249
+ searchInput: "style_module_searchInput",
2250
+ selectedCount: "style_module_selectedCount",
2251
+ tagsArea: "style_module_tagsArea",
2252
+ tagContainer: "style_module_tagContainer",
2253
+ tag: "style_module_tag",
2254
+ expandBtnWrapper: "style_module_expandBtnWrapper",
2255
+ expandBtn: "style_module_expandBtn",
2256
+ tagsExpanded: "style_module_tagsExpanded",
2257
+ listArea: "style_module_listArea",
2258
+ listInner: "style_module_listInner",
2259
+ listItem: "style_module_listItem",
2260
+ listItemSelected: "style_module_listItemSelected",
2261
+ itemIconWrapper: "style_module_itemIconWrapper",
2262
+ itemInfo: "style_module_itemInfo",
2263
+ itemDesc: "style_module_itemDesc",
2264
+ footer: "style_module_footer",
2265
+ titleContainer: "style_module_titleContainer",
2266
+ favoriteCard: "style_module_favoriteCard",
2267
+ favoriteCardActive: "style_module_favoriteCardActive",
2268
+ favoriteCardTitle: "style_module_favoriteCardTitle",
2269
+ favoriteCardActions: "style_module_favoriteCardActions"};
2270
+ var ConversationFavoritesBtn_default = ({ icon, ...rest }) => {
2271
+ const chatStore = useChatStore();
2272
+ const conversationState = valtio.useSnapshot(chatStore.conversation);
2273
+ const favoriteState = valtio.useSnapshot(chatStore.favorite);
2274
+ const getFavoriteList = common.useDebounce(() => {
2275
+ chatStore.getConversationFavorite();
2276
+ }, 300);
2277
+ const renderFavoriteList = React10.useMemo(() => {
2278
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 4, className: classNames__default.default("height-full", "scroll-fade-in"), children: favoriteState.list.items.length ? favoriteState.list.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
2279
+ "div",
2280
+ {
2281
+ className: classNames__default.default(style_module_default.favoriteCard, { [style_module_default.favoriteCardActive]: conversationState.active.id === item.id }),
2282
+ onClick: () => chatStore.switchConversation(item.id),
2283
+ children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, align: "center", children: [
2284
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: classNames__default.default(style_module_default.favoriteCardTitle, "text-ellipsis"), children: item.title }),
2285
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", className: style_module_default.favoriteCardActions, children: /* @__PURE__ */ jsxRuntime.jsx(
2286
+ antd.Popconfirm,
2287
+ {
2288
+ title: "\u63D0\u793A",
2289
+ okText: "\u786E\u5B9A",
2290
+ cancelText: "\u53D6\u6D88",
2291
+ description: "\u786E\u8BA4\u53D6\u6D88\u6536\u85CF\u8BE5\u4F1A\u8BDD\u5417\uFF1F",
2292
+ onConfirm: (e) => {
2293
+ e.stopPropagation();
2294
+ chatStore.collectConversation(item.id, false);
2295
+ },
2296
+ onCancel: (e) => e.stopPropagation(),
2297
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2298
+ antd.Button,
2299
+ {
2300
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}),
2301
+ title: "\u5220\u9664",
2302
+ type: "text",
2303
+ onClick: (e) => {
2304
+ e.stopPropagation();
2305
+ }
2306
+ }
2307
+ )
2308
+ }
2309
+ ) })
2310
+ ] })
2311
+ },
2312
+ item.id
2313
+ )) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u6536\u85CF", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) });
2314
+ }, [favoriteState.list.items, conversationState.active.id]);
2315
+ const handlePopoverVisibleChange = (visible) => {
2316
+ if (!visible) return;
2317
+ getFavoriteList();
2318
+ };
2319
+ return /* @__PURE__ */ jsxRuntime.jsx(
2320
+ antd.Popover,
2321
+ {
2322
+ classNames: { container: style_module_default.popover },
2323
+ getPopupContainer: (e) => e,
2324
+ placement: "bottom",
2325
+ content: renderFavoriteList,
2326
+ trigger: ["click"],
2327
+ onOpenChange: handlePopoverVisibleChange,
2328
+ children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u6536\u85CF\u5939", type: "text", size: "large", icon: icon?.() || /* @__PURE__ */ jsxRuntime.jsx(icons.StarOutlined, {}), ...rest })
2329
+ }
2330
+ );
2331
+ };
2173
2332
  var CreateBtn_default = ({ icon, ...rest }) => {
2174
2333
  const chatStore = useChatStore();
2175
2334
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u65B0\u5EFA\u4F1A\u8BDD", size: "large", type: "text", icon: icon?.() || /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}), onClick: () => chatStore.createConversation(), ...rest });
@@ -2210,6 +2369,11 @@ var ConversationList_default = () => {
2210
2369
  }, [conversationsState.list.items]);
2211
2370
  const menuConfig = (conversation) => ({
2212
2371
  items: [
2372
+ {
2373
+ label: `${conversation.isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF"}`,
2374
+ key: "collect",
2375
+ icon: conversation?.isFavorite ? /* @__PURE__ */ jsxRuntime.jsx(icons.StarFilled, { className: "primary-text" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.StarOutlined, {})
2376
+ },
2213
2377
  {
2214
2378
  label: "\u5220\u9664",
2215
2379
  key: "deleteChat",
@@ -2221,6 +2385,8 @@ var ConversationList_default = () => {
2221
2385
  itemInfo.domEvent.stopPropagation();
2222
2386
  if (itemInfo.key === "deleteChat") {
2223
2387
  chatStore.delConversation(conversation.key);
2388
+ } else if (itemInfo.key === "collect") {
2389
+ chatStore.collectConversation(conversation.id, !conversation.isFavorite);
2224
2390
  }
2225
2391
  }
2226
2392
  });
@@ -2249,41 +2415,6 @@ var ConversationList_default = () => {
2249
2415
  }
2250
2416
  ) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) });
2251
2417
  };
2252
-
2253
- // src/ui/common/FeatureComponents/style.module.less
2254
- var style_module_default = {
2255
- popover: "style_module_popover",
2256
- resourceBtn: "style_module_resourceBtn",
2257
- divider: "style_module_divider",
2258
- count: "style_module_count",
2259
- resourceBtnActive: "style_module_resourceBtnActive",
2260
- customModal: "style_module_customModal",
2261
- layout: "style_module_layout",
2262
- sider: "style_module_sider",
2263
- categoryName: "style_module_categoryName",
2264
- siderContent: "style_module_siderContent",
2265
- categoryItem: "style_module_categoryItem",
2266
- categoryActive: "style_module_categoryActive",
2267
- roundCheckbox: "style_module_roundCheckbox",
2268
- content: "style_module_content",
2269
- searchInput: "style_module_searchInput",
2270
- selectedCount: "style_module_selectedCount",
2271
- tagsArea: "style_module_tagsArea",
2272
- tagContainer: "style_module_tagContainer",
2273
- tag: "style_module_tag",
2274
- expandBtnWrapper: "style_module_expandBtnWrapper",
2275
- expandBtn: "style_module_expandBtn",
2276
- tagsExpanded: "style_module_tagsExpanded",
2277
- listArea: "style_module_listArea",
2278
- listInner: "style_module_listInner",
2279
- listItem: "style_module_listItem",
2280
- listItemSelected: "style_module_listItemSelected",
2281
- itemIconWrapper: "style_module_itemIconWrapper",
2282
- itemInfo: "style_module_itemInfo",
2283
- itemDesc: "style_module_itemDesc",
2284
- footer: "style_module_footer",
2285
- titleContainer: "style_module_titleContainer"
2286
- };
2287
2418
  var HistoryBtn_default = ({ icon, ...rest }) => {
2288
2419
  return /* @__PURE__ */ jsxRuntime.jsx(
2289
2420
  antd.Popover,
@@ -2297,11 +2428,18 @@ var HistoryBtn_default = ({ icon, ...rest }) => {
2297
2428
  }
2298
2429
  );
2299
2430
  };
2300
- var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newConversationBtn = true, conversationListBtn = true }) => {
2431
+ var ChatHeader_default = ({
2432
+ title = true,
2433
+ avatar = true,
2434
+ closeBtn = false,
2435
+ newConversationBtn = true,
2436
+ conversationListBtn = true,
2437
+ conversationFavoriteBtn = true
2438
+ }) => {
2301
2439
  const chatStore = useChatStore();
2302
2440
  const agentState = valtio.useSnapshot(chatStore.agent);
2303
2441
  const configState = valtio.useSnapshot(chatStore.config);
2304
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(styles_module_default2.chatHeader, "zero-chat-header"), children: [
2442
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames__default.default(styles_module_default2.chatHeader, "zero-chat-header"), children: [
2305
2443
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.chatHeaderContent, children: [
2306
2444
  /* @__PURE__ */ jsxRuntime.jsx(
2307
2445
  common.RenderWrapper,
@@ -2316,7 +2454,8 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
2316
2454
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 2, children: [
2317
2455
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.chatHeaderBtnGroup, children: [
2318
2456
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: newConversationBtn, DefaultComponent: CreateBtn_default }),
2319
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationListBtn, DefaultComponent: HistoryBtn_default })
2457
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationListBtn, DefaultComponent: HistoryBtn_default }),
2458
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationFavoriteBtn, DefaultComponent: ConversationFavoritesBtn_default })
2320
2459
  ] }),
2321
2460
  /* @__PURE__ */ jsxRuntime.jsx(
2322
2461
  common.RenderWrapper,
@@ -2329,7 +2468,7 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
2329
2468
  ] }) });
2330
2469
  };
2331
2470
  var { Text } = antd.Typography;
2332
- var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true }) => {
2471
+ var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true, conversationFavoriteBtn = true }) => {
2333
2472
  const chatStore = useChatStore();
2334
2473
  const agentState = valtio.useSnapshot(chatStore.agent);
2335
2474
  return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "p-24", gap: 16, vertical: true, children: [
@@ -2346,8 +2485,8 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2346
2485
  {
2347
2486
  control: title,
2348
2487
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 4, flex: 1, style: { minWidth: 0 }, children: [
2349
- /* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, className: classNames2__default.default("fz-16"), children: agentState.agentInfo.name }),
2350
- /* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", ellipsis: true, className: classNames2__default.default("fz-12"), children: agentState.agentInfo.description })
2488
+ /* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, className: classNames__default.default("fz-16"), children: agentState.agentInfo.name }),
2489
+ /* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", ellipsis: true, className: classNames__default.default("fz-12"), children: agentState.agentInfo.description })
2351
2490
  ] }) })
2352
2491
  }
2353
2492
  )
@@ -2362,7 +2501,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2362
2501
  block: true,
2363
2502
  type: "primary",
2364
2503
  onClick: () => chatStore.createConversation(),
2365
- className: classNames2__default.default(styles_module_default2.createConversationButton),
2504
+ className: classNames__default.default(styles_module_default2.createConversationButton),
2366
2505
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2367
2506
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
2368
2507
  }
@@ -2372,7 +2511,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2372
2511
  ] });
2373
2512
  };
2374
2513
  var ConversationListPanel = ({ header }) => {
2375
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
2514
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames__default.default("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
2376
2515
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
2377
2516
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
2378
2517
  ] });
@@ -2841,7 +2980,7 @@ var CHART_COMPONENTS = Object.fromEntries(
2841
2980
  );
2842
2981
  var Charts_default = ({ data, loading }) => {
2843
2982
  const { type, config } = data;
2844
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
2983
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames__default.default(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
2845
2984
  // Antd 骨架屏
2846
2985
  /* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton.Node, { active: true, className: styles_module_default3.chartSkeleton, children: /* @__PURE__ */ jsxRuntime.jsx(icons.DotChartOutlined, { className: styles_module_default3.chartSkeletonIcon }) })
2847
2986
  ) : /* @__PURE__ */ jsxRuntime.jsx(
@@ -3136,7 +3275,7 @@ var XMarkdown_default = React10.memo(({ message: message3, components = {}, cont
3136
3275
  return /* @__PURE__ */ jsxRuntime.jsx(
3137
3276
  XMarkdown__default.default,
3138
3277
  {
3139
- className: classNames2__default.default("x-markdown-light", styles_module_default4.xMarkdownStyle),
3278
+ className: classNames__default.default("x-markdown-light", styles_module_default4.xMarkdownStyle),
3140
3279
  config,
3141
3280
  ...rest,
3142
3281
  content: processedContent,
@@ -3481,7 +3620,7 @@ var Switch = ({ id, label, value, bind_path_token, onChange, onDataChange }) =>
3481
3620
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#555" }, children: label })
3482
3621
  ] });
3483
3622
  };
3484
- var Button9 = ({ label, variant = "default", onClick, action, onAction }) => {
3623
+ var Button10 = ({ label, variant = "default", onClick, action, onAction }) => {
3485
3624
  const handleClick = () => {
3486
3625
  if (onClick) {
3487
3626
  onClick();
@@ -3511,7 +3650,7 @@ var A2uiComponents = {
3511
3650
  TextField,
3512
3651
  Select,
3513
3652
  Switch,
3514
- Button: Button9,
3653
+ Button: Button10,
3515
3654
  Divider,
3516
3655
  Tag: Tag3,
3517
3656
  Progress,
@@ -4796,10 +4935,12 @@ var TextNode2 = React10__namespace.default.memo(
4796
4935
 
4797
4936
  // src/components/CustomComponents/ToolRenders/index.module.less
4798
4937
  var index_module_default2 = {
4938
+ toolCollapse: "index_module_toolCollapse",
4799
4939
  iconContainer: "index_module_iconContainer",
4800
4940
  toolName: "index_module_toolName",
4801
4941
  toolNamePending: "index_module_toolNamePending",
4802
4942
  dot: "index_module_dot",
4943
+ dotBlink: "index_module_dotBlink",
4803
4944
  duration: "index_module_duration",
4804
4945
  statusIcon: "index_module_statusIcon",
4805
4946
  expandIcon: "index_module_expandIcon",
@@ -4807,8 +4948,30 @@ var index_module_default2 = {
4807
4948
  sectionLabel: "index_module_sectionLabel",
4808
4949
  plainTextContainer: "index_module_plainTextContainer",
4809
4950
  markdownContainer: "index_module_markdownContainer",
4951
+ summaryText: "index_module_summaryText",
4952
+ metaGrid: "index_module_metaGrid",
4953
+ metaItem: "index_module_metaItem",
4954
+ metaLabel: "index_module_metaLabel",
4955
+ metaValue: "index_module_metaValue",
4956
+ linkList: "index_module_linkList",
4957
+ linkItem: "index_module_linkItem",
4958
+ linkTitle: "index_module_linkTitle",
4959
+ linkIndex: "index_module_linkIndex",
4960
+ linkSummary: "index_module_linkSummary",
4961
+ linkUrl: "index_module_linkUrl",
4962
+ statusBlock: "index_module_statusBlock",
4963
+ status_info: "index_module_status_info",
4964
+ status_success: "index_module_status_success",
4965
+ status_warning: "index_module_status_warning",
4966
+ status_error: "index_module_status_error",
4967
+ errorDisplay: "index_module_errorDisplay",
4810
4968
  sectionBlock: "index_module_sectionBlock",
4969
+ compactSectionBlock: "index_module_compactSectionBlock",
4811
4970
  contentScrollContainer: "index_module_contentScrollContainer",
4971
+ subAgentContainer: "index_module_subAgentContainer",
4972
+ subAgentHeader: "index_module_subAgentHeader",
4973
+ subAgentName: "index_module_subAgentName",
4974
+ subAgentMessages: "index_module_subAgentMessages",
4812
4975
  todoList: "index_module_todoList",
4813
4976
  todoItem: "index_module_todoItem",
4814
4977
  statusIconWrapper: "index_module_statusIconWrapper",
@@ -4817,28 +4980,89 @@ var index_module_default2 = {
4817
4980
  completed: "index_module_completed",
4818
4981
  emptyText: "index_module_emptyText"
4819
4982
  };
4820
- var DefaultToolRender = ({ argsContent, resultContent, errorMessage, item }) => {
4821
- if (item.display) {
4822
- return /* @__PURE__ */ jsxRuntime.jsx("pre", { className: index_module_default2.plainTextContainer, children: item.display });
4983
+ var toMarkdown = (content, kind, lang) => {
4984
+ if (kind === "markdown") return content;
4985
+ if (kind === "data") return `\`\`\`json
4986
+ ${content}
4987
+ \`\`\``;
4988
+ return lang ? `\`\`\`${lang}
4989
+ ${content}
4990
+ \`\`\`` : `\`\`\`
4991
+ ${content}
4992
+ \`\`\``;
4993
+ };
4994
+ var renderBlock = (block, index) => {
4995
+ if (block.kind === "status") {
4996
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${index_module_default2.statusBlock} ${index_module_default2[`status_${block.level}`] || ""}`, children: block.text }, `status-${index}`);
4823
4997
  }
4824
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4825
- (item.content || item.arguments) && argsContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.sectionBlock, children: [
4826
- /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: "\u8F93\u5165\u53C2\u6570" }),
4827
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: argsContent.isJson ? `\`\`\`json
4998
+ if (block.kind === "key_value") {
4999
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.sectionBlock, children: [
5000
+ block.title && /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: block.title }),
5001
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.metaGrid, children: block.items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.metaItem, children: [
5002
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: index_module_default2.metaLabel, children: item.label }),
5003
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: index_module_default2.metaValue, children: item.value })
5004
+ ] }, `${item.label}-${itemIndex}`)) })
5005
+ ] }, `kv-${index}`);
5006
+ }
5007
+ if (block.kind === "links") {
5008
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.sectionBlock, children: [
5009
+ block.title && /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: block.title }),
5010
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.linkList, children: block.items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs("a", { href: item.url, target: "_blank", rel: "noreferrer", className: index_module_default2.linkItem, children: [
5011
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: index_module_default2.linkIndex, children: [
5012
+ itemIndex + 1,
5013
+ "."
5014
+ ] }),
5015
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: index_module_default2.linkTitle, children: item.title })
5016
+ ] }, `${item.url}-${itemIndex}`)) })
5017
+ ] }, `links-${index}`);
5018
+ }
5019
+ const markdown = block.kind === "markdown" ? block.content : toMarkdown(block.content, "code", block.lang);
5020
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.sectionBlock, children: [
5021
+ block.title && /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: block.title }),
5022
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: markdown }) })
5023
+ ] }, `${block.kind}-${index}`);
5024
+ };
5025
+ var renderDisplayView = (view, fallbackLabel) => {
5026
+ if (!view) return null;
5027
+ const hasBody = view.blocks && view.blocks.length > 0 || view.meta && view.meta.length > 0 || view.summary;
5028
+ if (!hasBody) return null;
5029
+ const hasRichBody = !!(view.blocks && view.blocks.length > 0);
5030
+ const isOnlyLinksBlock = !view.summary && (!view.meta || view.meta.length === 0) && view.blocks?.length === 1 && view.blocks[0].kind === "links";
5031
+ const label = isOnlyLinksBlock ? void 0 : (hasRichBody ? view.title : void 0);
5032
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${index_module_default2.sectionBlock} ${!hasRichBody ? index_module_default2.compactSectionBlock : ""}`, children: [
5033
+ label && /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: label }),
5034
+ view.summary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.summaryText, children: view.summary }),
5035
+ view.meta && view.meta.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.metaGrid, children: view.meta.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.metaItem, children: [
5036
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: index_module_default2.metaLabel, children: item.label }),
5037
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: index_module_default2.metaValue, children: item.value })
5038
+ ] }, `${item.label}-${index}`)) }),
5039
+ view.blocks?.map((block, index) => renderBlock(block, index))
5040
+ ] });
5041
+ };
5042
+ var DefaultToolRender = ({ argsContent, resultContent, item }) => {
5043
+ const sd = item.streamingArgsDisplay;
5044
+ const isError = item.isError || item.status === "error";
5045
+ const hasStructuredDisplay = !!item.displayProtocol || !!sd?.content || !!item.argsDisplay || !!item.resultDisplay;
5046
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: isError ? index_module_default2.errorDisplay : "", children: [
5047
+ !item.argsDisplay && sd?.content && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${index_module_default2.sectionBlock} ${index_module_default2.compactSectionBlock}`, children: [
5048
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: sd.title || "\u8F93\u5165\u751F\u6210\u4E2D" }),
5049
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: toMarkdown(sd.content, sd.kind, sd.lang) }) })
5050
+ ] }),
5051
+ renderDisplayView(item.argsDisplay),
5052
+ renderDisplayView(item.resultDisplay),
5053
+ !hasStructuredDisplay && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5054
+ (item.content || item.arguments) && argsContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.sectionBlock, children: [
5055
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: "\u8F93\u5165\u53C2\u6570" }),
5056
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: argsContent.isJson ? `\`\`\`json
4828
5057
  ${argsContent.text}
4829
5058
  \`\`\`` : argsContent.text }) })
4830
- ] }),
4831
- item.result && resultContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.sectionBlock, children: [
4832
- /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: "\u8FD4\u56DE\u7ED3\u679C" }),
4833
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: resultContent.isJson ? `\`\`\`json
5059
+ ] }),
5060
+ item.result && resultContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.sectionBlock, children: [
5061
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: "\u8FD4\u56DE\u7ED3\u679C" }),
5062
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: resultContent.isJson ? `\`\`\`json
4834
5063
  ${resultContent.text}
4835
5064
  \`\`\`` : resultContent.text }) })
4836
- ] }),
4837
- errorMessage && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.sectionBlock, children: [
4838
- /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { className: index_module_default2.sectionLabel, children: "\u9519\u8BEF\u4FE1\u606F" }),
4839
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.markdownContainer, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: `\`\`\`
4840
- ${errorMessage}
4841
- \`\`\`` }) })
5065
+ ] })
4842
5066
  ] })
4843
5067
  ] });
4844
5068
  };
@@ -4922,6 +5146,9 @@ var formatContent = (content) => {
4922
5146
  return { text, isJson: false, parsed: null };
4923
5147
  }
4924
5148
  };
5149
+ var hasDisplayViewBody = (view) => {
5150
+ return !!(view?.summary || view?.blocks?.length || view?.meta?.length);
5151
+ };
4925
5152
  var ToolCallItem = ({ item }) => {
4926
5153
  const { token } = antd.theme.useToken();
4927
5154
  const renderConfig = getToolRenderConfig(item);
@@ -4948,16 +5175,22 @@ var ToolCallItem = ({ item }) => {
4948
5175
  alwaysShow = renderConfig.alwaysShowContent;
4949
5176
  }
4950
5177
  if (alwaysShow) return true;
4951
- if (item.display) return true;
4952
- if (item.errorMessage) return true;
5178
+ if (item.displayProtocol) {
5179
+ if (item.streamingArgsDisplay?.content) return true;
5180
+ if (hasDisplayViewBody(item.argsDisplay)) return true;
5181
+ if (hasDisplayViewBody(item.resultDisplay)) return true;
5182
+ return false;
5183
+ }
4953
5184
  if (argsContent.text) return true;
4954
5185
  if (resultContent?.text) return true;
4955
5186
  return false;
4956
5187
  }, [
4957
5188
  renderConfig.disableExpandOnError,
4958
5189
  renderConfig.alwaysShowContent,
4959
- item.display,
4960
- item.errorMessage,
5190
+ item.displayProtocol,
5191
+ item.streamingArgsDisplay,
5192
+ item.argsDisplay,
5193
+ item.resultDisplay,
4961
5194
  status,
4962
5195
  argsContent.parsed,
4963
5196
  resultContent?.parsed,
@@ -4985,15 +5218,19 @@ var ToolCallItem = ({ item }) => {
4985
5218
  return /* @__PURE__ */ jsxRuntime.jsx(
4986
5219
  antd.Collapse,
4987
5220
  {
4988
- style: { width: "70%" },
5221
+ className: index_module_default2.toolCollapse,
5222
+ style: { width: "100%" },
4989
5223
  collapsible: hasContent ? void 0 : "disabled",
4990
5224
  defaultActiveKey: isDefaultExpanded && hasContent ? [item.toolCallId || "fallback-key"] : void 0,
4991
5225
  expandIconPlacement: "end",
4992
5226
  expandIcon: ({ isActive }) => hasContent ? /* @__PURE__ */ jsxRuntime.jsx(icons.RightOutlined, { className: `${index_module_default2.expandIcon} ${isActive ? index_module_default2.expanded : ""}` }) : null,
4993
5227
  styles: {
4994
5228
  header: {
4995
- padding: "6px 10px",
5229
+ padding: "4px 8px",
4996
5230
  overflow: "hidden"
5231
+ },
5232
+ body: {
5233
+ padding: "0 8px 8px"
4997
5234
  }
4998
5235
  },
4999
5236
  items: [
@@ -5115,7 +5352,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
5115
5352
  /* @__PURE__ */ jsxRuntime.jsx(
5116
5353
  xV2.Welcome,
5117
5354
  {
5118
- className: classNames2__default.default(styles_module_default2.chatWelcome, "p-t-32"),
5355
+ className: classNames__default.default(styles_module_default2.chatWelcome, "p-t-32"),
5119
5356
  variant: "borderless",
5120
5357
  icon: /* @__PURE__ */ jsxRuntime.jsx(
5121
5358
  common.RenderWrapper,
@@ -5141,7 +5378,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
5141
5378
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
5142
5379
  xV2.Prompts,
5143
5380
  {
5144
- className: classNames2__default.default("m-t-16", styles_module_default2.promptItem),
5381
+ className: classNames__default.default("m-t-16", styles_module_default2.promptItem),
5145
5382
  wrap: true,
5146
5383
  onItemClick: (info) => chatStore.sendMessage(info.data.description),
5147
5384
  items: recommendQuestions
@@ -5350,7 +5587,7 @@ var BubbleListItems_default = ({
5350
5587
  autoScroll: false,
5351
5588
  ref: listRef,
5352
5589
  items: bubbleListItems,
5353
- className: classNames2__default.default(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
5590
+ className: classNames__default.default(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
5354
5591
  onScroll: handleScroll
5355
5592
  },
5356
5593
  conversationState.active.id
@@ -5398,7 +5635,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5398
5635
  setCategories([{ id: ALL_CATEGORY_ID, name: "\u5168\u90E8" }, ...tagsRes.data || []]);
5399
5636
  setResources(fetchedResources);
5400
5637
  const spec = conversationState.active.spec;
5401
- const initialItems = isSkill ? spec?.skills?.items : spec?.knowledge?.items;
5638
+ const initialItems = isSkill ? spec?.skills?.items : spec?.knowledges?.items;
5402
5639
  const validIds = new Set(fetchedResources.map((r) => r.id));
5403
5640
  const validSelectedIds = (initialItems || []).map((item) => item.id).filter((id) => validIds.has(id));
5404
5641
  setSelectedIds(validSelectedIds);
@@ -5445,7 +5682,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5445
5682
  items: ids.map((id) => ({ id }))
5446
5683
  };
5447
5684
  } else {
5448
- nextSpec.knowledge = {
5685
+ nextSpec.knowledges = {
5449
5686
  items: ids.map((id) => {
5450
5687
  const resource = resourceList.find((r) => r.id === id);
5451
5688
  return { id, name: resource?.name || "" };
@@ -5501,7 +5738,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5501
5738
  return /* @__PURE__ */ jsxRuntime.jsxs(
5502
5739
  antd.Flex,
5503
5740
  {
5504
- className: classNames2__default.default(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
5741
+ className: classNames__default.default(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
5505
5742
  onClick: () => handleCategoryChange(cat.id, !isChecked),
5506
5743
  children: [
5507
5744
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5536,7 +5773,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5536
5773
  "\u5DF2\u9009 ",
5537
5774
  selectedIds.length
5538
5775
  ] }) }),
5539
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
5776
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames__default.default(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
5540
5777
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
5541
5778
  selectedIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
5542
5779
  antd.Tag,
@@ -5566,7 +5803,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
5566
5803
  return /* @__PURE__ */ jsxRuntime.jsxs(
5567
5804
  "div",
5568
5805
  {
5569
- className: classNames2__default.default(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
5806
+ className: classNames__default.default(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
5570
5807
  onClick: () => toggleItemSelection(item.id),
5571
5808
  children: [
5572
5809
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: iconType }) }),
@@ -5592,7 +5829,7 @@ var KnowledgeBtn_default = ({}) => {
5592
5829
  const chatStore = useChatStore();
5593
5830
  const conversationState = valtio.useSnapshot(chatStore.conversation);
5594
5831
  const [modalOpen, setModalOpen] = React10.useState(false);
5595
- const knowledgeCount = conversationState.active.spec?.knowledge?.items?.length ?? 0;
5832
+ const knowledgeCount = conversationState.active.spec?.knowledges?.items?.length ?? 0;
5596
5833
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5597
5834
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
5598
5835
  /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-remark" }),
@@ -5696,7 +5933,7 @@ var ReasonBtn_default = ({}) => {
5696
5933
  return /* @__PURE__ */ jsxRuntime.jsxs(
5697
5934
  "div",
5698
5935
  {
5699
- className: classNames2__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
5936
+ className: classNames__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
5700
5937
  onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
5701
5938
  children: [
5702
5939
  /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
@@ -6169,9 +6406,9 @@ var ChatMainPanel = React10.memo(
6169
6406
  );
6170
6407
  const configState = valtio.useSnapshot(chatStore.config);
6171
6408
  const agentState = valtio.useSnapshot(chatStore.agent);
6172
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("height-full"), children: [
6409
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames__default.default("height-full"), children: [
6173
6410
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
6174
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", vertical: true, gap: 24, className: classNames2__default.default("height-full", styles_module_default5.bodyWidth), children: [
6411
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", vertical: true, gap: 24, className: classNames__default.default("height-full", styles_module_default5.bodyWidth), children: [
6175
6412
  common.shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.userInput, DefaultComponent: UserInputPanel_default }),
6176
6413
  common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
6177
6414
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(ChatSenderHeader_default, {}) }),
@@ -6206,7 +6443,7 @@ var ChatPreviewPanel = React10.memo(({ file }) => {
6206
6443
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6207
6444
  file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
6208
6445
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default5.previewHeader, children: [
6209
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
6446
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames__default.default(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
6210
6447
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
6211
6448
  /* @__PURE__ */ jsxRuntime.jsx(
6212
6449
  antd.Button,
@@ -6342,12 +6579,12 @@ var layouts_default = React10.forwardRef(({ theme: theme5, params, hooks, layout
6342
6579
  React10.useEffect(() => {
6343
6580
  hooks?.onBeforeInit?.();
6344
6581
  }, []);
6345
- return /* @__PURE__ */ jsxRuntime.jsx(xV2.XProvider, { theme: { cssVar: {}, ...theme5 }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default(index_module_default3.chatLayout, "zero-chat-layout", "height-full"), children: [
6582
+ return /* @__PURE__ */ jsxRuntime.jsx(xV2.XProvider, { theme: { cssVar: {}, ...theme5 }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames__default.default(index_module_default3.chatLayout, "zero-chat-layout", "height-full"), children: [
6346
6583
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
6347
6584
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { ref: containerRef, className: "full-scroll", children: [
6348
6585
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
6349
6586
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
6350
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className: classNames2__default.default("flex-1", index_module_default3.animatedSplitter, { [index_module_default3.hideSplitterBar]: !hasPreView }), children: [
6587
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className: classNames__default.default("flex-1", index_module_default3.animatedSplitter, { [index_module_default3.hideSplitterBar]: !hasPreView }), children: [
6351
6588
  /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsx(ChatMainPanel_default, { ref: senderRef }) }),
6352
6589
  /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: /* @__PURE__ */ jsxRuntime.jsx(ChatPreviewPanel_default, { file: configState.preview.file }) })
6353
6590
  ] })