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

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