@glodon-aiot/agent-cli-ui 3.0.6 → 3.0.7-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 (70) hide show
  1. package/dist/es/Dialog/AgentChat/index.mjs +454 -434
  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,65 +1,65 @@
1
- var Mt = Object.defineProperty, zt = Object.defineProperties;
2
- var Ut = Object.getOwnPropertyDescriptors;
1
+ var Mt = Object.defineProperty, jt = Object.defineProperties;
2
+ var Vt = 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 $t = Object.prototype.hasOwnProperty, At = Object.prototype.propertyIsEnumerable;
5
+ var ve = (x, o, g) => o in x ? Mt(x, o, { enumerable: !0, configurable: !0, writable: !0, value: g }) : x[o] = g, ke = (x, o) => {
6
+ for (var g in o || (o = {}))
7
+ $t.call(o, g) && ve(x, g, o[g]);
8
8
  if (Xe)
9
- for (var y of Xe(s))
10
- Vt.call(s, y) && ye(x, y, s[y]);
9
+ for (var g of Xe(o))
10
+ At.call(o, g) && ve(x, g, o[g]);
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) => jt(x, Vt(o));
13
+ var P = (x, o, g) => (ve(x, typeof o != "symbol" ? o + "" : o, g), g);
14
+ var z = (x, o, g) => new Promise((e, k) => {
15
+ var ae = (w) => {
16
16
  try {
17
- O(y.next(b));
17
+ O(g.next(w));
18
18
  } catch (p) {
19
- w(p);
19
+ k(p);
20
20
  }
21
- }, v = (b) => {
21
+ }, v = (w) => {
22
22
  try {
23
- O(y.throw(b));
23
+ O(g.throw(w));
24
24
  } catch (p) {
25
- w(p);
25
+ k(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 = (w) => w.done ? e(w.value) : Promise.resolve(w.value).then(ae, v);
28
+ O((g = g.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 a } from "../../_virtual/jsx-runtime.mjs";
31
+ import { memo as Bt, useState as u, useRef as $, useContext as qt, useEffect as C } 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";
36
- import _t from "../HistoryItem/index.mjs";
37
- import Gt from "dayjs";
38
- import Xt from "../../context.mjs";
39
- import { MB as Zt } from "../../constant.mjs";
40
- import Jt from "../FilePreview/index.mjs";
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,
33
+ import { Divider as Kt, Spin as Wt, Button as Q, Space as re, Upload as Qt, Tooltip as Yt, message as R, notification as _t } from "antd";
34
+ import be from "../../Iconfont/index.mjs";
35
+ import { IHistoryRole as Y, ChatMessageRole as Ze } from "@glodon-aiot/apis";
36
+ import Gt from "../HistoryItem/index.mjs";
37
+ import Xt from "dayjs";
38
+ import Zt from "../../context.mjs";
39
+ import { MB as Jt } from "../../constant.mjs";
40
+ import St from "../FilePreview/index.mjs";
41
+ import { getImageExtension as ei } from "../../utils/index.mjs";
42
+ import ti from "../../QuillEditor/index.mjs";
43
+ import ii from "../Recommend/index.mjs";
44
+ import ni from "../Greeting/index.mjs";
45
+ import oi from "../PromptManager/index.mjs";
46
+ import si from "../../Footer/index.mjs";
47
+ import { CameraOutlined as Je, PlusOutlined as li } from "@ant-design/icons";
48
+ import ri from "../UploadKnowledgeFiles/index.mjs";
49
+ import ai from "../UploadingPrompt/index.mjs";
50
+ import di from "../PromptSetting/index.mjs";
51
+ import xe from "../../node_modules/ahooks/es/useMemoizedFn/index.mjs";
52
+ import ci from "../SessionListDrawer/index.mjs";
53
+ import fi from "../../node_modules/react-infinite-scroll-component/dist/index.es.mjs";
54
+ import ui from "../ConnectToNetwork/index.mjs";
55
+ import pi from "../../assets/icon.svg.mjs";
56
+ import et from "../../node_modules/uuid/dist/esm-browser/v4.mjs";
57
+ const hi = Bt(Gt), gi = {
58
+ icon: pi,
59
59
  text: "今天我能帮你什么?"
60
60
  };
61
- class _ {
62
- constructor(s, y, e, w) {
61
+ class Z {
62
+ constructor(o, g, e, k) {
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 = g, this.role = e, this.files = k, this.content = o, this.role = e, this.sessionId = g, this.files = k, this.messageTime = Xt(/* @__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, Ki = (x) => {
78
+ var $e, Ae, Be, qe, Ke, We, Qe, Ye, _e;
79
79
  const {
80
- application: s,
81
- docViewerUrl: y = "",
80
+ application: o,
81
+ docViewerUrl: g = "",
82
82
  currentSession: e,
83
- onCreateSession: w,
84
- embeddingService: se,
83
+ onCreateSession: k,
84
+ embeddingService: ae,
85
85
  setCurrentSession: v,
86
86
  networkStatus: O,
87
- setNetworkStatus: b
88
- } = x, [p, I] = u([]), [et, G] = u(), [le, xe] = u(), T = V(null), {
89
- service: C,
87
+ setNetworkStatus: w
88
+ } = x, [p, I] = u([]), [tt, J] = u(), [de, Ie] = u(), T = $(null), {
89
+ service: N,
90
90
  agentClient: L,
91
- depId: tt,
91
+ depId: it,
92
92
  footer: nt,
93
- transform: f,
94
- defaultInput: re,
95
- onMessage: X,
96
- onHistoryLoad: Ie,
97
- beforeMessageSend: Z,
98
- bodyStyle: it,
93
+ transform: c,
94
+ defaultInput: ce,
95
+ onMessage: S,
96
+ onHistoryLoad: Le,
97
+ beforeMessageSend: M,
98
+ bodyStyle: ot,
99
99
  disabled: D,
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);
102
- F(() => {
103
- var l, i;
100
+ features: f
101
+ } = qt(Zt), [Ne, fe] = u(!1), h = $(p), Ce = $(), [st, lt] = u(0), [_, A] = u(), [B, ee] = u(""), [Fe, ue] = u(!1), pe = $(null), [Ee, rt] = u([]), [Te, G] = u(!1), [Pe, at] = u(!1), [dt, ct] = u(""), [ft, q] = u(), [te, ie] = u({}), ne = $(null), Re = $(null), he = $(null), [Oe, ut] = u(!1), [pt, ht] = u([]), [gt, oe] = u(!0), [mt, yt] = u(!0), [De, H] = u(!1), [ge, j] = u(!1), [He, vt] = u(!1), [F, se] = u(typeof (f == null ? void 0 : f.promptVariables) == "object" ? f.promptVariables.default || [] : []), [kt, wt] = u(typeof (f == null ? void 0 : f.knowledges) == "object" && f.knowledges.default || void 0), [Ue, U] = u(!1), [bt, X] = u(!0), [xt, K] = u(typeof (f == null ? void 0 : f.connectNetwork) == "object" && typeof (f == null ? void 0 : f.connectNetwork.default) == "boolean" ? f.connectNetwork.default : !1), [ze, le] = u(!1);
102
+ C(() => {
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 (j(!1), H(!1), (n = e.messages) != null && n.length) {
111
+ const s = [...e.messages.filter((d) => d == null ? void 0 : d.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 ? X(!1) : X(!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
- }, [e]), F(() => {
125
+ }, [e]), C(() => {
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 && se(e.promptVariables.sort((l, n) => l.key.localeCompare(n.key))), e.knowledges && wt(e.knowledges), w(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
- }, [e]), F(() => {
134
- var n;
135
- if (!((n = e == null ? void 0 : e.data) != null && n.id))
133
+ }, [e]), C(() => {
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,363 +141,390 @@ 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 Z("", t, Y.System);
153
+ n.isContext = !0, I([n, ...p]);
154
154
  });
155
155
  };
156
- F(() => {
157
- s != null && s.id && (C == null || C.getRecommendQues(s.id).then((t) => {
158
- lt(t);
156
+ C(() => {
157
+ o != null && o.id && (N == null || N.getRecommendQues(o.id).then((t) => {
158
+ rt(t);
159
159
  }));
160
- }, [tt, s]);
161
- const Ue = (t) => j(void 0, null, function* () {
162
- var k, g;
160
+ }, [it, o]);
161
+ const Me = (t) => z(void 0, null, function* () {
162
+ var b, m;
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
- if (!(E == null ? void 0 : E.every((m) => !!(m != null && m.value)))) {
169
- if (f != null && f.promptVariables)
168
+ if (!(F == null ? void 0 : F.every((y) => !!(y != null && y.value)))) {
169
+ if (c != null && c.promptVariables)
170
170
  return R.error("变量值不能为空");
171
- console.error("变量值不能为空", E == null ? void 0 : E.map((m) => !!(m != null && m.value)));
171
+ console.error("变量值不能为空", F == null ? void 0 : F.map((y) => !!(y != null && y.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
- A(void 0), S("");
182
- const i = (k = e == null ? void 0 : e.data) == null ? void 0 : k.id;
183
- if (!i) {
184
- w == null || w({
181
+ A(void 0), ee("");
182
+ const n = (b = e == null ? void 0 : e.data) == null ? void 0 : b.id;
183
+ if (!n) {
184
+ k == null || k({
185
185
  netOpen: O ? 1 : 2
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);
186
+ }).then((y) => {
187
+ var E, V;
188
+ U(!0), w(!!((E = y.data) != null && E.netOpen)), K(!!((V = y.data) != null && V.enableNetOpen)), Lt(y).then(() => {
189
+ v == null || v(y), U(!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
+ le(!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
+ M ? s = yield M == null ? void 0 : M({
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: te[n]
207
207
  }
208
- }) : o = !0;
209
- } catch (m) {
210
- o = !1;
208
+ }) : s = !0;
209
+ } catch (y) {
210
+ s = !1;
211
211
  }
212
- if (ze(!1), o === !1)
212
+ if (le(!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) => {
218
- var g;
219
- const k = (g = E.find((m) => m.key === a.key)) == null ? void 0 : g.value;
220
- return a.value = k || "", a;
214
+ let d = i;
215
+ typeof s == "object" && (d = s.content || i), ((m = te[n]) == null ? void 0 : m.length) > 0 ? Nt(d) : me(d);
216
+ }), Lt = (t) => new Promise((i, l) => z(void 0, null, function* () {
217
+ const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.key !== "query").map((d) => {
218
+ var m;
219
+ const b = (m = F.find((y) => y.key === d.key)) == null ? void 0 : m.value;
220
+ return d.value = b || "", d;
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
+ se(s.sort((d, b) => d.key.localeCompare(b.key))), yield t == null ? void 0 : t.setPromptVariables(s), i();
223
+ })), Nt = (t) => {
224
+ var s, d, b;
225
+ if (oe(!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 = ((d = e.data) == null ? void 0 : d.id) || "", l = [];
228
+ let n = [], r = /* @__PURE__ */ new Set();
229
+ (b = te[i]) == null || b.forEach((m) => {
230
+ r.has(m.id) || (n.push(m), r.add(m.id));
231
+ }), Promise.all(n.map((m) => N == null ? void 0 : N.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, i, m.id, {
232
232
  enabled: 1
233
- }).then((m) => {
234
- l.push(g);
235
- }))).then((g) => {
236
- ne(!0), ge(t, l);
237
- }).catch((g) => {
238
- throw Error(g);
233
+ }).then((y) => {
234
+ l.push(m);
235
+ }))).then((m) => {
236
+ oe(!0), me(t, l);
237
+ }).catch((m) => {
238
+ throw Error(m);
239
239
  });
240
240
  };
241
- F(() => {
242
- if (!le || !e)
241
+ C(() => {
242
+ if (!de || !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 = de, i = () => z(void 0, null, function* () {
245
+ le(!0);
246
+ const l = B ? `![](${B})
247
+ ${t}` : t;
248
+ let n;
249
+ try {
250
+ M ? n = yield M == null ? void 0 : M({
251
+ applicationId: o.id,
252
+ sessionId: e.id,
253
+ message: {
254
+ content: l,
255
+ sessionId: e.id,
256
+ role: Ze.User,
257
+ files: te[e.id]
258
+ }
259
+ }) : n = !0;
260
+ } catch (r) {
261
+ n = !1;
262
+ }
263
+ le(!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* () {
252
- var g, m;
253
- const l = (g = e == null ? void 0 : e.data) == null ? void 0 : g.id;
268
+ }, [de, e]);
269
+ const me = (t, i) => z(void 0, null, function* () {
270
+ var m, y;
271
+ const l = (m = e == null ? void 0 : e.data) == null ? void 0 : m.id;
254
272
  if (!l)
255
273
  return;
256
- 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,
274
+ j(!0), H(!0);
275
+ const n = B ? `![](${B})
276
+ ${t}` : t, r = new Z(n, l, Y.User, i);
277
+ J(void 0), q(void 0), h.current = [r, ...p], I(h.current), o.id && S && S({
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 Z("", l, Y.System);
283
+ s.isWaiting = !0, h.current = [s, ...h.current], I(h.current);
284
+ const d = (i == null ? void 0 : i.map((E) => E.id)) || [], b = {
267
285
  stream: !0,
268
286
  referenceFirst: !1
269
287
  };
270
- if (f != null && f.promptVariables) {
271
- const N = E == null ? void 0 : E.reduce((U, Ge) => (U[Ge.key] = Ge.value, U), {});
272
- k.formatValues = N, e.setPromptVariables(E);
288
+ if (c != null && c.promptVariables) {
289
+ const E = F == null ? void 0 : F.reduce((V, Ge) => (V[Ge.key] = Ge.value, V), {});
290
+ b.formatValues = E, e.setPromptVariables(F);
273
291
  }
274
- if (f != null && f.knowledges) {
275
- const N = vt;
276
- k.knowledges = N, e.setKnowledges(N);
292
+ if (c != null && c.knowledges) {
293
+ const E = kt;
294
+ b.knowledges = E, e.setKnowledges(E);
277
295
  }
278
296
  yield e.send({
279
- text: i,
280
- fileIds: a
281
- }, k), ee({
297
+ text: n,
298
+ fileIds: d
299
+ }, b), ie({
282
300
  [l]: []
283
- }), (m = te.current) == null || m.update();
301
+ }), (y = ne.current) == null || y.update();
284
302
  });
285
- F(() => {
303
+ C(() => {
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), j(!1), h.current = h.current.filter((d) => !d.isWaiting), I([...h.current]), h.current = [...h.current], n.content))
312
+ return _t.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 Z(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((d) => !d.isWaiting).filter((d) => !d.isReplying), n.index === void 0 && I([s, ...h.current]), n.code === 11915 && (H(!1), j(!1), s.isLoading = !1, s.content = "请您换个问题问我吧~", s.isSensitive = !0, I([s, ...h.current])), n.index === -2 && (H(!1), j(!1), s.isLoading = !1, s.content = "回答已中止~", s.isSuspend = !0, I([s, ...h.current])), n.index === -1 && (H(!1), j(!1), s.isLoading = !1, s.reference = n.reference, I([s, ...h.current]), o.id && S && S({
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), j(!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
- }, [e]), F(() => {
327
+ }, [e]), C(() => {
310
328
  if (!e) {
311
- ae(!1);
329
+ fe(!1);
312
330
  return;
313
331
  }
314
- const t = (n) => {
315
- ae(n);
332
+ const t = (i) => {
333
+ fe(i);
316
334
  };
317
- return ae(e.frozen), e.addEventListener("frozen", t), () => {
335
+ return fe(e.frozen), e.addEventListener("frozen", t), () => {
318
336
  e == null || e.removeEventListener("frozen", t);
319
337
  };
320
- }, [e]), F(() => {
338
+ }, [e]), C(() => {
321
339
  if (!L)
322
340
  return;
323
341
  const t = L.questionContextMaxLength || 4e3;
324
- st(t);
325
- }, [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({
342
+ lt(t);
343
+ }, [L, N]), C(() => {
344
+ ce && q(ce.text);
345
+ }, [ce]);
346
+ const Ct = (t) => {
347
+ const i = t.size;
348
+ return i <= 0 ? (R.error("该文件为空,请重新上传"), !1) : i > 20 * Jt ? (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
+ U(!0), k == null || k({
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), U(!1), w(!!((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 = ei(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
+ ue(!0), N == null || N.postTicket(r).then((d) => {
370
+ N.uploadMinioFile(d.minio, i).then(() => {
371
+ var E, V;
372
+ const b = (E = d.minio.endpoints) == null ? void 0 : E[0], m = d.minio.bucket, y = (V = d.minio.fileKeys) == null ? void 0 : V[0];
373
+ n(`${location.protocol}//${b}/${m}/${y}`);
356
374
  }).catch(() => {
357
- S(""), A(void 0);
375
+ ee(""), A(void 0);
358
376
  }).finally(() => {
359
- de(!1);
377
+ ue(!1);
360
378
  });
361
379
  }).catch(() => {
362
- S(""), A(void 0), de(!1);
380
+ ee(""), A(void 0), ue(!1);
363
381
  });
364
382
  });
365
383
  };
366
- F(() => {
384
+ C(() => {
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 Et = (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
+ N == null || N.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 = ne.current) == null || r.update().finally(l);
381
399
  });
382
- }), Ft = () => {
400
+ }), Tt = () => {
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
+ }, Pt = (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
+ }, Rt = () => {
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
+ }, Ot = xe((t) => {
417
+ var i, l;
418
+ (i = pe.current) == null || i.update(t), (l = pe.current) == null || l.focus();
419
+ }), Dt = xe((t) => {
420
+ Me(t);
421
+ }), Ht = 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);
409
- t.isWaiting = !0, h.current = [t, ...h.current], I(h.current), M(!0), H(!0), e.answerAgain();
426
+ const t = new Z("", e.data.id, Y.System);
427
+ t.isWaiting = !0, h.current = [t, ...h.current], I(h.current), j(!0), H(!0), e.answerAgain();
410
428
  });
411
- 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());
429
+ C(() => {
430
+ var t, i;
431
+ Ce.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Ue && ((i = he.current) == null || i.clear());
414
432
  }, [e]);
415
- const Dt = () => {
433
+ const Ut = () => {
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
+ X(!1);
427
445
  return;
428
446
  }
429
- r.length < 10 ? Y(!1) : Y(!0), I([...p, ...r.reverse()]);
447
+ r.length < 10 ? X(!1) : X(!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))
434
- b(t);
449
+ }, zt = (t) => z(void 0, null, function* () {
450
+ var i, l;
451
+ if (!((i = e == null ? void 0 : e.data) != null && i.id))
452
+ w(t);
435
453
  else {
436
454
  if (yield e.setNetOpen(t), !((l = e.data) != null && l.id))
437
455
  return;
438
- b(t);
456
+ w(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 && (w(t.netOpen), K(t.enableNetOpen));
462
+ }) : (w(!1), K(o.arrange[0].enableNetOpen));
445
463
  });
446
- return F(() => {
447
- me();
448
- }, [e]), F(() => {
449
- var t, n;
464
+ C(() => {
465
+ ye();
466
+ }, [e]), C(() => {
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
- }, [p]), F(() => {
483
+ }, [p]), C(() => {
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) => {
473
- var k, g;
474
- let a = "";
475
- 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 + "",
490
+ ).map((r, s) => {
491
+ var b, m;
492
+ let d = "";
493
+ return typeof (f == null ? void 0 : f.promptVariables) == "object" && (d = ((m = (b = f.promptVariables.default) == null ? void 0 : b.find((y) => y.key === r.key)) == null ? void 0 : m.value) || ""), {
494
+ id: s + "",
477
495
  key: r.key,
478
496
  name: r.name,
479
- value: a
497
+ value: d
480
498
  };
481
499
  });
482
- ie([...i].sort((r, o) => r.key.localeCompare(o.key)));
500
+ se([...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, f == null ? void 0 : f.promptVariables]);
506
+ const Ve = () => {
507
+ k == null || k({
508
+ netOpen: O ? 1 : 2
509
+ }).then((t) => {
510
+ var i, l;
511
+ v == null || v(t), U(!1), w(!!((i = t.data) != null && i.netOpen)), K(!!((l = t.data) != null && l.enableNetOpen));
512
+ });
513
+ };
514
+ return /* @__PURE__ */ W("div", {
488
515
  className: "agent-chat",
489
- children: [(f == null ? void 0 : f.promptVariables) && /* @__PURE__ */ d(dn, {
490
- ref: Pe,
491
- appId: s.id,
516
+ children: [(c == null ? void 0 : c.promptVariables) && /* @__PURE__ */ a(di, {
517
+ ref: Re,
518
+ appId: o.id,
492
519
  currentSession: e,
493
- promptVariables: E,
494
- setPromptVariables: ie,
520
+ promptVariables: F,
521
+ setPromptVariables: se,
495
522
  setCurrentSession: v
496
- }), /* @__PURE__ */ q("div", {
523
+ }), /* @__PURE__ */ W("div", {
497
524
  className: "chat-main",
498
525
  id: "chat-main",
499
- style: it,
500
- children: [/* @__PURE__ */ d("div", {
526
+ style: ot,
527
+ children: [/* @__PURE__ */ a("div", {
501
528
  className: "chat-main-wrapper",
502
529
  id: "scrollableDiv",
503
530
  style: {
@@ -507,99 +534,92 @@ ${t}` : t, r = new _(i, l, W.User, n);
507
534
  flexDirection: "column-reverse"
508
535
  },
509
536
  ref: T,
510
- onScroll: Tt,
511
- children: (Ae = e == null ? void 0 : e.data) != null && Ae.id && (p != null && p.length) ? /* @__PURE__ */ d(fn, {
537
+ onScroll: Rt,
538
+ children: ($e = e == null ? void 0 : e.data) != null && $e.id && (p != null && p.length) ? /* @__PURE__ */ a(fi, {
512
539
  dataLength: p.length,
513
- next: Dt,
540
+ next: Ut,
514
541
  style: {
515
542
  display: "flex",
516
543
  flexDirection: "column-reverse",
517
544
  overflowX: "hidden"
518
545
  },
519
546
  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, {
547
+ endMessage: p.length > Se && // 少于一页不展示这个提示
548
+ ((Ae = T.current) != null && Ae.scrollTop) && ((Be = T.current) == null ? void 0 : Be.scrollTop) < -10 ? /* @__PURE__ */ a(Kt, {
522
549
  plain: !0,
523
550
  children: "没有更多数据了"
524
551
  }) : null,
525
- hasMore: wt,
526
- loader: /* @__PURE__ */ d("div", {
552
+ hasMore: bt,
553
+ loader: /* @__PURE__ */ a("div", {
527
554
  style: {
528
555
  height: "50px",
529
556
  textAlign: "center",
530
557
  overflow: "hidden"
531
558
  },
532
- children: /* @__PURE__ */ d(qt, {})
559
+ children: /* @__PURE__ */ a(Wt, {})
533
560
  }),
534
561
  scrollableTarget: "scrollableDiv",
535
- children: p.map((t, n) => /* @__PURE__ */ d(hn, {
536
- application: s,
562
+ children: p.map((t, i) => /* @__PURE__ */ a(hi, {
563
+ application: o,
537
564
  currentSession: e,
538
565
  history: t,
539
- docViewerUrl: y,
540
- isLastHistory: n === 0,
541
- onRelatedClick: Rt,
542
- onAgainClick: Ot,
543
- onEditClick: Pt
544
- }, t.messageId + n))
545
- }) : /* @__PURE__ */ d("div", {
566
+ docViewerUrl: g,
567
+ isLastHistory: i === 0,
568
+ onRelatedClick: Dt,
569
+ onAgainClick: Ht,
570
+ onEditClick: Ot
571
+ }, t.messageId + i))
572
+ }) : /* @__PURE__ */ a("div", {
546
573
  className: "main-empty",
547
- children: /* @__PURE__ */ d(nn, ke(ve({}, gn), {
548
- children: !!Fe.length && /* @__PURE__ */ d(tn, {
549
- ref: pe,
574
+ children: /* @__PURE__ */ a(ni, we(ke({}, gi), {
575
+ children: !!Ee.length && /* @__PURE__ */ a(ii, {
576
+ ref: he,
550
577
  sid: (qe = e == null ? void 0 : e.data) == null ? void 0 : qe.id,
551
- isRecommendClearing: Ee,
552
- data: Fe,
578
+ isRecommendClearing: Te,
579
+ data: Ee,
553
580
  onItemClick: (t) => {
554
- var l, i, r;
555
- if (G(t == null ? void 0 : t.question), B(t == null ? void 0 : t.question), Ee)
581
+ var l, n, r;
582
+ if (J(t == null ? void 0 : t.question), q(t == null ? void 0 : t.question), Te)
556
583
  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({
564
- netOpen: O ? 1 : 2
565
- }).then((a) => {
566
- var g, m, N;
567
- v == null || v(a), z(!1), b(!!((g = a.data) != null && g.netOpen)), $(!!((m = a.data) != null && m.enableNetOpen));
568
- const k = ((N = a.data) == null ? void 0 : N.id) || "";
569
- Ve(k, t);
570
- })));
571
- });
584
+ t != null && t.id && G(!0);
585
+ const i = (l = e == null ? void 0 : e.data) == null ? void 0 : l.id;
586
+ c != null && c.fileUpload ? (r = (n = ne.current) == null ? void 0 : n.clear()) == null || r.then(() => {
587
+ var s;
588
+ t != null && t.id && (i ? (s = Et(i, t)) == null || s.finally(() => {
589
+ G(!1);
590
+ }) : (G(!1), U(!0), Ve()));
591
+ }) : i ? G(!1) : (G(!1), U(!0), Ve());
572
592
  }
573
593
  })
574
594
  }))
575
595
  })
576
- }), Oe && /* @__PURE__ */ d("div", {
596
+ }), De && /* @__PURE__ */ a("div", {
577
597
  className: "session-stop",
578
- children: /* @__PURE__ */ d(K, {
598
+ children: /* @__PURE__ */ a(Q, {
579
599
  type: "primary",
580
600
  style: {
581
601
  background: "white"
582
602
  },
583
603
  ghost: !0,
584
604
  size: "small",
585
- icon: /* @__PURE__ */ d(we, {
605
+ icon: /* @__PURE__ */ a(be, {
586
606
  type: "icon-zantinghuida",
587
607
  style: {
588
608
  fontSize: 16
589
609
  }
590
610
  }),
591
- onClick: () => Ft(),
611
+ onClick: () => Tt(),
592
612
  children: "停止回答"
593
613
  })
594
- }), De && (p == null ? void 0 : p.length) > 0 && /* @__PURE__ */ d("div", {
614
+ }), He && (p == null ? void 0 : p.length) > 0 && /* @__PURE__ */ a("div", {
595
615
  className: "back-bottom",
596
- children: /* @__PURE__ */ d(K, {
616
+ children: /* @__PURE__ */ a(Q, {
597
617
  size: "small",
598
- onClick: () => Et({
618
+ onClick: () => Pt({
599
619
  behavior: "smooth"
600
620
  }),
601
621
  type: "link",
602
- icon: /* @__PURE__ */ d(we, {
622
+ icon: /* @__PURE__ */ a(be, {
603
623
  type: "icon-yijianhuidaodibu",
604
624
  style: {
605
625
  fontSize: 24
@@ -607,34 +627,34 @@ ${t}` : t, r = new _(i, l, W.User, n);
607
627
  })
608
628
  })
609
629
  })]
610
- }), /* @__PURE__ */ d("div", {
630
+ }), /* @__PURE__ */ a("div", {
611
631
  className: "chat-footer",
612
- children: /* @__PURE__ */ q("div", {
632
+ children: /* @__PURE__ */ W("div", {
613
633
  className: "chat-footer-input",
614
- children: [Q && /* @__PURE__ */ d("div", {
634
+ children: [_ && /* @__PURE__ */ a("div", {
615
635
  className: "input-files",
616
- children: /* @__PURE__ */ d(Jt, {
617
- file: Q,
636
+ children: /* @__PURE__ */ a(St, {
637
+ file: _,
618
638
  actions: {
619
- upload: Ct,
639
+ upload: Ft,
620
640
  remove: () => {
621
641
  A(void 0);
622
642
  }
623
643
  },
624
- onUrlChange: (t) => S(t)
644
+ onUrlChange: (t) => ee(t)
625
645
  })
626
- }), /* @__PURE__ */ q(oe, {
646
+ }), /* @__PURE__ */ W(re, {
627
647
  className: "footer-upload-action",
628
648
  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,
649
+ children: [/* @__PURE__ */ W(re, {
650
+ children: [o.type === 2 && (c == null ? void 0 : c.imageUpload) && /* @__PURE__ */ a(Qt, {
651
+ disabled: !!_ || D,
632
652
  accept: ".jpg, .png, .jpeg,.bmp",
633
653
  listType: "picture-card",
634
- beforeUpload: Nt,
654
+ beforeUpload: Ct,
635
655
  className: "footer-upload-picture",
636
656
  showUploadList: !1,
637
- children: Q ? /* @__PURE__ */ d(K, {
657
+ children: _ ? /* @__PURE__ */ a(Q, {
638
658
  type: "text",
639
659
  className: "camera-out-btn",
640
660
  style: {
@@ -642,20 +662,20 @@ ${t}` : t, r = new _(i, l, W.User, n);
642
662
  position: "relative",
643
663
  bottom: "-2px"
644
664
  },
645
- disabled: !!Q || D,
646
- icon: /* @__PURE__ */ d(Ze, {
665
+ disabled: !!_ || D,
666
+ icon: /* @__PURE__ */ a(Je, {
647
667
  className: "icon-tianjia",
648
668
  style: {
649
669
  fontSize: "22px"
650
670
  }
651
671
  })
652
- }) : /* @__PURE__ */ d(Wt, {
672
+ }) : /* @__PURE__ */ a(Yt, {
653
673
  placement: "topLeft",
654
674
  overlayClassName: "footer-upload-tooltip",
655
- title: /* @__PURE__ */ d("div", {
675
+ title: /* @__PURE__ */ a("div", {
656
676
  children: "支持上传.jpg .png .jpeg .bmp格式的图片数据,最大20M,单次仅可上传1个"
657
677
  }),
658
- children: /* @__PURE__ */ d(K, {
678
+ children: /* @__PURE__ */ a(Q, {
659
679
  type: "text",
660
680
  className: "camera-out-btn",
661
681
  style: {
@@ -663,7 +683,7 @@ ${t}` : t, r = new _(i, l, W.User, n);
663
683
  position: "relative",
664
684
  bottom: "-2px"
665
685
  },
666
- icon: /* @__PURE__ */ d(Ze, {
686
+ icon: /* @__PURE__ */ a(Je, {
667
687
  className: "icon-tianjia",
668
688
  style: {
669
689
  fontSize: "22px"
@@ -671,136 +691,136 @@ ${t}` : t, r = new _(i, l, W.User, n);
671
691
  })
672
692
  })
673
693
  })
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,
678
- docViewerUrl: y,
679
- onStatusChange: (t) => j(void 0, null, function* () {
680
- t !== "process" ? (ne(!0), me()) : ne(!1);
694
+ }), ae && (c != null && c.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ a(ri, {
695
+ appId: o == null ? void 0 : o.id,
696
+ ref: ne,
697
+ isFirstSession: Ue,
698
+ docViewerUrl: g,
699
+ onStatusChange: (t) => z(void 0, null, function* () {
700
+ t !== "process" ? (oe(!0), ye()) : oe(!1);
681
701
  }),
682
702
  createSession: () => new Promise((t) => {
683
- z(!0), w == null || w({
703
+ U(!0), k == null || k({
684
704
  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) || "";
705
+ }).then((i) => {
706
+ var n, r, s;
707
+ v == null || v(i), U(!1), w(!!((n = i.data) != null && n.netOpen)), K(!!((r = i.data) != null && r.enableNetOpen));
708
+ const l = ((s = i.data) == null ? void 0 : s.id) || "";
689
709
  t(l);
690
710
  });
691
711
  }),
692
712
  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] || [];
713
+ disabled: ge || D,
714
+ afterFileAdd: (t, i) => {
715
+ i && ie((l) => {
716
+ const n = l[i] || [];
697
717
  return {
698
- [n]: [...i, t]
718
+ [i]: [...n, t]
699
719
  };
700
720
  });
701
721
  },
702
722
  afterFileDelete: (t) => {
703
723
  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] || [];
724
+ const i = (l = e == null ? void 0 : e.data) == null ? void 0 : l.id;
725
+ i && ie((n) => {
726
+ const r = n[i] || [];
707
727
  return {
708
- [n]: r.filter((o) => o.id !== t)
728
+ [i]: r.filter((s) => s.id !== t)
709
729
  };
710
730
  });
711
731
  },
712
732
  onFileListChange: (t) => {
713
- pt(t);
733
+ ht(t);
714
734
  },
715
- shouldContinue: gt,
735
+ shouldContinue: mt,
716
736
  afterFilesClear: () => {
717
- var n;
718
- const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
719
- t && (ee({
737
+ var i;
738
+ const t = (i = e == null ? void 0 : e.data) == null ? void 0 : i.id;
739
+ t && (ie({
720
740
  [t]: []
721
- }), me());
741
+ }), ye());
722
742
  }
723
- }) : null, (f == null ? void 0 : f.prompt) && (s == null ? void 0 : s.id) && /* @__PURE__ */ d(on, {
724
- appId: s.id,
743
+ }) : null, (c == null ? void 0 : c.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ a(oi, {
744
+ appId: o.id,
725
745
  list: [],
726
- search: Te ? at : "",
746
+ search: Pe ? dt : "",
727
747
  onPromptSelect: (t) => {
728
- B(t.context), G(t.context);
748
+ q(t.context), J(t.context);
729
749
  },
730
750
  disabled: D
731
751
  })]
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, {
752
+ }), /* @__PURE__ */ W(re, {
753
+ children: [(c == null ? void 0 : c.connectNetwork) && o.type === 0 && ((We = o.arrange) == null ? void 0 : We.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ a(ui, {
734
754
  sessionId: (Qe = e == null ? void 0 : e.data) == null ? void 0 : Qe.id,
735
755
  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,
756
+ enable: typeof (f == null ? void 0 : f.connectNetwork) == "object" && typeof (f == null ? void 0 : f.connectNetwork.diabled) == "boolean" ? !(f != null && f.connectNetwork.diabled) : xt,
737
757
  disabledTip: e ? void 0 : "网络访问已被禁用",
738
758
  onNetStatusChange: (t) => {
739
- Ht(t);
759
+ zt(t);
740
760
  }
741
- }), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ d(cn, {
761
+ }), (c == null ? void 0 : c.sessionList) && /* @__PURE__ */ a(ci, {
742
762
  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);
763
+ onSessionChange: (t, i) => {
764
+ q(void 0), v == null || v(i);
745
765
  },
746
766
  disabled: D
747
- }), (f == null ? void 0 : f.sessionOpen) && /* @__PURE__ */ d(K, {
748
- icon: /* @__PURE__ */ d(ln, {}),
767
+ }), (c == null ? void 0 : c.sessionOpen) && /* @__PURE__ */ a(Q, {
768
+ icon: /* @__PURE__ */ a(li, {}),
749
769
  className: "add-btn",
750
770
  type: "primary",
751
- disabled: Oe || !e || !p.length || D,
771
+ disabled: De || !e || !p.length || D,
752
772
  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();
773
+ var t, i;
774
+ v == null || v(void 0), w(!1), (t = Re.current) == null || t.clear(), (i = he.current) == null || i.clear();
755
775
  },
756
776
  children: "新会话"
757
777
  })]
758
778
  })]
759
- }), /* @__PURE__ */ d("div", {
779
+ }), /* @__PURE__ */ a("div", {
760
780
  className: "footer-textarea",
761
- children: /* @__PURE__ */ d(en, {
762
- ref: ce,
763
- maxLength: ot,
764
- text: ct,
781
+ children: /* @__PURE__ */ a(ti, {
782
+ ref: pe,
783
+ maxLength: st,
784
+ text: ft,
765
785
  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);
786
+ loading: ze,
787
+ disabled: Ne || Fe || D || ze,
788
+ onTextSend: Me,
789
+ onChange: (t, i) => {
790
+ q(t);
791
+ const l = i.getText().replace(/[\n\s]+$/, "");
792
+ J(l), ct(l), Pe || at(!0);
773
793
  },
774
- clearAction: /* @__PURE__ */ d(oe, {
794
+ clearAction: /* @__PURE__ */ a(re, {
775
795
  size: 0,
776
- children: /* @__PURE__ */ d(K, {
796
+ children: /* @__PURE__ */ a(Q, {
777
797
  type: "link",
778
- disabled: he || D,
798
+ disabled: ge || D,
779
799
  ghost: !0,
780
- icon: /* @__PURE__ */ d(we, {
800
+ icon: /* @__PURE__ */ a(be, {
781
801
  style: {
782
802
  fontSize: 22
783
803
  },
784
804
  type: "icon-qingchujiyi"
785
805
  }),
786
- onClick: () => xt()
806
+ onClick: () => It()
787
807
  })
788
808
  })
789
809
  })
790
810
  })]
791
811
  })
792
- }), /* @__PURE__ */ d(sn, {
812
+ }), /* @__PURE__ */ a(si, {
793
813
  tips: nt
794
- }), Re && /* @__PURE__ */ d(an, {
795
- isvisible: Re,
796
- files: ut,
814
+ }), Oe && /* @__PURE__ */ a(ai, {
815
+ isvisible: Oe,
816
+ files: pt,
797
817
  sessionId: (_e = e == null ? void 0 : e.data) == null ? void 0 : _e.id,
798
818
  onClose: (t) => {
799
- ft(!1), mt(!1);
819
+ ut(!1), yt(!1);
800
820
  }
801
821
  })]
802
822
  });
803
823
  };
804
824
  export {
805
- Kn as default
825
+ Ki as default
806
826
  };