@glodon-aiot/agent-cli-ui 3.9.0-alpha.7 → 3.9.0-beta.10

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.
Files changed (89) hide show
  1. package/dist/es/Dialog/AgentChat/HistoryItem/SessionRefer/index.mjs +8 -8
  2. package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +4 -4
  3. package/dist/es/Dialog/SessionList/index.mjs +178 -166
  4. package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +51 -51
  5. package/dist/es/packages/agent-cli-ui/package.json.mjs +11 -11
  6. package/dist/es/packages/react-components/dist/es/components/Markdown/index.mjs +22 -23
  7. package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
  8. package/dist/es/src/style13.css +1 -1
  9. package/dist/es/src/style14.css +1 -1
  10. package/dist/es/src/style15.css +1 -1
  11. package/dist/es/src/style16.css +1 -1
  12. package/dist/es/src/style17.css +1 -1
  13. package/dist/es/src/style18.css +1 -1
  14. package/dist/es/src/style20.css +1 -1
  15. package/dist/es/src/style21.css +1 -1
  16. package/dist/es/src/style22.css +1 -1
  17. package/dist/es/src/style24.css +1 -1
  18. package/dist/es/src/style25.css +1 -1
  19. package/dist/es/src/style27.css +1 -1
  20. package/dist/es/src/style28.css +1 -1
  21. package/dist/es/src/style7.css +1 -1
  22. package/dist/es/src/style9.css +1 -1
  23. package/dist/lib/index.js +69 -70
  24. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/fetch.d.ts +44 -0
  25. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/index.d.ts +1 -0
  26. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/parse.d.ts +36 -0
  27. package/dist/src/utils/reactCompatibility.d.ts +27 -0
  28. package/dist/src/utils/testAntdPrefix.d.ts +3 -0
  29. package/package.json +3 -3
  30. package/dist/es/node_modules/hast-util-from-parse5/lib/index.mjs +0 -162
  31. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/index.mjs +0 -12
  32. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/aria.mjs +0 -61
  33. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/find.mjs +0 -33
  34. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/html.mjs +0 -368
  35. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/normalize.mjs +0 -6
  36. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/svg.mjs +0 -566
  37. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/case-insensitive-transform.mjs +0 -7
  38. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/case-sensitive-transform.mjs +0 -6
  39. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/create.mjs +0 -14
  40. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/defined-info.mjs +0 -36
  41. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/info.mjs +0 -28
  42. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/merge.mjs +0 -10
  43. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/schema.mjs +0 -21
  44. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/types.mjs +0 -15
  45. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/xlink.mjs +0 -19
  46. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/xml.mjs +0 -15
  47. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/xmlns.mjs +0 -16
  48. package/dist/es/node_modules/hast-util-from-parse5/node_modules/vfile-location/lib/index.mjs +0 -47
  49. package/dist/es/node_modules/hast-util-from-parse5/node_modules/web-namespaces/index.mjs +0 -11
  50. package/dist/es/node_modules/rehype-raw/lib/index.mjs +0 -26
  51. package/dist/es/node_modules/rehype-raw/node_modules/entities/dist/esm/decode-codepoint.mjs +0 -38
  52. package/dist/es/node_modules/rehype-raw/node_modules/entities/dist/esm/decode.mjs +0 -251
  53. package/dist/es/node_modules/rehype-raw/node_modules/entities/dist/esm/generated/decode-data-html.mjs +0 -7
  54. package/dist/es/node_modules/rehype-raw/node_modules/hast-util-raw/lib/index.mjs +0 -249
  55. package/dist/es/node_modules/rehype-raw/node_modules/hast-util-to-parse5/lib/index.mjs +0 -125
  56. package/dist/es/node_modules/rehype-raw/node_modules/html-void-elements/index.mjs +0 -4
  57. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/doctype.mjs +0 -34
  58. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/error-codes.mjs +0 -7
  59. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/foreign-content.mjs +0 -103
  60. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/html.mjs +0 -44
  61. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/token.mjs +0 -14
  62. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/unicode.mjs +0 -38
  63. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/parser/formatting-element-list.mjs +0 -91
  64. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/parser/index.mjs +0 -2308
  65. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/parser/open-element-stack.mjs +0 -220
  66. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/serializer/index.mjs +0 -2
  67. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/tokenizer/index.mjs +0 -1948
  68. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/tokenizer/preprocessor.mjs +0 -92
  69. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/tree-adapters/default.mjs +0 -173
  70. package/dist/es/node_modules/rehype-raw/node_modules/property-information/index.mjs +0 -12
  71. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/aria.mjs +0 -61
  72. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/find.mjs +0 -33
  73. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/html.mjs +0 -368
  74. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/normalize.mjs +0 -6
  75. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/svg.mjs +0 -566
  76. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/case-insensitive-transform.mjs +0 -7
  77. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/case-sensitive-transform.mjs +0 -6
  78. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/create.mjs +0 -17
  79. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/defined-info.mjs +0 -27
  80. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/info.mjs +0 -23
  81. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/merge.mjs +0 -11
  82. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/schema.mjs +0 -17
  83. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/types.mjs +0 -15
  84. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/xlink.mjs +0 -19
  85. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/xml.mjs +0 -15
  86. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/xmlns.mjs +0 -16
  87. package/dist/es/node_modules/rehype-raw/node_modules/unist-util-visit/lib/index.mjs +0 -16
  88. package/dist/es/node_modules/rehype-raw/node_modules/web-namespaces/index.mjs +0 -11
  89. package/dist/es/node_modules/zwitch/index.mjs +0 -18
