@glodon-aiot/agent-cli-ui 3.3.2-beta.9 → 3.3.2

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 (42) hide show
  1. package/dist/es/AgentClientUI.mjs +32 -34
  2. package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +142 -156
  3. package/dist/es/Dialog/AgentChat/index.mjs +147 -150
  4. package/dist/es/index.mjs +95 -101
  5. package/dist/es/packages/react-components/dist/es/components/Markdown/ATag/index.mjs +25 -27
  6. package/dist/es/packages/react-components/dist/es/components/Markdown/Image/index.mjs +27 -29
  7. package/dist/es/packages/react-components/dist/es/components/Markdown/index.mjs +48 -58
  8. package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
  9. package/dist/es/src/style10.css +1 -1
  10. package/dist/es/src/style11.css +1 -1
  11. package/dist/es/src/style12.css +1 -1
  12. package/dist/es/src/style13.css +1 -1
  13. package/dist/es/src/style14.css +1 -1
  14. package/dist/es/src/style15.css +1 -1
  15. package/dist/es/src/style16.css +1 -1
  16. package/dist/es/src/style17.css +1 -1
  17. package/dist/es/src/style19.css +1 -1
  18. package/dist/es/src/style20.css +1 -1
  19. package/dist/es/src/style21.css +1 -1
  20. package/dist/es/src/style22.css +1 -1
  21. package/dist/es/src/style23.css +1 -1
  22. package/dist/es/src/style24.css +1 -1
  23. package/dist/es/src/style3.css +1 -1
  24. package/dist/es/src/style4.css +1 -1
  25. package/dist/es/src/style5.css +1 -1
  26. package/dist/es/src/style6.css +1 -1
  27. package/dist/es/src/style7.css +1 -1
  28. package/dist/es/src/style9.css +1 -1
  29. package/dist/lib/index.js +51 -51
  30. package/dist/src/Dialog/AgentChat/HistoryItem/index.d.ts +0 -2
  31. package/dist/src/ReactTextGenerationUI/components/TextSiders/index.d.ts +22 -0
  32. package/dist/src/ReactTextGenerationUI/components/fetchEventSource/fetch.d.ts +44 -0
  33. package/dist/src/ReactTextGenerationUI/components/fetchEventSource/index.d.ts +1 -0
  34. package/dist/src/ReactTextGenerationUI/components/fetchEventSource/parse.d.ts +36 -0
  35. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/fetch.d.ts +44 -0
  36. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/index.d.ts +1 -0
  37. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/parse.d.ts +36 -0
  38. package/dist/src/ReactTextGenerationUI/index.d.ts +4 -0
  39. package/dist/src/index.d.ts +0 -1
  40. package/dist/src/types.d.ts +0 -3
  41. package/dist/src/utils/reactCompatibility.d.ts +27 -0
  42. package/package.json +3 -3
@@ -2,15 +2,15 @@ var Yt = Object.defineProperty, Kt = Object.defineProperties;
2
2
  var Wt = Object.getOwnPropertyDescriptors;
3
3
  var et = Object.getOwnPropertySymbols;
4
4
  var Qt = Object.prototype.hasOwnProperty, _t = Object.prototype.propertyIsEnumerable;
