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