@glodon-aiot/agent-cli-ui 3.4.0-alpha.4 → 3.4.0-alpha.5

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,51 +1,51 @@
1
- var ln = Object.defineProperty, dn = Object.defineProperties;
2
- var cn = Object.getOwnPropertyDescriptors;
3
- var gt = Object.getOwnPropertySymbols;
4
- var fn = Object.prototype.hasOwnProperty, gn = Object.prototype.propertyIsEnumerable;
5
- var Le = (x, k, o) => k in x ? ln(x, k, { enumerable: !0, configurable: !0, writable: !0, value: o }) : x[k] = o, ut = (x, k) => {
1
+ var an = Object.defineProperty, ln = Object.defineProperties;
2
+ var dn = Object.getOwnPropertyDescriptors;
3
+ var ct = Object.getOwnPropertySymbols;
4
+ var cn = Object.prototype.hasOwnProperty, fn = Object.prototype.propertyIsEnumerable;
5
+ var Le = (x, k, o) => k in x ? an(x, k, { enumerable: !0, configurable: !0, writable: !0, value: o }) : x[k] = o, ft = (x, k) => {
6
6
  for (var o in k || (k = {}))
7
- fn.call(k, o) && Le(x, o, k[o]);
8
- if (gt)
9
- for (var o of gt(k))
10
- gn.call(k, o) && Le(x, o, k[o]);
7
+ cn.call(k, o) && Le(x, o, k[o]);
8
+ if (ct)
9
+ for (var o of ct(k))
10
+ fn.call(k, o) && Le(x, o, k[o]);
11
11
  return x;
12
- }, ht = (x, k) => dn(x, cn(k));
12
+ }, gt = (x, k) => ln(x, dn(k));
13
13
  var D = (x, k, o) => (Le(x, typeof k != "symbol" ? k + "" : k, o), o);
