@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.esm.js CHANGED
@@ -3,8 +3,8 @@ import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover, Lis
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
5
5
  import { useSnapshot, proxy } from 'valtio';
6
- import { CloudUploadOutlined, PaperClipOutlined, EnterOutlined, CloseOutlined, FileSearchOutlined, UserSwitchOutlined, PlusOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, SearchOutlined, PushpinOutlined, EditOutlined, DeleteOutlined, RedoOutlined, SignatureOutlined, PlayCircleOutlined, DotChartOutlined } from '@ant-design/icons';
7
- import classNames11 from 'classnames';
6
+ import { CloudUploadOutlined, PaperClipOutlined, EnterOutlined, CloseOutlined, FileSearchOutlined, UserSwitchOutlined, PlusOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, SearchOutlined, PushpinOutlined, EditOutlined, DeleteOutlined, StarFilled, StarOutlined, RedoOutlined, SignatureOutlined, PlayCircleOutlined, DotChartOutlined } from '@ant-design/icons';
7
+ import classNames12 from 'classnames';
8
8
  import { Attachments, Sender, Suggestion, XProvider, Prompts, Bubble, Conversations, Welcome } from '@ant-design/x';
9
9
  import dayjs from 'dayjs';
10
10
  import InfiniteScroll from 'react-infinite-scroll-component';
