@glodon-aiot/agent-cli-ui 3.3.5-alpha.29 → 3.3.5-beta.30

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.
@@ -1,15 +1,15 @@
1
1
  var Wt = Object.defineProperty, Qt = Object.defineProperties;
2
2
  var _t = Object.getOwnPropertyDescriptors;
3
- var it = Object.getOwnPropertySymbols;
3
+ var ot = Object.getOwnPropertySymbols;
4
4
  var Gt = Object.prototype.hasOwnProperty, Xt = Object.prototype.propertyIsEnumerable;
5
- var Ie = (L, o, v) => o in L ? Wt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v, ot = (L, o) => {
5
+ var Ie = (L, o, v) => o in L ? Wt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v, st = (L, o) => {
6
6
  for (var v in o || (o = {}))
7
7
  Gt.call(o, v) && Ie(L, v, o[v]);
8
- if (it)
9
- for (var v of it(o))
8
+ if (ot)
9
+ for (var v of ot(o))
10
10
  Xt.call(o, v) && Ie(L, v, o[v]);
11
11
  return L;
12
- }, st = (L, o) => Qt(L, _t(o));
12
+ }, rt = (L, o) => Qt(L, _t(o));
13
13
  var D = (L, o, v) => (Ie(L, typeof o != "symbol" ? o + "" : o, v), v);
