@zero-library/chat-agent 2.3.5 → 2.3.7

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 classNames12 = require('classnames');
9
+ var classNames11 = 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 classNames12__default = /*#__PURE__*/_interopDefault(classNames12);
16
+ var classNames11__default = /*#__PURE__*/_interopDefault(classNames11);
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: classNames12__default.default(styles_module_default.chart, "scroll-fade-in"), children: loading ? (
314
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__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(
@@ -1308,15 +1308,13 @@ var MessageRender_default = ({ message: message2, placement, onFilePreview, cust
1308
1308
  onFilePreview?.(file);
1309
1309
  }
1310
1310
  };
1311
- const mergedCustomComponents = react.useMemo(() => {
1312
- return { ...customComponents, ...propsCustomComponents };
1313
- }, [propsCustomComponents]);
1311
+ const mergedCustomComponents = { ...customComponents, ...propsCustomComponents };
1314
1312
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, children: !(msgContent || message2.msgFiles.length) ? /* @__PURE__ */ jsxRuntime.jsx(antd.Typography, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { size: "small" }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1315
1313
  msgContent && /* @__PURE__ */ jsxRuntime.jsx(
1316
1314
  x.Bubble,
1317
1315
  {
1318
1316
  placement,
1319
- className: classNames12__default.default({ [styles_module_default2.loadingMessage]: message2.type }),
1317
+ className: classNames11__default.default({ [styles_module_default2.loadingMessage]: message2.type }),
1320
1318
  content: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content: replaceMarkdownTags(msgContent), customComponents: mergedCustomComponents, message: message2 })
1321
1319
  }
1322
1320
  ),
@@ -1399,10 +1397,6 @@ var styles_module_default3 = {
1399
1397
  chatWelcomeWrap: "styles_module_chatWelcomeWrap",
1400
1398
  chatWelcome: "styles_module_chatWelcome",
1401
1399
  chatWelcomePrompts: "styles_module_chatWelcomePrompts",
1402
- nsSenderListTitle: "styles_module_nsSenderListTitle",
1403
- nsSenderList: "styles_module_nsSenderList",
1404
- nsSenderListItem: "styles_module_nsSenderListItem",
1405
- nsSenderListFooter: "styles_module_nsSenderListFooter",
1406
1400
  nsChatUserName: "styles_module_nsChatUserName",
1407
1401
  nsSenderReferenceHeaderTitle: "styles_module_nsSenderReferenceHeaderTitle",
1408
1402
  nsSenderReferenceHeaderContent: "styles_module_nsSenderReferenceHeaderContent",
@@ -1423,7 +1417,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1423
1417
  /* @__PURE__ */ jsxRuntime.jsx(
1424
1418
  x.Welcome,
1425
1419
  {
1426
- className: classNames12__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1420
+ className: classNames11__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1427
1421
  variant: "borderless",
1428
1422
  icon: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: icon, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { shape: "square", size: 58, src: receiverState.active.logo }) }),
1429
1423
  title: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}` }),
@@ -1452,7 +1446,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1452
1446
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1453
1447
  children: receiverState?.recommendQuestions.map((question) => ({
1454
1448
  key: question,
1455
- description: /* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames12__default.default(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1449
+ description: /* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames11__default.default(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1456
1450
  }))
1457
1451
  }
1458
1452
  ]
@@ -1690,7 +1684,7 @@ var BubbleListItems_default = ({
1690
1684
  autoScroll: false,
1691
1685
  ref: listRef,
1692
1686
  items: bubbleListItems,
1693
- className: classNames12__default.default(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1687
+ className: classNames11__default.default(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1694
1688
  onScroll: handleScroll
1695
1689
  },
1696
1690
  conversationState.active.id
@@ -1725,7 +1719,7 @@ var CharacterList_default = () => {
1725
1719
  /* @__PURE__ */ jsxRuntime.jsx(
1726
1720
  antd.Avatar,
1727
1721
  {
1728
- className: classNames12__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1722
+ className: classNames11__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1729
1723
  [styles_module_default3.nsAvatarListItemIconActive]: activeCharacter.id === item.id
1730
1724
  }),
1731
1725
  size: 50,
@@ -1762,14 +1756,14 @@ var ConversationFavoritesList_default = () => {
1762
1756
  chatStore.getConversationFavorite();
1763
1757
  }, 300);
1764
1758
  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(
1759
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default("height-full", "scroll-fade-in"), children: favoriteState.list.items.length ? favoriteState.list.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
1766
1760
  "div",
1767
1761
  {
1768
- className: classNames12__default.default(styles_module_default3.favoriteCard, { [styles_module_default3.favoriteCardActive]: conversationState.active.id === item.id }),
1762
+ className: classNames11__default.default(styles_module_default3.favoriteCard, { [styles_module_default3.favoriteCardActive]: conversationState.active.id === item.id }),
1769
1763
  onClick: () => chatStore.switchConversation(item.id),
1770
1764
  children: [
1771
1765
  /* @__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 }),
1766
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: classNames11__default.default(styles_module_default3.favoriteCardTitle, "text-ellipsis"), children: item.title }),
1773
1767
  /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", className: styles_module_default3.favoriteCardActions, children: /* @__PURE__ */ jsxRuntime.jsx(
1774
1768
  antd.Popconfirm,
1775
1769
  {
@@ -1781,6 +1775,7 @@ var ConversationFavoritesList_default = () => {
1781
1775
  e.stopPropagation();
1782
1776
  chatStore.collectConversation(item.id, false);
1783
1777
  },
1778
+ onCancel: (e) => e.stopPropagation(),
1784
1779
  children: /* @__PURE__ */ jsxRuntime.jsx(
1785
1780
  antd.Button,
1786
1781
  {
@@ -1896,7 +1891,7 @@ var ChatHeader_default = ({
1896
1891
  const chatStore = useChatStore();
1897
1892
  const receiverState = valtio.useSnapshot(chatStore.receiver);
1898
1893
  const configState = valtio.useSnapshot(chatStore.config);
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: [
1894
+ 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: [
1900
1895
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, align: "center", children: [
1901
1896
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }) }),
1902
1897
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name }) }),
@@ -2178,7 +2173,7 @@ init_Context();
2178
2173
  // src/ui/common/FeaturesRenderer.tsx
2179
2174
  init_Context();
2180
2175
 
2181
- // src/ui/common/QuickAsk/QuickAskPanel.tsx
2176
+ // src/ui/common/QuickAsk/QuickAskPanelDrawer.tsx
2182
2177
  init_Context();
2183
2178
 
2184
2179
  // src/ui/common/QuickAsk/QuickAskEditModal.tsx
@@ -2281,7 +2276,8 @@ var styles_module_default4 = {
2281
2276
  quickAskItemHeaderActions: "styles_module_quickAskItemHeaderActions",
2282
2277
  quickAskItemBody: "styles_module_quickAskItemBody"
2283
2278
  };
2284
- var QuickAskPanel_default = () => {
2279
+ var ALL = "all";
2280
+ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2285
2281
  const { message: message2 } = antd.App.useApp();
2286
2282
  const chatStore = useChatStore();
2287
2283
  const configState = valtio.useSnapshot(chatStore.config);
@@ -2302,6 +2298,19 @@ var QuickAskPanel_default = () => {
2302
2298
  } catch (err) {
2303
2299
  }
2304
2300
  };
2301
+ const tabsItems = react.useMemo(
2302
+ () => [
2303
+ {
2304
+ key: ALL,
2305
+ label: "\u5168\u90E8"
2306
+ },
2307
+ ...categories.map((item) => ({
2308
+ key: item.id,
2309
+ label: item.labelName
2310
+ }))
2311
+ ],
2312
+ [categories]
2313
+ );
2305
2314
  const [loading, setLoading] = react.useState(false);
2306
2315
  const fetchItems = common.useDebounce(async () => {
2307
2316
  try {
@@ -2357,153 +2366,158 @@ var QuickAskPanel_default = () => {
2357
2366
  } catch (err) {
2358
2367
  }
2359
2368
  };
2360
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: styles_module_default4.quickAskPanel, children: [
2361
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "space-between", align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Title, { level: 5, children: "\u5FEB\u901F\u63D0\u95EE" }) }),
2362
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: "m-b-16 m-t-16", children: [
2363
- !searchExpanded && /* @__PURE__ */ jsxRuntime.jsx(
2364
- antd.Button,
2365
- {
2366
- type: "dashed",
2367
- block: true,
2368
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2369
- className: "flex-1",
2370
- onClick: () => {
2371
- setEditingItem(null);
2372
- setEditModalOpen(true);
2373
- },
2374
- children: "\u65B0\u589E\u5FEB\u901F\u63D0\u95EE"
2375
- }
2376
- ),
2377
- searchExpanded ? /* @__PURE__ */ jsxRuntime.jsx(
2378
- antd.Input,
2379
- {
2380
- autoFocus: true,
2381
- placeholder: "\u8F93\u5165\u95EE\u9898\u540D\u79F0\u6216\u5185\u5BB9\u68C0\u7D22",
2382
- prefix: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, {}),
2383
- value: searchText,
2384
- onChange: (e) => {
2385
- setSearchText(e.target.value);
2386
- fetchItems();
2387
- },
2388
- className: "flex-1",
2389
- allowClear: true,
2390
- onBlur: () => setSearchExpanded(false)
2391
- }
2392
- ) : /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, {}), onClick: () => setSearchExpanded(true) })
2393
- ] }),
2394
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", className: classNames12__default.default("scroll-fade-in", "m-b-16", styles_module_default4.tagContainer), children: [
2395
- /* @__PURE__ */ jsxRuntime.jsx(
2396
- antd.Tag,
2397
- {
2398
- color: !activeTab.id ? "processing" : "default",
2399
- className: "cursor-pointer",
2400
- bordered: false,
2401
- onClick: () => {
2402
- setActiveTab({});
2403
- fetchItems();
2404
- },
2405
- children: "\u5168\u90E8"
2406
- }
2407
- ),
2408
- categories.map((c) => /* @__PURE__ */ jsxRuntime.jsx(
2409
- antd.Tag,
2410
- {
2411
- color: activeTab.id === c.id ? "processing" : "default",
2412
- className: "cursor-pointer",
2413
- bordered: false,
2414
- onClick: () => {
2415
- setActiveTab(c);
2416
- fetchItems();
2417
- },
2418
- children: c.labelName
2419
- },
2420
- c.id
2421
- ))
2422
- ] }),
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(
2424
- "div",
2369
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2370
+ /* @__PURE__ */ jsxRuntime.jsx(
2371
+ antd.Drawer,
2425
2372
  {
2426
- className: styles_module_default4.quickAskItem,
2427
- onClick: () => {
2428
- chatStore.setContent(item.content);
2429
- chatStore.setContentParams({
2430
- use_template: 1
2431
- });
2432
- },
2433
- 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: [
2437
- /* @__PURE__ */ jsxRuntime.jsx(
2373
+ className: classNames11__default.default("no-padding-drawer"),
2374
+ width: 360,
2375
+ open,
2376
+ title: "\u5FEB\u901F\u63D0\u95EE",
2377
+ closable: { placement: "end" },
2378
+ onClose,
2379
+ placement: "right",
2380
+ mask: false,
2381
+ children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: styles_module_default4.quickAskPanel, children: [
2382
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 12, className: "p-16", vertical: true, children: [
2383
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, children: [
2384
+ !searchExpanded && /* @__PURE__ */ jsxRuntime.jsx(
2438
2385
  antd.Button,
2439
2386
  {
2440
- type: "primary",
2441
- size: "small",
2442
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PushpinOutlined, { rotate: item.isTop ? -45 : 0 }),
2443
- title: item.isTop ? "\u53D6\u6D88\u7F6E\u9876" : "\u7F6E\u9876",
2444
- onClick: (e) => {
2445
- e.stopPropagation();
2446
- handleTop(item);
2447
- }
2448
- },
2449
- "top"
2450
- ),
2451
- /* @__PURE__ */ jsxRuntime.jsx(
2452
- antd.Button,
2453
- {
2454
- type: "primary",
2455
- size: "small",
2456
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CopyOutlined, {}),
2457
- title: "\u590D\u5236",
2458
- onClick: (e) => {
2459
- e.stopPropagation();
2460
- setEditingItem({
2461
- title: item.title,
2462
- labelName: item.labelName,
2463
- content: item.content
2464
- });
2387
+ type: "dashed",
2388
+ block: true,
2389
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2390
+ className: "flex-1",
2391
+ onClick: () => {
2392
+ setEditingItem(null);
2465
2393
  setEditModalOpen(true);
2466
- }
2467
- },
2468
- "copy"
2469
- ),
2470
- /* @__PURE__ */ jsxRuntime.jsx(
2471
- antd.Button,
2472
- {
2473
- type: "primary",
2474
- size: "small",
2475
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EditOutlined, {}),
2476
- title: "\u7F16\u8F91",
2477
- onClick: (e) => {
2478
- e.stopPropagation();
2479
- setEditingItem(item);
2480
- setEditModalOpen(true);
2481
- }
2482
- },
2483
- "edit"
2394
+ },
2395
+ children: "\u65B0\u589E\u5FEB\u901F\u63D0\u95EE"
2396
+ }
2484
2397
  ),
2485
- item.canDelete && /* @__PURE__ */ jsxRuntime.jsx(
2486
- antd.Popconfirm,
2398
+ searchExpanded ? /* @__PURE__ */ jsxRuntime.jsx(
2399
+ antd.Input,
2487
2400
  {
2488
- title: "\u63D0\u793A",
2489
- okText: "\u786E\u5B9A",
2490
- cancelText: "\u53D6\u6D88",
2491
- description: "\u786E\u8BA4\u5220\u9664\u95EE\u9898\u5417?",
2492
- onConfirm: (e) => {
2493
- e.stopPropagation();
2494
- handleDelete(item.id);
2401
+ autoFocus: true,
2402
+ placeholder: "\u8F93\u5165\u95EE\u9898\u540D\u79F0\u6216\u5185\u5BB9\u68C0\u7D22",
2403
+ prefix: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, {}),
2404
+ value: searchText,
2405
+ onChange: (e) => {
2406
+ setSearchText(e.target.value);
2407
+ fetchItems();
2495
2408
  },
2496
- children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}), title: "\u5220\u9664", onClick: (e) => e.stopPropagation() })
2409
+ className: "flex-1",
2410
+ allowClear: true,
2411
+ onBlur: () => setSearchExpanded(false)
2412
+ }
2413
+ ) : /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, {}), onClick: () => setSearchExpanded(true) })
2414
+ ] }),
2415
+ /* @__PURE__ */ jsxRuntime.jsx(
2416
+ antd.Tabs,
2417
+ {
2418
+ className: styles_module_default4.tagContainer,
2419
+ activeKey: activeTab.id ? activeTab.id : ALL,
2420
+ onChange: (key) => {
2421
+ setActiveTab(key === ALL ? {} : categories.find((c) => c.id === key));
2422
+ fetchItems();
2497
2423
  },
2498
- "delete"
2499
- )
2500
- ] })
2424
+ tabPosition: "top",
2425
+ items: tabsItems,
2426
+ size: "small"
2427
+ }
2428
+ )
2501
2429
  ] }),
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 }) })
2503
- ]
2504
- },
2505
- item.id
2506
- )) }) }) }),
2430
+ /* @__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 p-16 p-t-8", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
2431
+ "div",
2432
+ {
2433
+ className: styles_module_default4.quickAskItem,
2434
+ onClick: () => {
2435
+ chatStore.setContent(item.content);
2436
+ chatStore.setContentParams({
2437
+ use_template: 1
2438
+ });
2439
+ onClose();
2440
+ },
2441
+ children: [
2442
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "space-between", align: "center", className: styles_module_default4.quickAskItemHeader, children: [
2443
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default("flex-1 text-ellipsis", styles_module_default4.quickAskItemTitle), children: item.title }),
2444
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 4, className: styles_module_default4.quickAskItemHeaderActions, children: [
2445
+ /* @__PURE__ */ jsxRuntime.jsx(
2446
+ antd.Button,
2447
+ {
2448
+ type: "primary",
2449
+ size: "small",
2450
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PushpinOutlined, { rotate: item.isTop ? -45 : 0 }),
2451
+ title: item.isTop ? "\u53D6\u6D88\u7F6E\u9876" : "\u7F6E\u9876",
2452
+ onClick: (e) => {
2453
+ e.stopPropagation();
2454
+ handleTop(item);
2455
+ }
2456
+ },
2457
+ "top"
2458
+ ),
2459
+ /* @__PURE__ */ jsxRuntime.jsx(
2460
+ antd.Button,
2461
+ {
2462
+ type: "primary",
2463
+ size: "small",
2464
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CopyOutlined, {}),
2465
+ title: "\u590D\u5236",
2466
+ onClick: (e) => {
2467
+ e.stopPropagation();
2468
+ setEditingItem({
2469
+ title: item.title,
2470
+ labelName: item.labelName,
2471
+ content: item.content
2472
+ });
2473
+ setEditModalOpen(true);
2474
+ }
2475
+ },
2476
+ "copy"
2477
+ ),
2478
+ /* @__PURE__ */ jsxRuntime.jsx(
2479
+ antd.Button,
2480
+ {
2481
+ type: "primary",
2482
+ size: "small",
2483
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EditOutlined, {}),
2484
+ title: "\u7F16\u8F91",
2485
+ onClick: (e) => {
2486
+ e.stopPropagation();
2487
+ setEditingItem(item);
2488
+ setEditModalOpen(true);
2489
+ }
2490
+ },
2491
+ "edit"
2492
+ ),
2493
+ item.canDelete && /* @__PURE__ */ jsxRuntime.jsx(
2494
+ antd.Popconfirm,
2495
+ {
2496
+ title: "\u63D0\u793A",
2497
+ okText: "\u786E\u5B9A",
2498
+ cancelText: "\u53D6\u6D88",
2499
+ description: "\u786E\u8BA4\u5220\u9664\u95EE\u9898\u5417?",
2500
+ onConfirm: (e) => {
2501
+ e.stopPropagation();
2502
+ handleDelete(item.id);
2503
+ },
2504
+ onCancel: (e) => {
2505
+ e.stopPropagation();
2506
+ },
2507
+ children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}), title: "\u5220\u9664", onClick: (e) => e.stopPropagation() })
2508
+ },
2509
+ "delete"
2510
+ )
2511
+ ] })
2512
+ ] }),
2513
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default4.quickAskItemBody), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis-3", children: item.content }) })
2514
+ ]
2515
+ },
2516
+ item.id
2517
+ )) }) }) })
2518
+ ] })
2519
+ }
2520
+ ),
2507
2521
  editModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
2508
2522
  QuickAskEditModal_default,
2509
2523
  {
@@ -2521,6 +2535,7 @@ var FeaturesRenderer_default = () => {
2521
2535
  const chatStore = useChatStore();
2522
2536
  const receiverState = valtio.useSnapshot(chatStore.receiver);
2523
2537
  const conversationState = valtio.useSnapshot(chatStore.conversation);
2538
+ const [quickAskOpen, setQuickAskOpen] = react.useState(false);
2524
2539
  const chatMessage = react.useMemo(
2525
2540
  () => conversationState.messages[conversationState.active.id] || {},
2526
2541
  [conversationState.messages[conversationState.active.id]]
@@ -2551,66 +2566,14 @@ var FeaturesRenderer_default = () => {
2551
2566
  children: "\u5411\u4E13\u5BB6\u54A8\u8BE2"
2552
2567
  }
2553
2568
  ),
2554
- receiverState.active.feature?.quickAsk && /* @__PURE__ */ jsxRuntime.jsx(
2555
- antd.Popover,
2556
- {
2557
- trigger: "click",
2558
- placement: "topLeft",
2559
- content: /* @__PURE__ */ jsxRuntime.jsx(QuickAskPanel_default, {}),
2560
- children: /* @__PURE__ */ jsxRuntime.jsx(
2561
- antd.Button,
2562
- {
2563
- size: "small",
2564
- color: "primary",
2565
- variant: "filled",
2566
- children: "\u5FEB\u901F\u63D0\u95EE"
2567
- }
2568
- )
2569
- }
2570
- )
2569
+ receiverState.active.feature?.quickAsk && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2570
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { size: "small", color: "primary", variant: "filled", onClick: () => setQuickAskOpen(true), children: "\u5FEB\u901F\u63D0\u95EE" }),
2571
+ quickAskOpen && /* @__PURE__ */ jsxRuntime.jsx(QuickAskPanelDrawer_default, { open: quickAskOpen, onClose: () => setQuickAskOpen(false) })
2572
+ ] })
2571
2573
  ] });
2572
2574
  };
2573
-
2574
- // src/ui/common/SenderPromptsItems.tsx
2575
- init_Context();
2576
- var SenderPromptsItems_default = () => {
2577
- const chatStore = useChatStore();
2578
- const receiverState = valtio.useSnapshot(chatStore.receiver);
2579
- const component = react.useMemo(
2580
- () => receiverState.active.config?.labels?.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, wrap: true, children: [
2581
- /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { disabled: true, color: "default", variant: "text", children: "\u968F\u4FBF\u804A\u804A" }),
2582
- receiverState.active.config.labels.slice(0, 6).map((question) => /* @__PURE__ */ jsxRuntime.jsx(
2583
- antd.Popover,
2584
- {
2585
- content: /* @__PURE__ */ jsxRuntime.jsx(
2586
- antd.List,
2587
- {
2588
- itemLayout: "horizontal",
2589
- split: false,
2590
- className: styles_module_default3.nsSenderList,
2591
- dataSource: question.items,
2592
- renderItem: (item) => /* @__PURE__ */ jsxRuntime.jsx(antd.List.Item, { onClick: () => chatStore.sendMessage(item.question), className: styles_module_default3.nsSenderListItem, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis", children: item.question }) }),
2593
- footer: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: styles_module_default3.nsSenderListFooter, children: "(\u60A8\u53EF\u70B9\u51FB\u4EE5\u4E0A\u95EE\u9898\u5F00\u542FAI\u4F53\u9A8C)" })
2594
- }
2595
- ),
2596
- title: /* @__PURE__ */ jsxRuntime.jsx(
2597
- "div",
2598
- {
2599
- className: classNames12__default.default(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
2600
- children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
2601
- }
2602
- ),
2603
- children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "default", variant: "filled", children: question.name })
2604
- },
2605
- question.id
2606
- ))
2607
- ] }),
2608
- [receiverState.active.config?.labels]
2609
- );
2610
- return component;
2611
- };
2612
2575
  var ChatSender_default2 = react.forwardRef(
2613
- ({ placeholder, extraBtn = false, referencesBtn = false, sendBtnProps, footerBelow = false, prompts = true }, ref) => {
2576
+ ({ placeholder, extraBtn = false, referencesBtn = false, sendBtnProps, footerBelow = false }, ref) => {
2614
2577
  const chatStore = useChatStore();
2615
2578
  const configState = valtio.useSnapshot(chatStore.config);
2616
2579
  const receiverState = valtio.useSnapshot(chatStore.receiver);
@@ -2630,61 +2593,58 @@ var ChatSender_default2 = react.forwardRef(
2630
2593
  chatStore.setContent(con);
2631
2594
  chatStore.sendMessage();
2632
2595
  };
2633
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, className: "zero-chat-sender", children: [
2634
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: prompts, DefaultComponent: SenderPromptsItems_default }),
2635
- /* @__PURE__ */ jsxRuntime.jsx(
2636
- ChatSender_default,
2637
- {
2638
- ref,
2639
- placeholder,
2640
- content: chatMessage.content,
2641
- fileList: chatMessage.files,
2642
- headerOpen: chatMessage.headerOpen,
2643
- loading: chatMessage.loading,
2644
- onContentChange: chatStore.setContent,
2645
- onFileListChange: chatStore.setFileList,
2646
- onHeaderOpenChange: chatStore.setHeaderOpen,
2647
- onSend: () => chatStore.sendMessage(),
2648
- onCancel: chatStore.cancelReceive,
2649
- onFocus: chatStore.config.hooks?.onSenderFocus,
2650
- fileUpload: {
2651
- request: configState.services.request?.fileUpload,
2652
- config: receiverState.active.config?.fileUpload
2653
- },
2654
- sendBtnProps: common.isFunction(sendBtnProps) ? sendBtnProps() : {},
2655
- extraFooterBelow: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: footerBelow }),
2656
- extraFooter: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2657
- /* @__PURE__ */ jsxRuntime.jsx(FeaturesRenderer_default, {}),
2658
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: extraBtn })
2659
- ] }),
2660
- extraHeader: /* @__PURE__ */ jsxRuntime.jsx(
2661
- x.Sender.Header,
2662
- {
2663
- title: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, children: [
2664
- /* @__PURE__ */ jsxRuntime.jsx(icons.EnterOutlined, {}),
2665
- /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { type: "secondary", ellipsis: true, children: referenceContent })
2666
- ] }),
2667
- open: !!referenceContent,
2668
- onOpenChange: () => chatStore.setReferences(),
2669
- classNames: {
2670
- header: styles_module_default3.nsSenderReferenceHeaderTitle,
2671
- content: common.shouldRender(referencesBtn) ? "" : styles_module_default3.nsSenderReferenceHeaderContent
2672
- },
2673
- children: /* @__PURE__ */ jsxRuntime.jsx(
2674
- common.RenderWrapper,
2675
- {
2676
- control: referencesBtn,
2677
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, children: ["\u6DF1\u5EA6\u89E3\u8BFB", "\u6982\u8981\u89E3\u8BFB"].map((con) => /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { color: "primary", variant: "filled", onClick: () => referenceHandle(con), children: [
2678
- con,
2679
- " \u2192"
2680
- ] }, con)) })
2681
- }
2682
- )
2683
- }
2684
- )
2685
- }
2686
- )
2687
- ] });
2596
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, className: "zero-chat-sender", children: /* @__PURE__ */ jsxRuntime.jsx(
2597
+ ChatSender_default,
2598
+ {
2599
+ ref,
2600
+ placeholder,
2601
+ content: chatMessage.content,
2602
+ fileList: chatMessage.files,
2603
+ headerOpen: chatMessage.headerOpen,
2604
+ loading: chatMessage.loading,
2605
+ onContentChange: chatStore.setContent,
2606
+ onFileListChange: chatStore.setFileList,
2607
+ onHeaderOpenChange: chatStore.setHeaderOpen,
2608
+ onSend: () => chatStore.sendMessage(),
2609
+ onCancel: chatStore.cancelReceive,
2610
+ onFocus: chatStore.config.hooks?.onSenderFocus,
2611
+ fileUpload: {
2612
+ request: configState.services.request?.fileUpload,
2613
+ config: receiverState.active.config?.fileUpload
2614
+ },
2615
+ sendBtnProps: common.isFunction(sendBtnProps) ? sendBtnProps() : {},
2616
+ extraFooterBelow: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: footerBelow }),
2617
+ extraFooter: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2618
+ /* @__PURE__ */ jsxRuntime.jsx(FeaturesRenderer_default, {}),
2619
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: extraBtn })
2620
+ ] }),
2621
+ extraHeader: /* @__PURE__ */ jsxRuntime.jsx(
2622
+ x.Sender.Header,
2623
+ {
2624
+ title: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, children: [
2625
+ /* @__PURE__ */ jsxRuntime.jsx(icons.EnterOutlined, {}),
2626
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { type: "secondary", ellipsis: true, children: referenceContent })
2627
+ ] }),
2628
+ open: !!referenceContent,
2629
+ onOpenChange: () => chatStore.setReferences(),
2630
+ classNames: {
2631
+ header: styles_module_default3.nsSenderReferenceHeaderTitle,
2632
+ content: common.shouldRender(referencesBtn) ? "" : styles_module_default3.nsSenderReferenceHeaderContent
2633
+ },
2634
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2635
+ common.RenderWrapper,
2636
+ {
2637
+ control: referencesBtn,
2638
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, children: ["\u6DF1\u5EA6\u89E3\u8BFB", "\u6982\u8981\u89E3\u8BFB"].map((con) => /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { color: "primary", variant: "filled", onClick: () => referenceHandle(con), children: [
2639
+ con,
2640
+ " \u2192"
2641
+ ] }, con)) })
2642
+ }
2643
+ )
2644
+ }
2645
+ )
2646
+ }
2647
+ ) });
2688
2648
  }
2689
2649
  );
2690
2650
 
@@ -2700,7 +2660,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2700
2660
  common.RenderWrapper,
2701
2661
  {
2702
2662
  control: title,
2703
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames12__default.default(styles_module_default3.nsChatUserName, "flex-1 text-ellipsis"), children: receiverState.active.name })
2663
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames11__default.default(styles_module_default3.nsChatUserName, "flex-1 text-ellipsis"), children: receiverState.active.name })
2704
2664
  }
2705
2665
  ),
2706
2666
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationListFavoriteBtn, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(ConversationFavoritesList_default, {}) })
@@ -2716,7 +2676,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2716
2676
  type: "primary",
2717
2677
  shape: "round",
2718
2678
  onClick: () => chatStore.createConversation(),
2719
- className: classNames12__default.default("m-t-16"),
2679
+ className: classNames11__default.default("m-t-16"),
2720
2680
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2721
2681
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
2722
2682
  }
@@ -2726,7 +2686,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2726
2686
  ] });
2727
2687
  };
2728
2688
  var ConversationListPanel_default = ({ header }) => {
2729
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames12__default.default("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2689
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames11__default.default("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2730
2690
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
2731
2691
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
2732
2692
  ] });
@@ -2820,7 +2780,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2820
2780
  react.useEffect(() => {
2821
2781
  configState.hooks?.onBeforeInit?.();
2822
2782
  }, []);
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: [
2783
+ 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: [
2824
2784
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
2825
2785
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "full-scroll", children: [
2826
2786
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
@@ -2829,7 +2789,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2829
2789
  /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: hasPreView && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2830
2790
  configState.preview.file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
2831
2791
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default5.nsPreviewHeader, children: [
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 }),
2792
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default5.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),
2833
2793
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
2834
2794
  /* @__PURE__ */ jsxRuntime.jsx(
2835
2795
  antd.Button,
@@ -2873,15 +2833,15 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2873
2833
  }
2874
2834
  )
2875
2835
  ] }) }),
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: [
2836
+ /* @__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: [
2877
2837
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
2878
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames12__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(
2838
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames11__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(
2879
2839
  antd.Flex,
2880
2840
  {
2881
2841
  justify: "center",
2882
2842
  vertical: true,
2883
2843
  gap: 24,
2884
- className: classNames12__default.default("height-full", styles_module_default5.nsChatBody, "zero-chat-body", styles_module_default5.nsBodyWidth),
2844
+ className: classNames11__default.default("height-full", styles_module_default5.nsChatBody, "zero-chat-body", styles_module_default5.nsBodyWidth),
2885
2845
  children: [
2886
2846
  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 }) }),
2887
2847
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [