@glodon-aiot/agent-cli-ui 3.4.0-alpha.2 → 3.4.0-alpha.3

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