@zero-library/chat-agent 2.3.3 → 2.3.5

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
@@ -6,14 +6,14 @@ var jsxRuntime = require('react/jsx-runtime');
6
6
  var react = require('react');
7
7
  var valtio = require('valtio');
8
8
  var icons = require('@ant-design/icons');
9
- var classNames11 = require('classnames');
9
+ var classNames12 = require('classnames');
10
10
  var x = require('@ant-design/x');
11
11
  var dayjs = require('dayjs');
12
12
  var InfiniteScroll = require('react-infinite-scroll-component');
13
13
 
14
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
15
 
16
- var classNames11__default = /*#__PURE__*/_interopDefault(classNames11);
16
+ var classNames12__default = /*#__PURE__*/_interopDefault(classNames12);
17
17
  var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
18
18
  var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
19
19
 
@@ -311,7 +311,7 @@ var init_Charts = __esm({
311
311
  );
312
312
  Charts_default = ({ data, loading }) => {
313
313
  const { type, config } = data;
314
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default.chart, "scroll-fade-in"), children: loading ? (
314
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames12__default.default(styles_module_default.chart, "scroll-fade-in"), children: loading ? (
315
315
  // Antd 骨架屏
316
316
  /* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton.Node, { active: true, className: styles_module_default.chartSkeleton, children: /* @__PURE__ */ jsxRuntime.jsx(icons.DotChartOutlined, { className: styles_module_default.chartSkeletonIcon }) })
317
317
  ) : /* @__PURE__ */ jsxRuntime.jsx(
@@ -373,6 +373,12 @@ var createChatService = (request) => {
373
373
  const conversationDelete = (conversationId) => {
374
374
  return request.delete("/lolr/conversation", { conversationId });
375
375
  };
376
+ const conversationFavoritesQuery = (params) => {
377
+ return request.get("/lolr/conversation/favorite", params);
378
+ };
379
+ const conversationFavorite = (conversationId, isFavorite) => {
380
+ return request.put("/lolr/conversation/favorite/status", { conversationId, status: Number(isFavorite) });
381
+ };
376
382
  const conversationRecentUpdate = (params) => {
377
383
  return request.put("/lolr/conversation/recent", params);
378
384
  };
@@ -440,6 +446,8 @@ var createChatService = (request) => {
440
446
  conversationsQuery,
441
447
  conversationCreate,
442
448
  conversationDelete,
449
+ conversationFavoritesQuery,
450
+ conversationFavorite,
443
451
  conversationRecentUpdate,
444
452
  conversationRecentQuery,
445
453
  conversationMessagesQuery,
@@ -745,7 +753,8 @@ function createChatStore() {
745
753
  group: (c) => {
746
754
  return classifyTime(c.updateTime);
747
755
  },
748
- timestamp: "updateTime"
756
+ timestamp: "updateTime",
757
+ isFavorite: "isFavorite"
749
758
  });
750
759
  conversations.list.items = items;
751
760
  } finally {
@@ -769,6 +778,48 @@ function createChatStore() {
769
778
  conversations.delLoading = false;
770
779
  }
771
780
  };
781
+ const favorite = valtio.proxy({
782
+ /** 收藏列表数据 */
783
+ list: {
784
+ items: [],
785
+ /** 分页查询参数 */
786
+ params: {
787
+ pageNo: 1,
788
+ pageSize: 1e3
789
+ }
790
+ },
791
+ /** 收藏列表的加载状态 */
792
+ loading: false
793
+ });
794
+ const getConversationFavorite = async () => {
795
+ try {
796
+ favorite.loading = true;
797
+ const { data } = await config.services.request.conversationFavoritesQuery({
798
+ targetId: receiver.active.id,
799
+ targetType: receiver.active.type,
800
+ ...favorite.list.params
801
+ });
802
+ favorite.list.items = data?.items || [];
803
+ } finally {
804
+ favorite.loading = false;
805
+ }
806
+ };
807
+ const collectConversation = async (conversationId, isFavorite) => {
808
+ try {
809
+ await config.services.request.conversationFavorite(conversationId, isFavorite);
810
+ if (conversations.list.items.length) {
811
+ const item = conversations.list.items.find((item2) => item2.id === conversationId);
812
+ if (item) {
813
+ item.isFavorite = isFavorite;
814
+ }
815
+ }
816
+ if (!isFavorite && favorite.list.items.length) {
817
+ favorite.list.items = favorite.list.items.filter((item) => item.id !== conversationId);
818
+ }
819
+ antd.message.success(isFavorite ? "\u6536\u85CF\u6210\u529F" : "\u5DF2\u53D6\u6D88\u6536\u85CF");
820
+ } finally {
821
+ }
822
+ };
772
823
  const conversation = valtio.proxy({
773
824
  /** 当前激活的会话信息 */
774
825
  active: {
@@ -1163,6 +1214,12 @@ function createChatStore() {
1163
1214
  getConversations,
1164
1215
  /** 删除会话 */
1165
1216
  delConversation,
1217
+ /** 收藏相关状态 */
1218
+ favorite,
1219
+ /** 取消/收藏 */
1220
+ collectConversation,
1221
+ /** 获取收藏的会话列表 */
1222
+ getConversationFavorite,
1166
1223
  /** 当前会话状态 */
1167
1224
  conversation,
1168
1225
  /** 设置说话人类型 */
@@ -1259,7 +1316,7 @@ var MessageRender_default = ({ message: message2, placement, onFilePreview, cust
1259
1316
  x.Bubble,
1260
1317
  {
1261
1318
  placement,
1262
- className: classNames11__default.default({ [styles_module_default2.loadingMessage]: message2.type }),
1319
+ className: classNames12__default.default({ [styles_module_default2.loadingMessage]: message2.type }),
1263
1320
  content: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content: replaceMarkdownTags(msgContent), customComponents: mergedCustomComponents, message: message2 })
1264
1321
  }
1265
1322
  ),
@@ -1330,10 +1387,15 @@ init_Context();
1330
1387
  var styles_module_default3 = {
1331
1388
  nsConversationListPanel: "styles_module_nsConversationListPanel",
1332
1389
  nsConversations: "styles_module_nsConversations",
1390
+ favoriteCard: "styles_module_favoriteCard",
1391
+ favoriteCardActive: "styles_module_favoriteCardActive",
1392
+ favoriteCardTitle: "styles_module_favoriteCardTitle",
1393
+ favoriteCardActions: "styles_module_favoriteCardActions",
1394
+ favoriteCardDate: "styles_module_favoriteCardDate",
1333
1395
  nsBubbleList: "styles_module_nsBubbleList",
1334
1396
  nsChatHeader: "styles_module_nsChatHeader",
1335
1397
  nsChatTitle: "styles_module_nsChatTitle",
1336
- nsChatHeaderPopover: "styles_module_nsChatHeaderPopover",
1398
+ nsPopover: "styles_module_nsPopover",
1337
1399
  chatWelcomeWrap: "styles_module_chatWelcomeWrap",
1338
1400
  chatWelcome: "styles_module_chatWelcome",
1339
1401
  chatWelcomePrompts: "styles_module_chatWelcomePrompts",
@@ -1361,7 +1423,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1361
1423
  /* @__PURE__ */ jsxRuntime.jsx(
1362
1424
  x.Welcome,
1363
1425
  {
1364
- className: classNames11__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1426
+ className: classNames12__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1365
1427
  variant: "borderless",
1366
1428
  icon: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: icon, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { shape: "square", size: 58, src: receiverState.active.logo }) }),
1367
1429
  title: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}` }),
@@ -1390,7 +1452,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1390
1452
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1391
1453
  children: receiverState?.recommendQuestions.map((question) => ({
1392
1454
  key: question,
1393
- description: /* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames11__default.default(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1455
+ description: /* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames12__default.default(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1394
1456
  }))
1395
1457
  }
1396
1458
  ]
@@ -1628,7 +1690,7 @@ var BubbleListItems_default = ({
1628
1690
  autoScroll: false,
1629
1691
  ref: listRef,
1630
1692
  items: bubbleListItems,
1631
- className: classNames11__default.default(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1693
+ className: classNames12__default.default(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1632
1694
  onScroll: handleScroll
1633
1695
  },
1634
1696
  conversationState.active.id
@@ -1663,7 +1725,7 @@ var CharacterList_default = () => {
1663
1725
  /* @__PURE__ */ jsxRuntime.jsx(
1664
1726
  antd.Avatar,
1665
1727
  {
1666
- className: classNames11__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1728
+ className: classNames12__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1667
1729
  [styles_module_default3.nsAvatarListItemIconActive]: activeCharacter.id === item.id
1668
1730
  }),
1669
1731
  size: 50,
@@ -1690,6 +1752,73 @@ var AgentCharacter_default = () => {
1690
1752
  ] });
1691
1753
  };
1692
1754
 
1755
+ // src/ui/common/ConversationFavoritesList.tsx
1756
+ init_Context();
1757
+ var ConversationFavoritesList_default = () => {
1758
+ const chatStore = useChatStore();
1759
+ const conversationState = valtio.useSnapshot(chatStore.conversation);
1760
+ const favoriteState = valtio.useSnapshot(chatStore.favorite);
1761
+ const getFavoriteList = common.useDebounce(() => {
1762
+ chatStore.getConversationFavorite();
1763
+ }, 300);
1764
+ const renderFavoriteList = react.useMemo(() => {
1765
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames12__default.default("height-full", "scroll-fade-in"), children: favoriteState.list.items.length ? favoriteState.list.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
1766
+ "div",
1767
+ {
1768
+ className: classNames12__default.default(styles_module_default3.favoriteCard, { [styles_module_default3.favoriteCardActive]: conversationState.active.id === item.id }),
1769
+ onClick: () => chatStore.switchConversation(item.id),
1770
+ children: [
1771
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, align: "center", children: [
1772
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: classNames12__default.default(styles_module_default3.favoriteCardTitle, "text-ellipsis"), children: item.title }),
1773
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", className: styles_module_default3.favoriteCardActions, children: /* @__PURE__ */ jsxRuntime.jsx(
1774
+ antd.Popconfirm,
1775
+ {
1776
+ title: "\u63D0\u793A",
1777
+ okText: "\u786E\u5B9A",
1778
+ cancelText: "\u53D6\u6D88",
1779
+ description: "\u786E\u8BA4\u53D6\u6D88\u6536\u85CF\u8BE5\u4F1A\u8BDD\u5417\uFF1F",
1780
+ onConfirm: (e) => {
1781
+ e.stopPropagation();
1782
+ chatStore.collectConversation(item.id, false);
1783
+ },
1784
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1785
+ antd.Button,
1786
+ {
1787
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}),
1788
+ title: "\u5220\u9664",
1789
+ type: "text",
1790
+ onClick: (e) => {
1791
+ e.stopPropagation();
1792
+ }
1793
+ }
1794
+ )
1795
+ }
1796
+ ) })
1797
+ ] }),
1798
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.favoriteCardDate, children: item.favoriteTime })
1799
+ ]
1800
+ },
1801
+ item.id
1802
+ )) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u6536\u85CF", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) });
1803
+ }, [favoriteState.list.items, conversationState.active.id]);
1804
+ const handlePopoverVisibleChange = (visible) => {
1805
+ if (!visible) return;
1806
+ getFavoriteList();
1807
+ };
1808
+ return /* @__PURE__ */ jsxRuntime.jsx(
1809
+ antd.Popover,
1810
+ {
1811
+ classNames: { body: styles_module_default3.nsPopover },
1812
+ getPopupContainer: (e) => e,
1813
+ placement: "bottom",
1814
+ content: renderFavoriteList,
1815
+ trigger: ["click"],
1816
+ onOpenChange: handlePopoverVisibleChange,
1817
+ children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u6536\u85CF\u5939", type: "text", size: "large", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.StarOutlined, {}) })
1818
+ }
1819
+ );
1820
+ };
1821
+
1693
1822
  // src/ui/common/ConversationList.tsx
1694
1823
  init_Context();
1695
1824
  var ConversationList_default = () => {
@@ -1698,7 +1827,7 @@ var ConversationList_default = () => {
1698
1827
  const conversationsState = valtio.useSnapshot(chatStore.conversations);
1699
1828
  const conversationState = valtio.useSnapshot(chatStore.conversation);
1700
1829
  const getConversations = common.useDebounce(() => {
1701
- chatStore.getConversations(receiverState.active.id, 3);
1830
+ chatStore.getConversations(receiverState.active.id, receiverState.active.type);
1702
1831
  }, 300);
1703
1832
  react.useEffect(() => {
1704
1833
  if (receiverState.active.id) {
@@ -1729,6 +1858,11 @@ var ConversationList_default = () => {
1729
1858
  groupable: true,
1730
1859
  menu: (conversation) => ({
1731
1860
  items: [
1861
+ {
1862
+ label: `${conversation.isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF"}`,
1863
+ key: "collect",
1864
+ icon: conversation?.isFavorite ? /* @__PURE__ */ jsxRuntime.jsx(icons.StarFilled, { className: "primary-text" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.StarOutlined, {})
1865
+ },
1732
1866
  {
1733
1867
  label: "\u5220\u9664\u4F1A\u8BDD",
1734
1868
  key: "delete",
@@ -1740,6 +1874,8 @@ var ConversationList_default = () => {
1740
1874
  menuInfo.domEvent.stopPropagation();
1741
1875
  if (menuInfo.key === "delete") {
1742
1876
  chatStore.delConversation(conversation.id);
1877
+ } else if (menuInfo.key === "collect") {
1878
+ chatStore.collectConversation(conversation.id, !conversation.isFavorite);
1743
1879
  }
1744
1880
  }
1745
1881
  })
@@ -1754,12 +1890,13 @@ var ChatHeader_default = ({
1754
1890
  closeBtn = false,
1755
1891
  newConversationBtn = true,
1756
1892
  agentCharacter = true,
1757
- conversationListBtn = true
1893
+ conversationListBtn = true,
1894
+ conversationListFavoriteBtn = true
1758
1895
  }) => {
1759
1896
  const chatStore = useChatStore();
1760
1897
  const receiverState = valtio.useSnapshot(chatStore.receiver);
1761
1898
  const configState = valtio.useSnapshot(chatStore.config);
1762
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", className: classNames11__default.default(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1899
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", className: classNames12__default.default(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1763
1900
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, align: "center", children: [
1764
1901
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }) }),
1765
1902
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name }) }),
@@ -1783,7 +1920,7 @@ var ChatHeader_default = ({
1783
1920
  {
1784
1921
  getPopupContainer: (e) => e,
1785
1922
  placement: "bottom",
1786
- classNames: { body: styles_module_default3.nsChatHeaderPopover },
1923
+ classNames: { body: styles_module_default3.nsPopover },
1787
1924
  content: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}),
1788
1925
  trigger: ["click"],
1789
1926
  children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u5386\u53F2\u4F1A\u8BDD", type: "text", size: "large", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CommentOutlined, {}) })
@@ -1791,6 +1928,7 @@ var ChatHeader_default = ({
1791
1928
  )
1792
1929
  }
1793
1930
  ),
