@zero-library/chat-agent 2.3.2 → 2.3.4

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
@@ -2139,6 +2139,8 @@ var styles_module_default4 = {
2139
2139
  tagContainer: "styles_module_tagContainer",
2140
2140
  quickAskItem: "styles_module_quickAskItem",
2141
2141
  quickAskItemHeader: "styles_module_quickAskItemHeader",
2142
+ quickAskItemTitle: "styles_module_quickAskItemTitle",
2143
+ quickAskItemHeaderActions: "styles_module_quickAskItemHeaderActions",
2142
2144
  quickAskItemBody: "styles_module_quickAskItemBody"
2143
2145
  };
2144
2146
  var QuickAskPanel_default = () => {
@@ -2162,8 +2164,10 @@ var QuickAskPanel_default = () => {
2162
2164
  } catch (err) {
2163
2165
  }
2164
2166
  };
2167
+ const [loading, setLoading] = react.useState(false);
2165
2168
  const fetchItems = common.useDebounce(async () => {
2166
2169
  try {
2170
+ setLoading(true);
2167
2171
  const res = await configState.services.request?.labelItemsQuery?.(receiverState.active?.id, {
2168
2172
  labelId: getActiveTab().id,
2169
2173
  keyword: getSearchText()
@@ -2171,7 +2175,8 @@ var QuickAskPanel_default = () => {
2171
2175
  if (res?.data) {
2172
2176
  setItems(res.data);
2173
2177
  }
2174
- } catch (err) {
2178
+ } finally {
2179
+ setLoading(false);
2175
2180
  }
2176
2181
  });
2177
2182
  react.useEffect(() => {
@@ -2180,10 +2185,10 @@ var QuickAskPanel_default = () => {
2180
2185
  fetchItems();
2181
2186
  }
2182
2187
  }, [receiverState.active?.id]);
2183
- const [loading, setLoading] = react.useState(false);
2188
+ const [updateLoading, setUpdateLoading] = react.useState(false);
2184
2189
  const handleEditConfirm = async (values) => {
2185
2190
  try {
2186
- setLoading(true);
2191
+ setUpdateLoading(true);
2187
2192
  await configState.services.request?.labelItemUpdate?.(receiverState.active?.id, values);
2188
2193
  setEditModalOpen(false);
2189
2194
  message2.success("\u4FDD\u5B58\u6210\u529F");
@@ -2192,7 +2197,7 @@ var QuickAskPanel_default = () => {
2192
2197
  }
2193
2198
  fetchCategories();
2194
2199
  } finally {
2195
- setLoading(false);
2200
+ setUpdateLoading(false);
2196
2201
  }
2197
2202
  };
2198
2203
  const handleDelete = async (id) => {
@@ -2277,7 +2282,7 @@ var QuickAskPanel_default = () => {
2277
2282
  c.id
2278
2283
  ))
2279
2284
  ] }),
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(
2285
+ /* @__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
2286
  "div",
2282
2287
  {
2283
2288
  className: styles_module_default4.quickAskItem,
@@ -2288,9 +2293,9 @@ var QuickAskPanel_default = () => {
2288
2293
  });
2289
2294
  },
2290
2295
  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: [
2296
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "space-between", align: "center", className: styles_module_default4.quickAskItemHeader, children: [
2297
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default("flex-1 text-ellipsis", styles_module_default4.quickAskItemTitle), children: item.title }),
2298
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 4, className: styles_module_default4.quickAskItemHeaderActions, children: [
2294
2299
  /* @__PURE__ */ jsxRuntime.jsx(
2295
2300
  antd.Button,
2296
2301
  {
@@ -2314,11 +2319,12 @@ var QuickAskPanel_default = () => {
2314
2319
  title: "\u590D\u5236",
2315
2320
  onClick: (e) => {
2316
2321
  e.stopPropagation();
2317
- handleEditConfirm({
2322
+ setEditingItem({
2318
2323
  title: item.title,
2319
2324
  labelName: item.labelName,
2320
2325
  content: item.content
2321
2326
  });
2327
+ setEditModalOpen(true);
2322
2328
  }
2323
2329
  },
2324
2330
  "copy"
@@ -2359,14 +2365,14 @@ var QuickAskPanel_default = () => {
2359
2365
  ]
2360
2366
  },
2361
2367
  item.id
2362
- )) }) }),
2368
+ )) }) }) }),
2363
2369
  editModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
2364
2370
  QuickAskEditModal_default,
2365
2371
  {
2366
2372
  open: editModalOpen,
2367
2373
  onCancel: () => setEditModalOpen(false),
2368
2374
  onConfirm: handleEditConfirm,
2369
- loading,
2375
+ loading: updateLoading,
2370
2376
  initialValues: editingItem,
2371
2377
  categories
2372
2378
  }
@@ -2583,7 +2589,8 @@ var styles_module_default5 = {
2583
2589
  nsDisclaimerNotice: "styles_module_nsDisclaimerNotice",
2584
2590
  nsChatLayout: "styles_module_nsChatLayout",
2585
2591
  nsChatBody: "styles_module_nsChatBody",
2586
- nsBodyWidth: "styles_module_nsBodyWidth"
2592
+ nsBodyWidth: "styles_module_nsBodyWidth",
2593
+ nsPrompts: "styles_module_nsPrompts"
2587
2594
  };
2588
2595
  var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout, config, services }, ref) => {
2589
2596
  const chatStore = react.useMemo(() => createChatStore(), []);
@@ -2752,13 +2759,14 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2752
2759
  DefaultComponent: receiverState?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
2753
2760
  x.Prompts,
2754
2761
  {
2762
+ className: styles_module_default5.nsPrompts,
2755
2763
  vertical: true,
2756
2764
  title: "\u63A8\u8350\u95EE\u9898:",
2757
2765
  onItemClick: ({ data }) => chatStore.sendMessage(data.key),
2758
2766
  items: receiverState?.recommendQuestions.map((question) => ({
2759
2767
  key: question,
2760
2768
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.FileSearchOutlined, {}),
2761
- description: question
2769
+ description: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis", children: question })
2762
2770
  }))
2763
2771
  }
2764
2772
  )