14
14
  var j = (L, o, v) => new Promise((e, w) => {
15
15
  var ue = (x) => {
@@ -28,13 +28,13 @@ var j = (L, o, v) => new Promise((e, w) => {
28
28
  H((v = v.apply(L, o)).next());
29
29
  });
30
30
  import { jsx as c, jsxs as $ } from "react/jsx-runtime";
31
- import { memo as Zt, useState as m, useRef as q, useContext as Jt, useEffect as F, useMemo as St } from "react";
31
+ import { memo as Zt, useState as m, useRef as q, useContext as Jt, useEffect as E, useMemo as St } from "react";
32
32
  /* empty css */import { Divider as en, Spin as tn, Button as _, Space as de, Upload as nn, Tooltip as on, notification as ce, message as u } from "antd";
33
33
  import fe from "../../components/Iconfont/index.mjs";
34
- import { IHistoryRole as G, ChatMessageRole as rt, PromptVariableType as ge } from "@glodon-aiot/apis";
35
- import dt from "./HistoryItem/index.mjs";
36
- import ct from "dayjs";
37
- import { v4 as ft } from "uuid";
34
+ import { IHistoryRole as G, ChatMessageRole as at, PromptVariableType as ge } from "@glodon-aiot/apis";
35
+ import ct from "./HistoryItem/index.mjs";
36
+ import ft from "dayjs";
37
+ import { v4 as Ce } from "uuid";
38
38
  import sn from "../../context.mjs";
39
39
  import { configuration as rn } from "@glodon-aiot/bot-client-sdk";
40
40
  import { MB as an } from "../../constant.mjs";
@@ -54,7 +54,7 @@ import bn from "react-infinite-scroll-component";
54
54
  import wn from "./Tools/ConnectToNetwork/index.mjs";
55
55
  import xn from "./Tools/PromptManager/index.mjs";
56
56
  import In from "../../assets/icon.svg.mjs";
57
- const Ln = Zt(dt), at = {
57
+ const Ln = Zt(ct), lt = {
58
58
  icon: In,
59
59
  text: "今天我能帮你什么?"
60
60
  };
@@ -69,13 +69,13 @@ class S {
69
69
  D(this, "isSensitive");
70
70
  D(this, "isSuspend");
71
71
  D(this, "comment");
72
- this.content = o, this.sessionId = v, this.role = e, this.files = w, this.content = o, this.role = e, this.sessionId = v, this.files = w, this.messageTime = ct(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = ft(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
72
+ this.content = o, this.sessionId = v, this.role = e, this.files = w, this.content = o, this.role = e, this.sessionId = v, this.files = w, this.messageTime = ft(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Ce(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
73
73
  isAgree: 0
74
74
  };
75
75
  }
76
76
  }
77
- const lt = 10, ei = (L) => {
78
- var We, Qe, _e, Ge, Xe, Ze, Je, Se, et, tt, nt;
77
+ const dt = 10, ei = (L) => {
78
+ var Qe, _e, Ge, Xe, Ze, Je, Se, et, tt, nt, it;
79
79
  const {
80
80
  application: o,
81
81
  docViewerUrl: v = "",
@@ -85,7 +85,7 @@ const lt = 10, ei = (L) => {
85
85
  setCurrentSession: b,
86
86
  networkStatus: H,
87
87
  setNetworkStatus: x
88
- } = L, [h, C] = m([]), [gt, ee] = m(), [he, Ce] = m(), R = q(null), {
88
+ } = L, [h, C] = m([]), [gt, ee] = m(), [he, Ne] = m(), R = q(null), {
89
89
  service: P,
90
90
  agentClient: N,
91
91
  depId: ut,
@@ -93,15 +93,15 @@ const lt = 10, ei = (L) => {
93
93
  transform: g,
94
94
  defaultInput: me,
95
95
  onMessage: te,
96
- onHistoryLoad: Ne,
96
+ onHistoryLoad: Pe,
97
97
  beforeMessageSend: z,
98
98
  bodyStyle: mt,
99
99
  disabled: M,
100
100
  features: a,
101
101
  popupContainer: f,
102
102
  icon: yt
103
- } = Jt(sn), [Pe, ye] = m(!1), y = q(h), Te = q(void 0), [pt, vt] = m(0), [X, A] = m(), [Y, ne] = m(""), [Fe, pe] = m(!1), ve = q(null), [Ee, kt] = m([]), [Re, K] = m(!1), [De, bt] = m(!1), [wt, xt] = m(""), [It, W] = m(), [ie, oe] = m({}), se = q(null), He = q(null), ke = q(null), [Me, Lt] = m(!1), [Ct, Nt] = m([]), [Pt, re] = m(!0), [Tt, Ft] = m(!0), [Oe, O] = m(!1), [be, V] = m(!1), [Ue, Et] = m(!1), [E, ae] = m(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [Rt, Dt] = m(typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0), [je, U] = m(!1), [ze, Z] = m(!1), [Ht, Q] = m(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), [Ve, le] = m(!1);
104
- F(() => {
103
+ } = Jt(sn), [Te, ye] = m(!1), y = q(h), Ee = q(void 0), [pt, vt] = m(0), [X, A] = m(), [Y, ne] = m(""), [Fe, pe] = m(!1), ve = q(null), [Re, kt] = m([]), [De, K] = m(!1), [He, bt] = m(!1), [wt, xt] = m(""), [It, W] = m(), [ie, oe] = m({}), se = q(null), Me = q(null), ke = q(null), [Oe, Lt] = m(!1), [Ct, Nt] = m([]), [Pt, re] = m(!0), [Tt, Et] = m(!0), [Ue, O] = m(!1), [be, V] = m(!1), [je, Ft] = m(!1), [F, ae] = m(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [Rt, Dt] = m(typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0), [ze, U] = m(!1), [Ve, Z] = m(!1), [Ht, Q] = m(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), [Be, le] = m(!1);
104
+ E(() => {
105
105
  var r, i;
106
106
  e && (y.current = []), C([]);
107
107
  const t = R.current;
@@ -115,7 +115,7 @@ const lt = 10, ei = (L) => {
115
115
  }
116
116
  const n = (l) => {
117
117
  var s;
118
- (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), Ne && Ne({
118
+ (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), Pe && Pe({
119
119
  applicationId: o.id,
120
120
  sessionId: e.data.id,
121
121
  histories: l
@@ -124,7 +124,7 @@ const lt = 10, ei = (L) => {
124
124
  return e.addEventListener("history:loaded", n), () => {
125
125
  y.current = [], C([]), e == null || e.removeEventListener("history:loaded", n);
126
126
  };
127
- }, [e]), F(() => {
127
+ }, [e]), E(() => {
128
128
  const t = () => {
129
129
  var n;
130
130
  (n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && ae(e.promptVariables.sort((r, i) => r.key.localeCompare(i.key))), e.knowledges && Dt(e.knowledges), x(e.netOpen));
@@ -132,7 +132,7 @@ const lt = 10, ei = (L) => {
132
132
  return e == null || e.addEventListener("data:updated", t), () => {
133
133
  e == null || e.removeEventListener("data:updated", t);
134
134
  };
135
- }, [e]), F(() => {
135
+ }, [e]), E(() => {
136
136
  var n;
137
137
  if (!((n = e == null ? void 0 : e.data) != null && n.id))
138
138
  return;
@@ -168,12 +168,12 @@ const lt = 10, ei = (L) => {
168
168
  i.isContext = !0, C([i, ...h]);
169
169
  });
170
170
  };
171
- F(() => {
171
+ E(() => {
172
172
  o != null && o.id && (P == null || P.getRecommendQues(o.id).then((t) => {
173
173
  kt(t);
174
174
  }));
175
175
  }, [ut, o]);
176
- const Be = (t) => j(void 0, null, function* () {
176
+ const $e = (t) => j(void 0, null, function* () {
177
177
  var p, T;
178
178
  if (M) {
179
179
  u.config({
@@ -192,7 +192,7 @@ const lt = 10, ei = (L) => {
192
192
  });
193
193
  return;
194
194
  }
195
- if (!(E == null ? void 0 : E.every((k) => !!(k != null && k.value))))
195
+ if (!(F == null ? void 0 : F.every((k) => !!(k != null && k.value))))
196
196
  if (g != null && g.promptVariables) {
197
197
  u.config({
198
198
  getContainer: () => (f == null ? void 0 : f.current) || document.body
@@ -201,7 +201,7 @@ const lt = 10, ei = (L) => {
201
201
  });
202
202
  return;
203
203
  } else
204
- console.error("变量值不能为空", E == null ? void 0 : E.map((k) => !!(k != null && k.value)));
204
+ console.error("变量值不能为空", F == null ? void 0 : F.map((k) => !!(k != null && k.value)));
205
205
  if (be) {
206
206
  u.config({
207
207
  getContainer: () => (f == null ? void 0 : f.current) || document.body
@@ -210,7 +210,7 @@ const lt = 10, ei = (L) => {
210
210
  });
211
211
  return;
212
212
  }
213
- if (Pe) {
213
+ if (Te) {
214
214
  u.config({
215
215
  getContainer: () => (f == null ? void 0 : f.current) || document.body
216
216
  }), u.error("等待初始化"), u.config({
@@ -241,8 +241,8 @@ const lt = 10, ei = (L) => {
241
241
  netOpen: H ? 1 : 2
242
242
  }).then((k) => {
243
243
  var B, J;
244
- U(!0), x(!!((B = k.data) != null && B.netOpen)), Q(!!((J = k.data) != null && J.enableNetOpen)), $e(k).then(() => {
245
- b == null || b(k), U(!1), Ce(n);
244
+ U(!0), x(!!((B = k.data) != null && B.netOpen)), Q(!!((J = k.data) != null && J.enableNetOpen)), qe(k).then(() => {
245
+ b == null || b(k), U(!1), Ne(n);
246
246
  });
247
247
  });
248
248
  return;
@@ -258,7 +258,7 @@ ${n}` : n;
258
258
  message: {
259
259
  content: l,
260
260
  sessionId: i,
261
- role: rt.User,
261
+ role: at.User,
262
262
  files: ie[i]
263
263
  }
264
264
  }) : s = !0;
@@ -268,11 +268,11 @@ ${n}` : n;
268
268
  if (le(!1), s === !1)
269
269
  return;
270
270
  let d = n;
271
- typeof s == "object" && (d = s.content || n), (yield e.setPromptVariables(E)) && (((T = ie[i]) == null ? void 0 : T.length) > 0 ? Ot(d) : we(d));
272
- }), $e = (t) => new Promise((n, r) => j(void 0, null, function* () {
271
+ typeof s == "object" && (d = s.content || n), (yield e.setPromptVariables(F)) && (((T = ie[i]) == null ? void 0 : T.length) > 0 ? Ot(d) : we(d));
272
+ }), qe = (t) => new Promise((n, r) => j(void 0, null, function* () {
273
273
  const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.type ? !((d.type === ge.User || d.type === void 0) && d.key === "query") && !((d.type === ge.System || d.type === void 0) && d.key === "datetime") : d.key !== "query").map((d) => {
274
274
  var p;
275
- const I = (p = E.find((T) => T.key === d.key && T.type === d.type)) == null ? void 0 : p.value;
275
+ const I = (p = F.find((T) => T.key === d.key && T.type === d.type)) == null ? void 0 : p.value;
276
276
  return d.value = I || "", d;
277
277
  });
278
278
  ae(s.sort((d, I) => d.key.localeCompare(I.key))), yield t == null ? void 0 : t.setPromptVariables(s).catch((d) => {
@@ -300,7 +300,7 @@ ${n}` : n;
300
300
  throw Error(p);
301
301
  });
302
302
  };
303
- F(() => {
303
+ E(() => {
304
304
  if (!he || !e)
305
305
  return;
306
306
  const t = he, n = () => j(void 0, null, function* () {
@@ -315,14 +315,14 @@ ${t}` : t;
315
315
  message: {
316
316
  content: r,
317
317
  sessionId: e.id,
318
- role: rt.User,
318
+ role: at.User,
319
319
  files: ie[e.id]
320
320
  }
321
321
  }) : i = !0;
322
322
  } catch (l) {
323
323
  i = !1;
324
324
  }
325
- le(!1), i !== !1 && (we(t), Ce(void 0));
325
+ le(!1), i !== !1 && (we(t), Ne(void 0));
326
326
  });
327
327
  return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
328
328
  e == null || e.removeEventListener("ready", n);
@@ -348,7 +348,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
348
348
  referenceFirst: !1
349
349
  };
350
350
  if (g != null && g.promptVariables) {
351
- const k = E == null ? void 0 : E.reduce((B, J) => (B[J.key] = J.value, B), {});
351
+ const k = F == null ? void 0 : F.reduce((B, J) => (B[J.key] = J.value, B), {});
352
352
  I.formatValues = k;
353
353
  }
354
354
  if (g != null && g.knowledges) {
@@ -357,25 +357,26 @@ ${t}` : t, l = new S(i, r, G.User, n);
357
357
  }
358
358
  yield e.send({
359
359
  text: i,
360
- fileIds: d
360
+ fileIds: d,
361
+ files: n
361
362
  }, I), oe({
362
363
  [r]: []
363
364
  }), (T = se.current) == null || T.update();
364
365
  });
365
- F(() => {
366
+ E(() => {
366
367
  var r;
367
368
  const t = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
368
369
  if (!t)
369
370
  return;
370
371
  const n = (i) => {
371
- if (!i.sessionId || i.sessionId && i.sessionId !== Te.current || i.role === G.User)
372
+ if (!i.sessionId || i.sessionId && i.sessionId !== Ee.current || i.role === G.User)
372
373
  return;
373
374
  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))
374
375
  return ce.error({
375
376
  message: i.content
376
377
  });
377
378
  const l = i.actions || [], s = new S(i.content, t, G.Robot);
378
- 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 && te && te({
379
+ s.messageId = i.messageId || Ce(), 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 && te && te({
379
380
  applicationId: o.id,
380
381
  sessionId: t,
381
382
  message: s
@@ -386,7 +387,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
386
387
  }), () => {
387
388
  e == null || e.removeEventListener("message:updated", n);
388
389
  };
389
- }, [e]), F(() => {
390
+ }, [e]), E(() => {
390
391
  if (!e) {
391
392
  ye(!1);
392
393
  return;
@@ -397,12 +398,12 @@ ${t}` : t, l = new S(i, r, G.User, n);
397
398
  return ye(e.frozen), e.addEventListener("frozen", t), () => {
398
399
  e == null || e.removeEventListener("frozen", t);
399
400
  };
400
- }, [e]), F(() => {
401
+ }, [e]), E(() => {
401
402
  if (!N)
402
403
  return;
403
404
  const t = N.questionContextMaxLength || 4e3;
404
405
  vt(t);
405
- }, [N, P]), F(() => {
406
+ }, [N, P]), E(() => {
406
407
  me && W(me.text);
407
408
  }, [me]);
408
409
  const Ut = (t) => {
@@ -418,20 +419,20 @@ ${t}` : t, l = new S(i, r, G.User, n);
418
419
  }), !1) : (A(t), !1);
419
420
  }, jt = (t) => j(void 0, null, function* () {
420
421
  var n;
421
- return A(t), (n = e == null ? void 0 : e.data) != null && n.id ? qe(e, t) : new Promise((r) => {
422
+ return A(t), (n = e == null ? void 0 : e.data) != null && n.id ? Ae(e, t) : new Promise((r) => {
422
423
  U(!0), w == null || w({
423
424
  netOpen: H ? 1 : 2
424
425
  }).then((i) => {
425
426
  var l, s;
426
- b == null || b(i), U(!1), x(!!((l = i.data) != null && l.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(qe(i, t));
427
+ b == null || b(i), U(!1), x(!!((l = i.data) != null && l.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(Ae(i, t));
427
428
  });
428
429
  });
429
- }), qe = (t, n) => {
430
+ }), Ae = (t, n) => {
430
431
  const r = dn(n.name);
431
432
  return new Promise((i) => {
432
433
  var s;
433
434
  const l = {
434
- files: [`${ft()}.${r}`],
435
+ files: [`${Ce()}.${r}`],
435
436
  isv: "minio",
436
437
  knowledgeId: ((s = t.data) == null ? void 0 : s.id) || "",
437
438
  type: 1
@@ -451,16 +452,16 @@ ${t}` : t, l = new S(i, r, G.User, n);
451
452
  });
452
453
  });
453
454
  };
454
- F(() => {
455
+ E(() => {
455
456
  const t = R.current;
456
- t && !Ue && t.scrollTo({
457
+ t && !je && t.scrollTo({
457
458
  top: t.scrollHeight
458
459
  });
459
460
  }, [h]);
460
- const Ae = (t, n) => new Promise((r) => {
461
+ const Ye = (t, n) => new Promise((r) => {
461
462
  if (!n.file.url || !(o != null && o.id))
462
463
  return r();
463
- const i = st(ot({}, n.file), {
464
+ const i = rt(st({}, n.file), {
464
465
  type: 1
465
466
  });
466
467
  P == null || P.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
@@ -482,12 +483,12 @@ ${t}` : t, l = new S(i, r, G.User, n);
482
483
  if (!R.current)
483
484
  return;
484
485
  const t = R.current.scrollTop <= -80;
485
- Et(t);
486
+ Ft(t);
486
487
  }, $t = Le((t) => {
487
488
  var n, r;
488
489
  (n = ve.current) == null || n.update(t), (r = ve.current) == null || r.focus();
489
490
  }), qt = Le((t) => {
490
- Be(t);
491
+ $e(t);
491
492
  }), At = Le(() => {
492
493
  var n;
493
494
  if (!((n = e == null ? void 0 : e.data) != null && n.id))
@@ -496,9 +497,9 @@ ${t}` : t, l = new S(i, r, G.User, n);
496
497
  const t = new S("", e.data.id, G.System);
497
498
  t.isWaiting = !0, y.current = [t, ...y.current], C(y.current), V(!0), O(!0), e.answerAgain();
498
499
  });
499
- F(() => {
500
+ E(() => {
500
501
  var t, n;
501
- Te.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !je && ((n = ke.current) == null || n.clear());
502
+ Ee.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !ze && ((n = ke.current) == null || n.clear());
502
503
  }, [e]);
503
504
  const Yt = () => {
504
505
  var r;
@@ -507,7 +508,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
507
508
  const n = h[h.length - 1].messageTime;
508
509
  e.fetchMessages({
509
510
  endTime: n,
510
- pageSize: lt
511
+ pageSize: dt
511
512
  }).then((i) => {
512
513
  const l = i || [];
513
514
  if (!l || !(l != null && l.length)) {
@@ -531,9 +532,9 @@ ${t}` : t, l = new S(i, r, G.User, n);
531
532
  (n = e == null ? void 0 : e.data) != null && n.id && (x(t.netOpen), Q(t.enableNetOpen));
532
533
  }) : (x(!1), Q(o.arrange[0].enableNetOpen));
533
534
  });
534
- F(() => {
535
+ E(() => {
535
536
  xe();
536
- }, [e]), F(() => {
537
+ }, [e]), E(() => {
537
538
  var t, n;
538
539
  if (R.current) {
539
540
  const r = document.getElementById("chat-main"), i = (t = R.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), l = (n = R.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
@@ -550,7 +551,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
550
551
  i.style.height = "auto";
551
552
  }
552
553
  }
553
- }, [h]), F(() => {
554
+ }, [h]), E(() => {
554
555
  if (e)
555
556
  return;
556
557
  const t = () => {
@@ -571,14 +572,14 @@ ${t}` : t, l = new S(i, r, G.User, n);
571
572
  N == null || N.removeEventListener("ready", t);
572
573
  };
573
574
  }, [e, N, a == null ? void 0 : a.promptVariables]);
574
- const Ye = () => w == null ? void 0 : w({
575
+ const Ke = () => w == null ? void 0 : w({
575
576
  netOpen: H ? 1 : 2
576
577
  }).then((t) => {
577
578
  var n, r;
578
- return b == null || b(t), U(!1), x(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), $e(t), t;
579
- }), Ke = St(() => {
579
+ return b == null || b(t), U(!1), x(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), qe(t), t;
580
+ }), We = St(() => {
580
581
  var t;
581
- return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(dt, {
582
+ return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(ct, {
582
583
  application: o,
583
584
  history: {
584
585
  role: 1,
@@ -588,7 +589,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
588
589
  sessionId: "",
589
590
  reference: [],
590
591
  searchReference: [],
591
- messageTime: ct(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
592
+ messageTime: ft(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
592
593
  actions: [],
593
594
  isLoading: !1
594
595
  },
@@ -599,10 +600,10 @@ ${t}` : t, l = new S(i, r, G.User, n);
599
600
  return /* @__PURE__ */ $("div", {
600
601
  className: "agent-chat",
601
602
  children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(vn, {
602
- ref: He,
603
+ ref: Me,
603
604
  appId: o.id,
604
605
  currentSession: e,
605
- promptVariables: E,
606
+ promptVariables: F,
606
607
  setPromptVariables: ae,
607
608
  setCurrentSession: b
608
609
  }), /* @__PURE__ */ $("div", {
@@ -620,7 +621,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
620
621
  },
621
622
  ref: R,
622
623
  onScroll: Bt,
623
- children: (We = e == null ? void 0 : e.data) != null && We.id && (h != null && h.length) ? /* @__PURE__ */ $(bn, {
624
+ children: (Qe = e == null ? void 0 : e.data) != null && Qe.id && (h != null && h.length) ? /* @__PURE__ */ $(bn, {
624
625
  dataLength: h.length,
625
626
  next: Yt,
626
627
  style: {
@@ -629,12 +630,12 @@ ${t}` : t, l = new S(i, r, G.User, n);
629
630
  overflowX: "hidden"
630
631
  },
631
632
  inverse: !0,
632
- endMessage: h.length > lt && // 少于一页不展示这个提示
633
- ((Qe = R.current) != null && Qe.scrollTop) && ((_e = R.current) == null ? void 0 : _e.scrollTop) < -10 ? /* @__PURE__ */ c(en, {
633
+ endMessage: h.length > dt && // 少于一页不展示这个提示
634
+ ((_e = R.current) != null && _e.scrollTop) && ((Ge = R.current) == null ? void 0 : Ge.scrollTop) < -10 ? /* @__PURE__ */ c(en, {
634
635
  plain: !0,
635
636
  children: "没有更多数据了"
636
637
  }) : null,
637
- hasMore: ze,
638
+ hasMore: Ve,
638
639
  loader: /* @__PURE__ */ c("div", {
639
640
  style: {
640
641
  height: "50px",
@@ -654,40 +655,40 @@ ${t}` : t, l = new S(i, r, G.User, n);
654
655
  onAgainClick: At,
655
656
  onEditClick: $t,
656
657
  markdown: a == null ? void 0 : a.markdown
657
- }, t.messageId + n)), !ze && Ke]
658
+ }, t.messageId + n)), !Ve && We]
658
659
  }) : /* @__PURE__ */ $("div", {
659
660
  className: "main-empty",
660
661
  children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ c(gn, {
661
- text: a === void 0 || a.greeting === !0 || ((Ge = a.greeting) == null ? void 0 : Ge.text) === void 0 ? at.text : a.greeting.text,
662
- icon: a === void 0 || a.greeting === !0 || ((Xe = a.greeting) == null ? void 0 : Xe.icon) === void 0 ? yt || at.icon : a.greeting.icon,
663
- children: !!Ee.length && (((a == null ? void 0 : a.greeting) === void 0 || (a == null ? void 0 : a.greeting)) === !0 || typeof (a == null ? void 0 : a.greeting) == "object" && a.greeting.questions !== !1) && /* @__PURE__ */ c(fn, {
662
+ text: a === void 0 || a.greeting === !0 || ((Xe = a.greeting) == null ? void 0 : Xe.text) === void 0 ? lt.text : a.greeting.text,
663
+ icon: a === void 0 || a.greeting === !0 || ((Ze = a.greeting) == null ? void 0 : Ze.icon) === void 0 ? yt || lt.icon : a.greeting.icon,
664
+ children: !!Re.length && (((a == null ? void 0 : a.greeting) === void 0 || (a == null ? void 0 : a.greeting)) === !0 || typeof (a == null ? void 0 : a.greeting) == "object" && a.greeting.questions !== !1) && /* @__PURE__ */ c(fn, {
664
665
  ref: ke,
665
- sid: (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id,
666
- isRecommendClearing: Re,
667
- data: Ee,
666
+ sid: (Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id,
667
+ isRecommendClearing: De,
668
+ data: Re,
668
669
  layoutBreakpoints: typeof (a == null ? void 0 : a.greeting) == "object" ? a.greeting.layoutBreakpoints : void 0,
669
670
  onItemClick: (t) => {
670
671
  var r, i, l;
671
- if (ee(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), Re)
672
+ if (ee(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), De)
672
673
  return;
673
674
  t != null && t.id && K(!0);
674
675
  const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
675
676
  g != null && g.fileUpload ? (l = (i = se.current) == null ? void 0 : i.clear()) == null || l.then(() => {
676
677
  var s, d;
677
- t != null && t.id && (n ? (s = Ae(n, t)) == null || s.finally(() => {
678
+ t != null && t.id && (n ? (s = Ye(n, t)) == null || s.finally(() => {
678
679
  K(!1);
679
- }) : (K(!1), U(!0), (d = Ye()) == null || d.then((I) => {
680
+ }) : (K(!1), U(!0), (d = Ke()) == null || d.then((I) => {
680
681
  var p;
681
- (p = Ae(I.id, t)) == null || p.finally(() => {
682
+ (p = Ye(I.id, t)) == null || p.finally(() => {
682
683
  K(!1);
683
684
  });
684
685
  })));
685
- }) : n ? K(!1) : (K(!1), U(!0), Ye());
686
+ }) : n ? K(!1) : (K(!1), U(!0), Ke());
686
687
  }
687
688
  })
688
- }), Ke]
689
+ }), We]
689
690
  })
690
- }), Oe && /* @__PURE__ */ c("div", {
691
+ }), Ue && /* @__PURE__ */ c("div", {
691
692
  className: "session-stop",
692
693
  children: /* @__PURE__ */ c(_, {
693
694
  type: "primary",
@@ -705,7 +706,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
705
706
  onClick: () => zt(),
706
707
  children: "停止回答"
707
708
  })
708
- }), Ue && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ c("div", {
709
+ }), je && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ c("div", {
709
710
  className: "back-bottom",
710
711
  children: /* @__PURE__ */ c(_, {
711
712
  size: "small",
@@ -789,7 +790,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
789
790
  }), ue && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(yn, {
790
791
  appId: o == null ? void 0 : o.id,
791
792
  ref: se,
792
- isFirstSession: je,
793
+ isFirstSession: ze,
793
794
  docViewerUrl: v,
794
795
  onStatusChange: (t) => j(void 0, null, function* () {
795
796
  t !== "process" ? (re(!0), xe()) : re(!1);
@@ -804,7 +805,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
804
805
  t(r);
805
806
  });
806
807
  }),
807
- sid: (Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id,
808
+ sid: (Se = e == null ? void 0 : e.data) == null ? void 0 : Se.id,
808
809
  disabled: be || M,
809
810
  afterFileAdd: (t, n) => {
810
811
  n && oe((r) => {
@@ -838,15 +839,15 @@ ${t}` : t, l = new S(i, r, G.User, n);
838
839
  }) : null, (g == null ? void 0 : g.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(xn, {
839
840
  appId: o.id,
840
841
  list: [],
841
- search: De ? wt : "",
842
+ search: He ? wt : "",
842
843
  onPromptSelect: (t) => {
843
844
  W(t.context), ee(t.context);
844
845
  },
845
846
  disabled: M
846
847
  })]
847
848
  }), /* @__PURE__ */ $(de, {
848
- children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((Se = o.arrange) == null ? void 0 : Se.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(wn, {
849
- sessionId: (et = e == null ? void 0 : e.data) == null ? void 0 : et.id,
849
+ children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((et = o.arrange) == null ? void 0 : et.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(wn, {
850
+ sessionId: (tt = e == null ? void 0 : e.data) == null ? void 0 : tt.id,
850
851
  netStatus: H,
851
852
  enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : Ht,
852
853
  disabledTip: e ? void 0 : "网络访问已被禁用",
@@ -854,7 +855,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
854
855
  Kt(t);
855
856
  }
856
857
  }), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(kn, {
857
- currentSessionId: (tt = e == null ? void 0 : e.data) == null ? void 0 : tt.id,
858
+ currentSessionId: (nt = e == null ? void 0 : e.data) == null ? void 0 : nt.id,
858
859
  onSessionChange: (t, n) => {
859
860
  W(void 0), b == null || b(n);
860
861
  },
@@ -863,10 +864,10 @@ ${t}` : t, l = new S(i, r, G.User, n);
863
864
  icon: /* @__PURE__ */ c(mn, {}),
864
865
  className: "add-btn",
865
866
  type: "primary",
866
- disabled: Oe || !e || !h.length || M,
867
+ disabled: Ue || !e || !h.length || M,
867
868
  onClick: () => {
868
869
  var t, n;
869
- b == null || b(void 0), x(!1), (t = He.current) == null || t.clear(), (n = ke.current) == null || n.clear();
870
+ b == null || b(void 0), x(!1), (t = Me.current) == null || t.clear(), (n = ke.current) == null || n.clear();
870
871
  },
871
872
  children: "新会话"
872
873
  })]
@@ -878,13 +879,13 @@ ${t}` : t, l = new S(i, r, G.User, n);
878
879
  maxLength: pt,
879
880
  text: It,
880
881
  networkStatus: !1,
881
- loading: Ve,
882
- disabled: Pe || Fe || M || Ve,
883
- onTextSend: Be,
882
+ loading: Be,
883
+ disabled: Te || Fe || M || Be,
884
+ onTextSend: $e,
884
885
  onChange: (t, n) => {
885
886
  W(t);
886
887
  const r = n.getText().replace(/[\n\s]+$/, "");
887
- ee(r), xt(r), De || bt(!0);
888
+ ee(r), xt(r), He || bt(!0);
888
889
  },
889
890
  clearAction: /* @__PURE__ */ c(de, {
890
891
  size: 0,
@@ -906,12 +907,12 @@ ${t}` : t, l = new S(i, r, G.User, n);
906
907
  })
907
908
  }), /* @__PURE__ */ c(un, {
908
909
  tips: ht
909
- }), Me && /* @__PURE__ */ c(pn, {
910
- isvisible: Me,
910
+ }), Oe && /* @__PURE__ */ c(pn, {
911
+ isvisible: Oe,
911
912
  files: Ct,
912
- sessionId: (nt = e == null ? void 0 : e.data) == null ? void 0 : nt.id,
913
+ sessionId: (it = e == null ? void 0 : e.data) == null ? void 0 : it.id,
913
914
  onClose: (t) => {
914
- Lt(!1), Ft(!1);
915
+ Lt(!1), Et(!1);
915
916
  }
916
917
  })]
917
918
  });