1931
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationListFavoriteBtn, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(ConversationFavoritesList_default, {}) }),
1794
1932
  /* @__PURE__ */ jsxRuntime.jsx(
1795
1933
  common.RenderWrapper,
1796
1934
  {
@@ -2139,6 +2277,8 @@ var styles_module_default4 = {
2139
2277
  tagContainer: "styles_module_tagContainer",
2140
2278
  quickAskItem: "styles_module_quickAskItem",
2141
2279
  quickAskItemHeader: "styles_module_quickAskItemHeader",
2280
+ quickAskItemTitle: "styles_module_quickAskItemTitle",
2281
+ quickAskItemHeaderActions: "styles_module_quickAskItemHeaderActions",
2142
2282
  quickAskItemBody: "styles_module_quickAskItemBody"
2143
2283
  };
2144
2284
  var QuickAskPanel_default = () => {
@@ -2162,8 +2302,10 @@ var QuickAskPanel_default = () => {
2162
2302
  } catch (err) {
2163
2303
  }
2164
2304
  };
2305
+ const [loading, setLoading] = react.useState(false);
2165
2306
  const fetchItems = common.useDebounce(async () => {
2166
2307
  try {
2308
+ setLoading(true);
2167
2309
  const res = await configState.services.request?.labelItemsQuery?.(receiverState.active?.id, {
2168
2310
  labelId: getActiveTab().id,
2169
2311
  keyword: getSearchText()
@@ -2171,7 +2313,8 @@ var QuickAskPanel_default = () => {
2171
2313
  if (res?.data) {
2172
2314
  setItems(res.data);
2173
2315
  }
2174
- } catch (err) {
2316
+ } finally {
2317
+ setLoading(false);
2175
2318
  }
2176
2319
  });
2177
2320
  react.useEffect(() => {
@@ -2180,10 +2323,10 @@ var QuickAskPanel_default = () => {
2180
2323
  fetchItems();
2181
2324
  }
2182
2325
  }, [receiverState.active?.id]);
2183
- const [loading, setLoading] = react.useState(false);
2326
+ const [updateLoading, setUpdateLoading] = react.useState(false);
2184
2327
  const handleEditConfirm = async (values) => {
2185
2328
  try {
2186
- setLoading(true);
2329
+ setUpdateLoading(true);
2187
2330
  await configState.services.request?.labelItemUpdate?.(receiverState.active?.id, values);
2188
2331
  setEditModalOpen(false);
2189
2332
  message2.success("\u4FDD\u5B58\u6210\u529F");
@@ -2192,7 +2335,7 @@ var QuickAskPanel_default = () => {
2192
2335
  }
2193
2336
  fetchCategories();
2194
2337
  } finally {
2195
- setLoading(false);
2338
+ setUpdateLoading(false);
2196
2339
  }
2197
2340
  };
2198
2341
  const handleDelete = async (id) => {
@@ -2248,7 +2391,7 @@ var QuickAskPanel_default = () => {
2248
2391
  }
2249
2392
  ) : /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, {}), onClick: () => setSearchExpanded(true) })
2250
2393
  ] }),
