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