@glodon-aiot/agent-cli-ui 3.0.6 → 3.0.7-beta.0

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