@glodon-aiot/agent-cli-ui 3.3.4-beta.2 → 3.3.4-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 z = (L, o, v) => new Promise((e, w) => {
15
15
  var ue = (x) => {
@@ -18,23 +18,23 @@ var z = (L, o, v) => new Promise((e, w) => {
18
18
  } catch (h) {
19
19
  w(h);
20
20
  }
21
- }, k = (x) => {
21
+ }, b = (x) => {
22
22
  try {
23
23
  H(v.throw(x));
24
24
  } catch (h) {
25
25
  w(h);
26
26
  }
27
- }, H = (x) => x.done ? e(x.value) : Promise.resolve(x.value).then(ue, k);
27
+ }, H = (x) => x.done ? e(x.value) : Promise.resolve(x.value).then(ue, b);
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
- import { memo as Zt, useState as m, useRef as B, useContext as Jt, useEffect as F, useMemo as St } from "react";
31
+ import { memo as Zt, useState as m, useRef as B, 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";
@@ -49,12 +49,12 @@ import yn from "./Tools/UploadKnowledgeFiles/index.mjs";
49
49
  import pn from "../UploadingPrompt/index.mjs";
50
50
  import vn from "./PromptSetting/index.mjs";
51
51
  import { useMemoizedFn as Le } from "ahooks";
52
- import bn from "./Tools/SessionListDrawer/index.mjs";
53
- import kn from "react-infinite-scroll-component";
52
+ import kn from "./Tools/SessionListDrawer/index.mjs";
53
+ 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,23 +69,23 @@ 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 = "",
82
82
  currentSession: e,
83
83
  onCreateSession: w,
84
84
  embeddingService: ue,
85
- setCurrentSession: k,
85
+ setCurrentSession: b,
86
86
  networkStatus: H,
87
87
  setNetworkStatus: x
88
- } = L, [h, C] = m([]), [gt, ee] = m(), [he, Ce] = m(), R = B(null), {
88
+ } = L, [h, C] = m([]), [gt, ee] = m(), [he, Ne] = m(), R = B(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: j,
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 = B(h), Te = B(), [pt, vt] = m(0), [X, q] = m(), [Y, ne] = m(""), [Fe, pe] = m(!1), ve = B(null), [Ee, bt] = m([]), [Re, K] = m(!1), [De, kt] = m(!1), [wt, xt] = m(""), [It, W] = m(), [ie, oe] = m({}), se = B(null), He = B(null), be = B(null), [Me, Lt] = m(!1), [Ct, Nt] = m([]), [Pt, re] = m(!0), [Tt, Ft] = m(!0), [Oe, O] = m(!1), [ke, 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), [ze, U] = m(!1), [je, 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 = B(h), Ee = B(), [pt, vt] = m(0), [X, q] = m(), [Y, ne] = m(""), [Fe, pe] = m(!1), ve = B(null), [Re, kt] = m([]), [De, K] = m(!1), [He, bt] = m(!1), [wt, xt] = m(""), [It, W] = m(), [ie, oe] = m({}), se = B(null), Me = B(null), ke = B(null), [Oe, Lt] = m(!1), [Ct, Nt] = m([]), [Pt, re] = m(!0), [Tt, Et] = m(!0), [Ue, O] = m(!1), [be, V] = m(!1), [ze, 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), [je, 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), [$e, 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
- bt(t);
173
+ kt(t);
174
174
  }));
175
175
  }, [ut, o]);
176
- const $e = (t) => z(void 0, null, function* () {
176
+ const Ae = (t) => z(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((b) => !!(b != null && b.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,8 +201,8 @@ const lt = 10, ei = (L) => {
201
201
  });
202
202
  return;
203
203
  } else
204
- console.error("变量值不能为空", E == null ? void 0 : E.map((b) => !!(b != null && b.value)));
205
- if (ke) {
204
+ console.error("变量值不能为空", F == null ? void 0 : F.map((k) => !!(k != null && k.value)));
205
+ if (be) {
206
206
  u.config({
207
207
  getContainer: () => (f == null ? void 0 : f.current) || document.body
208
208
  }), u.error("正在回复中"), u.config({
@@ -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({
@@ -239,10 +239,10 @@ const lt = 10, ei = (L) => {
239
239
  if (!i) {
240
240
  w == null || w({
241
241
  netOpen: H ? 1 : 2
242
- }).then((b) => {
242
+ }).then((k) => {
243
243
  var $, J;
244
- U(!0), x(!!(($ = b.data) != null && $.netOpen)), Q(!!((J = b.data) != null && J.enableNetOpen)), Ae(b).then(() => {
245
- k == null || k(b), U(!1), Ce(n);
244
+ U(!0), x(!!(($ = k.data) != null && $.netOpen)), Q(!!((J = k.data) != null && J.enableNetOpen)), Be(k).then(() => {
245
+ b == null || b(k), U(!1), Ne(n);
246
246
  });
247
247
  });
248
248
  return;
@@ -258,21 +258,21 @@ ${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;
265
- } catch (b) {
265
+ } catch (k) {
266
266
  s = !1;
267
267
  }
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
- }), Ae = (t) => new Promise((n, r) => z(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
+ }), Be = (t) => new Promise((n, r) => z(void 0, null, function* () {
273
273
  const s = (t == null ? void 0 : t.promptVariables).filter((d) => !(d.type === ge.User && d.key === "query") && !(d.type === ge.System && d.key === "datetime")).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 = () => z(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);
@@ -343,39 +343,40 @@ ${t}` : t, l = new S(i, r, G.User, n);
343
343
  });
344
344
  const s = new S("", r, G.System);
345
345
  s.isWaiting = !0, y.current = [s, ...y.current], C(y.current);
346
- const d = (n == null ? void 0 : n.map((b) => b.id)) || [], I = {
346
+ const d = (n == null ? void 0 : n.map((k) => k.id)) || [], I = {
347
347
  stream: rn.stream,
348
348
  referenceFirst: !1
349
349
  };
350
350
  if (g != null && g.promptVariables) {
351
- const b = E == null ? void 0 : E.reduce(($, J) => ($[J.key] = J.value, $), {});
352
- I.formatValues = b;
351
+ const k = F == null ? void 0 : F.reduce(($, J) => ($[J.key] = J.value, $), {});
352
+ I.formatValues = k;
353
353
  }
354
354
  if (g != null && g.knowledges) {
355
- const b = Rt;
356
- I.knowledges = b;
355
+ const k = Rt;
356
+ I.knowledges = k;
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,28 +419,28 @@ ${t}` : t, l = new S(i, r, G.User, n);
418
419
  }), !1) : (q(t), !1);
419
420
  }, zt = (t) => z(void 0, null, function* () {
420
421
  var n;
421
- return q(t), (n = e == null ? void 0 : e.data) != null && n.id ? Be(e, t) : new Promise((r) => {
422
+ return q(t), (n = e == null ? void 0 : e.data) != null && n.id ? qe(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
- k == null || k(i), U(!1), x(!!((l = i.data) != null && l.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(Be(i, t));
427
+ 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
428
  });
428
429
  });
429
- }), Be = (t, n) => {
430
+ }), qe = (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
438
439
  };
439
440
  pe(!0), P == null || P.postTicket(l).then((d) => {
440
441
  P.uploadMinioFile(d.minio, n).then(() => {
441
- var b, $;
442
- const I = (b = d.minio.endpoints) == null ? void 0 : b[0], p = d.minio.bucket, T = ($ = d.minio.fileKeys) == null ? void 0 : $[0];
442
+ var k, $;
443
+ const I = (k = d.minio.endpoints) == null ? void 0 : k[0], p = d.minio.bucket, T = ($ = d.minio.fileKeys) == null ? void 0 : $[0];
443
444
  i(`${location.protocol}//${I}/${p}/${T}`);
444
445
  }).catch(() => {
445
446
  ne(""), q(void 0);
@@ -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 && !ze && t.scrollTo({
457
458
  top: t.scrollHeight
458
459
  });
459
460
  }, [h]);
460
- const qe = (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
  }, At = Le((t) => {
487
488
  var n, r;
488
489
  (n = ve.current) == null || n.update(t), (r = ve.current) == null || r.focus();
489
490
  }), Bt = Le((t) => {
490
- $e(t);
491
+ Ae(t);
491
492
  }), qt = 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, !ze && ((n = be.current) == null || n.clear());
502
+ Ee.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !je && ((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 = () => {
@@ -574,14 +575,14 @@ ${t}` : t, l = new S(i, r, G.User, n);
574
575
  N == null || N.removeEventListener("ready", t);
575
576
  };
576
577
  }, [e, N, a == null ? void 0 : a.promptVariables]);
577
- const Ye = () => w == null ? void 0 : w({
578
+ const Ke = () => w == null ? void 0 : w({
578
579
  netOpen: H ? 1 : 2
579
580
  }).then((t) => {
580
581
  var n, r;
581
- return k == null || k(t), U(!1), x(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), Ae(t), t;
582
- }), Ke = St(() => {
582
+ return b == null || b(t), U(!1), x(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), Be(t), t;
583
+ }), We = St(() => {
583
584
  var t;
584
- return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(dt, {
585
+ return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(ct, {
585
586
  application: o,
586
587
  history: {
587
588
  role: 1,
@@ -591,7 +592,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
591
592
  sessionId: "",
592
593
  reference: [],
593
594
  searchReference: [],
594
- messageTime: ct(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
595
+ messageTime: ft(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
595
596
  actions: [],
596
597
  isLoading: !1
597
598
  },
@@ -602,12 +603,12 @@ ${t}` : t, l = new S(i, r, G.User, n);
602
603
  return /* @__PURE__ */ A("div", {
603
604
  className: "agent-chat",
604
605
  children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(vn, {
605
- ref: He,
606
+ ref: Me,
606
607
  appId: o.id,
607
608
  currentSession: e,
608
- promptVariables: E,
609
+ promptVariables: F,
609
610
  setPromptVariables: ae,
610
- setCurrentSession: k
611
+ setCurrentSession: b
611
612
  }), /* @__PURE__ */ A("div", {
612
613
  className: "chat-main",
613
614
  id: "chat-main",
@@ -623,7 +624,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
623
624
  },
624
625
  ref: R,
625
626
  onScroll: $t,
626
- children: (We = e == null ? void 0 : e.data) != null && We.id && (h != null && h.length) ? /* @__PURE__ */ A(kn, {
627
+ children: (Qe = e == null ? void 0 : e.data) != null && Qe.id && (h != null && h.length) ? /* @__PURE__ */ A(bn, {
627
628
  dataLength: h.length,
628
629
  next: Yt,
629
630
  style: {
@@ -632,12 +633,12 @@ ${t}` : t, l = new S(i, r, G.User, n);
632
633
  overflowX: "hidden"
633
634
  },
634
635
  inverse: !0,
635
- endMessage: h.length > lt && // 少于一页不展示这个提示
636
- ((Qe = R.current) != null && Qe.scrollTop) && ((_e = R.current) == null ? void 0 : _e.scrollTop) < -10 ? /* @__PURE__ */ c(en, {
636
+ endMessage: h.length > dt && // 少于一页不展示这个提示
637
+ ((_e = R.current) != null && _e.scrollTop) && ((Ge = R.current) == null ? void 0 : Ge.scrollTop) < -10 ? /* @__PURE__ */ c(en, {
637
638
  plain: !0,
638
639
  children: "没有更多数据了"
639
640
  }) : null,
640
- hasMore: je,
641
+ hasMore: Ve,
641
642
  loader: /* @__PURE__ */ c("div", {
642
643
  style: {
643
644
  height: "50px",
@@ -657,39 +658,39 @@ ${t}` : t, l = new S(i, r, G.User, n);
657
658
  onAgainClick: qt,
658
659
  onEditClick: At,
659
660
  markdown: a == null ? void 0 : a.markdown
660
- }, t.messageId + n)), !je && Ke]
661
+ }, t.messageId + n)), !Ve && We]
661
662
  }) : /* @__PURE__ */ A("div", {
662
663
  className: "main-empty",
663
664
  children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ c(gn, {
664
- text: a === void 0 || a.greeting === !0 || ((Ge = a.greeting) == null ? void 0 : Ge.text) === void 0 ? at.text : a.greeting.text,
665
- icon: a === void 0 || a.greeting === !0 || ((Xe = a.greeting) == null ? void 0 : Xe.icon) === void 0 ? yt || at.icon : a.greeting.icon,
666
- 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, {
667
- ref: be,
668
- sid: (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id,
669
- isRecommendClearing: Re,
670
- data: Ee,
665
+ text: a === void 0 || a.greeting === !0 || ((Xe = a.greeting) == null ? void 0 : Xe.text) === void 0 ? lt.text : a.greeting.text,
666
+ icon: a === void 0 || a.greeting === !0 || ((Ze = a.greeting) == null ? void 0 : Ze.icon) === void 0 ? yt || lt.icon : a.greeting.icon,
667
+ 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, {
668
+ ref: ke,
669
+ sid: (Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id,
670
+ isRecommendClearing: De,
671
+ data: Re,
671
672
  onItemClick: (t) => {
672
673
  var r, i, l;
673
- if (ee(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), Re)
674
+ if (ee(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), De)
674
675
  return;
675
676
  t != null && t.id && K(!0);
676
677
  const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
677
678
  g != null && g.fileUpload ? (l = (i = se.current) == null ? void 0 : i.clear()) == null || l.then(() => {
678
679
  var s, d;
679
- t != null && t.id && (n ? (s = qe(n, t)) == null || s.finally(() => {
680
+ t != null && t.id && (n ? (s = Ye(n, t)) == null || s.finally(() => {
680
681
  K(!1);
681
- }) : (K(!1), U(!0), (d = Ye()) == null || d.then((I) => {
682
+ }) : (K(!1), U(!0), (d = Ke()) == null || d.then((I) => {
682
683
  var p;
683
- (p = qe(I.id, t)) == null || p.finally(() => {
684
+ (p = Ye(I.id, t)) == null || p.finally(() => {
684
685
  K(!1);
685
686
  });
686
687
  })));
687
- }) : n ? K(!1) : (K(!1), U(!0), Ye());
688
+ }) : n ? K(!1) : (K(!1), U(!0), Ke());
688
689
  }
689
690
  })
690
- }), Ke]
691
+ }), We]
691
692
  })
692
- }), Oe && /* @__PURE__ */ c("div", {
693
+ }), Ue && /* @__PURE__ */ c("div", {
693
694
  className: "session-stop",
694
695
  children: /* @__PURE__ */ c(_, {
695
696
  type: "primary",
@@ -707,7 +708,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
707
708
  onClick: () => jt(),
708
709
  children: "停止回答"
709
710
  })
710
- }), Ue && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ c("div", {
711
+ }), ze && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ c("div", {
711
712
  className: "back-bottom",
712
713
  children: /* @__PURE__ */ c(_, {
713
714
  size: "small",
@@ -791,7 +792,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
791
792
  }), ue && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(yn, {
792
793
  appId: o == null ? void 0 : o.id,
793
794
  ref: se,
794
- isFirstSession: ze,
795
+ isFirstSession: je,
795
796
  docViewerUrl: v,
796
797
  onStatusChange: (t) => z(void 0, null, function* () {
797
798
  t !== "process" ? (re(!0), xe()) : re(!1);
@@ -801,13 +802,13 @@ ${t}` : t, l = new S(i, r, G.User, n);
801
802
  netOpen: H ? 1 : 2
802
803
  }).then((n) => {
803
804
  var i, l, s;
804
- k == null || k(n), U(!1), x(!!((i = n.data) != null && i.netOpen)), Q(!!((l = n.data) != null && l.enableNetOpen));
805
+ b == null || b(n), U(!1), x(!!((i = n.data) != null && i.netOpen)), Q(!!((l = n.data) != null && l.enableNetOpen));
805
806
  const r = ((s = n.data) == null ? void 0 : s.id) || "";
806
807
  t(r);
807
808
  });
808
809
  }),
809
- sid: (Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id,
810
- disabled: ke || M,
810
+ sid: (Se = e == null ? void 0 : e.data) == null ? void 0 : Se.id,
811
+ disabled: be || M,
811
812
  afterFileAdd: (t, n) => {
812
813
  n && oe((r) => {
813
814
  const i = r[n] || [];
@@ -840,35 +841,35 @@ ${t}` : t, l = new S(i, r, G.User, n);
840
841
  }) : null, (g == null ? void 0 : g.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(xn, {
841
842
  appId: o.id,
842
843
  list: [],
843
- search: De ? wt : "",
844
+ search: He ? wt : "",
844
845
  onPromptSelect: (t) => {
845
846
  W(t.context), ee(t.context);
846
847
  },
847
848
  disabled: M
848
849
  })]
849
850
  }), /* @__PURE__ */ A(de, {
850
- 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, {
851
- sessionId: (et = e == null ? void 0 : e.data) == null ? void 0 : et.id,
851
+ 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, {
852
+ sessionId: (tt = e == null ? void 0 : e.data) == null ? void 0 : tt.id,
852
853
  netStatus: H,
853
854
  enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : Ht,
854
855
  disabledTip: e ? void 0 : "网络访问已被禁用",
855
856
  onNetStatusChange: (t) => {
856
857
  Kt(t);
857
858
  }
858
- }), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(bn, {
859
- currentSessionId: (tt = e == null ? void 0 : e.data) == null ? void 0 : tt.id,
859
+ }), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(kn, {
860
+ currentSessionId: (nt = e == null ? void 0 : e.data) == null ? void 0 : nt.id,
860
861
  onSessionChange: (t, n) => {
861
- W(void 0), k == null || k(n);
862
+ W(void 0), b == null || b(n);
862
863
  },
863
864
  disabled: M
864
865
  }), (g == null ? void 0 : g.sessionOpen) && /* @__PURE__ */ c(_, {
865
866
  icon: /* @__PURE__ */ c(mn, {}),
866
867
  className: "add-btn",
867
868
  type: "primary",
868
- disabled: Oe || !e || !h.length || M,
869
+ disabled: Ue || !e || !h.length || M,
869
870
  onClick: () => {
870
871
  var t, n;
871
- k == null || k(void 0), x(!1), (t = He.current) == null || t.clear(), (n = be.current) == null || n.clear();
872
+ b == null || b(void 0), x(!1), (t = Me.current) == null || t.clear(), (n = ke.current) == null || n.clear();
872
873
  },
873
874
  children: "新会话"
874
875
  })]
@@ -880,19 +881,19 @@ ${t}` : t, l = new S(i, r, G.User, n);
880
881
  maxLength: pt,
881
882
  text: It,
882
883
  networkStatus: !1,
883
- loading: Ve,
884
- disabled: Pe || Fe || M || Ve,
885
- onTextSend: $e,
884
+ loading: $e,
885
+ disabled: Te || Fe || M || $e,
886
+ onTextSend: Ae,
886
887
  onChange: (t, n) => {
887
888
  W(t);
888
889
  const r = n.getText().replace(/[\n\s]+$/, "");
889
- ee(r), xt(r), De || kt(!0);
890
+ ee(r), xt(r), He || bt(!0);
890
891
  },
891
892
  clearAction: /* @__PURE__ */ c(de, {
892
893
  size: 0,
893
894
  children: /* @__PURE__ */ c(_, {
894
895
  type: "link",
895
- disabled: ke || M,
896
+ disabled: be || M,
896
897
  ghost: !0,
897
898
  icon: /* @__PURE__ */ c(fe, {
898
899
  style: {
@@ -908,12 +909,12 @@ ${t}` : t, l = new S(i, r, G.User, n);
908
909
  })
909
910
  }), /* @__PURE__ */ c(un, {
910
911
  tips: ht
911
- }), Me && /* @__PURE__ */ c(pn, {
912
- isvisible: Me,
912
+ }), Oe && /* @__PURE__ */ c(pn, {
913
+ isvisible: Oe,
913
914
  files: Ct,
914
- sessionId: (nt = e == null ? void 0 : e.data) == null ? void 0 : nt.id,
915
+ sessionId: (it = e == null ? void 0 : e.data) == null ? void 0 : it.id,
915
916
  onClose: (t) => {
916
- Lt(!1), Ft(!1);
917
+ Lt(!1), Et(!1);
917
918
  }
918
919
  })]
919
920
  });