2251
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", className: classNames11__default.default("scroll-fade-in", "m-b-16", styles_module_default4.tagContainer), children: [
2394
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", className: classNames12__default.default("scroll-fade-in", "m-b-16", styles_module_default4.tagContainer), children: [
2252
2395
  /* @__PURE__ */ jsxRuntime.jsx(
2253
2396
  antd.Tag,
2254
2397
  {
@@ -2277,7 +2420,7 @@ var QuickAskPanel_default = () => {
2277
2420
  c.id
2278
2421
  ))
2279
2422
  ] }),
2280
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, className: "height-full scroll-fade-in", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
2423
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, wrapperClassName: "full-spin", tip: "\u52A0\u8F7D\u4E2D...", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, className: "height-full scroll-fade-in", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
2281
2424
  "div",
2282
2425
  {
2283
2426
  className: styles_module_default4.quickAskItem,
@@ -2288,9 +2431,9 @@ var QuickAskPanel_default = () => {
2288
2431
  });
2289
2432
  },
2290
2433
  children: [
2291
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "space-between", className: styles_module_default4.quickAskItemHeader, children: [
2292
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 text-ellipsis", children: item.title }),
2293
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 4, children: [
2434
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "space-between", align: "center", className: styles_module_default4.quickAskItemHeader, children: [
2435
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames12__default.default("flex-1 text-ellipsis", styles_module_default4.quickAskItemTitle), children: item.title }),
2436
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 4, className: styles_module_default4.quickAskItemHeaderActions, children: [
2294
2437
  /* @__PURE__ */ jsxRuntime.jsx(
2295
2438
  antd.Button,
2296
2439
  {
@@ -2314,11 +2457,12 @@ var QuickAskPanel_default = () => {
2314
2457
  title: "\u590D\u5236",
2315
2458
  onClick: (e) => {
2316
2459
  e.stopPropagation();
2317
- handleEditConfirm({
2460
+ setEditingItem({
2318
2461
  title: item.title,
2319
2462
  labelName: item.labelName,
2320
2463
  content: item.content
2321
2464
  });
2465
+ setEditModalOpen(true);
2322
2466
  }
2323
2467
  },
2324
2468
  "copy"
@@ -2355,18 +2499,18 @@ var QuickAskPanel_default = () => {
2355
2499
  )
2356
2500
  ] })
2357
2501
  ] }),
2358
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default4.quickAskItemBody), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis-3", children: item.content }) })
2502
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames12__default.default(styles_module_default4.quickAskItemBody), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis-3", children: item.content }) })
2359
2503
  ]