@@ -1,15 +1,15 @@
1
- var R = Object.defineProperty, T = Object.defineProperties;
2
- var U = Object.getOwnPropertyDescriptors;
1
+ var F = Object.defineProperty, R = Object.defineProperties;
2
+ var T = Object.getOwnPropertyDescriptors;
3
3
  var f = Object.getOwnPropertySymbols;
4
- var $ = Object.prototype.hasOwnProperty, b = Object.prototype.propertyIsEnumerable;
5
- var h = (a, e, n) => e in a ? R(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, w = (a, e) => {
4
+ var U = Object.prototype.hasOwnProperty, b = Object.prototype.propertyIsEnumerable;
5
+ var h = (a, e, n) => e in a ? F(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, w = (a, e) => {
6
6
  for (var n in e || (e = {}))
7
- $.call(e, n) && h(a, n, e[n]);
7
+ U.call(e, n) && h(a, n, e[n]);
8
8
  if (f)
9
9
  for (var n of f(e))
10
10
  b.call(e, n) && h(a, n, e[n]);
11
11
  return a;
12
- }, k = (a, e) => T(a, U(e));
12
+ }, k = (a, e) => R(a, T(e));
13
13
  import { jsxs as t, jsx as s } from "react/jsx-runtime";
14
14
  import { useContext as j } from "react";
15
15
  import { Space as I, Collapse as C } from "antd";
@@ -69,8 +69,8 @@ const {
69
69
  children: [i + 1, "."]
70
70
  }), d && /* @__PURE__ */ s(A, {
71
71
  data: o,
72
- loadPage: (x, S, D) => d.getKnowledgeIdFileIdData(x, S, D).then((y) => {
73
- const l = (y || []).find((F) => F.key === "pages_from");
72
+ loadPage: (x, S, D) => d.getKnowledgeIdFileIdData(x, S, D).then(($) => {
73
+ const l = ($ || []).find((y) => y.key === "pages_from");
74
74
  return (l == null ? void 0 : l.value) || 0;
75
75
  }),
76
76
  onClick: v
@@ -184,7 +184,7 @@ const Je = (s) => {
184
184
  ghost: !0,
185
185
  expandIconPosition: "right",
186
186
  children: (O = n.actions) == null ? void 0 : O.map((t, M) => {
187
- var J, P, Q, q, D, H, V, W, $, G, K, X;
187
+ var J, P, Q, q, D, H, $, V, W, G, K, X;
188
188
  return /* @__PURE__ */ o(Ne, {
189
189
  collapsible: S ? "header" : "icon",
190
190
  showArrow: S,
@@ -217,10 +217,10 @@ const Je = (s) => {
217
217
  }), (t[t.length - 1].type === "BEFORE_CALL" || t[t.length - 1].type === "FUNCTION_CALL") && /* @__PURE__ */ e("span", {
218
218
  className: "bot-plugin-result",
219
219
  children: "执行中"
220
- }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && g((V = t.find((a) => a.type === "RESULT")) == null ? void 0 : V.data.result) && /* @__PURE__ */ e("span", {
220
+ }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && g(($ = t.find((a) => a.type === "RESULT")) == null ? void 0 : $.data.result) && /* @__PURE__ */ e("span", {
221
221
  className: "bot-plugin-result",
222
222
  children: "执行成功"
223
- }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && !g((W = t.find((a) => a.type === "RESULT")) == null ? void 0 : W.data.result) && /* @__PURE__ */ e("span", {
223
+ }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && !g((V = t.find((a) => a.type === "RESULT")) == null ? void 0 : V.data.result) && /* @__PURE__ */ e("span", {
224
224
  className: "bot-plugin-result",
225
225
  children: "执行失败"
226
226
  }), t[t.length - 1].type === "ABORT" && /* @__PURE__ */ e("span", {
@@ -234,7 +234,7 @@ const Je = (s) => {
234
234
  }), /* @__PURE__ */ e("div", {
235
235
  className: "bot-plugin-json",
236
236
  children: /* @__PURE__ */ e(u, {
237
- josn: ($ = t.find((a) => a.type === "BEFORE_CALL")) == null ? void 0 : $.data.thought
237
+ josn: (W = t.find((a) => a.type === "BEFORE_CALL")) == null ? void 0 : W.data.thought
238
238
  })
239
239
  }), /* @__PURE__ */ e("div", {
240
240
  className: "bot-plugin-content",
@@ -1,87 +1,88 @@
1
- var Pe = Object.defineProperty;
2
- var he = Object.getOwnPropertySymbols;
3
- var je = Object.prototype.hasOwnProperty, De = Object.prototype.propertyIsEnumerable;
4
- var me = (A, u, a) => u in A ? Pe(A, u, { enumerable: !0, configurable: !0, writable: !0, value: a }) : A[u] = a, pe = (A, u) => {
5
- for (var a in u || (u = {}))
6
- je.call(u, a) && me(A, a, u[a]);
7
- if (he)
8
- for (var a of he(u))
9
- De.call(u, a) && me(A, a, u[a]);
10
- return A;
1
+ var De = Object.defineProperty;
2
+ var pe = Object.getOwnPropertySymbols;
3
+ var Ie = Object.prototype.hasOwnProperty, Re = Object.prototype.propertyIsEnumerable;
4
+ var ue = (N, g, a) => g in N ? De(N, g, { enumerable: !0, configurable: !0, writable: !0, value: a }) : N[g] = a, ye = (N, g) => {
5
+ for (var a in g || (g = {}))
6
+ Ie.call(g, a) && ue(N, a, g[a]);
7
+ if (pe)
8
+ for (var a of pe(g))
9
+ Re.call(g, a) && ue(N, a, g[a]);
10
+ return N;
11
11
  };
12
- var L = (A, u, a) => new Promise((r, O) => {
13
- var k = (N) => {
12
+ var L = (N, g, a) => new Promise((r, O) => {
13
+ var b = (E) => {
14
14
  try {
15
- M(a.next(N));
15
+ M(a.next(E));
16
16
  } catch (x) {
17
17
  O(x);
18
18
  }
19
- }, J = (N) => {
19
+ }, ee = (E) => {
20
20
  try {
21
- M(a.throw(N));
21
+ M(a.throw(E));
22
22
  } catch (x) {
23
23
  O(x);
24
24
  }
25
- }, M = (N) => N.done ? r(N.value) : Promise.resolve(N.value).then(k, J);
26
- M((a = a.apply(A, u)).next());
25
+ }, M = (E) => E.done ? r(E.value) : Promise.resolve(E.value).then(b, ee);
26
+ M((a = a.apply(N, g)).next());
27
27
  });
28
- import { jsx as f, jsxs as S } from "react/jsx-runtime";
29
- import { forwardRef as Ie, useState as b, useContext as Re, useRef as H, useEffect as D, useImperativeHandle as Ye, useMemo as $e } from "react";
30
- import { Button as Ve, Typography as Ce, Space as ue, Popconfirm as ye, Input as He, Divider as Fe } from "antd";
31
- import h from "dayjs";
32
- import Ke from "classnames";
33
- import ge from "../../components/Iconfont/index.mjs";
34
- import ze from "../../context.mjs";
35
- /* empty css */import { useMemoizedFn as ve } from "ahooks";
36
- import { MAX_KNOWLEDGES_AND_FILES_COUNT as F, NET_OPEN_STATUS as we } from "../../constant.mjs";
37
- import { useSessionState as Be } from "../../hooks/useSessionState.mjs";
38
- import { calcKnowledgesLeafCount as Ae } from "../../utils/index.mjs";
39
- const q = 15, Ge = Ie((A, u) => {
28
+ import { jsx as f, jsxs as T } from "react/jsx-runtime";
29
+ import { forwardRef as Se, useState as k, useContext as Ye, useRef as V, useEffect as D, useImperativeHandle as $e, useMemo as He } from "react";
30
+ import { Button as Ve, Typography as Fe, Space as ge, Popconfirm as ve, Input as Ke, Divider as ze, notification as J } from "antd";
31
+ import p from "dayjs";
32
+ import Be from "classnames";
33
+ import Ae from "../../components/Iconfont/index.mjs";
34
+ import Ge from "../../context.mjs";
35
+ /* empty css */import { useMemoizedFn as Ne } from "ahooks";
36
+ import { MAX_KNOWLEDGES_AND_FILES_COUNT as F, NET_OPEN_STATUS as Ee } from "../../constant.mjs";
37
+ import { useSessionState as Ue } from "../../hooks/useSessionState.mjs";
38
+ import { calcKnowledgesLeafCount as we } from "../../utils/index.mjs";
39
+ const Q = 15, Xe = Se((N, g) => {
40
40
  const {
41
41
  currentSession: a,
42
42
  setCurrentSession: r,
43
43
  checkKnowledges: O,
44
- application: k,
45
- networkStatus: J,
44
+ application: b,
45
+ networkStatus: ee,
46
46
  isShowHeader: M = !0,
47
- afterSessionClick: N,
47
+ afterSessionClick: E,
48
48
  sessionId: x
49
- } = A, [K, z] = b(), {
50
- agentClient: m,
51
- mode: Q,
52
- features: o
53
- } = Re(ze), [ee, te] = b(O), {
54
- sessions: T,
55
- setSessions: _
56
- } = Be(), [ae, B] = b(0), [Ne, I] = b(""), [Ee, oe] = b(null), P = 30, [G, R] = b(!1), [Y, $] = b(!0), [ke, V] = b(!1), C = H(void 0), j = H(0), U = H(null), X = H(null), ne = (e) => {
49
+ } = N, [K, z] = k(), {
50
+ agentClient: u,
51
+ mode: te,
52
+ features: o,
53
+ popupContainer: B
54
+ } = Ye(Ge), [ae, oe] = k(O), {
55
+ sessions: _,
56
+ setSessions: P
57
+ } = Ue(), [ne, G] = k(0), [be, I] = k(""), [ke, de] = k(null), j = 30, [U, R] = k(!1), [S, Y] = k(!0), [Oe, $] = k(!1), H = V(void 0), C = V(0), X = V(null), W = V(null), re = (e) => {
57
58
  var n, s;
58
59
  if (!(e != null && e.length))
59
60
  return;
60
61
  let t = (s = (n = e[0]) == null ? void 0 : n.data) == null ? void 0 : s.createdAt;
61
62
  return e.forEach((d) => {
62
- var l, p, g, w;
63
- t ? (p = d.data) != null && p.createdAt && h((g = d.data) == null ? void 0 : g.createdAt).valueOf() < h(t).valueOf() && (t = (w = d.data) == null ? void 0 : w.createdAt) : t = (l = d.data) == null ? void 0 : l.createdAt;
63
+ var l, m, h, y;
64
+ t ? (m = d.data) != null && m.createdAt && p((h = d.data) == null ? void 0 : h.createdAt).valueOf() < p(t).valueOf() && (t = (y = d.data) == null ? void 0 : y.createdAt) : t = (l = d.data) == null ? void 0 : l.createdAt;
64
65
  }), t;
65
- }, de = ve((e) => {
66
- e.id && _((t) => [...t.map((d) => {
66
+ }, ie = Ne((e) => {
67
+ e.id && P((t) => [...t.map((d) => {
67
68
  var l;
68
- return ((l = d.data) == null ? void 0 : l.id) === e.id && (d.data = pe({}, e)), d;
69
+ return ((l = d.data) == null ? void 0 : l.id) === e.id && (d.data = ye({}, e)), d;
69
70
  })].sort((d, l) => {
70
- var w, E;
71
- const p = h((w = d.data) == null ? void 0 : w.createdAt).valueOf();
72
- return h((E = l.data) == null ? void 0 : E.createdAt).valueOf() - p;
71
+ var y, w;
72
+ const m = p((y = d.data) == null ? void 0 : y.createdAt).valueOf();
73
+ return p((w = l.data) == null ? void 0 : w.createdAt).valueOf() - m;
73
74
  }));
74
75
  });
75
76
  D(() => {
76
- if (Q === "float") {
77
+ if (te === "float") {
77
78
  a === void 0 && !x && (r == null || r(null));
78
79
  return;
79
80
  }
80
- R(!0), C.current = void 0, j.current = 0, m == null || m.getSessions({
81
- pageSize: P
81
+ R(!0), H.current = void 0, C.current = 0, u == null || u.getSessions({
82
+ pageSize: j
82
83
  }).then((e) => L(void 0, null, function* () {
83
84
  var t;
84
- if (_([...e]), j.current = e.length, C.current = ne(e), $(e.length >= P), V(e.length < P), !((t = a == null ? void 0 : a.data) != null && t.id) && (e != null && e.length) && Q === "inlay") {
85
+ if (P([...e]), C.current = e.length, H.current = re(e), Y(e.length >= j), $(e.length < j), !((t = a == null ? void 0 : a.data) != null && t.id) && (e != null && e.length) && te === "inlay") {
85
86
  const n = e[0];
86
87
  x || r == null || r(n);
87
88
  } else
@@ -93,97 +94,108 @@ const q = 15, Ge = Ie((A, u) => {
93
94
  const t = typeof (o == null ? void 0 : o.knowledges) == "object" && o.knowledges.default || void 0;
94
95
  if (Array.isArray(t) && t.some((d) => Array.isArray(d.fileIds) && d.fileIds.length === 0))
95
96
  throw Error("fileIds cannot be an empty array");
96
- if (Ae(t || []) > F)
97
+ if (we(t || []) > F)
97
98
  throw Error(`knowledges and fileIds total count cannot exceed ${F}`);
98
- te(t);
99
+ oe(t);
99
100
  return;
100
101
  }
101
- te(O);
102
+ oe(O);
102
103
  }, [O]), D(() => {
103
- a == null || a.addEventListener("data:updated", de);
104
- }, [a]), Ye(u, () => ({
104
+ a == null || a.addEventListener("data:updated", ie);
105
+ }, [a]), $e(g, () => ({
105
106
  create(e) {
106
- return re(e).then((t) => (r == null || r(t), t));
107
+ return le(e).then((t) => (r == null || r(t), t));
107
108
  },
108
- list: () => Promise.resolve(T)
109
+ list: () => Promise.resolve(_)
109
110
  }));
110
- const re = (e) => {
111
+ const le = (e) => {
111
112
  const t = typeof (o == null ? void 0 : o.connectNetwork) == "object" && typeof (o == null ? void 0 : o.connectNetwork.default) == "boolean" ? o.connectNetwork.default : !1;
112
113
  return new Promise((n) => L(void 0, null, function* () {
113
- var l;
114
- const s = typeof (o == null ? void 0 : o.promptVariables) == "object" ? (o == null ? void 0 : o.promptVariables.default) || [] : void 0, d = yield m == null ? void 0 : m.loadSession("", {
114
+ var m;
115
+ const s = typeof (o == null ? void 0 : o.promptVariables) == "object" ? (o == null ? void 0 : o.promptVariables.default) || [] : void 0, d = yield u == null ? void 0 : u.loadSession("", {
115
116
  name: e == null ? void 0 : e.name,
116
117
  // @ts-ignore netOpen入参是number 响应是boolen
117
118
  // 只有对话有联网 其它没有
118
119
  // 不传netOpen会默认取defaultNetOpen
119
- netOpen: (k == null ? void 0 : k.type) === 0 ? e != null && e.netOpen ? e.netOpen : t ? we.OPEN : we.CLOSE : void 0,
120
- knowledges: (l = a == null ? void 0 : a.data) != null && l.id ? e == null ? void 0 : e.knowledges : ee,
120
+ netOpen: (b == null ? void 0 : b.type) === 0 ? e != null && e.netOpen ? e.netOpen : t ? Ee.OPEN : Ee.CLOSE : void 0,
121
+ knowledges: (m = a == null ? void 0 : a.data) != null && m.id ? e == null ? void 0 : e.knowledges : ae,
121
122
  promptVariables: s
122
- });
123
- d == null || d.addEventListener("data:created", () => L(void 0, null, function* () {
124
- _([d, ...T]), n(d);
123
+ }), l = (h) => {
124
+ var y;
125
+ J.config({
126
+ getContainer: () => (B == null ? void 0 : B.current) || document.body,
127
+ prefixCls: "gbot-notification"
128
+ }), J.error({
129
+ message: ((y = h.cause) == null ? void 0 : y.message) || h.message
130
+ }), J.config({
131
+ getContainer: void 0,
132
+ prefixCls: "gbot-notification"
133
+ });
134
+ };
135
+ d == null || d.addEventListener("error", l), d == null || d.addEventListener("data:created", () => L(void 0, null, function* () {
136
+ d == null || d.removeEventListener("error", l), P([d, ..._]), n(d);
125
137
  }));
126
138
  }));
127
- }, be = () => {
128
- re({
129
- knowledges: ee
139
+ }, Me = () => {
140
+ le({
141
+ knowledges: ae
130
142
  }).then((e) => {
131
143
  r == null || r(e);
132
144
  });
133
- }, Oe = (e) => {
134
- m == null || m.removeSession(e, !0).then(() => L(void 0, null, function* () {
145
+ }, xe = (e) => {
146
+ u == null || u.removeSession(e, !0).then(() => L(void 0, null, function* () {
135
147
  var n, s;
136
- const t = T.filter((d) => {
137
- var l, p;
138
- return ((l = d.data) == null ? void 0 : l.id) !== ((p = e.data) == null ? void 0 : p.id);
148
+ const t = _.filter((d) => {
149
+ var l, m;
150
+ return ((l = d.data) == null ? void 0 : l.id) !== ((m = e.data) == null ? void 0 : m.id);
139
151
  });
140
- ((n = e.data) == null ? void 0 : n.id) === ((s = a == null ? void 0 : a.data) == null ? void 0 : s.id) && (t != null && t.length ? r == null || r(t[0]) : r == null || r(null)), _([...t]);
152
+ ((n = e.data) == null ? void 0 : n.id) === ((s = a == null ? void 0 : a.data) == null ? void 0 : s.id) && (t != null && t.length ? r == null || r(t[0]) : r == null || r(null)), P([...t]);
141
153
  }));
142
- }, Me = () => L(void 0, null, function* () {
143
- if (!(G || !Y)) {
154
+ }, Le = () => L(void 0, null, function* () {
155
+ if (!(U || !S)) {
144
156
  R(!0);
145
157
  try {
146
- const e = yield m == null ? void 0 : m.getSessions({
147
- pageSize: P,
148
- beforeTime: C.current
149
- }), t = (e == null ? void 0 : e.length) || 0, n = t - j.current;
150
- _([...e || []]), C.current = ne(e || []), n <= 0 ? ($(!1), V(!0)) : n < P ? ($(!1), V(!0), j.current = t) : ($(!0), V(!1), j.current = t);
158
+ const e = yield u == null ? void 0 : u.getSessions({
159
+ pageSize: j,
160
+ beforeTime: H.current
161
+ }), t = (e == null ? void 0 : e.length) || 0, n = t - C.current;
162
+ P([...e || []]), H.current = re(e || []), n <= 0 ? (Y(!1), $(!0)) : n < j ? (Y(!1), $(!0), C.current = t) : (Y(!0), $(!1), C.current = t);
151
163
  } finally {
152
164
  R(!1);
153
165
  }
154
166
  }
155
167
  });
156
168
  D(() => {
157
- if (!U.current || !X.current)
169
+ if (!X.current || !W.current)
158
170
  return;
159
- const e = U.current, t = X.current, n = new IntersectionObserver((s) => {
160
- s[0].isIntersecting && Y && !G && Me();
171
+ const e = X.current, t = W.current, n = new IntersectionObserver((s) => {
172
+ s[0].isIntersecting && S && !U && Le();
161
173
  }, {
162
174
  root: e,
163
175
  rootMargin: "0px 0px 200px 0px",
164
176
  threshold: 0
165
177
  });
166
178
  return n.observe(t), () => n.disconnect();
167
- }, [Y, G]);
168
- const xe = (e) => {
179
+ }, [S, U]);
180
+ const Te = (e) => {
169
181
  var t, n;
170
- z((t = e.data) == null ? void 0 : t.name), I(""), oe(((n = e.data) == null ? void 0 : n.id) || null);
171
- }, Le = (e) => {
172
- const t = le(K || "");
182
+ z((t = e.data) == null ? void 0 : t.name), I(""), de(((n = e.data) == null ? void 0 : n.id) || null);
183
+ }, _e = (e) => {
184
+ const t = se(K || "");
173
185
  if (t) {
174
186
  I(t);
175
187
  return;
176
188
  }
177
- e.rename(K.trim()), e == null || e.addEventListener("data:updated", de), ie();
178
- }, Se = () => {
179
- ie();
180
- }, ie = () => {
181
- oe(null), z(""), I(""), B((e) => e + 1);
182
- }, le = (e) => !e || e.trim().length === 0 ? "会话名称不能为空" : e.length > q ? `不能超过${q}个字符` : "", Te = (e) => L(void 0, null, function* () {
183
- r == null || r(e), N == null || N(e);
184
- }), _e = (e) => {
189
+ e.rename(K.trim()), e == null || e.addEventListener("data:updated", ie), ce();
190
+ }, Pe = () => {
191
+ ce();
192
+ }, ce = () => {
193
+ de(null), z(""), I(""), G((e) => e + 1);
194
+ }, se = (e) => !e || e.trim().length === 0 ? "会话名称不能为空" : e.length > Q ? `不能超过${Q}个字符` : "", je = (e) => L(void 0, null, function* () {
195
+ r == null || r(e), E == null || E(e);
196
+ }), Ce = (e) => {
185
197
  const t = e.target.value;
186
- z(t), I(le(t));
198
+ z(t), I(se(t));
187
199
  };
188
200
  D(() => {
189
201
  var t, n, s, d;
@@ -191,85 +203,85 @@ const q = 15, Ge = Ie((A, u) => {
191
203
  return;
192
204
  const e = {};
193
205
  if (typeof (o == null ? void 0 : o.knowledges) == "object" && ((t = o == null ? void 0 : o.knowledges) != null && t.default)) {
194
- if (e.knowledges = (n = o == null ? void 0 : o.knowledges) == null ? void 0 : n.default, Array.isArray(e.knowledges) && e.knowledges.some((g) => Array.isArray(g.fileIds) && g.fileIds.length === 0))
206
+ if (e.knowledges = (n = o == null ? void 0 : o.knowledges) == null ? void 0 : n.default, Array.isArray(e.knowledges) && e.knowledges.some((h) => Array.isArray(h.fileIds) && h.fileIds.length === 0))
195
207
  throw Error("fileIds cannot be an empty array");
196
- if (Ae(e.knowledges) > F)
208
+ if (we(e.knowledges) > F)
197
209
  throw Error(`knowledges and fileIds total count cannot exceed ${F}`);
198
210
  }
199
- typeof (o == null ? void 0 : o.promptVariables) == "object" && ((s = o == null ? void 0 : o.promptVariables) != null && s.default) && (e.promptVariables = (d = o == null ? void 0 : o.promptVariables) == null ? void 0 : d.default), m == null || m.loadSession(a.id, e);
211
+ typeof (o == null ? void 0 : o.promptVariables) == "object" && ((s = o == null ? void 0 : o.promptVariables) != null && s.default) && (e.promptVariables = (d = o == null ? void 0 : o.promptVariables) == null ? void 0 : d.default), u == null || u.loadSession(a.id, e);
200
212
  }, [a]);
201
- const ce = ve((e) => {
202
- const t = h().endOf("day"), n = t.subtract(1, "day"), s = t.subtract(7, "day"), d = t.subtract(30, "day"), l = [], p = [], g = [], w = [], E = {};
213
+ const fe = Ne((e) => {
214
+ const t = p().endOf("day"), n = t.subtract(1, "day"), s = t.subtract(7, "day"), d = t.subtract(30, "day"), l = [], m = [], h = [], y = [], w = {};
203
215
  return e.forEach((c) => {
204
- var v;
205
- const i = h((v = c.data) == null ? void 0 : v.createdAt);
216
+ var A;
217
+ const i = p((A = c.data) == null ? void 0 : A.createdAt);
206
218
  if (i.isAfter(n))
207
- p.push(c);
219
+ m.push(c);
208
220
  else if (i.isAfter(s))
209
- g.push(c);
221
+ h.push(c);
210
222
  else if (i.isAfter(d))
211
- w.push(c);
223
+ y.push(c);
212
224
  else {
213
- const y = i.format("YYYY-MM");
214
- E[y] || (E[y] = []), E[y].push(c);
225
+ const v = i.format("YYYY-MM");
226
+ w[v] || (w[v] = []), w[v].push(c);
215
227
  }
216
- }), p.length > 0 && l.push({
228
+ }), m.length > 0 && l.push({
217
229
  title: "今天",
218
- sessions: p.sort((c, i) => {
219
- var v, y;
220
- return h((v = i.data) == null ? void 0 : v.createdAt).valueOf() - h((y = c.data) == null ? void 0 : y.createdAt).valueOf();
230
+ sessions: m.sort((c, i) => {
231
+ var A, v;
232
+ return p((A = i.data) == null ? void 0 : A.createdAt).valueOf() - p((v = c.data) == null ? void 0 : v.createdAt).valueOf();
221
233
  }),
222
234
  key: "today"
223
- }), g.length > 0 && l.push({
235
+ }), h.length > 0 && l.push({
224
236
  title: "7天内",
225
- sessions: g.sort((c, i) => {
226
- var v, y;
227
- return h((v = i.data) == null ? void 0 : v.createdAt).valueOf() - h((y = c.data) == null ? void 0 : y.createdAt).valueOf();
237
+ sessions: h.sort((c, i) => {
238
+ var A, v;
239
+ return p((A = i.data) == null ? void 0 : A.createdAt).valueOf() - p((v = c.data) == null ? void 0 : v.createdAt).valueOf();
228
240
  }),
229
241
  key: "seven-days"
230
- }), w.length > 0 && l.push({
242
+ }), y.length > 0 && l.push({
231
243
  title: "30天内",
232
- sessions: w.sort((c, i) => {
233
- var v, y;
234
- return h((v = i.data) == null ? void 0 : v.createdAt).valueOf() - h((y = c.data) == null ? void 0 : y.createdAt).valueOf();
244
+ sessions: y.sort((c, i) => {
245
+ var A, v;
246
+ return p((A = i.data) == null ? void 0 : A.createdAt).valueOf() - p((v = c.data) == null ? void 0 : v.createdAt).valueOf();
235
247
  }),
236
248
  key: "thirty-days"
237
- }), Object.keys(E).sort((c, i) => i.localeCompare(c)).forEach((c) => {
238
- const i = E[c].sort((v, y) => {
239
- var se, fe;
240
- return h((se = y.data) == null ? void 0 : se.createdAt).valueOf() - h((fe = v.data) == null ? void 0 : fe.createdAt).valueOf();
249
+ }), Object.keys(w).sort((c, i) => i.localeCompare(c)).forEach((c) => {
250
+ const i = w[c].sort((A, v) => {
251
+ var me, he;
252
+ return p((me = v.data) == null ? void 0 : me.createdAt).valueOf() - p((he = A.data) == null ? void 0 : he.createdAt).valueOf();
241
253
  });
242
254
  l.push({
243
- title: h(c).format("YYYY年MM月"),
255
+ title: p(c).format("YYYY年MM月"),
244
256
  sessions: i,
245
257
  key: `month-${c}`
246
258
  });
247
259
  }), l;
248
- }), W = $e(() => ce(T), [T, ce]);
260
+ }), Z = He(() => fe(_), [_, fe]);
249
261
  return /* @__PURE__ */ f("div", {
250
262
  className: "bot-session-container",
251
- children: /* @__PURE__ */ S("div", {
263
+ children: /* @__PURE__ */ T("div", {
252
264
  className: "agent-sessions",
253
265
  children: [M && (o == null ? void 0 : o.siderTitle) && /* @__PURE__ */ f("div", {
254
266
  className: "sessions-header",
255
267
  children: /* @__PURE__ */ f("div", {
256
268
  className: "session-header-title",
257
- children: (k == null ? void 0 : k.name) || "-"
269
+ children: (b == null ? void 0 : b.name) || "-"
258
270
  })
259
- }), /* @__PURE__ */ S("div", {
271
+ }), /* @__PURE__ */ T("div", {
260
272
  className: "sessions-main",
261
- ref: U,
273
+ ref: X,
262
274
  children: [M && /* @__PURE__ */ f("div", {
263
275
  className: "session-header-btn-wrapper",
264
276
  children: /* @__PURE__ */ f(Ve, {
265
277
  className: "session-header-btn",
266
- onClick: be,
278
+ onClick: Me,
267
279
  type: "primary",
268
280
  children: "+ 新会话"
269
281
  })
270
- }), W == null ? void 0 : W.map((e) => {
282
+ }), Z == null ? void 0 : Z.map((e) => {
271
283
  var t;
272
- return /* @__PURE__ */ S("div", {
284
+ return /* @__PURE__ */ T("div", {
273
285
  className: "session-group",
274
286
  children: [/* @__PURE__ */ f("div", {
275
287
  className: "group-header",
@@ -278,18 +290,18 @@ const q = 15, Ge = Ie((A, u) => {
278
290
  },
279
291
  children: e.title
280
292
  }), (t = e.sessions) == null ? void 0 : t.map((n) => {
281
- var s, d, l, p, g, w, E, Z, c;
293
+ var s, d, l, m, h, y, w, q, c;
282
294
  return /* @__PURE__ */ f("div", {
283
- className: Ke({
295
+ className: Be({
284
296
  "session-item": !0,
285
297
  "session-item__active": ((s = n.data) == null ? void 0 : s.id) === ((d = a == null ? void 0 : a.data) == null ? void 0 : d.id)
286
298
  }),
287
- onClick: () => Te(n),
299
+ onClick: () => je(n),
288
300
  children: /* @__PURE__ */ f("div", {
289
301
  className: "session-item-wrapper",
290
- children: /* @__PURE__ */ S("div", {
302
+ children: /* @__PURE__ */ T("div", {
291
303
  className: "session-item-top",
292
- children: [/* @__PURE__ */ f(Ce.Paragraph, {
304
+ children: [/* @__PURE__ */ f(Fe.Paragraph, {
293
305
  className: "item-top-title",
294
306
  style: {
295
307
  margin: 0,
@@ -302,41 +314,41 @@ const q = 15, Ge = Ie((A, u) => {
302
314
  placement: "topLeft"
303
315
  }
304
316
  },
305
- children: ((p = n.data) == null ? void 0 : p.name) || "-"
306
- }), /* @__PURE__ */ S(ue, {
317
+ children: ((m = n.data) == null ? void 0 : m.name) || "-"
318
+ }), /* @__PURE__ */ T(ge, {
307
319
  children: [/* @__PURE__ */ f("span", {
308
320
  className: "item-top-time",
309
- children: h((g = n.data) == null ? void 0 : g.createdAt).format("MM/DD HH:mm:ss")
310
- }), /* @__PURE__ */ S("div", {
321
+ children: p((h = n.data) == null ? void 0 : h.createdAt).format("MM/DD HH:mm:ss")
322
+ }), /* @__PURE__ */ T("div", {
311
323
  className: "item-top-action",
312
324
  onClick: (i) => i.stopPropagation(),
313
- children: [/* @__PURE__ */ f(ye, {
314
- open: Ee === ((w = n.data) == null ? void 0 : w.id),
325
+ children: [/* @__PURE__ */ f(ve, {
326
+ open: ke === ((y = n.data) == null ? void 0 : y.id),
315
327
  getPopupContainer: (i) => i.parentNode,
316
328
  icon: !1,
317
- title: /* @__PURE__ */ f(He, {
329
+ title: /* @__PURE__ */ f(Ke, {
318
330
  placeholder: "请输入内容",
319
331
  autoComplete: "off",
320
332
  showCount: !0,
321
333
  value: K,
322
- onChange: _e,
323
- maxLength: q,
324
- status: Ne ? "error" : ""
334
+ onChange: Ce,
335
+ maxLength: Q,
336
+ status: be ? "error" : ""
325
337
  }),
326
- onConfirm: () => Le(n),
327
- onCancel: Se,
328
- children: /* @__PURE__ */ f(ge, {
338
+ onConfirm: () => _e(n),
339
+ onCancel: Pe,
340
+ children: /* @__PURE__ */ f(Ae, {
329
341
  type: "icon-bianji2",
330
- onClick: () => xe(n),
342
+ onClick: () => Te(n),
331
343
  className: "icon-action",
332
344
  style: {
333
345
  marginRight: "8px"
334
346
  }
335
347
  })
336
- }, `edit-${(E = n.data) == null ? void 0 : E.id}-${ae}`), /* @__PURE__ */ f(ye, {
348
+ }, `edit-${(w = n.data) == null ? void 0 : w.id}-${ne}`), /* @__PURE__ */ f(ve, {
337
349
  getPopupContainer: (i) => i.parentNode,
338
350
  icon: !1,
339
- title: /* @__PURE__ */ S(ue, {
351
+ title: /* @__PURE__ */ T(ge, {
340
352
  direction: "vertical",
341
353
  children: [/* @__PURE__ */ f("div", {
342
354
  children: "删除确认?"
@@ -345,19 +357,19 @@ const q = 15, Ge = Ie((A, u) => {
345
357
  })]
346
358
  }),
347
359
  onConfirm: () => {
348
- Oe(n), B((i) => i + 1);
360
+ xe(n), G((i) => i + 1);
349
361
  },
350
362
  onCancel: () => {
351
- B((i) => i + 1);
363
+ G((i) => i + 1);
352
364
  },
353
- children: /* @__PURE__ */ f(ge, {
365
+ children: /* @__PURE__ */ f(Ae, {
354
366
  style: {
355
367
  fontSize: "18px"
356
368
  },
357
369
  className: "icon-action",
358
370
  type: "icon-del"
359
371
  })
360
- }, `delete-${(Z = n.data) == null ? void 0 : Z.id}-${ae}`)]
372
+ }, `delete-${(q = n.data) == null ? void 0 : q.id}-${ne}`)]
361
373
  })]
362
374
  })]
363
375
  })
@@ -365,14 +377,14 @@ const q = 15, Ge = Ie((A, u) => {
365
377
  }, (c = n.data) == null ? void 0 : c.id);
366
378
  })]
367
379
  }, e.key);
368
- }), !Y && ke && /* @__PURE__ */ f(Fe, {
380
+ }), !S && Oe && /* @__PURE__ */ f(ze, {
369
381
  style: {
370
382
  color: "rgb(199 199 199)"
371
383
  },
372
384
  plain: !0,
373
385
  children: "没有更多数据了"
374
386
  }), /* @__PURE__ */ f("div", {
375
- ref: X,
387
+ ref: W,
376
388
  style: {
377
389
  height: 1
378
390
  }
@@ -381,7 +393,7 @@ const q = 15, Ge = Ie((A, u) => {
381
393
  })
382
394
  });
383
395
  });
384
- Ge.displayName = "SessionList";
396
+ Xe.displayName = "SessionList";
385
397
  export {
386
- Ge as default
398
+ Xe as default
387
399
  };