@glodon-aiot/agent-cli-ui 3.9.0-alpha.5 → 3.9.0-alpha.6

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