2360
2504
  },
2361
2505
  item.id
2362
- )) }) }),
2506
+ )) }) }) }),
2363
2507
  editModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
2364
2508
  QuickAskEditModal_default,
2365
2509
  {
2366
2510
  open: editModalOpen,
2367
2511
  onCancel: () => setEditModalOpen(false),
2368
2512
  onConfirm: handleEditConfirm,
2369
- loading,
2513
+ loading: updateLoading,
2370
2514
  initialValues: editingItem,
2371
2515
  categories
2372
2516
  }
@@ -2452,7 +2596,7 @@ var SenderPromptsItems_default = () => {
2452
2596
  title: /* @__PURE__ */ jsxRuntime.jsx(
2453
2597
  "div",
2454
2598
  {
2455
- className: classNames11__default.default(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
2599
+ className: classNames12__default.default(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
2456
2600
  children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
2457
2601
  }
2458
2602
  ),
@@ -2546,30 +2690,43 @@ var ChatSender_default2 = react.forwardRef(
2546
2690
 
2547
2691
  // src/ui/common/ConversationListHeader.tsx
2548
2692
  init_Context();
2549
- var ConversationListHeader_default = () => {
2693
+ var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true, conversationListFavoriteBtn = true }) => {
2550
2694
  const chatStore = useChatStore();
2551
2695
  const receiverState = valtio.useSnapshot(chatStore.receiver);
2552
2696
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-24", children: [
2553
2697
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", gap: 8, children: [
2554
- /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 36, src: receiverState.active.logo }),
2555
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_module_default3.nsChatUserName, children: receiverState.active.name })
2698
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 36, src: receiverState.active.logo }) }),
2699
+ /* @__PURE__ */ jsxRuntime.jsx(
2700
+ common.RenderWrapper,
2701
+ {
2702
+ control: title,
2703
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames12__default.default(styles_module_default3.nsChatUserName, "flex-1 text-ellipsis"), children: receiverState.active.name })
2704
+ }
2705
+ ),
2706
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationListFavoriteBtn, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(ConversationFavoritesList_default, {}) })
2556
2707
  ] }),