5
- var be = (L, o, v) => o in L ? Yt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v, tt = (L, o) => {
5
+ var ke = (L, o, v) => o in L ? Yt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v, tt = (L, o) => {
6
6
  for (var v in o || (o = {}))
7
- Qt.call(o, v) && be(L, v, o[v]);
7
+ Qt.call(o, v) && ke(L, v, o[v]);
8
8
  if (et)
9
9
  for (var v of et(o))
10
- _t.call(o, v) && be(L, v, o[v]);
10
+ _t.call(o, v) && ke(L, v, o[v]);
11
11
  return L;
12
12
  }, nt = (L, o) => Kt(L, Wt(o));
13
- var D = (L, o, v) => (be(L, typeof o != "symbol" ? o + "" : o, v), v);
13
+ var D = (L, o, v) => (ke(L, typeof o != "symbol" ? o + "" : o, v), v);
14
14
  var z = (L, o, v) => new Promise((e, x) => {
15
15
  var ce = (I) => {
16
16
  try {
@@ -18,44 +18,43 @@ var z = (L, o, v) => new Promise((e, x) => {
18
18
  } catch (h) {
19
19
  x(h);
20
20
  }
21
- }, b = (I) => {
21
+ }, k = (I) => {
22
22
  try {
23
23
  H(v.throw(I));
24
24
  } catch (h) {
25
25
  x(h);
26
26
  }
27
- }, H = (I) => I.done ? e(I.value) : Promise.resolve(I.value).then(ce, b);
27
+ }, H = (I) => I.done ? e(I.value) : Promise.resolve(I.value).then(ce, k);
28
28
  H((v = v.apply(L, o)).next());
29
29
  });
30
30
  import { jsx as c, jsxs as A } from "react/jsx-runtime";
31
31
  import { memo as Gt, useState as m, useRef as B, useContext as Xt, useEffect as T, useMemo as Zt } from "react";
32
- /* empty css */import { Divider as Jt, Spin as St, Button as _, Space as le, Upload as en, Tooltip as tn, message as u, notification as nn } from "antd";
32
+ /* empty css */import { Divider as Jt, Spin as St, Button as _, Space as ae, Upload as en, Tooltip as tn, message as u, notification as nn } from "antd";
33
33
  import de from "../../components/Iconfont/index.mjs";
34
34
  import { IHistoryRole as G, ChatMessageRole as it } from "@glodon-aiot/apis";
35
35
  import rt from "./HistoryItem/index.mjs";
36
- import at from "dayjs";
37
- import { v4 as lt } from "uuid";
36
+ import lt from "dayjs";
37
+ import { v4 as at } from "uuid";
38
38
  import on from "../../context.mjs";
39
- import { configuration as sn } from "@glodon-aiot/bot-client-sdk";
40
- import { MB as rn } from "../../constant.mjs";
41
- import an from "../../components/FilePreview/index.mjs";
39
+ import { MB as sn } from "../../constant.mjs";
40
+ import rn from "../../components/FilePreview/index.mjs";
42
41
  import { getImageExtension as ln } from "../../utils/index.mjs";
43
- import dn from "../../QuillEditor/index.mjs";
44
- import cn from "../../components/Recommend/index.mjs";
45
- import fn from "../../components/Greeting/index.mjs";
46
- import gn from "../../Footer/index.mjs";
47
- import { CameraOutlined as un, PlusOutlined as hn } from "@ant-design/icons";
48
- import mn from "./Tools/UploadKnowledgeFiles/index.mjs";
49
- import pn from "../UploadingPrompt/index.mjs";
42
+ import an from "../../QuillEditor/index.mjs";
43
+ import dn from "../../components/Recommend/index.mjs";
44
+ import cn from "../../components/Greeting/index.mjs";
45
+ import fn from "../../Footer/index.mjs";
46
+ import { CameraOutlined as gn, PlusOutlined as un } from "@ant-design/icons";
47
+ import hn from "./Tools/UploadKnowledgeFiles/index.mjs";
48
+ import mn from "../UploadingPrompt/index.mjs";
50
49
  import yn from "./PromptSetting/index.mjs";
51
50
  import { useMemoizedFn as we } from "ahooks";
52
- import vn from "./Tools/SessionListDrawer/index.mjs";
53
- import kn from "react-infinite-scroll-component";
51
+ import pn from "./Tools/SessionListDrawer/index.mjs";
52
+ import vn from "react-infinite-scroll-component";
54
53
  import bn from "./Tools/ConnectToNetwork/index.mjs";
55
- import wn from "./Tools/PromptManager/index.mjs";
56
- import xn from "../../assets/icon.svg.mjs";
57
- const In = Gt(rt), ot = {
58
- icon: xn,
54
+ import kn from "./Tools/PromptManager/index.mjs";
55
+ import wn from "../../assets/icon.svg.mjs";
56
+ const xn = Gt(rt), ot = {
57
+ icon: wn,
59
58
  text: "今天我能帮你什么?"
60
59
  };
61
60
  class J {
@@ -69,12 +68,12 @@ class J {
69
68
  D(this, "isSensitive");
70
69
  D(this, "isSuspend");
71
70
  D(this, "comment");
72
- this.content = o, this.sessionId = v, this.role = e, this.files = x, this.content = o, this.role = e, this.sessionId = v, this.files = x, this.messageTime = at(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = lt(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
71
+ this.content = o, this.sessionId = v, this.role = e, this.files = x, this.content = o, this.role = e, this.sessionId = v, this.files = x, this.messageTime = lt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = at(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
73
72
  isAgree: 0
74
73
  };
75
74
  }
76
75
  }
77
- const st = 10, Sn = (L) => {
76
+ const st = 10, Zn = (L) => {
78
77
  var Be, qe, Ye, Ke, We, Qe, _e, Ge, Xe, Ze, Je;
79
78
  const {
80
79
  application: o,
@@ -82,7 +81,7 @@ const st = 10, Sn = (L) => {
82
81
  currentSession: e,
83
82
  onCreateSession: x,
84
83
  embeddingService: ce,
85
- setCurrentSession: b,
84
+ setCurrentSession: k,
86
85
  networkStatus: H,
87
86
  setNetworkStatus: I
88
87
  } = L, [h, C] = m([]), [dt, S] = m(), [fe, xe] = m(), P = B(null), {
@@ -97,13 +96,13 @@ const st = 10, Sn = (L) => {
97
96
  beforeMessageSend: j,
98
97
  bodyStyle: gt,
99
98
  disabled: M,
100
- features: l,
99
+ features: a,
101
100
  popupContainer: g,
102
101
  icon: ut
103
- } = Xt(on), [Le, ue] = m(!1), p = B(h), Ce = B(), [ht, mt] = m(0), [X, q] = m(), [Y, te] = m(""), [Ne, he] = m(!1), me = B(null), [Fe, pt] = m([]), [Te, K] = m(!1), [Ee, yt] = m(!1), [vt, kt] = m(""), [bt, W] = m(), [ne, ie] = m({}), oe = B(null), Pe = B(null), pe = B(null), [Re, wt] = m(!1), [xt, It] = m([]), [Lt, se] = m(!0), [Ct, Nt] = m(!0), [De, O] = m(!1), [ye, V] = m(!1), [He, Ft] = m(!1), [E, re] = m(typeof (l == null ? void 0 : l.promptVariables) == "object" ? l.promptVariables.default || [] : []), [Tt, Et] = m(typeof (l == null ? void 0 : l.knowledges) == "object" && l.knowledges.default || void 0), [Me, U] = m(!1), [Oe, Z] = m(!1), [Pt, Q] = m(typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.default) == "boolean" ? l.connectNetwork.default : !1), [Ue, ae] = m(!1);
102
+ } = Xt(on), [Le, ue] = m(!1), y = B(h), Ce = B(), [ht, mt] = m(0), [X, q] = m(), [Y, te] = m(""), [Ne, he] = m(!1), me = B(null), [Fe, yt] = m([]), [Te, K] = m(!1), [Ee, pt] = m(!1), [vt, bt] = m(""), [kt, W] = m(), [ne, ie] = m({}), oe = B(null), Pe = B(null), ye = B(null), [Re, wt] = m(!1), [xt, It] = m([]), [Lt, se] = m(!0), [Ct, Nt] = m(!0), [De, O] = m(!1), [pe, V] = m(!1), [He, Ft] = m(!1), [E, re] = m(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [Tt, Et] = m(typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0), [Me, U] = m(!1), [Oe, Z] = m(!1), [Pt, Q] = m(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), [Ue, le] = m(!1);
104
103
  T(() => {
105
104
  var r, i;
106
- e && (p.current = []), C([]);
105
+ e && (y.current = []), C([]);
107
106
  const t = P.current;
108
107
  if (t && t.scrollTo({
109
108
  top: 0
@@ -111,18 +110,18 @@ const st = 10, Sn = (L) => {
111
110
  return;
112
111
  if (V(!1), O(!1), (i = e.messages) != null && i.length) {
113
112
  const s = [...e.messages.filter((d) => d == null ? void 0 : d.messageId)].reverse();
114
- p.current = [...s], C([...s]);
113
+ y.current = [...s], C([...s]);
115
114
  }
116
- const n = (a) => {
115
+ const n = (l) => {
117
116
  var s;
118
- (s = e == null ? void 0 : e.data) != null && s.id && (p.current = [...a].reverse(), C([...a].reverse()), !a || a.length < 10 ? Z(!1) : Z(!0), Ie && Ie({
117
+ (s = e == null ? void 0 : e.data) != null && s.id && (y.current = [...l].reverse(), C([...l].reverse()), !l || l.length < 10 ? Z(!1) : Z(!0), Ie && Ie({
119
118
  applicationId: o.id,
120
119
  sessionId: e.data.id,
121
- histories: a
120
+ histories: l
122
121
  }));
123
122
  };
124
123
  return e.addEventListener("history:loaded", n), () => {
125
- p.current = [], C([]), e == null || e.removeEventListener("history:loaded", n);
124
+ y.current = [], C([]), e == null || e.removeEventListener("history:loaded", n);
126
125
  };
127
126
  }, [e]), T(() => {
128
127
  const t = () => {
@@ -163,11 +162,11 @@ const st = 10, Sn = (L) => {
163
162
  };
164
163
  T(() => {
165
164
  o != null && o.id && (F == null || F.getRecommendQues(o.id).then((t) => {
166
- pt(t);
165
+ yt(t);
167
166
  }));
168
167
  }, [ct, o]);
169
168
  const ze = (t) => z(void 0, null, function* () {
170
- var w, y;
169
+ var w, p;
171
170
  if (M) {
172
171
  u.config({
173
172
  getContainer: () => (g == null ? void 0 : g.current) || document.body
@@ -185,7 +184,7 @@ const st = 10, Sn = (L) => {
185
184
  });
186
185
  return;
187
186
  }
188
- if (!(E == null ? void 0 : E.every((k) => !!(k != null && k.value))))
187
+ if (!(E == null ? void 0 : E.every((b) => !!(b != null && b.value))))
189
188
  if (f != null && f.promptVariables) {
190
189
  u.config({
191
190
  getContainer: () => (g == null ? void 0 : g.current) || document.body
@@ -194,8 +193,8 @@ const st = 10, Sn = (L) => {
194
193
  });
195
194
  return;
196
195
  } else
197
- console.error("变量值不能为空", E == null ? void 0 : E.map((k) => !!(k != null && k.value)));
198
- if (ye) {
196
+ console.error("变量值不能为空", E == null ? void 0 : E.map((b) => !!(b != null && b.value)));
197
+ if (pe) {
199
198
  u.config({
200
199
  getContainer: () => (g == null ? void 0 : g.current) || document.body
201
200
  }), u.error("正在回复中"), u.config({
@@ -232,16 +231,16 @@ const st = 10, Sn = (L) => {
232
231
  if (!i) {
233
232
  x == null || x({
234
233
  netOpen: H ? 1 : 2
235
- }).then((k) => {
234
+ }).then((b) => {
236
235
  var R, $;
237
- U(!0), I(!!((R = k.data) != null && R.netOpen)), Q(!!(($ = k.data) != null && $.enableNetOpen)), Dt(k).then(() => {
238
- b == null || b(k), U(!1), xe(n);
236
+ U(!0), I(!!((R = b.data) != null && R.netOpen)), Q(!!(($ = b.data) != null && $.enableNetOpen)), Dt(b).then(() => {
237
+ k == null || k(b), U(!1), xe(n);
239
238
  });
240
239
  });
241
240
  return;
242
241
  }
243
- ae(!0);
244
- const a = Y ? `![](${Y})
242
+ le(!0);
243
+ const l = Y ? `![](${Y})
245
244
  ${n}` : n;
246
245
  let s;
247
246
  try {
@@ -249,23 +248,23 @@ ${n}` : n;
249
248
  applicationId: o.id,
250
249
  sessionId: i,
251
250
  message: {
252
- content: a,
251
+ content: l,
253
252
  sessionId: i,
254
253
  role: it.User,
255
254
  files: ne[i]
256
255
  }
257
256
  }) : s = !0;
258
- } catch (k) {
257
+ } catch (b) {
259
258
  s = !1;
260
259
  }
261
- if (ae(!1), s === !1)
260
+ if (le(!1), s === !1)
262
261
  return;
263
262
  let d = n;
264
- typeof s == "object" && (d = s.content || n), ((y = ne[i]) == null ? void 0 : y.length) > 0 ? Ht(d) : ve(d);
263
+ typeof s == "object" && (d = s.content || n), ((p = ne[i]) == null ? void 0 : p.length) > 0 ? Ht(d) : ve(d);
265
264
  }), Dt = (t) => new Promise((n, r) => z(void 0, null, function* () {
266
265
  const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.key !== "query").map((d) => {
267
- var y;
268
- const w = (y = E.find((k) => k.key === d.key)) == null ? void 0 : y.value;
266
+ var p;
267
+ const w = (p = E.find((b) => b.key === d.key)) == null ? void 0 : p.value;
269
268
  return d.value = w || "", d;
270
269
  });
271
270
  re(s.sort((d, w) => d.key.localeCompare(w.key))), yield t == null ? void 0 : t.setPromptVariables(s), n();
@@ -274,24 +273,24 @@ ${n}` : n;
274
273
  if (se(!1), !((s = e == null ? void 0 : e.data) != null && s.id) || !(o != null && o.id))
275
274
  return;
276
275
  const n = ((d = e.data) == null ? void 0 : d.id) || "", r = [];
277
- let i = [], a = /* @__PURE__ */ new Set();
278
- (w = ne[n]) == null || w.forEach((y) => {
279
- a.has(y.id) || (i.push(y), a.add(y.id));
280
- }), Promise.all(i.map((y) => F == null ? void 0 : F.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, y.id, {
276
+ let i = [], l = /* @__PURE__ */ new Set();
277
+ (w = ne[n]) == null || w.forEach((p) => {
278
+ l.has(p.id) || (i.push(p), l.add(p.id));
279
+ }), Promise.all(i.map((p) => F == null ? void 0 : F.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, p.id, {
281
280
  enabled: 1
282
- }).then((k) => {
283
- r.push(y);
284
- }))).then((y) => {
281
+ }).then((b) => {
282
+ r.push(p);
283
+ }))).then((p) => {
285
284
  se(!0), ve(t, r);
286
- }).catch((y) => {
287
- throw Error(y);
285
+ }).catch((p) => {
286
+ throw Error(p);
288
287
  });
289
288
  };
290
289
  T(() => {
291
290
  if (!fe || !e)
292
291
  return;
293
292
  const t = fe, n = () => z(void 0, null, function* () {
294
- ae(!0);
293
+ le(!0);
295
294
  const r = Y ? `![](${Y})
296
295
  ${t}` : t;
297
296
  let i;
@@ -306,32 +305,32 @@ ${t}` : t;
306
305
  files: ne[e.id]
307
306
  }
308
307
  }) : i = !0;
309
- } catch (a) {
308
+ } catch (l) {
310
309
  i = !1;
311
310
  }
312
- ae(!1), i !== !1 && (ve(t), xe(void 0));
311
+ le(!1), i !== !1 && (ve(t), xe(void 0));
313
312
  });
314
313
  return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
315
314
  e == null || e.removeEventListener("ready", n);
316
315
  };
317
316
  }, [fe, e]);
318
317
  const ve = (t, n) => z(void 0, null, function* () {
319
- var y, k;
320
- const r = (y = e == null ? void 0 : e.data) == null ? void 0 : y.id;
318
+ var p, b;
319
+ const r = (p = e == null ? void 0 : e.data) == null ? void 0 : p.id;
321
320
  if (!r)
322
321
  return;
323
322
  V(!0), O(!0);
324
323
  const i = Y ? `![](${Y})
325
- ${t}` : t, a = new J(i, r, G.User, n);
326
- S(void 0), W(void 0), p.current = [a, ...h], C(p.current), o.id && ee && ee({
324
+ ${t}` : t, l = new J(i, r, G.User, n);
325
+ S(void 0), W(void 0), y.current = [l, ...h], C(y.current), o.id && ee && ee({
327
326
  applicationId: o.id,
328
327
  sessionId: r,
329
- message: a
328
+ message: l
330
329
  });
331
330
  const s = new J("", r, G.System);
332
- s.isWaiting = !0, p.current = [s, ...p.current], C(p.current);
331
+ s.isWaiting = !0, y.current = [s, ...y.current], C(y.current);
333
332
  const d = (n == null ? void 0 : n.map((R) => R.id)) || [], w = {
334
- stream: sn.stream,
333
+ stream: !0,
335
334
  referenceFirst: !1
336
335
  };
337
336
  if (f != null && f.promptVariables) {
@@ -347,7 +346,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
347
346
  fileIds: d
348
347
  }, w), ie({
349
348
  [r]: []
350
- }), (k = oe.current) == null || k.update();
349
+ }), (b = oe.current) == null || b.update();
351
350
  });
352
351
  T(() => {
353
352
  var r;
@@ -357,16 +356,16 @@ ${t}` : t, a = new J(i, r, G.User, n);
357
356
  const n = (i) => {
358
357
  if (!i.sessionId || i.sessionId && i.sessionId !== Ce.current || i.role === G.User)
359
358
  return;
360
- if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (O(!1), V(!1), p.current = p.current.filter((d) => !d.isWaiting), C([...p.current]), p.current = [...p.current], i.content))
359
+ if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (O(!1), V(!1), y.current = y.current.filter((d) => !d.isWaiting), C([...y.current]), y.current = [...y.current], i.content))
361
360
  return nn.error({
362
361
  message: i.content
363
362
  });
364
- const a = i.actions || [], s = new J(i.content, t, G.Robot);
365
- s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions = a, s.isLoading = !0, s.searchingStatus = i.searchingStatus, p.current = p.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && C([s, ...p.current]), i.code === 11915 && (O(!1), V(!1), s.isLoading = !1, s.content = "请您换个问题问我吧~", s.isSensitive = !0, C([s, ...p.current])), i.index === -2 && (O(!1), V(!1), s.isLoading = !1, s.content = "回答已中止~", s.isSuspend = !0, C([s, ...p.current])), i.index === -1 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, C([s, ...p.current]), o.id && ee && ee({
363
+ const l = i.actions || [], s = new J(i.content, t, G.Robot);
364
+ s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions = l, s.isLoading = !0, s.searchingStatus = i.searchingStatus, y.current = y.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && C([s, ...y.current]), i.code === 11915 && (O(!1), V(!1), s.isLoading = !1, s.content = "请您换个问题问我吧~", s.isSensitive = !0, C([s, ...y.current])), i.index === -2 && (O(!1), V(!1), s.isLoading = !1, s.content = "回答已中止~", s.isSuspend = !0, C([s, ...y.current])), i.index === -1 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, C([s, ...y.current]), o.id && ee && ee({
366
365
  applicationId: o.id,
367
366
  sessionId: t,
368
367
  message: s
369
- })), i.index === -3 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, s.relatedQuesion = i.relatedQuesion, C([s, ...p.current]));
368
+ })), i.index === -3 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, s.relatedQuesion = i.relatedQuesion, C([s, ...y.current]));
370
369
  };
371
370
  return e.ready ? e.addEventListener("message:updated", n) : e.addEventListener("ready", () => {
372
371
  e.addEventListener("message:updated", n);
@@ -398,7 +397,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
398
397
  getContainer: () => (g == null ? void 0 : g.current) || document.body
399
398
  }), u.error("该文件为空,请重新上传"), u.config({
400
399
  getContainer: void 0
401
- }), !1) : n > 20 * rn ? (u.config({
400
+ }), !1) : n > 20 * sn ? (u.config({
402
401
  getContainer: () => (g == null ? void 0 : g.current) || document.body
403
402
  }), u.error("图片须小于20M"), u.config({
404
403
  getContainer: void 0
@@ -409,25 +408,25 @@ ${t}` : t, a = new J(i, r, G.User, n);
409
408
  U(!0), x == null || x({
410
409
  netOpen: H ? 1 : 2
411
410
  }).then((i) => {
412
- var a, s;
413
- b == null || b(i), U(!1), I(!!((a = i.data) != null && a.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(je(i, t));
411
+ var l, s;
412
+ k == null || k(i), U(!1), I(!!((l = i.data) != null && l.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(je(i, t));
414
413
  });
415
414
  });
416
415
  }), je = (t, n) => {
417
416
  const r = ln(n.name);
418
417
  return new Promise((i) => {
419
418
  var s;
420
- const a = {
421
- files: [`${lt()}.${r}`],
419
+ const l = {
420
+ files: [`${at()}.${r}`],
422
421
  isv: "minio",
423
422
  knowledgeId: ((s = t.data) == null ? void 0 : s.id) || "",
424
423
  type: 1
425
424
  };
426
- he(!0), F == null || F.postTicket(a).then((d) => {
425
+ he(!0), F == null || F.postTicket(l).then((d) => {
427
426
  F.uploadMinioFile(d.minio, n).then(() => {
428
427
  var R, $;
429
- const w = (R = d.minio.endpoints) == null ? void 0 : R[0], y = d.minio.bucket, k = ($ = d.minio.fileKeys) == null ? void 0 : $[0];
430
- i(`${location.protocol}//${w}/${y}/${k}`);
428
+ const w = (R = d.minio.endpoints) == null ? void 0 : R[0], p = d.minio.bucket, b = ($ = d.minio.fileKeys) == null ? void 0 : $[0];
429
+ i(`${location.protocol}//${w}/${p}/${b}`);
431
430
  }).catch(() => {
432
431
  te(""), q(void 0);
433
432
  }).finally(() => {
@@ -451,8 +450,8 @@ ${t}` : t, a = new J(i, r, G.User, n);
451
450
  type: 1
452
451
  });
453
452
  F == null || F.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
454
- var a;
455
- (a = oe.current) == null || a.update().finally(r);
453
+ var l;
454
+ (l = oe.current) == null || l.update().finally(r);
456
455
  });
457
456
  }), Ut = () => {
458
457
  var t;
@@ -479,13 +478,13 @@ ${t}` : t, a = new J(i, r, G.User, n);
479
478
  var n;
480
479
  if (!((n = e == null ? void 0 : e.data) != null && n.id))
481
480
  return;
482
- p.current = [...h.slice(1, h.length)], C(p.current);
481
+ y.current = [...h.slice(1, h.length)], C(y.current);
483
482
  const t = new J("", e.data.id, G.System);
484
- t.isWaiting = !0, p.current = [t, ...p.current], C(p.current), V(!0), O(!0), e.answerAgain();
483
+ t.isWaiting = !0, y.current = [t, ...y.current], C(y.current), V(!0), O(!0), e.answerAgain();
485
484
  });
486
485
  T(() => {
487
486
  var t, n;
488
- Ce.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Me && ((n = pe.current) == null || n.clear());
487
+ Ce.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Me && ((n = ye.current) == null || n.clear());
489
488
  }, [e]);
490
489
  const Bt = () => {
491
490
  var r;
@@ -496,12 +495,12 @@ ${t}` : t, a = new J(i, r, G.User, n);
496
495
  endTime: n,
497
496
  pageSize: st
498
497
  }).then((i) => {
499
- const a = i || [];
500
- if (!a || !(a != null && a.length)) {
498
+ const l = i || [];
499
+ if (!l || !(l != null && l.length)) {
501
500
  Z(!1);
502
501
  return;
503
502
  }
504
- a.length < 10 ? Z(!1) : Z(!0), C([...h, ...a.reverse()]);
503
+ l.length < 10 ? Z(!1) : Z(!0), C([...h, ...l.reverse()]);
505
504
  });
506
505
  }, qt = (t) => z(void 0, null, function* () {
507
506
  var n, r;
@@ -512,22 +511,22 @@ ${t}` : t, a = new J(i, r, G.User, n);
512
511
  return;
513
512
  I(t);
514
513
  }
515
- }), ke = () => z(void 0, null, function* () {
514
+ }), be = () => z(void 0, null, function* () {
516
515
  e ? e.fetchData().then((t) => {
517
516
  var n;
518
517
  (n = e == null ? void 0 : e.data) != null && n.id && (I(t.netOpen), Q(t.enableNetOpen));
519
518
  }) : (I(!1), Q(o.arrange[0].enableNetOpen));
520
519
  });
521
520
  T(() => {
522
- ke();
521
+ be();
523
522
  }, [e]), T(() => {
524
523
  var t, n;
525
524
  if (P.current) {
526
- const r = document.getElementById("chat-main"), i = (t = P.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), a = (n = P.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
527
- if (!i || !a || !r)
525
+ const r = document.getElementById("chat-main"), i = (t = P.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), l = (n = P.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
526
+ if (!i || !l || !r)
528
527
  return;
529
528
  const s = r.offsetHeight;
530
- if (a.offsetHeight <= s) {
529
+ if (l.offsetHeight <= s) {
531
530
  if (i.style.height === "100%")
532
531
  return;
533
532
  i.style.height = "100%";
@@ -542,29 +541,29 @@ ${t}` : t, a = new J(i, r, G.User, n);
542
541
  return;
543
542
  const t = () => {
544
543
  const i = ((N == null ? void 0 : N.promptVariables) || []).filter(
545
- (a) => a.key !== "query" && a.status === 1
544
+ (l) => l.key !== "query" && l.status === 1
546
545
  // 只要求输入被引用的变量
547
- ).map((a, s) => {
548
- var w, y;
546
+ ).map((l, s) => {
547
+ var w, p;
549
548
  let d = "";
550
- return typeof (l == null ? void 0 : l.promptVariables) == "object" && (d = ((y = (w = l.promptVariables.default) == null ? void 0 : w.find((k) => k.key === a.key)) == null ? void 0 : y.value) || ""), {
549
+ return typeof (a == null ? void 0 : a.promptVariables) == "object" && (d = ((p = (w = a.promptVariables.default) == null ? void 0 : w.find((b) => b.key === l.key)) == null ? void 0 : p.value) || ""), {
551
550
  id: s + "",
552
- key: a.key,
553
- name: a.name,
551
+ key: l.key,
552
+ name: l.name,
554
553
  value: d
555
554
  };
556
555
  });
557
- re([...i].sort((a, s) => a.key.localeCompare(s.key)));
556
+ re([...i].sort((l, s) => l.key.localeCompare(s.key)));
558
557
  };
559
558
  return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
560
559
  N == null || N.removeEventListener("ready", t);
561
560
  };
562
- }, [e, N, l == null ? void 0 : l.promptVariables]);
561
+ }, [e, N, a == null ? void 0 : a.promptVariables]);
563
562
  const $e = () => x == null ? void 0 : x({
564
563
  netOpen: H ? 1 : 2
565
564
  }).then((t) => {
566
565
  var n, r;
567
- return b == null || b(t), U(!1), I(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), t;
566
+ return k == null || k(t), U(!1), I(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), t;
568
567
  }), Ae = Zt(() => {
569
568
  var t;
570
569
  return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(rt, {
@@ -577,12 +576,11 @@ ${t}` : t, a = new J(i, r, G.User, n);
577
576
  sessionId: "",
578
577
  reference: [],
579
578
  searchReference: [],
580
- messageTime: at(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
579
+ messageTime: lt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
581
580
  actions: [],
582
581
  isLoading: !1
583
582
  },
584
- actions: !!h.length,
585
- markdown: l == null ? void 0 : l.markdown
583
+ actions: !!h.length
586
584
  }) : null;
587
585
  }, [o == null ? void 0 : o.arrange, h]);
588
586
  return /* @__PURE__ */ A("div", {
@@ -593,7 +591,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
593
591
  currentSession: e,
594
592
  promptVariables: E,
595
593
  setPromptVariables: re,
596
- setCurrentSession: b
594
+ setCurrentSession: k
597
595
  }), /* @__PURE__ */ A("div", {
598
596
  className: "chat-main",
599
597
  id: "chat-main",
@@ -609,7 +607,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
609
607
  },
610
608
  ref: P,
611
609
  onScroll: jt,
612
- children: (Be = e == null ? void 0 : e.data) != null && Be.id && (h != null && h.length) ? /* @__PURE__ */ A(kn, {
610
+ children: (Be = e == null ? void 0 : e.data) != null && Be.id && (h != null && h.length) ? /* @__PURE__ */ A(vn, {
613
611
  dataLength: h.length,
614
612
  next: Bt,
615
613
  style: {
@@ -633,7 +631,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
633
631
  children: /* @__PURE__ */ c(St, {})
634
632
  }),
635
633
  scrollableTarget: "scrollableDiv",
636
- children: [h.map((t, n) => /* @__PURE__ */ c(In, {
634
+ children: [h.map((t, n) => /* @__PURE__ */ c(xn, {
637
635
  application: o,
638
636
  currentSession: e,
639
637
  history: t,
@@ -641,32 +639,31 @@ ${t}` : t, a = new J(i, r, G.User, n);
641
639
  isLastHistory: n === 0,
642
640
  onRelatedClick: $t,
643
641
  onAgainClick: At,
644
- onEditClick: Vt,
645
- markdown: l == null ? void 0 : l.markdown
642
+ onEditClick: Vt
646
643
  }, t.messageId + n)), !Oe && Ae]
647
644
  }) : /* @__PURE__ */ A("div", {
648
645
  className: "main-empty",
649
- children: [(l == null ? void 0 : l.greeting) !== !1 && /* @__PURE__ */ c(fn, {
650
- text: l === void 0 || l.greeting === !0 || ((Ke = l.greeting) == null ? void 0 : Ke.text) === void 0 ? ot.text : l.greeting.text,
651
- icon: l === void 0 || l.greeting === !0 || ((We = l.greeting) == null ? void 0 : We.icon) === void 0 ? ut || ot.icon : l.greeting.icon,
652
- children: !!Fe.length && typeof (l == null ? void 0 : l.greeting) == "object" && l.greeting.questions !== !1 && /* @__PURE__ */ c(cn, {
653
- ref: pe,
646
+ children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ c(cn, {
647
+ text: a === void 0 || a.greeting === !0 || ((Ke = a.greeting) == null ? void 0 : Ke.text) === void 0 ? ot.text : a.greeting.text,
648
+ icon: a === void 0 || a.greeting === !0 || ((We = a.greeting) == null ? void 0 : We.icon) === void 0 ? ut || ot.icon : a.greeting.icon,
649
+ children: !!Fe.length && typeof (a == null ? void 0 : a.greeting) == "object" && a.greeting.questions !== !1 && /* @__PURE__ */ c(dn, {
650
+ ref: ye,
654
651
  sid: (Qe = e == null ? void 0 : e.data) == null ? void 0 : Qe.id,
655
652
  isRecommendClearing: Te,
656
653
  data: Fe,
657
654
  onItemClick: (t) => {
658
- var r, i, a;
655
+ var r, i, l;
659
656
  if (S(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), Te)
660
657
  return;
661
658
  t != null && t.id && K(!0);
662
659
  const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
663
- f != null && f.fileUpload ? (a = (i = oe.current) == null ? void 0 : i.clear()) == null || a.then(() => {
660
+ f != null && f.fileUpload ? (l = (i = oe.current) == null ? void 0 : i.clear()) == null || l.then(() => {
664
661
  var s, d;
665
662
  t != null && t.id && (n ? (s = Ve(n, t)) == null || s.finally(() => {
666
663
  K(!1);
667
664
  }) : (K(!1), U(!0), (d = $e()) == null || d.then((w) => {
668
- var y;
669
- (y = Ve(w.id, t)) == null || y.finally(() => {
665
+ var p;
666
+ (p = Ve(w.id, t)) == null || p.finally(() => {
670
667
  K(!1);
671
668
  });
672
669
  })));
@@ -715,7 +712,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
715
712
  className: "chat-footer-input",
716
713
  children: [X && /* @__PURE__ */ c("div", {
717
714
  className: "input-files",
718
- children: /* @__PURE__ */ c(an, {
715
+ children: /* @__PURE__ */ c(rn, {
719
716
  file: X,
720
717
  actions: {
721
718
  upload: Ot,
@@ -725,10 +722,10 @@ ${t}` : t, a = new J(i, r, G.User, n);
725
722
  },
726
723
  onUrlChange: (t) => te(t)
727
724
  })
728
- }), /* @__PURE__ */ A(le, {
725
+ }), /* @__PURE__ */ A(ae, {
729
726
  className: "footer-upload-action",
730
727
  onClick: (t) => t.preventDefault(),
731
- children: [/* @__PURE__ */ A(le, {
728
+ children: [/* @__PURE__ */ A(ae, {
732
729
  children: [o.type === 2 && (f == null ? void 0 : f.imageUpload) && /* @__PURE__ */ c(en, {
733
730
  disabled: !!X || M,
734
731
  accept: ".jpg, .png, .jpeg,.bmp",
@@ -745,7 +742,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
745
742
  bottom: "-2px"
746
743
  },
747
744
  disabled: !!X || M,
748
- icon: /* @__PURE__ */ c(un, {
745
+ icon: /* @__PURE__ */ c(gn, {
749
746
  className: "icon-tianjia",
750
747
  style: {
751
748
  fontSize: "22px"
@@ -774,26 +771,26 @@ ${t}` : t, a = new J(i, r, G.User, n);
774
771
  })
775
772
  })
776
773
  })
777
- }), ce && (f != null && f.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(mn, {
774
+ }), ce && (f != null && f.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(hn, {
778
775
  appId: o == null ? void 0 : o.id,
779
776
  ref: oe,
780
777
  isFirstSession: Me,
781
778
  docViewerUrl: v,
782
779
  onStatusChange: (t) => z(void 0, null, function* () {
783
- t !== "process" ? (se(!0), ke()) : se(!1);
780
+ t !== "process" ? (se(!0), be()) : se(!1);
784
781
  }),
785
782
  createSession: () => new Promise((t) => {
786
783
  U(!0), x == null || x({
787
784
  netOpen: H ? 1 : 2
788
785
  }).then((n) => {
789
- var i, a, s;
790
- b == null || b(n), U(!1), I(!!((i = n.data) != null && i.netOpen)), Q(!!((a = n.data) != null && a.enableNetOpen));
786
+ var i, l, s;
787
+ k == null || k(n), U(!1), I(!!((i = n.data) != null && i.netOpen)), Q(!!((l = n.data) != null && l.enableNetOpen));
791
788
  const r = ((s = n.data) == null ? void 0 : s.id) || "";
792
789
  t(r);
793
790
  });
794
791
  }),
795
792
  sid: (_e = e == null ? void 0 : e.data) == null ? void 0 : _e.id,
796
- disabled: ye || M,
793
+ disabled: pe || M,
797
794
  afterFileAdd: (t, n) => {
798
795
  n && ie((r) => {
799
796
  const i = r[n] || [];
@@ -806,9 +803,9 @@ ${t}` : t, a = new J(i, r, G.User, n);
806
803
  var r;
807
804
  const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
808
805
  n && ie((i) => {
809
- const a = i[n] || [];
806
+ const l = i[n] || [];
810
807
  return {
811
- [n]: a.filter((s) => s.id !== t)
808
+ [n]: l.filter((s) => s.id !== t)
812
809
  };
813
810
  });
814
811
  },
@@ -821,9 +818,9 @@ ${t}` : t, a = new J(i, r, G.User, n);
821
818
  const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
822
819
  t && (ie({
823
820
  [t]: []
824
- }), ke());
821
+ }), be());
825
822
  }
826
- }) : null, (f == null ? void 0 : f.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(wn, {
823
+ }) : null, (f == null ? void 0 : f.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(kn, {
827
824
  appId: o.id,
828
825
  list: [],
829
826
  search: Ee ? vt : "",
@@ -832,39 +829,39 @@ ${t}` : t, a = new J(i, r, G.User, n);
832
829
  },
833
830
  disabled: M
834
831
  })]
835
- }), /* @__PURE__ */ A(le, {
832
+ }), /* @__PURE__ */ A(ae, {
836
833
  children: [(f == null ? void 0 : f.connectNetwork) && o.type === 0 && ((Ge = o.arrange) == null ? void 0 : Ge.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(bn, {
837
834
  sessionId: (Xe = e == null ? void 0 : e.data) == null ? void 0 : Xe.id,
838
835
  netStatus: H,
839
- enable: typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.diabled) == "boolean" ? !(l != null && l.connectNetwork.diabled) : Pt,
836
+ enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : Pt,
840
837
  disabledTip: e ? void 0 : "网络访问已被禁用",
841
838
  onNetStatusChange: (t) => {
842
839
  qt(t);
843
840
  }
844
- }), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ c(vn, {
841
+ }), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ c(pn, {
845
842
  currentSessionId: (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id,
846
843
  onSessionChange: (t, n) => {
847
- W(void 0), b == null || b(n);
844
+ W(void 0), k == null || k(n);
848
845
  },
849
846
  disabled: M
850
847
  }), (f == null ? void 0 : f.sessionOpen) && /* @__PURE__ */ c(_, {
851
- icon: /* @__PURE__ */ c(hn, {}),
848
+ icon: /* @__PURE__ */ c(un, {}),
852
849
  className: "add-btn",
853
850
  type: "primary",
854
851
  disabled: De || !e || !h.length || M,
855
852
  onClick: () => {
856
853
  var t, n;
857
- b == null || b(void 0), I(!1), (t = Pe.current) == null || t.clear(), (n = pe.current) == null || n.clear();
854
+ k == null || k(void 0), I(!1), (t = Pe.current) == null || t.clear(), (n = ye.current) == null || n.clear();
858
855
  },
859
856
  children: "新会话"
860
857
  })]
861
858
  })]
862
859
  }), /* @__PURE__ */ c("div", {
863
860
  className: "footer-textarea",
864
- children: /* @__PURE__ */ c(dn, {
861
+ children: /* @__PURE__ */ c(an, {
865
862
  ref: me,
866
863
  maxLength: ht,
867
- text: bt,
864
+ text: kt,
868
865
  networkStatus: !1,
869
866
  loading: Ue,
870
867
  disabled: Le || Ne || M || Ue,
@@ -872,13 +869,13 @@ ${t}` : t, a = new J(i, r, G.User, n);
872
869
  onChange: (t, n) => {
873
870
  W(t);
874
871
  const r = n.getText().replace(/[\n\s]+$/, "");
875
- S(r), kt(r), Ee || yt(!0);
872
+ S(r), bt(r), Ee || pt(!0);
876
873
  },
877
- clearAction: /* @__PURE__ */ c(le, {
874
+ clearAction: /* @__PURE__ */ c(ae, {
878
875
  size: 0,
879
876
  children: /* @__PURE__ */ c(_, {
880
877
  type: "link",
881
- disabled: ye || M,
878
+ disabled: pe || M,
882
879
  ghost: !0,
883
880
  icon: /* @__PURE__ */ c(de, {
884
881
  style: {
@@ -892,9 +889,9 @@ ${t}` : t, a = new J(i, r, G.User, n);
892
889
  })
893
890
  })]
894
891
  })
895
- }), /* @__PURE__ */ c(gn, {
892
+ }), /* @__PURE__ */ c(fn, {
896
893
  tips: ft
897
- }), Re && /* @__PURE__ */ c(pn, {
894
+ }), Re && /* @__PURE__ */ c(mn, {
898
895
  isvisible: Re,
899
896
  files: xt,
900
897
  sessionId: (Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id,
@@ -905,5 +902,5 @@ ${t}` : t, a = new J(i, r, G.User, n);
905
902
  });
906
903
  };
907
904
  export {
908
- Sn as default
905
+ Zn as default
909
906
  };