@zero-library/chat-agent 2.3.11 → 2.3.13

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
@@ -187,7 +187,7 @@ var init_MdEdit = __esm({
187
187
  setValue(data.content);
188
188
  }, [data.content]);
189
189
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default.mdEdit, children: [
190
- /* @__PURE__ */ jsxRuntime.jsx(common.MarkdownEditor, { disabled: loading, value, onChange: setValue, showToolbar: false }),
190
+ /* @__PURE__ */ jsxRuntime.jsx(common.MarkdownEditor, { disabled: loading, value, onChange: setValue, fixedToolbar: false, floatToolbar: false }),
191
191
  !loading && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "primary", variant: "outlined", onClick: onOk, children: btnText }) })
192
192
  ] });
193
193
  };
@@ -427,11 +427,11 @@ var createChatService = (request) => {
427
427
  const labelItemDelete = (id) => {
428
428
  return request.delete("/lolr/label/item", { id });
429
429
  };
430
- const labelsQuery = (agentId, params) => {
431
- return request.get("/lolr/label", { agentId, ...params });
430
+ const labelsQuery = (params) => {
431
+ return request.get("/lolr/label", params);
432
432
  };
433
- const labelItemsQuery = (agentId, params) => {
434
- return request.get("/lolr/label/item", { ...params, agentId });
433
+ const labelItemsQuery = (params) => {
434
+ return request.get("/lolr/label/item", params);
435
435
  };
436
436
  const labelItemTop = (params) => {
437
437
  return request.put("/lolr/label/item/top", params);
@@ -2125,6 +2125,13 @@ var ChatSender_default = react.forwardRef(
2125
2125
  onSend();
2126
2126
  }
2127
2127
  };
2128
+ const isFocusedRef = react.useRef(false);
2129
+ react.useEffect(() => {
2130
+ if (!content) return;
2131
+ if (!isFocusedRef.current) {
2132
+ senderRef.current?.focus({ cursor: "end" });
2133
+ }
2134
+ }, [content]);
2128
2135
  react.useImperativeHandle(
2129
2136
  ref,
2130
2137
  () => ({
@@ -2143,7 +2150,13 @@ var ChatSender_default = react.forwardRef(
2143
2150
  header: senderHeader,
2144
2151
  onSubmit,
2145
2152
  onChange: setInputValue,
2146
- onFocus,
2153
+ onFocus: () => {
2154
+ isFocusedRef.current = true;
2155
+ onFocus?.();
2156
+ },
2157
+ onBlur: () => {
2158
+ isFocusedRef.current = false;
2159
+ },
2147
2160
  autoSize: { minRows: 2, maxRows: 6 },
2148
2161
  onCancel,
2149
2162
  footer: ({ components }) => {
@@ -2289,7 +2302,12 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2289
2302
  const [editingItem, setEditingItem] = react.useState();
2290
2303
  const fetchCategories = async () => {
2291
2304
  try {
2292
- const res = await configState.services.request?.labelsQuery?.(receiverState.active?.id, { pageNo: 1, pageSize: 1e3 });
2305
+ const res = await configState.services.request?.labelsQuery?.({
2306
+ agentId: receiverState.active?.id,
2307
+ businessData: configState.params.businessData,
2308
+ pageNo: 1,
2309
+ pageSize: 1e3
2310
+ });
2293
2311
  if (res?.data) {
2294
2312
  setCategories(res.data?.items);
2295
2313
  if (!activeTab && res.data?.items?.length) {
@@ -2311,7 +2329,8 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2311
2329
  if (!getActiveTab()) return;
2312
2330
  try {
2313
2331
  setLoading(true);
2314
- const res = await configState.services.request?.labelItemsQuery?.(receiverState.active?.id, {
2332
+ const res = await configState.services.request?.labelItemsQuery?.({
2333
+ agentId: receiverState.active?.id,
2315
2334
  labelId: getActiveTab(),
2316
2335
  keyword: getSearchText()
2317
2336
  });
@@ -2368,9 +2387,10 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2368
2387
  if (canProceed === false) {
2369
2388
  return;
2370
2389
  }
2371
- chatStore.setContent(item.content);
2390
+ chatStore.setContent(`#${item.title}# `);
2372
2391
  chatStore.setContentParams({
2373
- use_template: 1
2392
+ capacityId: item.id,
2393
+ capacityTitle: item.title
2374
2394
  });
2375
2395
  };
2376
2396
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -2388,11 +2408,10 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2388
2408
  children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: styles_module_default4.quickAskPanel, children: [
2389
2409
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 12, className: "p-16", vertical: true, children: [
2390
2410
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, children: [
2391
- !searchExpanded && /* @__PURE__ */ jsxRuntime.jsx(
2411
+ !searchExpanded ? /* @__PURE__ */ jsxRuntime.jsx(
2392
2412
  antd.Button,
2393
2413
  {
2394
2414
  type: "dashed",
2395
- block: true,
2396
2415
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2397
2416
  className: "flex-1",
2398
2417
  onClick: () => {
@@ -2401,6 +2420,20 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2401
2420
  },
2402
2421
  children: "\u65B0\u589E\u80FD\u529B\u6A21\u677F"
2403
2422
  }
2423
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2424
+ antd.Button,
2425
+ {
2426
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2427
+ onClick: () => {
2428
+ if (getSearchText()) {
2429
+ setSearchText("");
2430
+ fetchItems();
2431
+ }
2432
+ setSearchExpanded(false);
2433
+ setEditingItem(null);
2434
+ setEditModalOpen(true);
2435
+ }
2436
+ }
2404
2437
  ),
2405
2438
  searchExpanded ? /* @__PURE__ */ jsxRuntime.jsx(
2406
2439
  antd.Input,
@@ -2414,8 +2447,7 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
2414
2447
  fetchItems();
2415
2448
  },
2416
2449
  className: "flex-1",
2417
- allowClear: true,
2418
- onBlur: () => setSearchExpanded(false)
2450
+ allowClear: true
2419
2451
  }
2420
2452
  ) : /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, {}), onClick: () => setSearchExpanded(true) })
2421
2453
  ] }),
@@ -2777,7 +2809,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2777
2809
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
2778
2810
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
2779
2811
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className: "flex-1", onResize: setSplitterSizes, children: [
2780
- /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: hasPreView && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2812
+ hasPreView && /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2781
2813
  configState.preview.file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
2782
2814
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default5.nsPreviewHeader, children: [
2783
2815
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default5.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),