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

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