@glodon-aiot/agent-cli-ui 3.3.5-beta.31 → 3.3.5-beta.33

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