2557
2708
  /* @__PURE__ */ jsxRuntime.jsx(
2558
- antd.Button,
2709
+ common.RenderWrapper,
2559
2710
  {
2560
- block: true,
2561
- type: "primary",
2562
- shape: "round",
2563
- onClick: () => chatStore.createConversation(),
2564
- className: classNames11__default.default("m-t-16"),
2565
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2566
- children: "\u65B0\u5EFA\u4F1A\u8BDD"
2711
+ control: newConversationBtn,
2712
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
2713
+ antd.Button,
2714
+ {
2715
+ block: true,
2716
+ type: "primary",
2717
+ shape: "round",
2718
+ onClick: () => chatStore.createConversation(),
2719
+ className: classNames12__default.default("m-t-16"),
2720
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2721
+ children: "\u65B0\u5EFA\u4F1A\u8BDD"
2722
+ }
2723
+ )
2567
2724
  }
2568
2725
  )
2569
2726
  ] });
2570
2727
  };
2571
2728
  var ConversationListPanel_default = ({ header }) => {
2572
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames11__default.default("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2729
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames12__default.default("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2573
2730
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
2574
2731
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
2575
2732
  ] });
@@ -2583,7 +2740,8 @@ var styles_module_default5 = {
2583
2740
  nsDisclaimerNotice: "styles_module_nsDisclaimerNotice",
2584
2741
  nsChatLayout: "styles_module_nsChatLayout",
2585
2742
  nsChatBody: "styles_module_nsChatBody",
2586
- nsBodyWidth: "styles_module_nsBodyWidth"
2743
+ nsBodyWidth: "styles_module_nsBodyWidth",
2744
+ nsPrompts: "styles_module_nsPrompts"
2587
2745
  };
