@zero-library/chat-agent 2.3.7 → 2.3.9

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
@@ -1756,7 +1756,7 @@ var ConversationFavoritesList_default = () => {
1756
1756
  chatStore.getConversationFavorite();
1757
1757
  }, 300);
1758
1758
  const renderFavoriteList = react.useMemo(() => {
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(
1759
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 4, className: classNames11__default.default("height-full", "scroll-fade-in"), children: favoriteState.list.items.length ? favoriteState.list.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
1760
1760
  "div",
1761
1761
  {
1762
1762
  className: classNames11__default.default(styles_module_default3.favoriteCard, { [styles_module_default3.favoriteCardActive]: conversationState.active.id === item.id }),
@@ -2213,7 +2213,7 @@ var QuickAskEditModal_default = ({ open, onCancel, loading, onConfirm, initialVa
2213
2213
  return /* @__PURE__ */ jsxRuntime.jsxs(
2214
2214
  antd.Modal,
2215
2215
  {
2216
- title: initialValues?.id ? "\u7F16\u8F91\u5FEB\u901F\u63D0\u95EE" : "\u65B0\u589E\u5FEB\u901F\u63D0\u95EE",
2216
+ title: initialValues?.id ? "\u7F16\u8F91\u80FD\u529B\u6A21\u677F" : "\u65B0\u589E\u80FD\u529B\u6A21\u677F",
2217
2217
  open,
2218
2218
  onCancel,
2219
2219
  onOk: handleOk,
@@ -2271,10 +2271,9 @@ var styles_module_default4 = {
2271
2271
  quickAskPanel: "styles_module_quickAskPanel",
2272
2272
  tagContainer: "styles_module_tagContainer",
2273
2273
  quickAskItem: "styles_module_quickAskItem",
2274
- quickAskItemHeader: "styles_module_quickAskItemHeader",
2274
+ quickAskItemIcon: "styles_module_quickAskItemIcon",
2275
2275
  quickAskItemTitle: "styles_module_quickAskItemTitle",
2276
- quickAskItemHeaderActions: "styles_module_quickAskItemHeaderActions",
2277
- quickAskItemBody: "styles_module_quickAskItemBody"
2276
+ quickAskItemActions: "styles_module_quickAskItemActions"
2278
2277
  };
2279
2278
  var ALL = "all";
2280
2279
  var QuickAskPanelDrawer_default = ({ open, onClose }) => {
@@ -2366,6 +2365,17 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2366
2365
  } catch (err) {
2367
2366
  }
2368
2367
  };
2368
+ const onSelectItem = async (item) => {
2369
+ const canProceed = await configState.hooks?.onBeforeSelectCapacity?.(item);
2370
+ onClose();
2371
+ if (canProceed === false) {
2372
+ return;
2373
+ }
2374
+ chatStore.setContent(item.content);
2375
+ chatStore.setContentParams({
2376
+ use_template: 1
2377
+ });
2378
+ };
2369
2379
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2370
2380
  /* @__PURE__ */ jsxRuntime.jsx(
2371
2381
  antd.Drawer,
@@ -2373,7 +2383,7 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2373
2383
  className: classNames11__default.default("no-padding-drawer"),
2374
2384
  width: 360,
2375
2385
  open,
2376
- title: "\u5FEB\u901F\u63D0\u95EE",
2386
+ title: "\u80FD\u529B\u9009\u62E9",
2377
2387
  closable: { placement: "end" },
2378
2388
  onClose,
2379
2389
  placement: "right",
@@ -2392,7 +2402,7 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2392
2402
  setEditingItem(null);
2393
2403
  setEditModalOpen(true);
2394
2404
  },
2395
- children: "\u65B0\u589E\u5FEB\u901F\u63D0\u95EE"
2405
+ children: "\u65B0\u589E\u80FD\u529B\u6A21\u677F"
2396
2406
  }
2397
2407
  ),
2398
2408
  searchExpanded ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -2427,94 +2437,91 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2427
2437
  }
2428
2438
  )
2429
2439
  ] }),
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
- )) }) }) })
2440
+ /* @__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-0", children: items.length ? items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, align: "start", className: styles_module_default4.quickAskItem, onClick: () => onSelectItem(item), children: [
2441
+ /* @__PURE__ */ jsxRuntime.jsx(icons.FileTextOutlined, { className: styles_module_default4.quickAskItemIcon }),
2442
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default("flex-1 text-ellipsis-2", styles_module_default4.quickAskItemTitle), children: item.title }),
2443
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 0, className: styles_module_default4.quickAskItemActions, children: [
2444
+ /* @__PURE__ */ jsxRuntime.jsx(
2445
+ antd.Button,
2446
+ {
2447
+ variant: "text",
2448
+ color: "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
+ variant: "text",
2463
+ color: "primary",
2464
+ size: "small",
2465
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CopyOutlined, {}),
2466
+ title: "\u590D\u5236",
2467
+ onClick: (e) => {
2468
+ e.stopPropagation();
2469
+ setEditingItem({
2470
+ title: item.title,
2471
+ labelName: item.labelName,
2472
+ content: item.content
2473
+ });
2474
+ setEditModalOpen(true);
2475
+ }
2476
+ },
2477
+ "copy"
2478
+ ),
2479
+ /* @__PURE__ */ jsxRuntime.jsx(
2480
+ antd.Button,
2481
+ {
2482
+ variant: "text",
2483
+ color: "primary",
2484
+ size: "small",
2485
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EditOutlined, {}),
2486
+ title: "\u7F16\u8F91",
2487
+ onClick: (e) => {
2488
+ e.stopPropagation();
2489
+ setEditingItem(item);
2490
+ setEditModalOpen(true);
2491
+ }
2492
+ },
2493
+ "edit"
2494
+ ),
2495
+ item.canDelete && /* @__PURE__ */ jsxRuntime.jsx(
2496
+ antd.Popconfirm,
2497
+ {
2498
+ title: "\u63D0\u793A",
2499
+ okText: "\u786E\u5B9A",
2500
+ cancelText: "\u53D6\u6D88",
2501
+ description: "\u786E\u8BA4\u5220\u9664\u95EE\u9898\u5417?",
2502
+ onConfirm: (e) => {
2503
+ e.stopPropagation();
2504
+ handleDelete(item.id);
2505
+ },
2506
+ onCancel: (e) => {
2507
+ e.stopPropagation();
2508
+ },
2509
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2510
+ antd.Button,
2511
+ {
2512
+ variant: "text",
2513
+ color: "primary",
2514
+ size: "small",
2515
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}),
2516
+ title: "\u5220\u9664",
2517
+ onClick: (e) => e.stopPropagation()
2518
+ }
2519
+ )
2520
+ },
2521
+ "delete"
2522
+ )
2523
+ ] })
2524
+ ] }, item.id)) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u6570\u636E", className: "m-t-24" }) }) }) })
2518
2525
  ] })
2519
2526
  }
2520
2527
  ),
@@ -2567,7 +2574,7 @@ var FeaturesRenderer_default = () => {
2567
2574
  }
2568
2575
  ),
2569
2576
  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" }),
2577
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { size: "small", color: "primary", variant: "filled", onClick: () => setQuickAskOpen(true), children: "\u80FD\u529B\u9009\u62E9" }),
2571
2578
  quickAskOpen && /* @__PURE__ */ jsxRuntime.jsx(QuickAskPanelDrawer_default, { open: quickAskOpen, onClose: () => setQuickAskOpen(false) })
2572
2579
  ] })
2573
2580
  ] });