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