2588
2746
  var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout, config, services }, ref) => {
2589
2747
  const chatStore = react.useMemo(() => createChatStore(), []);
@@ -2662,7 +2820,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2662
2820
  react.useEffect(() => {
2663
2821
  configState.hooks?.onBeforeInit?.();
2664
2822
  }, []);
2665
- return /* @__PURE__ */ jsxRuntime.jsx(x.XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames11__default.default(styles_module_default5.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2823
+ return /* @__PURE__ */ jsxRuntime.jsx(x.XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames12__default.default(styles_module_default5.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2666
2824
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
2667
2825
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "full-scroll", children: [
2668
2826
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
@@ -2671,7 +2829,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2671
2829
  /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: hasPreView && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2672
2830
  configState.preview.file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
2673
2831
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default5.nsPreviewHeader, children: [
2674
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default5.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),
2832
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames12__default.default(styles_module_default5.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),
2675
2833
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
2676
2834
  /* @__PURE__ */ jsxRuntime.jsx(
2677
2835
  antd.Button,
@@ -2715,15 +2873,15 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2715
2873
  }
2716
2874
  )
2717
2875
  ] }) }),
2718
- /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames11__default.default("height-full"), children: [
2876
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames12__default.default("height-full"), children: [
2719
2877
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
2720
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames11__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(
2878
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames12__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(
2721
2879
  antd.Flex,
2722
2880
  {
2723
2881
  justify: "center",
2724
2882
  vertical: true,
2725
2883
  gap: 24,
2726
- className: classNames11__default.default("height-full", styles_module_default5.nsChatBody, "zero-chat-body", styles_module_default5.nsBodyWidth),
2884
+ className: classNames12__default.default("height-full", styles_module_default5.nsChatBody, "zero-chat-body", styles_module_default5.nsBodyWidth),
2727
2885
  children: [
2728
2886
  common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
2729
2887
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
@@ -2752,13 +2910,14 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2752
2910
  DefaultComponent: receiverState?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
2753
2911
  x.Prompts,
2754
2912
  {
2913
+ className: styles_module_default5.nsPrompts,
2755
2914
  vertical: true,
2756
2915
  title: "\u63A8\u8350\u95EE\u9898:",
2757
2916
  onItemClick: ({ data }) => chatStore.sendMessage(data.key),
2758
2917
  items: receiverState?.recommendQuestions.map((question) => ({
2759
2918
  key: question,
2760
2919
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.FileSearchOutlined, {}),
2761
- description: question
2920
+ description: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis", children: question })
2762
2921
  }))
2763
2922
  }
2764
2923
  )