@@ -303,7 +303,7 @@ var init_Charts = __esm({
303
303
  );
304
304
  Charts_default = ({ data, loading }) => {
305
305
  const { type, config } = data;
306
- return /* @__PURE__ */ jsx("div", { className: classNames11(styles_module_default.chart, "scroll-fade-in"), children: loading ? (
306
+ return /* @__PURE__ */ jsx("div", { className: classNames12(styles_module_default.chart, "scroll-fade-in"), children: loading ? (
307
307
  // Antd 骨架屏
308
308
  /* @__PURE__ */ jsx(Skeleton.Node, { active: true, className: styles_module_default.chartSkeleton, children: /* @__PURE__ */ jsx(DotChartOutlined, { className: styles_module_default.chartSkeletonIcon }) })
309
309
  ) : /* @__PURE__ */ jsx(
@@ -365,6 +365,12 @@ var createChatService = (request) => {
365
365
  const conversationDelete = (conversationId) => {
366
366
  return request.delete("/lolr/conversation", { conversationId });
367
367
  };
368
+ const conversationFavoritesQuery = (params) => {
369
+ return request.get("/lolr/conversation/favorite", params);
370
+ };
371
+ const conversationFavorite = (conversationId, isFavorite) => {
372
+ return request.put("/lolr/conversation/favorite/status", { conversationId, status: Number(isFavorite) });
373
+ };
368
374
  const conversationRecentUpdate = (params) => {
369
375
  return request.put("/lolr/conversation/recent", params);
370
376
  };
@@ -432,6 +438,8 @@ var createChatService = (request) => {
432
438
  conversationsQuery,
433
439
  conversationCreate,
434
440
  conversationDelete,
441
+ conversationFavoritesQuery,
442
+ conversationFavorite,
435
443
  conversationRecentUpdate,
436
444
  conversationRecentQuery,
437
445
  conversationMessagesQuery,
@@ -737,7 +745,8 @@ function createChatStore() {
737
745
  group: (c) => {
738
746
  return classifyTime(c.updateTime);
739
747
  },
740
- timestamp: "updateTime"
748
+ timestamp: "updateTime",
749
+ isFavorite: "isFavorite"
741
750
  });
742
751
  conversations.list.items = items;
743
752
  } finally {
@@ -761,6 +770,48 @@ function createChatStore() {
761
770
  conversations.delLoading = false;
762
771
  }
763
772
  };
773
+ const favorite = proxy({
774
+ /** 收藏列表数据 */
775
+ list: {
776
+ items: [],
777
+ /** 分页查询参数 */
778
+ params: {
779
+ pageNo: 1,
780
+ pageSize: 1e3
781
+ }
782
+ },
783
+ /** 收藏列表的加载状态 */
784
+ loading: false
785
+ });
786
+ const getConversationFavorite = async () => {
787
+ try {
788
+ favorite.loading = true;
789
+ const { data } = await config.services.request.conversationFavoritesQuery({
790
+ targetId: receiver.active.id,
791
+ targetType: receiver.active.type,
792
+ ...favorite.list.params
793
+ });
794
+ favorite.list.items = data?.items || [];
795
+ } finally {
796
+ favorite.loading = false;
797
+ }
798
+ };
799
+ const collectConversation = async (conversationId, isFavorite) => {
800
+ try {
801
+ await config.services.request.conversationFavorite(conversationId, isFavorite);
802
+ if (conversations.list.items.length) {
803
+ const item = conversations.list.items.find((item2) => item2.id === conversationId);
804
+ if (item) {
805
+ item.isFavorite = isFavorite;
806
+ }
807
+ }
808
+ if (!isFavorite && favorite.list.items.length) {
809
+ favorite.list.items = favorite.list.items.filter((item) => item.id !== conversationId);
810
+ }
811
+ message.success(isFavorite ? "\u6536\u85CF\u6210\u529F" : "\u5DF2\u53D6\u6D88\u6536\u85CF");
812
+ } finally {
813
+ }
814
+ };
764
815
  const conversation = proxy({
765
816
  /** 当前激活的会话信息 */
766
817
  active: {
@@ -1155,6 +1206,12 @@ function createChatStore() {
1155
1206
  getConversations,
1156
1207
  /** 删除会话 */
1157
1208
  delConversation,
1209
+ /** 收藏相关状态 */
1210
+ favorite,
1211
+ /** 取消/收藏 */
1212
+ collectConversation,
1213
+ /** 获取收藏的会话列表 */
1214
+ getConversationFavorite,
1158
1215
  /** 当前会话状态 */
1159
1216
  conversation,
1160
1217
  /** 设置说话人类型 */
@@ -1251,7 +1308,7 @@ var MessageRender_default = ({ message: message2, placement, onFilePreview, cust
1251
1308
  Bubble,
1252
1309
  {
1253
1310
  placement,
1254
- className: classNames11({ [styles_module_default2.loadingMessage]: message2.type }),
1311
+ className: classNames12({ [styles_module_default2.loadingMessage]: message2.type }),
1255
1312
  content: /* @__PURE__ */ jsx(RenderMarkdown, { content: replaceMarkdownTags(msgContent), customComponents: mergedCustomComponents, message: message2 })
1256
1313
  }
1257
1314
  ),
@@ -1322,10 +1379,15 @@ init_Context();
1322
1379
  var styles_module_default3 = {
1323
1380
  nsConversationListPanel: "styles_module_nsConversationListPanel",
1324
1381
  nsConversations: "styles_module_nsConversations",
1382
+ favoriteCard: "styles_module_favoriteCard",
1383
+ favoriteCardActive: "styles_module_favoriteCardActive",
1384
+ favoriteCardTitle: "styles_module_favoriteCardTitle",
1385
+ favoriteCardActions: "styles_module_favoriteCardActions",
1386
+ favoriteCardDate: "styles_module_favoriteCardDate",
1325
1387
  nsBubbleList: "styles_module_nsBubbleList",
1326
1388
  nsChatHeader: "styles_module_nsChatHeader",
1327
1389
  nsChatTitle: "styles_module_nsChatTitle",
1328
- nsChatHeaderPopover: "styles_module_nsChatHeaderPopover",
1390
+ nsPopover: "styles_module_nsPopover",
1329
1391
  chatWelcomeWrap: "styles_module_chatWelcomeWrap",
1330
1392
  chatWelcome: "styles_module_chatWelcome",
1331
1393
  chatWelcomePrompts: "styles_module_chatWelcomePrompts",
@@ -1353,7 +1415,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1353
1415
  /* @__PURE__ */ jsx(
1354
1416
  Welcome,
1355
1417
  {
1356
- className: classNames11(styles_module_default3.chatWelcome, "p-t-32"),
1418
+ className: classNames12(styles_module_default3.chatWelcome, "p-t-32"),
1357
1419
  variant: "borderless",
1358
1420
  icon: /* @__PURE__ */ jsx(RenderWrapper, { control: icon, DefaultComponent: /* @__PURE__ */ jsx(Avatar, { shape: "square", size: 58, src: receiverState.active.logo }) }),
1359
1421
  title: /* @__PURE__ */ jsx(RenderWrapper, { control: title, DefaultComponent: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}` }),
@@ -1382,7 +1444,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1382
1444
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1383
1445
  children: receiverState?.recommendQuestions.map((question) => ({
1384
1446
  key: question,
1385
- description: /* @__PURE__ */ jsx("span", { className: classNames11(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1447
+ description: /* @__PURE__ */ jsx("span", { className: classNames12(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1386
1448
  }))
1387
1449
  }
1388
1450
  ]
@@ -1620,7 +1682,7 @@ var BubbleListItems_default = ({
1620
1682
  autoScroll: false,
1621
1683
  ref: listRef,
1622
1684
  items: bubbleListItems,
1623
- className: classNames11(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1685
+ className: classNames12(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1624
1686
  onScroll: handleScroll
1625
1687
  },
1626
1688
  conversationState.active.id
@@ -1655,7 +1717,7 @@ var CharacterList_default = () => {
1655
1717
  /* @__PURE__ */ jsx(
1656
1718
  Avatar,
1657
1719
  {
1658
- className: classNames11(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1720
+ className: classNames12(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1659
1721
  [styles_module_default3.nsAvatarListItemIconActive]: activeCharacter.id === item.id
1660
1722
  }),
1661
1723
  size: 50,
@@ -1682,6 +1744,73 @@ var AgentCharacter_default = () => {
1682
1744
  ] });
1683
1745
  };
1684
1746
 
1747
+ // src/ui/common/ConversationFavoritesList.tsx
1748
+ init_Context();
1749
+ var ConversationFavoritesList_default = () => {
1750
+ const chatStore = useChatStore();
1751
+ const conversationState = useSnapshot(chatStore.conversation);
1752
+ const favoriteState = useSnapshot(chatStore.favorite);
1753
+ const getFavoriteList = useDebounce(() => {
1754
+ chatStore.getConversationFavorite();
1755
+ }, 300);
1756
+ const renderFavoriteList = useMemo(() => {
1757
+ return /* @__PURE__ */ jsx("div", { className: classNames12("height-full", "scroll-fade-in"), children: favoriteState.list.items.length ? favoriteState.list.items.map((item) => /* @__PURE__ */ jsxs(
1758
+ "div",
1759
+ {
1760
+ className: classNames12(styles_module_default3.favoriteCard, { [styles_module_default3.favoriteCardActive]: conversationState.active.id === item.id }),
1761
+ onClick: () => chatStore.switchConversation(item.id),
1762
+ children: [
1763
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", children: [
1764
+ /* @__PURE__ */ jsx(Flex, { flex: 1, className: classNames12(styles_module_default3.favoriteCardTitle, "text-ellipsis"), children: item.title }),
1765
+ /* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", className: styles_module_default3.favoriteCardActions, children: /* @__PURE__ */ jsx(
1766
+ Popconfirm,
1767
+ {
1768
+ title: "\u63D0\u793A",
1769
+ okText: "\u786E\u5B9A",
1770
+ cancelText: "\u53D6\u6D88",
1771
+ description: "\u786E\u8BA4\u53D6\u6D88\u6536\u85CF\u8BE5\u4F1A\u8BDD\u5417\uFF1F",
1772
+ onConfirm: (e) => {
1773
+ e.stopPropagation();
1774
+ chatStore.collectConversation(item.id, false);
1775
+ },
1776
+ children: /* @__PURE__ */ jsx(
1777
+ Button,
1778
+ {
1779
+ icon: /* @__PURE__ */ jsx(DeleteOutlined, {}),
1780
+ title: "\u5220\u9664",
1781
+ type: "text",
1782
+ onClick: (e) => {
1783
+ e.stopPropagation();
1784
+ }
1785
+ }
1786
+ )
1787
+ }
1788
+ ) })
1789
+ ] }),
1790
+ /* @__PURE__ */ jsx("div", { className: styles_module_default3.favoriteCardDate, children: item.favoriteTime })
1791
+ ]
1792
+ },
1793
+ item.id
1794
+ )) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u6536\u85CF", image: Empty.PRESENTED_IMAGE_SIMPLE }) });
1795
+ }, [favoriteState.list.items, conversationState.active.id]);
1796
+ const handlePopoverVisibleChange = (visible) => {
1797
+ if (!visible) return;
1798
+ getFavoriteList();
1799
+ };
1800
+ return /* @__PURE__ */ jsx(
1801
+ Popover,
1802
+ {
1803
+ classNames: { body: styles_module_default3.nsPopover },
1804
+ getPopupContainer: (e) => e,
1805
+ placement: "bottom",
1806
+ content: renderFavoriteList,
1807
+ trigger: ["click"],
1808
+ onOpenChange: handlePopoverVisibleChange,
1809
+ children: /* @__PURE__ */ jsx(Button, { title: "\u6536\u85CF\u5939", type: "text", size: "large", icon: /* @__PURE__ */ jsx(StarOutlined, {}) })
1810
+ }
1811
+ );
1812
+ };
1813
+
1685
1814
  // src/ui/common/ConversationList.tsx
1686
1815
  init_Context();
1687
1816
  var ConversationList_default = () => {
@@ -1690,7 +1819,7 @@ var ConversationList_default = () => {
1690
1819
  const conversationsState = useSnapshot(chatStore.conversations);
1691
1820
  const conversationState = useSnapshot(chatStore.conversation);
1692
1821
  const getConversations = useDebounce(() => {
1693
- chatStore.getConversations(receiverState.active.id, 3);
1822
+ chatStore.getConversations(receiverState.active.id, receiverState.active.type);
1694
1823
  }, 300);
1695
1824
  useEffect(() => {
1696
1825
  if (receiverState.active.id) {
@@ -1721,6 +1850,11 @@ var ConversationList_default = () => {
1721
1850
  groupable: true,
1722
1851
  menu: (conversation) => ({
1723
1852
  items: [
1853
+ {
1854
+ label: `${conversation.isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF"}`,
1855
+ key: "collect",
1856
+ icon: conversation?.isFavorite ? /* @__PURE__ */ jsx(StarFilled, { className: "primary-text" }) : /* @__PURE__ */ jsx(StarOutlined, {})
1857
+ },
1724
1858
  {
1725
1859
  label: "\u5220\u9664\u4F1A\u8BDD",
1726
1860
  key: "delete",
@@ -1732,6 +1866,8 @@ var ConversationList_default = () => {
1732
1866
  menuInfo.domEvent.stopPropagation();
1733
1867
  if (menuInfo.key === "delete") {
1734
1868
  chatStore.delConversation(conversation.id);
1869
+ } else if (menuInfo.key === "collect") {
1870
+ chatStore.collectConversation(conversation.id, !conversation.isFavorite);
1735
1871
  }
1736
1872
  }
1737
1873
  })
@@ -1746,12 +1882,13 @@ var ChatHeader_default = ({
1746
1882
  closeBtn = false,
1747
1883
  newConversationBtn = true,
1748
1884
  agentCharacter = true,
1749
- conversationListBtn = true
1885
+ conversationListBtn = true,
1886
+ conversationListFavoriteBtn = true
1750
1887
  }) => {
1751
1888
  const chatStore = useChatStore();
1752
1889
  const receiverState = useSnapshot(chatStore.receiver);
1753
1890
  const configState = useSnapshot(chatStore.config);
1754
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", className: classNames11(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1891
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", className: classNames12(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1755
1892
  /* @__PURE__ */ jsxs(Flex, { gap: 4, align: "center", children: [
1756
1893
  /* @__PURE__ */ jsx(RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsx(Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }) }),
1757
1894
  /* @__PURE__ */ jsx(RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name }) }),
@@ -1775,7 +1912,7 @@ var ChatHeader_default = ({
1775
1912
  {
1776
1913
  getPopupContainer: (e) => e,
1777
1914
  placement: "bottom",
1778
- classNames: { body: styles_module_default3.nsChatHeaderPopover },
1915
+ classNames: { body: styles_module_default3.nsPopover },
1779
1916
  content: /* @__PURE__ */ jsx(ConversationList_default, {}),
1780
1917
  trigger: ["click"],
1781
1918
  children: /* @__PURE__ */ jsx(Button, { title: "\u5386\u53F2\u4F1A\u8BDD", type: "text", size: "large", icon: /* @__PURE__ */ jsx(CommentOutlined, {}) })
@@ -1783,6 +1920,7 @@ var ChatHeader_default = ({
1783
1920
  )
1784
1921
  }
1785
1922
  ),
1923
+ /* @__PURE__ */ jsx(RenderWrapper, { control: conversationListFavoriteBtn, DefaultComponent: /* @__PURE__ */ jsx(ConversationFavoritesList_default, {}) }),
1786
1924
  /* @__PURE__ */ jsx(
1787
1925
  RenderWrapper,
1788
1926
  {
@@ -2131,6 +2269,8 @@ var styles_module_default4 = {
2131
2269
  tagContainer: "styles_module_tagContainer",
2132
2270
  quickAskItem: "styles_module_quickAskItem",
2133
2271
  quickAskItemHeader: "styles_module_quickAskItemHeader",
2272
+ quickAskItemTitle: "styles_module_quickAskItemTitle",
2273
+ quickAskItemHeaderActions: "styles_module_quickAskItemHeaderActions",
2134
2274
  quickAskItemBody: "styles_module_quickAskItemBody"
2135
2275
  };
2136
2276
  var QuickAskPanel_default = () => {
@@ -2154,8 +2294,10 @@ var QuickAskPanel_default = () => {
2154
2294
  } catch (err) {
2155
2295
  }
2156
2296
  };
2297
+ const [loading, setLoading] = useState(false);
2157
2298
  const fetchItems = useDebounce(async () => {
2158
2299
  try {
2300
+ setLoading(true);
2159
2301
  const res = await configState.services.request?.labelItemsQuery?.(receiverState.active?.id, {
2160
2302
  labelId: getActiveTab().id,
2161
2303
  keyword: getSearchText()
@@ -2163,7 +2305,8 @@ var QuickAskPanel_default = () => {
2163
2305
  if (res?.data) {
2164
2306
  setItems(res.data);
2165
2307
  }
2166
- } catch (err) {
2308
+ } finally {
2309
+ setLoading(false);
2167
2310
  }
2168
2311
  });
2169
2312
  useEffect(() => {
@@ -2172,10 +2315,10 @@ var QuickAskPanel_default = () => {
2172
2315
  fetchItems();
2173
2316
  }
2174
2317
  }, [receiverState.active?.id]);
2175
- const [loading, setLoading] = useState(false);
2318
+ const [updateLoading, setUpdateLoading] = useState(false);
2176
2319
  const handleEditConfirm = async (values) => {
2177
2320
  try {
2178
- setLoading(true);
2321
+ setUpdateLoading(true);
2179
2322
  await configState.services.request?.labelItemUpdate?.(receiverState.active?.id, values);
2180
2323
  setEditModalOpen(false);
2181
2324
  message2.success("\u4FDD\u5B58\u6210\u529F");
@@ -2184,7 +2327,7 @@ var QuickAskPanel_default = () => {
2184
2327
  }
2185
2328
  fetchCategories();
2186
2329
  } finally {
2187
- setLoading(false);
2330
+ setUpdateLoading(false);
2188
2331
  }
2189
2332
  };
2190
2333
  const handleDelete = async (id) => {
@@ -2240,7 +2383,7 @@ var QuickAskPanel_default = () => {
2240
2383
  }
2241
2384
  ) : /* @__PURE__ */ jsx(Button, { icon: /* @__PURE__ */ jsx(SearchOutlined, {}), onClick: () => setSearchExpanded(true) })
2242
2385
  ] }),
2243
- /* @__PURE__ */ jsxs(Flex, { align: "center", className: classNames11("scroll-fade-in", "m-b-16", styles_module_default4.tagContainer), children: [
2386
+ /* @__PURE__ */ jsxs(Flex, { align: "center", className: classNames12("scroll-fade-in", "m-b-16", styles_module_default4.tagContainer), children: [
2244
2387
  /* @__PURE__ */ jsx(
2245
2388
  Tag,
2246
2389
  {
@@ -2269,7 +2412,7 @@ var QuickAskPanel_default = () => {
2269
2412
  c.id
2270
2413
  ))
2271
2414
  ] }),
2272
- /* @__PURE__ */ jsx(Flex, { vertical: true, className: "flex-1", children: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, className: "height-full scroll-fade-in", children: items.map((item) => /* @__PURE__ */ jsxs(
2415
+ /* @__PURE__ */ jsx(Flex, { vertical: true, className: "flex-1", children: /* @__PURE__ */ jsx(Spin, { spinning: loading, wrapperClassName: "full-spin", tip: "\u52A0\u8F7D\u4E2D...", children: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, className: "height-full scroll-fade-in", children: items.map((item) => /* @__PURE__ */ jsxs(
2273
2416
  "div",
2274
2417
  {
2275
2418
  className: styles_module_default4.quickAskItem,
@@ -2280,9 +2423,9 @@ var QuickAskPanel_default = () => {
2280
2423
  });
2281
2424
  },
2282
2425
  children: [
2283
- /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default4.quickAskItemHeader, children: [
2284
- /* @__PURE__ */ jsx("div", { className: "flex-1 text-ellipsis", children: item.title }),
2285
- /* @__PURE__ */ jsxs(Space, { size: 4, children: [
2426
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", align: "center", className: styles_module_default4.quickAskItemHeader, children: [
2427
+ /* @__PURE__ */ jsx("div", { className: classNames12("flex-1 text-ellipsis", styles_module_default4.quickAskItemTitle), children: item.title }),
2428
+ /* @__PURE__ */ jsxs(Space, { size: 4, className: styles_module_default4.quickAskItemHeaderActions, children: [
2286
2429
  /* @__PURE__ */ jsx(
2287
2430
  Button,
2288
2431
  {
@@ -2306,11 +2449,12 @@ var QuickAskPanel_default = () => {
2306
2449
  title: "\u590D\u5236",
2307
2450
  onClick: (e) => {
2308
2451
  e.stopPropagation();
2309
- handleEditConfirm({
2452
+ setEditingItem({
2310
2453
  title: item.title,
2311
2454
  labelName: item.labelName,
2312
2455
  content: item.content
2313
2456
  });
2457
+ setEditModalOpen(true);
2314
2458
  }
2315
2459
  },
2316
2460
  "copy"
@@ -2347,18 +2491,18 @@ var QuickAskPanel_default = () => {
2347
2491
  )
2348
2492
  ] })
2349
2493
  ] }),
2350
- /* @__PURE__ */ jsx("div", { className: classNames11(styles_module_default4.quickAskItemBody), children: /* @__PURE__ */ jsx("div", { className: "text-ellipsis-3", children: item.content }) })
2494
+ /* @__PURE__ */ jsx("div", { className: classNames12(styles_module_default4.quickAskItemBody), children: /* @__PURE__ */ jsx("div", { className: "text-ellipsis-3", children: item.content }) })
2351
2495
  ]
2352
2496
  },
2353
2497
  item.id
2354
- )) }) }),
2498
+ )) }) }) }),
2355
2499
  editModalOpen && /* @__PURE__ */ jsx(
2356
2500
  QuickAskEditModal_default,
2357
2501
  {
2358
2502
  open: editModalOpen,
2359
2503
  onCancel: () => setEditModalOpen(false),
2360
2504
  onConfirm: handleEditConfirm,
2361
- loading,
2505
+ loading: updateLoading,
2362
2506
  initialValues: editingItem,
2363
2507
  categories
2364
2508
  }
@@ -2444,7 +2588,7 @@ var SenderPromptsItems_default = () => {
2444
2588
  title: /* @__PURE__ */ jsx(
2445
2589
  "div",
2446
2590
  {
2447
- className: classNames11(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
2591
+ className: classNames12(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
2448
2592
  children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
2449
2593
  }
2450
2594
  ),
@@ -2538,30 +2682,43 @@ var ChatSender_default2 = forwardRef(
2538
2682
 
2539
2683
  // src/ui/common/ConversationListHeader.tsx
2540
2684
  init_Context();
2541
- var ConversationListHeader_default = () => {
2685
+ var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true, conversationListFavoriteBtn = true }) => {
2542
2686
  const chatStore = useChatStore();
2543
2687
  const receiverState = useSnapshot(chatStore.receiver);
2544
2688
  return /* @__PURE__ */ jsxs("div", { className: "p-24", children: [
2545
2689
  /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 8, children: [
2546
- /* @__PURE__ */ jsx(Avatar, { size: 36, src: receiverState.active.logo }),
2547
- /* @__PURE__ */ jsx("span", { className: styles_module_default3.nsChatUserName, children: receiverState.active.name })
2690
+ /* @__PURE__ */ jsx(RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsx(Avatar, { size: 36, src: receiverState.active.logo }) }),
2691
+ /* @__PURE__ */ jsx(
2692
+ RenderWrapper,
2693
+ {
2694
+ control: title,
2695
+ DefaultComponent: /* @__PURE__ */ jsx("span", { className: classNames12(styles_module_default3.nsChatUserName, "flex-1 text-ellipsis"), children: receiverState.active.name })
2696
+ }
2697
+ ),
2698
+ /* @__PURE__ */ jsx(RenderWrapper, { control: conversationListFavoriteBtn, DefaultComponent: /* @__PURE__ */ jsx(ConversationFavoritesList_default, {}) })
2548
2699
  ] }),
2549
2700
  /* @__PURE__ */ jsx(
2550
- Button,
2701
+ RenderWrapper,
2551
2702
  {
2552
- block: true,
2553
- type: "primary",
2554
- shape: "round",
2555
- onClick: () => chatStore.createConversation(),
2556
- className: classNames11("m-t-16"),
2557
- icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
2558
- children: "\u65B0\u5EFA\u4F1A\u8BDD"
2703
+ control: newConversationBtn,
2704
+ DefaultComponent: /* @__PURE__ */ jsx(
2705
+ Button,
2706
+ {
2707
+ block: true,
2708
+ type: "primary",
2709
+ shape: "round",
2710
+ onClick: () => chatStore.createConversation(),
2711
+ className: classNames12("m-t-16"),
2712
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
2713
+ children: "\u65B0\u5EFA\u4F1A\u8BDD"
2714
+ }
2715
+ )
2559
2716
  }
2560
2717
  )
2561
2718
  ] });
2562
2719
  };
2563
2720
  var ConversationListPanel_default = ({ header }) => {
2564
- return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames11("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2721
+ return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames12("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2565
2722
  /* @__PURE__ */ jsx(RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
2566
2723
  /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(ConversationList_default, {}) })
2567
2724
  ] });
@@ -2575,7 +2732,8 @@ var styles_module_default5 = {
2575
2732
  nsDisclaimerNotice: "styles_module_nsDisclaimerNotice",
2576
2733
  nsChatLayout: "styles_module_nsChatLayout",
2577
2734
  nsChatBody: "styles_module_nsChatBody",
2578
- nsBodyWidth: "styles_module_nsBodyWidth"
2735
+ nsBodyWidth: "styles_module_nsBodyWidth",
2736
+ nsPrompts: "styles_module_nsPrompts"
2579
2737
  };
2580
2738
  var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, config, services }, ref) => {
2581
2739
  const chatStore = useMemo(() => createChatStore(), []);
@@ -2654,7 +2812,7 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2654
2812
  useEffect(() => {
2655
2813
  configState.hooks?.onBeforeInit?.();
2656
2814
  }, []);
2657
- return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames11(styles_module_default5.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2815
+ return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames12(styles_module_default5.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2658
2816
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
2659
2817
  /* @__PURE__ */ jsxs(Flex, { className: "full-scroll", children: [
2660
2818
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel }),
@@ -2663,7 +2821,7 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2663
2821
  /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: hasPreView && /* @__PURE__ */ jsxs(Fragment, { children: [
2664
2822
  configState.preview.file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
2665
2823
  /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default5.nsPreviewHeader, children: [
2666
- /* @__PURE__ */ jsx("div", { className: classNames11(styles_module_default5.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),
2824
+ /* @__PURE__ */ jsx("div", { className: classNames12(styles_module_default5.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),
2667
2825
  /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
2668
2826
  /* @__PURE__ */ jsx(
2669
2827
  Button,
@@ -2707,15 +2865,15 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2707
2865
  }
2708
2866
  )
2709
2867
  ] }) }),
2710
- /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames11("height-full"), children: [
2868
+ /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames12("height-full"), children: [
2711
2869
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
2712
- /* @__PURE__ */ jsx(Flex, { vertical: true, className: classNames11("full-scroll"), children: /* @__PURE__ */ jsxs(
2870
+ /* @__PURE__ */ jsx(Flex, { vertical: true, className: classNames12("full-scroll"), children: /* @__PURE__ */ jsxs(
2713
2871
  Flex,
2714
2872
  {
2715
2873
  justify: "center",
2716
2874
  vertical: true,
2717
2875
  gap: 24,
2718
- className: classNames11("height-full", styles_module_default5.nsChatBody, "zero-chat-body", styles_module_default5.nsBodyWidth),
2876
+ className: classNames12("height-full", styles_module_default5.nsChatBody, "zero-chat-body", styles_module_default5.nsBodyWidth),
2719
2877
  children: [
2720
2878
  shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
2721
2879
  /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
@@ -2744,13 +2902,14 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2744
2902
  DefaultComponent: receiverState?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsx(
2745
2903
  Prompts,
2746
2904
  {
2905
+ className: styles_module_default5.nsPrompts,
2747
2906
  vertical: true,
2748
2907
  title: "\u63A8\u8350\u95EE\u9898:",
2749
2908
  onItemClick: ({ data }) => chatStore.sendMessage(data.key),
2750
2909
  items: receiverState?.recommendQuestions.map((question) => ({
2751
2910
  key: question,
2752
2911
  icon: /* @__PURE__ */ jsx(FileSearchOutlined, {}),
2753
- description: question
2912
+ description: /* @__PURE__ */ jsx("div", { className: "text-ellipsis", children: question })
2754
2913
  }))
2755
2914
  }
2756
2915
  )