14
- var j = (x, k, o) => new Promise((q, e) => {
14
+ var j = (x, k, o) => new Promise(($, e) => {
15
15
  var L = (E) => {
16
16
  try {
17
17
  p(o.next(E));
18
18
  } catch (P) {
19
19
  e(P);
20
20
  }
21
- }, ye = (E) => {
21
+ }, pe = (E) => {
22
22
  try {
23
23
  p(o.throw(E));
24
24
  } catch (P) {
25
25
  e(P);
26
26
  }
27
- }, p = (E) => E.done ? q(E.value) : Promise.resolve(E.value).then(L, ye);
27
+ }, p = (E) => E.done ? $(E.value) : Promise.resolve(E.value).then(L, pe);
28
28
  p((o = o.apply(x, k)).next());
29
29
  });
30
- import { jsx as c, jsxs as z, Fragment as un } from "react/jsx-runtime";
31
- import { memo as hn, forwardRef as mn, useState as h, useRef as K, useContext as yn, useMemo as mt, useEffect as C, useImperativeHandle as pn } from "react";
32
- /* empty css */import { Spin as yt, Divider as vn, Button as W, Space as ue, Upload as kn, Tooltip as bn, Popover as wn, notification as he, message as u } from "antd";
33
- import ne from "../../components/Iconfont/index.mjs";
34
- import { IHistoryRole as Z, ChatMessageRole as pt, PromptVariableType as me } from "@glodon-aiot/apis";
35
- import bt from "./HistoryItem/index.mjs";
36
- import wt from "dayjs";
30
+ import { jsx as c, jsxs as z, Fragment as gn } from "react/jsx-runtime";
31
+ import { memo as un, forwardRef as hn, useState as h, useRef as W, useContext as mn, useEffect as C, useMemo as yn, useImperativeHandle as pn } from "react";
32
+ /* empty css */import { Spin as ut, Divider as vn, Button as Q, Space as he, Upload as kn, Tooltip as bn, Popover as wn, notification as me, message as u } from "antd";
33
+ import ie from "../../components/Iconfont/index.mjs";
34
+ import { IHistoryRole as J, ChatMessageRole as ht, PromptVariableType as ye } from "@glodon-aiot/apis";
35
+ import pt from "./HistoryItem/index.mjs";
36
+ import vt from "dayjs";
37
37
  import { v4 as Pe } from "uuid";
38
38
  import xn from "../../context.mjs";
39
39
  import { configuration as In } from "@glodon-aiot/bot-client-sdk";
40
- import { NET_OPEN_STATUS as $, MB as Nn } from "../../constant.mjs";
40
+ import { NET_OPEN_STATUS as B, MB as Nn } from "../../constant.mjs";
41
41
  import Cn from "../../components/FilePreview/index.mjs";
42
42
  import { getImageExtension as Ln } from "../../utils/index.mjs";
43
43
  import En from "../../QuillEditor/index.mjs";
44
44
  import Pn from "../../components/Recommend/index.mjs";
45
45
  import Tn from "../../components/Greeting/index.mjs";
46
- import On from "../../Footer/index.mjs";
47
- import { CameraOutlined as Fn, PlusOutlined as Rn } from "@ant-design/icons";
48
- import Hn from "./Tools/UploadKnowledgeFiles/index.mjs";
46
+ import Fn from "../../Footer/index.mjs";
47
+ import { CameraOutlined as On, PlusOutlined as Hn } from "@ant-design/icons";
48
+ import Rn from "./Tools/UploadKnowledgeFiles/index.mjs";
49
49
  import Dn from "../UploadingPrompt/index.mjs";
50
50
  import Un from "./PromptSetting/index.mjs";
51
51
  import { useMemoizedFn as Ee } from "ahooks";
@@ -54,13 +54,13 @@ import jn from "./Tools/SessionHistoryDrawer/index.mjs";
54
54
  import zn from "react-infinite-scroll-component";
55
55
  import Vn from "./Tools/ConnectToNetwork/index.mjs";
56
56
  import An from "./Tools/PromptManager/index.mjs";
57
- import Bn from "../../assets/icon.svg.mjs";
58
- const $n = hn(bt), vt = {
59
- icon: Bn,
57
+ import qn from "../../assets/icon.svg.mjs";
58
+ const Bn = un(pt), mt = {
59
+ icon: qn,
60
60
  text: "今天我能帮你什么?"
61
61
  };
62
- class ie {
63
- constructor(k, o, q, e) {
62
+ class oe {
63
+ constructor(k, o, $, e) {
64
64
  D(this, "messageTime");
65
65
  D(this, "isWaiting");
66
66
  D(this, "messageId");
@@ -70,61 +70,71 @@ class ie {
70
70
  D(this, "isSensitive");
71
71
  D(this, "isSuspend");
72
72
  D(this, "comment");
73
- this.content = k, this.sessionId = o, this.role = q, this.files = e, this.content = k, this.role = q, this.sessionId = o, this.files = e, this.messageTime = wt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Pe(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
73
+ this.content = k, this.sessionId = o, this.role = $, this.files = e, this.content = k, this.role = $, this.sessionId = o, this.files = e, this.messageTime = vt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Pe(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
74
74
  isAgree: 0
75
75
  };
76
76
  }
77
77
  }
78
- const kt = 10, ki = mn((x, k) => {
79
- var Se, et, tt, nt, it, ot, st, rt, at, lt, dt, ct, ft;
78
+ const yt = 10, ki = hn((x, k) => {
79
+ var Je, Se, et, tt, nt, it, ot, st, rt, at, lt, dt;
80
80
  const {
81
81
  application: o,
82
- docViewerUrl: q = "",
82
+ docViewerUrl: $ = "",
83
83
  currentSession: e,
84
84
  onCreateSession: L,
85
- embeddingService: ye,
85
+ embeddingService: pe,
86
86
  setCurrentSession: p,
87
87
  networkStatus: E,
88
88
  setNetworkStatus: P,
89
- sessions: xt,
89
+ sessions: kt,
90
90
  // 👈 新增
91
- setSessions: It
91
+ setSessions: bt
92
92
  // 👈 新增
93
- } = x, [v, I] = h([]), [Nt, J] = h(), [pe, Te] = h(), R = K(null), {
93
+ } = x, [v, I] = h([]), [wt, S] = h(), [ve, Te] = h(), H = W(null), {
94
94
  service: T,
95
95
  agentClient: N,
96
- depId: Ct,
97
- footer: Lt,
96
+ depId: xt,
97
+ footer: It,
98
98
  transform: g,
99
- defaultInput: ve,
100
- onMessage: oe,
101
- onHistoryLoad: Oe,
99
+ defaultInput: ke,
100
+ onMessage: se,
101
+ onHistoryLoad: Fe,
102
102
  beforeMessageSend: V,
103
- bodyStyle: Et,
104
- disabled: H,
103
+ bodyStyle: Nt,
104
+ disabled: R,
105
105
  features: s,
106
106
  popupContainer: f,
107
- icon: Pt,
108
- sider: Tt,
109
- mode: Ot
110
- } = yn(xn), [Fe, ke] = h(!1), m = K(v), Re = K(void 0), [Ft, Rt] = h(0), [S, Q] = h(), [_, se] = h(""), [He, be] = h(!1), re = K(null), [De, Ht] = h([]), [Ue, G] = h(!1), [Me, Dt] = h(!1), [Ut, Mt] = h(""), [jt, Y] = h(), [ae, le] = h({}), de = K(null), je = K(null), we = K(null), [ze, zt] = h(!1), [Vt, At] = h([]), [Bt, ce] = h(!0), [$t, qt] = h(!0), [Ve, U] = h(!1), [xe, A] = h(!1), [Ae, Yt] = h(!1), [F, fe] = h(typeof (s == null ? void 0 : s.promptVariables) == "object" ? s.promptVariables.default || [] : []), [Kt, Wt] = h(typeof (s == null ? void 0 : s.knowledges) == "object" && s.knowledges.default || void 0), [Be, M] = h(!1), [$e, ee] = h(!1), [Qt, X] = h(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), [qe, ge] = h(!1), [_t, Ie] = h(!1), [Ye, Ke] = h(!1), We = mt(() => e === null ? !1 : e === void 0 ? !0 : e ? !e.ready : !0, [e, e == null ? void 0 : e.ready, (Se = e == null ? void 0 : e.data) == null ? void 0 : Se.id]);
107
+ icon: Ct,
108
+ sider: Lt,
109
+ mode: Et
110
+ } = mn(xn), [Oe, be] = h(!1), m = W(v), He = W(void 0), [Pt, Tt] = h(0), [ee, _] = h(), [G, re] = h(""), [Re, we] = h(!1), ae = W(null), [De, Ft] = h([]), [Ue, X] = h(!1), [Me, Ot] = h(!1), [Ht, Rt] = h(""), [Dt, Y] = h(), [le, de] = h({}), ce = W(null), je = W(null), xe = W(null), [ze, Ut] = h(!1), [Mt, jt] = h([]), [zt, fe] = h(!0), [Vt, At] = h(!0), [Ve, U] = h(!1), [Ie, A] = h(!1), [Ae, qt] = h(!1), [O, ge] = h(typeof (s == null ? void 0 : s.promptVariables) == "object" ? s.promptVariables.default || [] : []), [Bt, $t] = h(typeof (s == null ? void 0 : s.knowledges) == "object" && s.knowledges.default || void 0), [qe, M] = h(!1), [Be, te] = h(!1), [Yt, Z] = h(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), [$e, ue] = h(!1), [Kt, K] = h(!1), [Wt, Qt] = h(null), [Ye, Ke] = h(!1);
111
111
  C(() => {
112
- Ie(We);
113
- }, [We]), C(() => {
112
+ if (Qt(e), e === null)
113
+ K(!1);
114
+ else if (e === void 0)
115
+ K(!0);
116
+ else {
117
+ if (Wt === null) {
118
+ K(!1);
119
+ return;
120
+ }
121
+ e.ready ? K(!1) : K(!0);
122
+ }
123
+ }, [e, e == null ? void 0 : e.ready]), C(() => {
114
124
  var a, i;
115
125
  e && (m.current = []), I([]);
116
- const t = R.current;
126
+ const t = H.current;
117
127
  if (t && t.scrollTo({
118
128
  top: 0
119
129
  }), !((a = e == null ? void 0 : e.data) != null && a.id))
120
130
  return;
121
131
  if (A(!1), U(!1), (i = e.messages) != null && i.length) {
122
132
  const r = [...e.messages.filter((d) => d == null ? void 0 : d.messageId)].reverse();
123
- m.current = [...r], I([...r]), Ie(!1);
133
+ m.current = [...r], I([...r]), K(!1);
124
134
  }
125
135
  const n = (l) => {
126
136
  var r;
127
- (r = e == null ? void 0 : e.data) != null && r.id && (m.current = [...l].reverse(), I([...l].reverse()), !l || l.length < 10 ? ee(!1) : ee(!0), Ie(!1), Oe && Oe({
137
+ (r = e == null ? void 0 : e.data) != null && r.id && (m.current = [...l].reverse(), I([...l].reverse()), !l || l.length < 10 ? te(!1) : te(!0), K(!1), Fe && Fe({
128
138
  applicationId: o.id,
129
139
  sessionId: e.data.id,
130
140
  histories: l
@@ -136,7 +146,7 @@ const kt = 10, ki = mn((x, k) => {
136
146
  }, [e]), C(() => {
137
147
  const t = () => {
138
148
  var n;
139
- (n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && fe(e.promptVariables.sort((a, i) => a.key.localeCompare(i.key))), e.knowledges && Wt(e.knowledges), P(e.netOpen));
149
+ (n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && ge(e.promptVariables.sort((a, i) => a.key.localeCompare(i.key))), e.knowledges && $t(e.knowledges), P(e.netOpen));
140
150
  };
141
151
  return e == null || e.addEventListener("data:updated", t), () => {
142
152
  e == null || e.removeEventListener("data:updated", t);
@@ -147,11 +157,11 @@ const kt = 10, ki = mn((x, k) => {
147
157
  return;
148
158
  const t = (a) => {
149
159
  var i;
150
- console.error(a.message, a.cause, "e.case"), he.config({
160
+ console.error(a.message, a.cause, "e.case"), me.config({
151
161
  getContainer: () => (f == null ? void 0 : f.current) || document.body
152
- }), he.error({
162
+ }), me.error({
153
163
  message: ((i = a.cause) == null ? void 0 : i.message) || a.message
154
- }), he.config({
164
+ }), me.config({
155
165
  getContainer: void 0
156
166
  });
157
167
  };
@@ -159,7 +169,7 @@ const kt = 10, ki = mn((x, k) => {
159
169
  e == null || e.removeEventListener("error", t);
160
170
  };
161
171
  }, [e]);
162
- const Gt = () => {
172
+ const _t = () => {
163
173
  var a;
164
174
  if (!((a = e == null ? void 0 : e.data) != null && a.id) || !(o != null && o.id))
165
175
  return;
@@ -173,18 +183,18 @@ const kt = 10, ki = mn((x, k) => {
173
183
  return;
174
184
  } else
175
185
  e.clear().then(() => {
176
- const i = new ie("", t, Z.System);
186
+ const i = new oe("", t, J.System);
177
187
  i.isContext = !0, I([i, ...v]);
178
188
  });
179
189
  };
180
190
  C(() => {
181
191
  o != null && o.id && (T == null || T.getRecommendQues(o.id).then((t) => {
182
- Ht(t);
192
+ Ft(t);
183
193
  }));
184
- }, [Ct, o]);
185
- const Qe = (t) => j(void 0, null, function* () {
186
- var y, O;
187
- if (H) {
194
+ }, [xt, o]);
195
+ const We = (t) => j(void 0, null, function* () {
196
+ var y, F;
197
+ if (R) {
188
198
  u.config({
189
199
  getContainer: () => (f == null ? void 0 : f.current) || document.body
190
200
  }), u.error("发送功能被禁用"), u.config({
@@ -192,7 +202,7 @@ const kt = 10, ki = mn((x, k) => {
192
202
  });
193
203
  return;
194
204
  }
195
- const n = t || Nt;
205
+ const n = t || wt;
196
206
  if (!(n != null && n.trim())) {
197
207
  u.config({
198
208
  getContainer: () => (f == null ? void 0 : f.current) || document.body
@@ -201,7 +211,7 @@ const kt = 10, ki = mn((x, k) => {
201
211
  });
202
212
  return;
203
213
  }
204
- if (!(F == null ? void 0 : F.every((b) => !!(b != null && b.value))))
214
+ if (!(O == null ? void 0 : O.every((b) => !!(b != null && b.value))))
205
215
  if (g != null && g.promptVariables) {
206
216
  u.config({
207
217
  getContainer: () => (f == null ? void 0 : f.current) || document.body
@@ -210,8 +220,8 @@ const kt = 10, ki = mn((x, k) => {
210
220
  });
211
221
  return;
212
222
  } else
213
- console.error("变量值不能为空", F == null ? void 0 : F.map((b) => !!(b != null && b.value)));
214
- if (xe) {
223
+ console.error("变量值不能为空", O == null ? void 0 : O.map((b) => !!(b != null && b.value)));
224
+ if (Ie) {
215
225
  u.config({
216
226
  getContainer: () => (f == null ? void 0 : f.current) || document.body
217
227
  }), u.error("正在回复中"), u.config({
@@ -219,7 +229,7 @@ const kt = 10, ki = mn((x, k) => {
219
229
  });
220
230
  return;
221
231
  }
222
- if (Fe) {
232
+ if (Oe) {
223
233
  u.config({
224
234
  getContainer: () => (f == null ? void 0 : f.current) || document.body
225
235
  }), u.error("等待初始化"), u.config({
@@ -227,7 +237,7 @@ const kt = 10, ki = mn((x, k) => {
227
237
  });
228
238
  return;
229
239
  }
230
- if (!Bt) {
240
+ if (!zt) {
231
241
  u.config({
232
242
  getContainer: () => (f == null ? void 0 : f.current) || document.body
233
243
  }), u.error("正在解析文件"), u.config({
@@ -235,7 +245,7 @@ const kt = 10, ki = mn((x, k) => {
235
245
  });
236
246
  return;
237
247
  }
238
- if (He) {
248
+ if (Re) {
239
249
  u.config({
240
250
  getContainer: () => (f == null ? void 0 : f.current) || document.body
241
251
  }), u.error("正在上传图片"), u.config({
@@ -243,21 +253,21 @@ const kt = 10, ki = mn((x, k) => {
243
253
  });
244
254
  return;
245
255
  }
246
- Q(void 0), se("");
256
+ _(void 0), re("");
247
257
  const i = (y = e == null ? void 0 : e.data) == null ? void 0 : y.id;
248
258
  if (!i) {
249
259
  L == null || L({
250
- netOpen: E ? $.OPEN : $.CLOSE
260
+ netOpen: E ? B.OPEN : B.CLOSE
251
261
  }).then((b) => {
252
- var B, te;
253
- M(!0), P(!!((B = b.data) != null && B.netOpen)), X(!!((te = b.data) != null && te.enableNetOpen)), _e(b).then(() => {
262
+ var q, ne;
263
+ M(!0), P(!!((q = b.data) != null && q.netOpen)), Z(!!((ne = b.data) != null && ne.enableNetOpen)), Qe(b).then(() => {
254
264
  p == null || p(b), M(!1), Te(n);
255
265
  });
256
266
  });
257
267
  return;
258
268
  }
259
- ge(!0);
260
- const l = _ ? `![](${_})
269
+ ue(!0);
270
+ const l = G ? `![](${G})
261
271
  ${n}` : n;
262
272
  let r;
263
273
  try {
@@ -267,54 +277,54 @@ ${n}` : n;
267
277
  message: {
268
278
  content: l,
269
279
  sessionId: i,
270
- role: pt.User,
271
- files: ae[i]
280
+ role: ht.User,
281
+ files: le[i]
272
282
  }
273
283
  }) : r = !0;
274
284
  } catch (b) {
275
285
  r = !1;
276
286
  }
277
- if (ge(!1), r === !1)
287
+ if (ue(!1), r === !1)
278
288
  return;
279
289
  let d = n;
280
- typeof r == "object" && (d = r.content || n), (yield e.setPromptVariables(F)) && (((O = ae[i]) == null ? void 0 : O.length) > 0 ? Xt(d) : Ne(d));
281
- }), _e = (t) => new Promise((n, a) => j(void 0, null, function* () {
282
- const r = (t == null ? void 0 : t.promptVariables).filter((d) => d.type ? !((d.type === me.User || d.type === void 0) && d.key === "query") && !((d.type === me.System || d.type === void 0) && d.key === "datetime") : d.key !== "query").map((d) => {
290
+ typeof r == "object" && (d = r.content || n), (yield e.setPromptVariables(O)) && (((F = le[i]) == null ? void 0 : F.length) > 0 ? Gt(d) : Ne(d));
291
+ }), Qe = (t) => new Promise((n, a) => j(void 0, null, function* () {
292
+ const r = (t == null ? void 0 : t.promptVariables).filter((d) => d.type ? !((d.type === ye.User || d.type === void 0) && d.key === "query") && !((d.type === ye.System || d.type === void 0) && d.key === "datetime") : d.key !== "query").map((d) => {
283
293
  var y;
284
- const w = (y = F.find((O) => O.key === d.key && O.type === d.type)) == null ? void 0 : y.value;
294
+ const w = (y = O.find((F) => F.key === d.key && F.type === d.type)) == null ? void 0 : y.value;
285
295
  return d.value = w || "", d;
286
296
  });
287
- fe(r.sort((d, w) => d.key.localeCompare(w.key))), yield t == null ? void 0 : t.setPromptVariables(r).catch((d) => {
297
+ ge(r.sort((d, w) => d.key.localeCompare(w.key))), yield t == null ? void 0 : t.setPromptVariables(r).catch((d) => {
288
298
  console.error(d), u.config({
289
299
  getContainer: () => (f == null ? void 0 : f.current) || document.body
290
300
  }), u.error(d.message), u.config({
291
301
  getContainer: void 0
292
302
  });
293
303
  }), n();
294
- })), Xt = (t) => {
304
+ })), Gt = (t) => {
295
305
  var r, d, w;
296
- if (ce(!1), !((r = e == null ? void 0 : e.data) != null && r.id) || !(o != null && o.id))
306
+ if (fe(!1), !((r = e == null ? void 0 : e.data) != null && r.id) || !(o != null && o.id))
297
307
  return;
298
308
  const n = ((d = e.data) == null ? void 0 : d.id) || "", a = [];
299
309
  let i = [], l = /* @__PURE__ */ new Set();
300
- (w = ae[n]) == null || w.forEach((y) => {
310
+ (w = le[n]) == null || w.forEach((y) => {
301
311
  l.has(y.id) || (i.push(y), l.add(y.id));
302
312
  }), Promise.all(i.map((y) => T == null ? void 0 : T.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, y.id, {
303
313
  enabled: 1
304
- }).then((O) => {
314
+ }).then((F) => {
305
315
  a.push(y);
306
316
  }))).then((y) => {
307
- ce(!0), Ne(t, a);
317
+ fe(!0), Ne(t, a);
308
318
  }).catch((y) => {
309
319
  throw Error(y);
310
320
  });
311
321
  };
312
322
  C(() => {
313
- if (!pe || !e)
323
+ if (!ve || !e)
314
324
  return;
315
- const t = pe, n = () => j(void 0, null, function* () {
316
- ge(!0);
317
- const a = _ ? `![](${_})
325
+ const t = ve, n = () => j(void 0, null, function* () {
326
+ ue(!0);
327
+ const a = G ? `![](${G})
318
328
  ${t}` : t;
319
329
  let i;
320
330
  try {
@@ -324,53 +334,53 @@ ${t}` : t;
324
334
  message: {
325
335
  content: a,
326
336
  sessionId: e.id,
327
- role: pt.User,
328
- files: ae[e.id]
337
+ role: ht.User,
338
+ files: le[e.id]
329
339
  }
330
340
  }) : i = !0;
331
341
  } catch (l) {
332
342
  i = !1;
333
343
  }
334
- ge(!1), i !== !1 && (Ne(t), Te(void 0));
344
+ ue(!1), i !== !1 && (Ne(t), Te(void 0));
335
345
  });
336
346
  return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
337
347
  e == null || e.removeEventListener("ready", n);
338
348
  };
339
- }, [pe, e]);
349
+ }, [ve, e]);
340
350
  const Ne = (t, n) => j(void 0, null, function* () {
341
- var y, O;
351
+ var y, F;
342
352
  const a = (y = e == null ? void 0 : e.data) == null ? void 0 : y.id;
343
353
  if (!a)
344
354
  return;
345
355
  A(!0), U(!0);
346
- const i = _ ? `![](${_})
347
- ${t}` : t, l = new ie(i, a, Z.User, n);
348
- J(void 0), Y(void 0), m.current = [l, ...v], I(m.current), o.id && oe && oe({
356
+ const i = G ? `![](${G})
357
+ ${t}` : t, l = new oe(i, a, J.User, n);
358
+ S(void 0), Y(void 0), m.current = [l, ...v], I(m.current), o.id && se && se({
349
359
  applicationId: o.id,
350
360
  sessionId: a,
351
361
  message: l
352
362
  });
353
- const r = new ie("", a, Z.System);
363
+ const r = new oe("", a, J.System);
354
364
  r.isWaiting = !0, m.current = [r, ...m.current], I(m.current);
355
365
  const d = (n == null ? void 0 : n.map((b) => b.id)) || [], w = {
356
366
  stream: In.stream,
357
367
  referenceFirst: !1
358
368
  };
359
369
  if (g != null && g.promptVariables) {
360
- const b = F == null ? void 0 : F.reduce((B, te) => (B[te.key] = te.value, B), {});
370
+ const b = O == null ? void 0 : O.reduce((q, ne) => (q[ne.key] = ne.value, q), {});
361
371
  w.formatValues = b;
362
372
  }
363
373
  if (g != null && g.knowledges) {
364
- const b = Kt;
374
+ const b = Bt;
365
375
  w.knowledges = b;
366
376
  }
367
377
  yield e.send({
368
378
  text: i,
369
379
  fileIds: d,
370
380
  files: n
371
- }, w), le({
381
+ }, w), de({
372
382
  [a]: []
373
- }), (O = de.current) == null || O.update();
383
+ }), (F = ce.current) == null || F.update();
374
384
  });
375
385
  C(() => {
376
386
  var a;
@@ -378,14 +388,14 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
378
388
  if (!t)
379
389
  return;
380
390
  const n = (i) => {
381
- if (!i.sessionId || i.sessionId && i.sessionId !== Re.current || i.role === Z.User)
391
+ if (!i.sessionId || i.sessionId && i.sessionId !== He.current || i.role === J.User)
382
392
  return;
383
393
  if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (U(!1), A(!1), m.current = m.current.filter((d) => !d.isWaiting), I([...m.current]), m.current = [...m.current], i.content))
384
- return he.error({
394
+ return me.error({
385
395
  message: i.content
386
396
  });
387
- const l = i.actions || [], r = new ie(i.content, t, Z.Robot);
388
- r.messageId = i.messageId || Pe(), r.reasoningContent = i.reasoningContent, r.searchReference = i.searchReference, r.thinkingSecs = i.thinkingSecs, r.thinkingStatus = i.thinkingStatus, r.actions = l, r.isLoading = !0, r.searchingStatus = i.searchingStatus, m.current = m.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && I([r, ...m.current]), i.code === 11915 && (U(!1), A(!1), r.isLoading = !1, r.content = "请您换个问题问我吧~", r.isSensitive = !0, I([r, ...m.current])), i.index === -2 && (U(!1), A(!1), r.isLoading = !1, r.content = "回答已中止~", r.isSuspend = !0, I([r, ...m.current])), i.index === -1 && (U(!1), A(!1), r.isLoading = !1, r.reference = i.reference, I([r, ...m.current]), o.id && oe && oe({
397
+ const l = i.actions || [], r = new oe(i.content, t, J.Robot);
398
+ r.messageId = i.messageId || Pe(), r.reasoningContent = i.reasoningContent, r.searchReference = i.searchReference, r.thinkingSecs = i.thinkingSecs, r.thinkingStatus = i.thinkingStatus, r.actions = l, r.isLoading = !0, r.searchingStatus = i.searchingStatus, m.current = m.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && I([r, ...m.current]), i.code === 11915 && (U(!1), A(!1), r.isLoading = !1, r.content = "请您换个问题问我吧~", r.isSensitive = !0, I([r, ...m.current])), i.index === -2 && (U(!1), A(!1), r.isLoading = !1, r.content = "回答已中止~", r.isSuspend = !0, I([r, ...m.current])), i.index === -1 && (U(!1), A(!1), r.isLoading = !1, r.reference = i.reference, I([r, ...m.current]), o.id && se && se({
389
399
  applicationId: o.id,
390
400
  sessionId: t,
391
401
  message: r
@@ -398,26 +408,26 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
398
408
  };
399
409
  }, [e]), C(() => {
400
410
  if (!e) {
401
- ke(!1);
411
+ be(!1);
402
412
  return;
403
413
  }
404
414
  const t = (n) => {
405
- ke(n);
415
+ be(n);
406
416
  };
407
- return ke(e.frozen), e.addEventListener("frozen", t), () => {
417
+ return be(e.frozen), e.addEventListener("frozen", t), () => {
408
418
  e == null || e.removeEventListener("frozen", t);
409
419
  };
410
420
  }, [e]), C(() => {
411
- e && (Y(void 0), J(void 0));
412
- }, [(et = e == null ? void 0 : e.data) == null ? void 0 : et.id]), C(() => {
421
+ e && (Y(void 0), S(void 0));
422
+ }, [(Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id]), C(() => {
413
423
  if (!N)
414
424
  return;
415
425
  const t = N.questionContextMaxLength || 4e3;
416
- Rt(t);
426
+ Tt(t);
417
427
  }, [N, T]), C(() => {
418
- ve && Y(ve.text);
419
- }, [ve]);
420
- const Zt = (t) => {
428
+ ke && Y(ke.text);
429
+ }, [ke]);
430
+ const Xt = (t) => {
421
431
  const n = t.size;
422
432
  return n <= 0 ? (u.config({
423
433
  getContainer: () => (f == null ? void 0 : f.current) || document.body
@@ -427,18 +437,18 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
427
437
  getContainer: () => (f == null ? void 0 : f.current) || document.body
428
438
  }), u.error("图片须小于20M"), u.config({
429
439
  getContainer: void 0
430
- }), !1) : (Q(t), !1);
431
- }, Jt = (t) => j(void 0, null, function* () {
440
+ }), !1) : (_(t), !1);
441
+ }, Zt = (t) => j(void 0, null, function* () {
432
442
  var n;
433
- return Q(t), (n = e == null ? void 0 : e.data) != null && n.id ? Ge(e, t) : new Promise((a) => {
443
+ return _(t), (n = e == null ? void 0 : e.data) != null && n.id ? _e(e, t) : new Promise((a) => {
434
444
  M(!0), L == null || L({
435
- netOpen: E ? $.OPEN : $.CLOSE
445
+ netOpen: E ? B.OPEN : B.CLOSE
436
446
  }).then((i) => {
437
447
  var l, r;
438
- p == null || p(i), M(!1), P(!!((l = i.data) != null && l.netOpen)), X(!!((r = i.data) != null && r.enableNetOpen)), a(Ge(i, t));
448
+ p == null || p(i), M(!1), P(!!((l = i.data) != null && l.netOpen)), Z(!!((r = i.data) != null && r.enableNetOpen)), a(_e(i, t));
439
449
  });
440
450
  });
441
- }), Ge = (t, n) => {
451
+ }), _e = (t, n) => {
442
452
  const a = Ln(n.name);
443
453
  return new Promise((i) => {
444
454
  var r;
@@ -448,87 +458,87 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
448
458
  knowledgeId: ((r = t.data) == null ? void 0 : r.id) || "",
449
459
  type: 1
450
460
  };
451
- be(!0), T == null || T.postTicket(l).then((d) => {
461
+ we(!0), T == null || T.postTicket(l).then((d) => {
452
462
  T.uploadMinioFile(d.minio, n).then(() => {
453
- var b, B;
454
- const w = (b = d.minio.endpoints) == null ? void 0 : b[0], y = d.minio.bucket, O = (B = d.minio.fileKeys) == null ? void 0 : B[0];
455
- i(`${location.protocol}//${w}/${y}/${O}`);
463
+ var b, q;
464
+ const w = (b = d.minio.endpoints) == null ? void 0 : b[0], y = d.minio.bucket, F = (q = d.minio.fileKeys) == null ? void 0 : q[0];
465
+ i(`${location.protocol}//${w}/${y}/${F}`);
456
466
  }).catch(() => {
457
- se(""), Q(void 0);
467
+ re(""), _(void 0);
458
468
  }).finally(() => {
459
- be(!1);
469
+ we(!1);
460
470
  });
461
471
  }).catch(() => {
462
- se(""), Q(void 0), be(!1);
472
+ re(""), _(void 0), we(!1);
463
473
  });
464
474
  });
465
475
  };
466
476
  C(() => {
467
- const t = R.current;
477
+ const t = H.current;
468
478
  t && !Ae && t.scrollTo({
469
479
  top: t.scrollHeight
470
480
  });
471
481
  }, [v]);
472
- const Xe = (t, n) => new Promise((a) => {
482
+ const Ge = (t, n) => new Promise((a) => {
473
483
  if (!n.file.url || !(o != null && o.id))
474
484
  return a();
475
- const i = ht(ut({}, n.file), {
485
+ const i = gt(ft({}, n.file), {
476
486
  type: 1
477
487
  });
478
488
  T == null || T.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
479
489
  var l;
480
- (l = de.current) == null || l.update().finally(a);
490
+ (l = ce.current) == null || l.update().finally(a);
481
491
  });
482
- }), St = () => {
492
+ }), Jt = () => {
483
493
  var t;
484
494
  (t = e == null ? void 0 : e.data) != null && t.id && (U(!1), e.suspend());
485
- }, en = (t) => {
486
- const n = R.current;
495
+ }, St = (t) => {
496
+ const n = H.current;
487
497
  n && setTimeout(() => {
488
498
  n.scrollTo({
489
499
  top: n.scrollHeight,
490
500
  behavior: t == null ? void 0 : t.behavior
491
501
  });
492
502
  }, t == null ? void 0 : t.ms);
493
- }, tn = () => {
494
- if (!R.current)
503
+ }, en = () => {
504
+ if (!H.current)
495
505
  return;
496
- const t = R.current.scrollTop <= -80;
497
- Yt(t);
498
- }, nn = Ee((t) => {
506
+ const t = H.current.scrollTop <= -80;
507
+ qt(t);
508
+ }, tn = Ee((t) => {
499
509
  var n, a;
500
- (n = re.current) == null || n.update(t), (a = re.current) == null || a.focus();
501
- }), on = Ee((t) => {
502
- Qe(t);
503
- }), sn = Ee(() => {
510
+ (n = ae.current) == null || n.update(t), (a = ae.current) == null || a.focus();
511
+ }), nn = Ee((t) => {
512
+ We(t);
513
+ }), on = Ee(() => {
504
514
  var n;
505
515
  if (!((n = e == null ? void 0 : e.data) != null && n.id))
506
516
  return;
507
517
  m.current = [...v.slice(1, v.length)], I(m.current);
508
- const t = new ie("", e.data.id, Z.System);
518
+ const t = new oe("", e.data.id, J.System);
509
519
  t.isWaiting = !0, m.current = [t, ...m.current], I(m.current), A(!0), U(!0), e.answerAgain();
510
520
  });
511
521
  C(() => {
512
522
  var t, n;
513
- Re.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Be && ((n = we.current) == null || n.clear());
523
+ He.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !qe && ((n = xe.current) == null || n.clear());
514
524
  }, [e]);
515
- const rn = () => {
525
+ const sn = () => {
516
526
  var a;
517
527
  if (!((a = e == null ? void 0 : e.data) != null && a.id))
518
528
  return;
519
529
  const n = v[v.length - 1].messageTime;
520
530
  e.fetchMessages({
521
531
  endTime: n,
522
- pageSize: kt
532
+ pageSize: yt
523
533
  }).then((i) => {
524
534
  const l = i || [];
525
535
  if (!l || !(l != null && l.length)) {
526
- ee(!1);
536
+ te(!1);
527
537
  return;
528
538
  }
529
- l.length < 10 ? ee(!1) : ee(!0), I([...v, ...l.reverse()]);
539
+ l.length < 10 ? te(!1) : te(!0), I([...v, ...l.reverse()]);
530
540
  });
531
- }, an = (t) => j(void 0, null, function* () {
541
+ }, rn = (t) => j(void 0, null, function* () {
532
542
  var n, a;
533
543
  if (!((n = e == null ? void 0 : e.data) != null && n.id))
534
544
  P(t);
@@ -540,36 +550,38 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
540
550
  }), Ce = () => j(void 0, null, function* () {
541
551
  e ? e.fetchData().then((t) => {
542
552
  var n;
543
- (n = e == null ? void 0 : e.data) != null && n.id && (P(t.netOpen), X(t.enableNetOpen));
544
- }) : (P(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), X(o.arrange[0].enableNetOpen));
553
+ (n = e == null ? void 0 : e.data) != null && n.id && (P(t.netOpen), Z(t.enableNetOpen));
554
+ }) : (P(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), Z(o.arrange[0].enableNetOpen));
545
555
  });
546
556
  C(() => {
547
557
  Ce();
548
558
  }, [e]), C(() => {
549
- var t, n;
550
- if (R.current) {
551
- const a = 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");
552
- if (!i || !l || !a)
553
- return;
554
- const r = a.offsetHeight;
555
- if (l.offsetHeight <= r) {
556
- if (i.style.height === "100%")
557
- return;
558
- i.style.height = "100%";
559
- } else {
560
- if (i.style.height === "auto")
559
+ requestAnimationFrame(() => {
560
+ var n, a;
561
+ if (H.current) {
562
+ const i = document.getElementById("chat-main"), l = (n = H.current) == null ? void 0 : n.querySelector(".infinite-scroll-component__outerdiv"), r = (a = H.current) == null ? void 0 : a.querySelector(".infinite-scroll-component");
563
+ if (!l || !r || !i)
561
564
  return;
562
- i.style.height = "auto";
565
+ const d = i.offsetHeight;
566
+ if (r.offsetHeight <= d) {
567
+ if (l.style.height === "100%")
568
+ return;
569
+ l.style.height = "100%";
570
+ } else {
571
+ if (l.style.height === "auto")
572
+ return;
573
+ l.style.height = "auto";
574
+ }
563
575
  }
564
- }
576
+ });
565
577
  }, [v]), C(() => {
566
578
  if (e)
567
579
  return;
568
580
  const t = () => {
569
- const i = ((N == null ? void 0 : N.promptVariables) || []).filter((l) => l.type ? !(l.type === me.User && l.key === "query") && !(l.type === me.System && l.key === "datetime") && l.status === 1 : l.key !== "query" && l.status === 1).map((l, r) => {
581
+ const i = ((N == null ? void 0 : N.promptVariables) || []).filter((l) => l.type ? !(l.type === ye.User && l.key === "query") && !(l.type === ye.System && l.key === "datetime") && l.status === 1 : l.key !== "query" && l.status === 1).map((l, r) => {
570
582
  var w, y;
571
583
  let d = "";
572
- return typeof (s == null ? void 0 : s.promptVariables) == "object" && (d = ((y = (w = s.promptVariables.default) == null ? void 0 : w.find((O) => O.key === l.key && O.type === l.type)) == null ? void 0 : y.value) || ""), {
584
+ return typeof (s == null ? void 0 : s.promptVariables) == "object" && (d = ((y = (w = s.promptVariables.default) == null ? void 0 : w.find((F) => F.key === l.key && F.type === l.type)) == null ? void 0 : y.value) || ""), {
573
585
  id: r + "",
574
586
  key: l.key,
575
587
  name: l.name,
@@ -577,20 +589,20 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
577
589
  type: l.type
578
590
  };
579
591
  });
580
- fe([...i].sort((l, r) => l.key.localeCompare(r.key)));
592
+ ge([...i].sort((l, r) => l.key.localeCompare(r.key)));
581
593
  };
582
594
  return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
583
595
  N == null || N.removeEventListener("ready", t);
584
596
  };
585
597
  }, [e, N, s == null ? void 0 : s.promptVariables]);
586
- const Ze = () => L == null ? void 0 : L({
587
- netOpen: E ? $.OPEN : $.CLOSE
598
+ const Xe = () => L == null ? void 0 : L({
599
+ netOpen: E ? B.OPEN : B.CLOSE
588
600
  }).then((t) => {
589
601
  var n, a;
590
- return p == null || p(t), M(!1), P(!!((n = t.data) != null && n.netOpen)), X(!!((a = t.data) != null && a.enableNetOpen)), _e(t), t;
591
- }), Je = mt(() => {
602
+ return p == null || p(t), M(!1), P(!!((n = t.data) != null && n.netOpen)), Z(!!((a = t.data) != null && a.enableNetOpen)), Qe(t), t;
603
+ }), Ze = yn(() => {
592
604
  var t;
593
- return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(bt, {
605
+ return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(pt, {
594
606
  application: o,
595
607
  history: {
596
608
  role: 1,
@@ -600,7 +612,7 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
600
612
  sessionId: "",
601
613
  reference: [],
602
614
  searchReference: [],
603
- messageTime: wt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
615
+ messageTime: vt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
604
616
  actions: [],
605
617
  isLoading: !1
606
618
  },
@@ -611,25 +623,25 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
611
623
  return pn(k, () => ({
612
624
  getCurrentInputText: () => {
613
625
  var t;
614
- return (t = re.current) == null ? void 0 : t.getCurrentText();
626
+ return (t = ae.current) == null ? void 0 : t.getCurrentText();
615
627
  }
616
628
  })), /* @__PURE__ */ z("div", {
617
629
  className: "agent-chat",
618
- children: [_t ? /* @__PURE__ */ c("div", {
630
+ children: [Kt ? /* @__PURE__ */ c("div", {
619
631
  className: "session-loading",
620
- children: /* @__PURE__ */ c(yt, {})
621
- }) : /* @__PURE__ */ z(un, {
632
+ children: /* @__PURE__ */ c(ut, {})
633
+ }) : /* @__PURE__ */ z(gn, {
622
634
  children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(Un, {
623
635
  ref: je,
624
636
  appId: o.id,
625
637
  currentSession: e,
626
- promptVariables: F,
627
- setPromptVariables: fe,
638
+ promptVariables: O,
639
+ setPromptVariables: ge,
628
640
  setCurrentSession: p
629
641
  }), /* @__PURE__ */ z("div", {
630
642
  className: "chat-main",
631
643
  id: "chat-main",
632
- style: Et,
644
+ style: Nt,
633
645
  children: [/* @__PURE__ */ c("div", {
634
646
  className: "chat-main-wrapper",
635
647
  id: "scrollableDiv",
@@ -639,102 +651,102 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
639
651
  display: "flex",
640
652
  flexDirection: "column-reverse"
641
653
  },
642
- ref: R,
643
- onScroll: tn,
644
- children: (tt = e == null ? void 0 : e.data) != null && tt.id && (v != null && v.length) ? /* @__PURE__ */ z(zn, {
654
+ ref: H,
655
+ onScroll: en,
656
+ children: (Se = e == null ? void 0 : e.data) != null && Se.id && (v != null && v.length) ? /* @__PURE__ */ z(zn, {
645
657
  dataLength: v.length,
646
- next: rn,
658
+ next: sn,
647
659
  style: {
648
660
  display: "flex",
649
661
  flexDirection: "column-reverse",
650
662
  overflowX: "hidden"
651
663
  },
652
664
  inverse: !0,
653
- endMessage: v.length > kt && // 少于一页不展示这个提示
654
- ((nt = R.current) != null && nt.scrollTop) && ((it = R.current) == null ? void 0 : it.scrollTop) < -10 ? /* @__PURE__ */ c(vn, {
665
+ endMessage: v.length > yt && // 少于一页不展示这个提示
666
+ ((et = H.current) != null && et.scrollTop) && ((tt = H.current) == null ? void 0 : tt.scrollTop) < -10 ? /* @__PURE__ */ c(vn, {
655
667
  plain: !0,
656
668
  children: "没有更多数据了"
657
669
  }) : null,
658
- hasMore: $e,
670
+ hasMore: Be,
659
671
  loader: /* @__PURE__ */ c("div", {
660
672
  style: {
661
673
  height: "50px",
662
674
  textAlign: "center",
663
675
  overflow: "hidden"
664
676
  },
665
- children: /* @__PURE__ */ c(yt, {})
677
+ children: /* @__PURE__ */ c(ut, {})
666
678
  }),
667
679
  scrollableTarget: "scrollableDiv",
668
- children: [v.map((t, n) => /* @__PURE__ */ c($n, {
680
+ children: [v.map((t, n) => /* @__PURE__ */ c(Bn, {
669
681
  application: o,
670
682
  currentSession: e,
671
683
  history: t,
672
- docViewerUrl: q,
684
+ docViewerUrl: $,
673
685
  isLastHistory: n === 0,
674
- onRelatedClick: on,
675
- onAgainClick: sn,
676
- onEditClick: nn,
686
+ onRelatedClick: nn,
687
+ onAgainClick: on,
688
+ onEditClick: tn,
677
689
  markdown: s == null ? void 0 : s.markdown
678
- }, t.messageId + n)), !$e && Je]
690
+ }, t.messageId + n)), !Be && Ze]
679
691
  }) : /* @__PURE__ */ z("div", {
680
692
  className: "main-empty",
681
693
  children: [(s == null ? void 0 : s.greeting) !== !1 && /* @__PURE__ */ c(Tn, {
682
- text: s === void 0 || s.greeting === !0 || ((ot = s.greeting) == null ? void 0 : ot.text) === void 0 ? vt.text : s.greeting.text,
683
- icon: s === void 0 || s.greeting === !0 || ((st = s.greeting) == null ? void 0 : st.icon) === void 0 ? Pt || vt.icon : s.greeting.icon,
694
+ text: s === void 0 || s.greeting === !0 || ((nt = s.greeting) == null ? void 0 : nt.text) === void 0 ? mt.text : s.greeting.text,
695
+ icon: s === void 0 || s.greeting === !0 || ((it = s.greeting) == null ? void 0 : it.icon) === void 0 ? Ct || mt.icon : s.greeting.icon,
684
696
  children: !!De.length && (((s == null ? void 0 : s.greeting) === void 0 || (s == null ? void 0 : s.greeting)) === !0 || typeof (s == null ? void 0 : s.greeting) == "object" && s.greeting.questions !== !1) && /* @__PURE__ */ c(Pn, {
685
- ref: we,
686
- sid: (rt = e == null ? void 0 : e.data) == null ? void 0 : rt.id,
697
+ ref: xe,
698
+ sid: (ot = e == null ? void 0 : e.data) == null ? void 0 : ot.id,
687
699
  isRecommendClearing: Ue,
688
700
  data: De,
689
701
  layoutBreakpoints: typeof (s == null ? void 0 : s.greeting) == "object" ? s.greeting.layoutBreakpoints : void 0,
690
702
  onItemClick: (t) => {
691
703
  var a, i, l;
692
- if (J(t == null ? void 0 : t.question), Y(t == null ? void 0 : t.question), Ue)
704
+ if (S(t == null ? void 0 : t.question), Y(t == null ? void 0 : t.question), Ue)
693
705
  return;
694
- t != null && t.id && G(!0);
706
+ t != null && t.id && X(!0);
695
707
  const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
696
- g != null && g.fileUpload ? (l = (i = de.current) == null ? void 0 : i.clear()) == null || l.then(() => {
708
+ g != null && g.fileUpload ? (l = (i = ce.current) == null ? void 0 : i.clear()) == null || l.then(() => {
697
709
  var r, d;
698
- t != null && t.id && (n ? (r = Xe(n, t)) == null || r.finally(() => {
699
- G(!1);
700
- }) : (G(!1), M(!0), (d = Ze()) == null || d.then((w) => {
710
+ t != null && t.id && (n ? (r = Ge(n, t)) == null || r.finally(() => {
711
+ X(!1);
712
+ }) : (X(!1), M(!0), (d = Xe()) == null || d.then((w) => {
701
713
  var y;
702
- (y = Xe(w.id, t)) == null || y.finally(() => {
703
- G(!1);
714
+ (y = Ge(w.id, t)) == null || y.finally(() => {
715
+ X(!1);
704
716
  });
705
717
  })));
706
- }) : n ? G(!1) : (G(!1), M(!0), Ze());
718
+ }) : n ? X(!1) : (X(!1), M(!0), Xe());
707
719
  }
708
720
  })
709
- }), Je]
721
+ }), Ze]
710
722
  })
711
723
  }), Ve && /* @__PURE__ */ c("div", {
712
724
  className: "session-stop",
713
- children: /* @__PURE__ */ c(W, {
725
+ children: /* @__PURE__ */ c(Q, {
714
726
  type: "primary",
715
727
  style: {
716
728
  background: "white"
717
729
  },
718
730
  ghost: !0,
719
731
  size: "small",
720
- icon: /* @__PURE__ */ c(ne, {
732
+ icon: /* @__PURE__ */ c(ie, {
721
733
  type: "icon-zantinghuida",
722
734
  style: {
723
735
  fontSize: 16
724
736
  }
725
737
  }),
726
- onClick: () => St(),
738
+ onClick: () => Jt(),
727
739
  children: "停止回答"
728
740
  })
729
741
  }), Ae && (v == null ? void 0 : v.length) > 0 && /* @__PURE__ */ c("div", {
730
742
  className: "back-bottom",
731
- children: /* @__PURE__ */ c(W, {
743
+ children: /* @__PURE__ */ c(Q, {
732
744
  size: "small",
733
- onClick: () => en({
745
+ onClick: () => St({
734
746
  behavior: "smooth"
735
747
  }),
736
748
  type: "link",
737
- icon: /* @__PURE__ */ c(ne, {
749
+ icon: /* @__PURE__ */ c(ie, {
738
750
  type: "icon-yijianhuidaodibu",
739
751
  style: {
740
752
  fontSize: 24
@@ -746,30 +758,30 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
746
758
  className: "chat-footer",
747
759
  children: /* @__PURE__ */ z("div", {
748
760
  className: "chat-footer-input",
749
- children: [S && /* @__PURE__ */ c("div", {
761
+ children: [ee && /* @__PURE__ */ c("div", {
750
762
  className: "input-files",
751
763
  children: /* @__PURE__ */ c(Cn, {
752
- file: S,
764
+ file: ee,
753
765
  actions: {
754
- upload: Jt,
766
+ upload: Zt,
755
767
  remove: () => {
756
- Q(void 0);
768
+ _(void 0);
757
769
  }
758
770
  },
759
- onUrlChange: (t) => se(t)
771
+ onUrlChange: (t) => re(t)
760
772
  })
761
- }), /* @__PURE__ */ z(ue, {
773
+ }), /* @__PURE__ */ z(he, {
762
774
  className: "footer-upload-action",
763
775
  onClick: (t) => t.preventDefault(),
764
- children: [/* @__PURE__ */ z(ue, {
776
+ children: [/* @__PURE__ */ z(he, {
765
777
  children: [o.type === 2 && (g == null ? void 0 : g.imageUpload) && /* @__PURE__ */ c(kn, {
766
- disabled: !!S || H,
778
+ disabled: !!ee || R,
767
779
  accept: ".jpg, .png, .jpeg,.bmp",
768
780
  listType: "picture-card",
769
- beforeUpload: Zt,
781
+ beforeUpload: Xt,
770
782
  className: "footer-upload-picture",
771
783
  showUploadList: !1,
772
- children: S ? /* @__PURE__ */ c(W, {
784
+ children: ee ? /* @__PURE__ */ c(Q, {
773
785
  type: "text",
774
786
  className: "camera-out-btn",
775
787
  style: {
@@ -777,8 +789,8 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
777
789
  position: "relative",
778
790
  bottom: "-2px"
779
791
  },
780
- disabled: !!S || H,
781
- icon: /* @__PURE__ */ c(Fn, {
792
+ disabled: !!ee || R,
793
+ icon: /* @__PURE__ */ c(On, {
782
794
  className: "icon-tianjia",
783
795
  style: {
784
796
  fontSize: "22px"
@@ -790,7 +802,7 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
790
802
  title: /* @__PURE__ */ c("div", {
791
803
  children: "支持上传.jpg .png .jpeg .bmp格式的图片数据,最大20M,单次仅可上传1个"
792
804
  }),
793
- children: /* @__PURE__ */ c(W, {
805
+ children: /* @__PURE__ */ c(Q, {
794
806
  type: "text",
795
807
  className: "camera-out-btn",
796
808
  style: {
@@ -798,7 +810,7 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
798
810
  position: "relative",
799
811
  bottom: "-2px"
800
812
  },
801
- icon: /* @__PURE__ */ c(ne, {
813
+ icon: /* @__PURE__ */ c(ie, {
802
814
  type: "icon-Vector",
803
815
  className: "icon-tianjia",
804
816
  style: {
@@ -807,28 +819,28 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
807
819
  })
808
820
  })
809
821
  })
810
- }), ye && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(Hn, {
822
+ }), pe && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(Rn, {
811
823
  appId: o == null ? void 0 : o.id,
812
- ref: de,
813
- isFirstSession: Be,
814
- docViewerUrl: q,
824
+ ref: ce,
825
+ isFirstSession: qe,
826
+ docViewerUrl: $,
815
827
  onStatusChange: (t) => j(void 0, null, function* () {
816
- t !== "process" ? (ce(!0), Ce()) : ce(!1);
828
+ t !== "process" ? (fe(!0), Ce()) : fe(!1);
817
829
  }),
818
830
  createSession: () => new Promise((t) => {
819
831
  M(!0), L == null || L({
820
- netOpen: E ? $.OPEN : $.CLOSE
832
+ netOpen: E ? B.OPEN : B.CLOSE
821
833
  }).then((n) => {
822
834
  var i, l, r;
823
- p == null || p(n), M(!1), P(!!((i = n.data) != null && i.netOpen)), X(!!((l = n.data) != null && l.enableNetOpen));
835
+ p == null || p(n), M(!1), P(!!((i = n.data) != null && i.netOpen)), Z(!!((l = n.data) != null && l.enableNetOpen));
824
836
  const a = ((r = n.data) == null ? void 0 : r.id) || "";
825
837
  t(a);
826
838
  });
827
839
  }),
828
- sid: (at = e == null ? void 0 : e.data) == null ? void 0 : at.id,
829
- disabled: xe || H,
840
+ sid: (st = e == null ? void 0 : e.data) == null ? void 0 : st.id,
841
+ disabled: Ie || R,
830
842
  afterFileAdd: (t, n) => {
831
- n && le((a) => {
843
+ n && de((a) => {
832
844
  const i = a[n] || [];
833
845
  return {
834
846
  [n]: [...i, t]
@@ -838,7 +850,7 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
838
850
  afterFileDelete: (t) => {
839
851
  var a;
840
852
  const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
841
- n && le((i) => {
853
+ n && de((i) => {
842
854
  const l = i[n] || [];
843
855
  return {
844
856
  [n]: l.filter((r) => r.id !== t)
@@ -846,41 +858,41 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
846
858
  });
847
859
  },
848
860
  onFileListChange: (t) => {
849
- At(t);
861
+ jt(t);
850
862
  },
851
- shouldContinue: $t,
863
+ shouldContinue: Vt,
852
864
  afterFilesClear: () => {
853
865
  var n;
854
866
  const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
855
- t && (le({
867
+ t && (de({
856
868
  [t]: []
857
869
  }), Ce());
858
870
  }
859
871
  }) : null, (g == null ? void 0 : g.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(An, {
860
872
  appId: o.id,
861
873
  list: [],
862
- search: Me ? Ut : "",
874
+ search: Me ? Ht : "",
863
875
  onPromptSelect: (t) => {
864
- Y(t.context), J(t.context);
876
+ Y(t.context), S(t.context);
865
877
  },
866
- disabled: H
878
+ disabled: R
867
879
  })]
868
- }), /* @__PURE__ */ z(ue, {
869
- children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((lt = o.arrange) == null ? void 0 : lt.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(Vn, {
870
- sessionId: (dt = e == null ? void 0 : e.data) == null ? void 0 : dt.id,
880
+ }), /* @__PURE__ */ z(he, {
881
+ children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((rt = o.arrange) == null ? void 0 : rt.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(Vn, {
882
+ sessionId: (at = e == null ? void 0 : e.data) == null ? void 0 : at.id,
871
883
  netStatus: E,
872
- enable: typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.diabled) == "boolean" ? !(s != null && s.connectNetwork.diabled) : Qt,
884
+ enable: typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.diabled) == "boolean" ? !(s != null && s.connectNetwork.diabled) : Yt,
873
885
  disabledTip: e ? void 0 : "网络访问已被禁用",
874
886
  onNetStatusChange: (t) => {
875
- an(t);
887
+ rn(t);
876
888
  }
877
889
  }), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(Mn, {
878
- currentSessionId: (ct = e == null ? void 0 : e.data) == null ? void 0 : ct.id,
890
+ currentSessionId: (lt = e == null ? void 0 : e.data) == null ? void 0 : lt.id,
879
891
  onSessionChange: (t, n) => {
880
892
  Y(void 0), p == null || p(n);
881
893
  },
882
- disabled: H
883
- }), Tt && Ot === "float" && /* @__PURE__ */ c("div", {
894
+ disabled: R
895
+ }), Lt && Et === "float" && /* @__PURE__ */ c("div", {
884
896
  className: "session-history-drawer-component",
885
897
  children: /* @__PURE__ */ c(wn, {
886
898
  placement: "topRight",
@@ -891,11 +903,11 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
891
903
  },
892
904
  getPopupContainer: (t) => t.parentNode,
893
905
  content: "会话历史记录",
894
- children: /* @__PURE__ */ c(W, {
906
+ children: /* @__PURE__ */ c(Q, {
895
907
  className: "history-overlay-action",
896
- disabled: H,
908
+ disabled: R,
897
909
  type: "text",
898
- icon: /* @__PURE__ */ c(ne, {
910
+ icon: /* @__PURE__ */ c(ie, {
899
911
  type: "icon-lishijilu",
900
912
  style: {
901
913
  fontSize: 24
@@ -904,14 +916,14 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
904
916
  onClick: () => Ke(!0)
905
917
  })
906
918
  })
907
- }), (g == null ? void 0 : g.sessionOpen) && /* @__PURE__ */ c(W, {
908
- icon: /* @__PURE__ */ c(Rn, {}),
919
+ }), (g == null ? void 0 : g.sessionOpen) && /* @__PURE__ */ c(Q, {
920
+ icon: /* @__PURE__ */ c(Hn, {}),
909
921
  className: "add-btn",
910
922
  type: "primary",
911
- disabled: Ve || !e || !v.length || H,
923
+ disabled: Ve || !e || !v.length || R,
912
924
  onClick: () => {
913
925
  var t, n;
914
- p == null || p(null), P(!1), (t = je.current) == null || t.clear(), (n = we.current) == null || n.clear();
926
+ p == null || p(null), P(!1), (t = je.current) == null || t.clear(), (n = xe.current) == null || n.clear();
915
927
  },
916
928
  children: "新会话"
917
929
  })]
@@ -919,44 +931,44 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
919
931
  }), /* @__PURE__ */ c("div", {
920
932
  className: "footer-textarea",
921
933
  children: /* @__PURE__ */ c(En, {
922
- ref: re,
923
- maxLength: Ft,
924
- text: jt,
934
+ ref: ae,
935
+ maxLength: Pt,
936
+ text: Dt,
925
937
  networkStatus: !1,
926
- loading: qe,
927
- disabled: Fe || He || H || qe,
928
- onTextSend: Qe,
938
+ loading: $e,
939
+ disabled: Oe || Re || R || $e,
940
+ onTextSend: We,
929
941
  onChange: (t, n) => {
930
942
  Y(t);
931
943
  const a = n.getText().replace(/[\n\s]+$/, "");
932
- J(a), Mt(a), Me || Dt(!0);
944
+ S(a), Rt(a), Me || Ot(!0);
933
945
  },
934
- clearAction: /* @__PURE__ */ c(ue, {
946
+ clearAction: /* @__PURE__ */ c(he, {
935
947
  size: 0,
936
- children: /* @__PURE__ */ c(W, {
948
+ children: /* @__PURE__ */ c(Q, {
937
949
  type: "link",
938
- disabled: xe || H,
950
+ disabled: Ie || R,
939
951
  ghost: !0,
940
- icon: /* @__PURE__ */ c(ne, {
952
+ icon: /* @__PURE__ */ c(ie, {
941
953
  style: {
942
954
  fontSize: 22
943
955
  },
944
956
  type: "icon-qingchujiyi"
945
957
  }),
946
- onClick: () => Gt()
958
+ onClick: () => _t()
947
959
  })
948
960
  })
949
961
  })
950
962
  })]
951
963
  })
952
- }), /* @__PURE__ */ c(On, {
953
- tips: Lt
964
+ }), /* @__PURE__ */ c(Fn, {
965
+ tips: It
954
966
  }), ze && /* @__PURE__ */ c(Dn, {
955
967
  isvisible: ze,
956
- files: Vt,
957
- sessionId: (ft = e == null ? void 0 : e.data) == null ? void 0 : ft.id,
968
+ files: Mt,
969
+ sessionId: (dt = e == null ? void 0 : e.data) == null ? void 0 : dt.id,
958
970
  onClose: (t) => {
959
- zt(!1), qt(!1);
971
+ Ut(!1), At(!1);
960
972
  }
961
973
  })]
962
974
  }), Ye && /* @__PURE__ */ c(jn, {
@@ -964,9 +976,9 @@ ${t}` : t, l = new ie(i, a, Z.User, n);
964
976
  application: o,
965
977
  networkStatus: E,
966
978
  setCurrentSession: p,
967
- sessions: xt,
968
- setSessions: It,
969
- disabled: H,
979
+ sessions: kt,
980
+ setSessions: bt,
981
+ disabled: R,
970
982
  isSessionHistoryVisible: Ye,
971
983
  setIsSessionHistoryVisible: Ke
972
984
  })]