@glodon-aiot/agent-cli-ui 3.19.0-alpha.18 → 3.19.0-alpha.19

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