@glodon-aiot/agent-cli-ui 3.17.0-alpha.2 → 3.17.0-alpha.4

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