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