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