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

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