@glodon-aiot/agent-cli-ui 3.3.5-alpha.27 → 3.3.5-alpha.29
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/HistoryItem/SessionRefer/index.mjs +59 -46
- package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +47 -46
- package/dist/es/Dialog/AgentChat/index.mjs +129 -131
- package/dist/es/components/Recommend/index.mjs +52 -34
- package/dist/es/constant.mjs +7 -3
- package/dist/es/index.mjs +117 -109
- 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/style.css +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/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style18.css +1 -1
- package/dist/es/src/style23.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/style3.css +1 -1
- package/dist/es/src/style30.css +1 -1
- package/dist/es/src/style4.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.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.css +1 -1
- package/dist/lib/index.js +36 -36
- package/dist/src/Dialog/AgentChat/HistoryItem/SessionRefer/index.d.ts +2 -0
- package/dist/src/components/Recommend/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/types.d.ts +1 -0
- package/package.json +3 -3
|
@@ -11,24 +11,24 @@ var Ie = (L, o, v) => o in L ? Wt(L, o, { enumerable: !0, configurable: !0, writ
|
|
|
11
11
|
return L;
|
|
12
12
|
}, st = (L, o) => Qt(L, _t(o));
|
|
13
13
|
var D = (L, o, v) => (Ie(L, typeof o != "symbol" ? o + "" : o, v), v);
|
|
14
|
-
var
|
|
14
|
+
var j = (L, o, v) => new Promise((e, w) => {
|
|
15
15
|
var ue = (x) => {
|
|
16
16
|
try {
|
|
17
17
|
H(v.next(x));
|
|
18
18
|
} catch (h) {
|
|
19
19
|
w(h);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, b = (x) => {
|
|
22
22
|
try {
|
|
23
23
|
H(v.throw(x));
|
|
24
24
|
} catch (h) {
|
|
25
25
|
w(h);
|
|
26
26
|
}
|
|
27
|
-
}, H = (x) => x.done ? e(x.value) : Promise.resolve(x.value).then(ue,
|
|
27
|
+
}, H = (x) => x.done ? e(x.value) : Promise.resolve(x.value).then(ue, b);
|
|
28
28
|
H((v = v.apply(L, o)).next());
|
|
29
29
|
});
|
|
30
|
-
import { jsx as c, jsxs as
|
|
31
|
-
import { memo as Zt, useState as m, useRef as
|
|
30
|
+
import { jsx as c, jsxs as $ } from "react/jsx-runtime";
|
|
31
|
+
import { memo as Zt, useState as m, useRef as q, useContext as Jt, useEffect as F, useMemo as St } from "react";
|
|
32
32
|
/* empty css */import { Divider as en, Spin as tn, Button as _, Space as de, Upload as nn, Tooltip as on, notification as ce, message as u } from "antd";
|
|
33
33
|
import fe from "../../components/Iconfont/index.mjs";
|
|
34
34
|
import { IHistoryRole as G, ChatMessageRole as rt, PromptVariableType as ge } from "@glodon-aiot/apis";
|
|
@@ -49,8 +49,8 @@ import yn from "./Tools/UploadKnowledgeFiles/index.mjs";
|
|
|
49
49
|
import pn from "../UploadingPrompt/index.mjs";
|
|
50
50
|
import vn from "./PromptSetting/index.mjs";
|
|
51
51
|
import { useMemoizedFn as Le } from "ahooks";
|
|
52
|
-
import
|
|
53
|
-
import
|
|
52
|
+
import kn from "./Tools/SessionListDrawer/index.mjs";
|
|
53
|
+
import bn from "react-infinite-scroll-component";
|
|
54
54
|
import wn from "./Tools/ConnectToNetwork/index.mjs";
|
|
55
55
|
import xn from "./Tools/PromptManager/index.mjs";
|
|
56
56
|
import In from "../../assets/icon.svg.mjs";
|
|
@@ -82,10 +82,10 @@ const lt = 10, ei = (L) => {
|
|
|
82
82
|
currentSession: e,
|
|
83
83
|
onCreateSession: w,
|
|
84
84
|
embeddingService: ue,
|
|
85
|
-
setCurrentSession:
|
|
85
|
+
setCurrentSession: b,
|
|
86
86
|
networkStatus: H,
|
|
87
87
|
setNetworkStatus: x
|
|
88
|
-
} = L, [h, C] = m([]), [gt, ee] = m(), [he, Ce] = m(), R =
|
|
88
|
+
} = L, [h, C] = m([]), [gt, ee] = m(), [he, Ce] = m(), R = q(null), {
|
|
89
89
|
service: P,
|
|
90
90
|
agentClient: N,
|
|
91
91
|
depId: ut,
|
|
@@ -94,13 +94,13 @@ const lt = 10, ei = (L) => {
|
|
|
94
94
|
defaultInput: me,
|
|
95
95
|
onMessage: te,
|
|
96
96
|
onHistoryLoad: Ne,
|
|
97
|
-
beforeMessageSend:
|
|
97
|
+
beforeMessageSend: z,
|
|
98
98
|
bodyStyle: mt,
|
|
99
99
|
disabled: M,
|
|
100
|
-
features:
|
|
100
|
+
features: a,
|
|
101
101
|
popupContainer: f,
|
|
102
102
|
icon: yt
|
|
103
|
-
} = Jt(sn), [Pe, ye] = m(!1), y =
|
|
103
|
+
} = Jt(sn), [Pe, ye] = m(!1), y = q(h), Te = q(void 0), [pt, vt] = m(0), [X, A] = m(), [Y, ne] = m(""), [Fe, pe] = m(!1), ve = q(null), [Ee, kt] = m([]), [Re, K] = m(!1), [De, bt] = m(!1), [wt, xt] = m(""), [It, W] = m(), [ie, oe] = m({}), se = q(null), He = q(null), ke = q(null), [Me, Lt] = m(!1), [Ct, Nt] = m([]), [Pt, re] = m(!0), [Tt, Ft] = m(!0), [Oe, O] = m(!1), [be, V] = m(!1), [Ue, Et] = m(!1), [E, ae] = m(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [Rt, Dt] = m(typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0), [je, U] = m(!1), [ze, Z] = m(!1), [Ht, Q] = m(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), [Ve, le] = m(!1);
|
|
104
104
|
F(() => {
|
|
105
105
|
var r, i;
|
|
106
106
|
e && (y.current = []), C([]);
|
|
@@ -113,12 +113,12 @@ const lt = 10, ei = (L) => {
|
|
|
113
113
|
const s = [...e.messages.filter((d) => d == null ? void 0 : d.messageId)].reverse();
|
|
114
114
|
y.current = [...s], C([...s]);
|
|
115
115
|
}
|
|
116
|
-
const n = (
|
|
116
|
+
const n = (l) => {
|
|
117
117
|
var s;
|
|
118
|
-
(s = e == null ? void 0 : e.data) != null && s.id && (y.current = [...
|
|
118
|
+
(s = e == null ? void 0 : e.data) != null && s.id && (y.current = [...l].reverse(), C([...l].reverse()), !l || l.length < 10 ? Z(!1) : Z(!0), Ne && Ne({
|
|
119
119
|
applicationId: o.id,
|
|
120
120
|
sessionId: e.data.id,
|
|
121
|
-
histories:
|
|
121
|
+
histories: l
|
|
122
122
|
}));
|
|
123
123
|
};
|
|
124
124
|
return e.addEventListener("history:loaded", n), () => {
|
|
@@ -170,10 +170,10 @@ const lt = 10, ei = (L) => {
|
|
|
170
170
|
};
|
|
171
171
|
F(() => {
|
|
172
172
|
o != null && o.id && (P == null || P.getRecommendQues(o.id).then((t) => {
|
|
173
|
-
|
|
173
|
+
kt(t);
|
|
174
174
|
}));
|
|
175
175
|
}, [ut, o]);
|
|
176
|
-
const
|
|
176
|
+
const Be = (t) => j(void 0, null, function* () {
|
|
177
177
|
var p, T;
|
|
178
178
|
if (M) {
|
|
179
179
|
u.config({
|
|
@@ -192,7 +192,7 @@ const lt = 10, ei = (L) => {
|
|
|
192
192
|
});
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
if (!(E == null ? void 0 : E.every((
|
|
195
|
+
if (!(E == null ? void 0 : E.every((k) => !!(k != null && k.value))))
|
|
196
196
|
if (g != null && g.promptVariables) {
|
|
197
197
|
u.config({
|
|
198
198
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
@@ -201,8 +201,8 @@ const lt = 10, ei = (L) => {
|
|
|
201
201
|
});
|
|
202
202
|
return;
|
|
203
203
|
} else
|
|
204
|
-
console.error("变量值不能为空", E == null ? void 0 : E.map((
|
|
205
|
-
if (
|
|
204
|
+
console.error("变量值不能为空", E == null ? void 0 : E.map((k) => !!(k != null && k.value)));
|
|
205
|
+
if (be) {
|
|
206
206
|
u.config({
|
|
207
207
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
208
208
|
}), u.error("正在回复中"), u.config({
|
|
@@ -234,43 +234,43 @@ const lt = 10, ei = (L) => {
|
|
|
234
234
|
});
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
|
-
|
|
237
|
+
A(void 0), ne("");
|
|
238
238
|
const i = (p = e == null ? void 0 : e.data) == null ? void 0 : p.id;
|
|
239
239
|
if (!i) {
|
|
240
240
|
w == null || w({
|
|
241
241
|
netOpen: H ? 1 : 2
|
|
242
|
-
}).then((
|
|
243
|
-
var
|
|
244
|
-
U(!0), x(!!((
|
|
245
|
-
|
|
242
|
+
}).then((k) => {
|
|
243
|
+
var B, J;
|
|
244
|
+
U(!0), x(!!((B = k.data) != null && B.netOpen)), Q(!!((J = k.data) != null && J.enableNetOpen)), $e(k).then(() => {
|
|
245
|
+
b == null || b(k), U(!1), Ce(n);
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
250
|
le(!0);
|
|
251
|
-
const
|
|
251
|
+
const l = Y ? `
|
|
252
252
|
${n}` : n;
|
|
253
253
|
let s;
|
|
254
254
|
try {
|
|
255
|
-
|
|
255
|
+
z ? s = yield z == null ? void 0 : z({
|
|
256
256
|
applicationId: o.id,
|
|
257
257
|
sessionId: i,
|
|
258
258
|
message: {
|
|
259
|
-
content:
|
|
259
|
+
content: l,
|
|
260
260
|
sessionId: i,
|
|
261
261
|
role: rt.User,
|
|
262
262
|
files: ie[i]
|
|
263
263
|
}
|
|
264
264
|
}) : s = !0;
|
|
265
|
-
} catch (
|
|
265
|
+
} catch (k) {
|
|
266
266
|
s = !1;
|
|
267
267
|
}
|
|
268
268
|
if (le(!1), s === !1)
|
|
269
269
|
return;
|
|
270
270
|
let d = n;
|
|
271
271
|
typeof s == "object" && (d = s.content || n), (yield e.setPromptVariables(E)) && (((T = ie[i]) == null ? void 0 : T.length) > 0 ? Ot(d) : we(d));
|
|
272
|
-
}),
|
|
273
|
-
const s = (t == null ? void 0 : t.promptVariables).filter((d) => !((d.type === ge.User || d.type === void 0) && d.key === "query") && !((d.type === ge.System || d.type === void 0) && d.key === "datetime")).map((d) => {
|
|
272
|
+
}), $e = (t) => new Promise((n, r) => j(void 0, null, function* () {
|
|
273
|
+
const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.type ? !((d.type === ge.User || d.type === void 0) && d.key === "query") && !((d.type === ge.System || d.type === void 0) && d.key === "datetime") : d.key !== "query").map((d) => {
|
|
274
274
|
var p;
|
|
275
275
|
const I = (p = E.find((T) => T.key === d.key && T.type === d.type)) == null ? void 0 : p.value;
|
|
276
276
|
return d.value = I || "", d;
|
|
@@ -287,9 +287,9 @@ ${n}` : n;
|
|
|
287
287
|
if (re(!1), !((s = e == null ? void 0 : e.data) != null && s.id) || !(o != null && o.id))
|
|
288
288
|
return;
|
|
289
289
|
const n = ((d = e.data) == null ? void 0 : d.id) || "", r = [];
|
|
290
|
-
let i = [],
|
|
290
|
+
let i = [], l = /* @__PURE__ */ new Set();
|
|
291
291
|
(I = ie[n]) == null || I.forEach((p) => {
|
|
292
|
-
|
|
292
|
+
l.has(p.id) || (i.push(p), l.add(p.id));
|
|
293
293
|
}), Promise.all(i.map((p) => P == null ? void 0 : P.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, p.id, {
|
|
294
294
|
enabled: 1
|
|
295
295
|
}).then((T) => {
|
|
@@ -303,13 +303,13 @@ ${n}` : n;
|
|
|
303
303
|
F(() => {
|
|
304
304
|
if (!he || !e)
|
|
305
305
|
return;
|
|
306
|
-
const t = he, n = () =>
|
|
306
|
+
const t = he, n = () => j(void 0, null, function* () {
|
|
307
307
|
le(!0);
|
|
308
308
|
const r = Y ? `
|
|
309
309
|
${t}` : t;
|
|
310
310
|
let i;
|
|
311
311
|
try {
|
|
312
|
-
|
|
312
|
+
z ? i = yield z == null ? void 0 : z({
|
|
313
313
|
applicationId: o.id,
|
|
314
314
|
sessionId: e.id,
|
|
315
315
|
message: {
|
|
@@ -319,7 +319,7 @@ ${t}` : t;
|
|
|
319
319
|
files: ie[e.id]
|
|
320
320
|
}
|
|
321
321
|
}) : i = !0;
|
|
322
|
-
} catch (
|
|
322
|
+
} catch (l) {
|
|
323
323
|
i = !1;
|
|
324
324
|
}
|
|
325
325
|
le(!1), i !== !1 && (we(t), Ce(void 0));
|
|
@@ -328,32 +328,32 @@ ${t}` : t;
|
|
|
328
328
|
e == null || e.removeEventListener("ready", n);
|
|
329
329
|
};
|
|
330
330
|
}, [he, e]);
|
|
331
|
-
const we = (t, n) =>
|
|
331
|
+
const we = (t, n) => j(void 0, null, function* () {
|
|
332
332
|
var p, T;
|
|
333
333
|
const r = (p = e == null ? void 0 : e.data) == null ? void 0 : p.id;
|
|
334
334
|
if (!r)
|
|
335
335
|
return;
|
|
336
336
|
V(!0), O(!0);
|
|
337
337
|
const i = Y ? `
|
|
338
|
-
${t}` : t,
|
|
339
|
-
ee(void 0), W(void 0), y.current = [
|
|
338
|
+
${t}` : t, l = new S(i, r, G.User, n);
|
|
339
|
+
ee(void 0), W(void 0), y.current = [l, ...h], C(y.current), o.id && te && te({
|
|
340
340
|
applicationId: o.id,
|
|
341
341
|
sessionId: r,
|
|
342
|
-
message:
|
|
342
|
+
message: l
|
|
343
343
|
});
|
|
344
344
|
const s = new S("", r, G.System);
|
|
345
345
|
s.isWaiting = !0, y.current = [s, ...y.current], C(y.current);
|
|
346
|
-
const d = (n == null ? void 0 : n.map((
|
|
346
|
+
const d = (n == null ? void 0 : n.map((k) => k.id)) || [], I = {
|
|
347
347
|
stream: rn.stream,
|
|
348
348
|
referenceFirst: !1
|
|
349
349
|
};
|
|
350
350
|
if (g != null && g.promptVariables) {
|
|
351
|
-
const
|
|
352
|
-
I.formatValues =
|
|
351
|
+
const k = E == null ? void 0 : E.reduce((B, J) => (B[J.key] = J.value, B), {});
|
|
352
|
+
I.formatValues = k;
|
|
353
353
|
}
|
|
354
354
|
if (g != null && g.knowledges) {
|
|
355
|
-
const
|
|
356
|
-
I.knowledges =
|
|
355
|
+
const k = Rt;
|
|
356
|
+
I.knowledges = k;
|
|
357
357
|
}
|
|
358
358
|
yield e.send({
|
|
359
359
|
text: i,
|
|
@@ -374,8 +374,8 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
374
374
|
return ce.error({
|
|
375
375
|
message: i.content
|
|
376
376
|
});
|
|
377
|
-
const
|
|
378
|
-
s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions =
|
|
377
|
+
const l = i.actions || [], s = new S(i.content, t, G.Robot);
|
|
378
|
+
s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions = l, s.isLoading = !0, s.searchingStatus = i.searchingStatus, y.current = y.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && C([s, ...y.current]), i.code === 11915 && (O(!1), V(!1), s.isLoading = !1, s.content = "请您换个问题问我吧~", s.isSensitive = !0, C([s, ...y.current])), i.index === -2 && (O(!1), V(!1), s.isLoading = !1, s.content = "回答已中止~", s.isSuspend = !0, C([s, ...y.current])), i.index === -1 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, C([s, ...y.current]), o.id && te && te({
|
|
379
379
|
applicationId: o.id,
|
|
380
380
|
sessionId: t,
|
|
381
381
|
message: s
|
|
@@ -415,39 +415,39 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
415
415
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
416
416
|
}), u.error("图片须小于20M"), u.config({
|
|
417
417
|
getContainer: void 0
|
|
418
|
-
}), !1) : (
|
|
419
|
-
},
|
|
418
|
+
}), !1) : (A(t), !1);
|
|
419
|
+
}, jt = (t) => j(void 0, null, function* () {
|
|
420
420
|
var n;
|
|
421
|
-
return
|
|
421
|
+
return A(t), (n = e == null ? void 0 : e.data) != null && n.id ? qe(e, t) : new Promise((r) => {
|
|
422
422
|
U(!0), w == null || w({
|
|
423
423
|
netOpen: H ? 1 : 2
|
|
424
424
|
}).then((i) => {
|
|
425
|
-
var
|
|
426
|
-
|
|
425
|
+
var l, s;
|
|
426
|
+
b == null || b(i), U(!1), x(!!((l = i.data) != null && l.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(qe(i, t));
|
|
427
427
|
});
|
|
428
428
|
});
|
|
429
|
-
}),
|
|
429
|
+
}), qe = (t, n) => {
|
|
430
430
|
const r = dn(n.name);
|
|
431
431
|
return new Promise((i) => {
|
|
432
432
|
var s;
|
|
433
|
-
const
|
|
433
|
+
const l = {
|
|
434
434
|
files: [`${ft()}.${r}`],
|
|
435
435
|
isv: "minio",
|
|
436
436
|
knowledgeId: ((s = t.data) == null ? void 0 : s.id) || "",
|
|
437
437
|
type: 1
|
|
438
438
|
};
|
|
439
|
-
pe(!0), P == null || P.postTicket(
|
|
439
|
+
pe(!0), P == null || P.postTicket(l).then((d) => {
|
|
440
440
|
P.uploadMinioFile(d.minio, n).then(() => {
|
|
441
|
-
var
|
|
442
|
-
const I = (
|
|
441
|
+
var k, B;
|
|
442
|
+
const I = (k = d.minio.endpoints) == null ? void 0 : k[0], p = d.minio.bucket, T = (B = d.minio.fileKeys) == null ? void 0 : B[0];
|
|
443
443
|
i(`${location.protocol}//${I}/${p}/${T}`);
|
|
444
444
|
}).catch(() => {
|
|
445
|
-
ne(""),
|
|
445
|
+
ne(""), A(void 0);
|
|
446
446
|
}).finally(() => {
|
|
447
447
|
pe(!1);
|
|
448
448
|
});
|
|
449
449
|
}).catch(() => {
|
|
450
|
-
ne(""),
|
|
450
|
+
ne(""), A(void 0), pe(!1);
|
|
451
451
|
});
|
|
452
452
|
});
|
|
453
453
|
};
|
|
@@ -457,17 +457,17 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
457
457
|
top: t.scrollHeight
|
|
458
458
|
});
|
|
459
459
|
}, [h]);
|
|
460
|
-
const
|
|
460
|
+
const Ae = (t, n) => new Promise((r) => {
|
|
461
461
|
if (!n.file.url || !(o != null && o.id))
|
|
462
462
|
return r();
|
|
463
463
|
const i = st(ot({}, n.file), {
|
|
464
464
|
type: 1
|
|
465
465
|
});
|
|
466
466
|
P == null || P.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
|
|
467
|
-
var
|
|
468
|
-
(
|
|
467
|
+
var l;
|
|
468
|
+
(l = se.current) == null || l.update().finally(r);
|
|
469
469
|
});
|
|
470
|
-
}),
|
|
470
|
+
}), zt = () => {
|
|
471
471
|
var t;
|
|
472
472
|
(t = e == null ? void 0 : e.data) != null && t.id && (O(!1), e.suspend());
|
|
473
473
|
}, Vt = (t) => {
|
|
@@ -478,17 +478,17 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
478
478
|
behavior: t == null ? void 0 : t.behavior
|
|
479
479
|
});
|
|
480
480
|
}, t == null ? void 0 : t.ms);
|
|
481
|
-
},
|
|
481
|
+
}, Bt = () => {
|
|
482
482
|
if (!R.current)
|
|
483
483
|
return;
|
|
484
484
|
const t = R.current.scrollTop <= -80;
|
|
485
485
|
Et(t);
|
|
486
|
-
},
|
|
486
|
+
}, $t = Le((t) => {
|
|
487
487
|
var n, r;
|
|
488
488
|
(n = ve.current) == null || n.update(t), (r = ve.current) == null || r.focus();
|
|
489
|
-
}),
|
|
490
|
-
|
|
491
|
-
}),
|
|
489
|
+
}), qt = Le((t) => {
|
|
490
|
+
Be(t);
|
|
491
|
+
}), At = Le(() => {
|
|
492
492
|
var n;
|
|
493
493
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
494
494
|
return;
|
|
@@ -498,7 +498,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
498
498
|
});
|
|
499
499
|
F(() => {
|
|
500
500
|
var t, n;
|
|
501
|
-
Te.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !
|
|
501
|
+
Te.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !je && ((n = ke.current) == null || n.clear());
|
|
502
502
|
}, [e]);
|
|
503
503
|
const Yt = () => {
|
|
504
504
|
var r;
|
|
@@ -509,14 +509,14 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
509
509
|
endTime: n,
|
|
510
510
|
pageSize: lt
|
|
511
511
|
}).then((i) => {
|
|
512
|
-
const
|
|
513
|
-
if (!
|
|
512
|
+
const l = i || [];
|
|
513
|
+
if (!l || !(l != null && l.length)) {
|
|
514
514
|
Z(!1);
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
|
-
|
|
517
|
+
l.length < 10 ? Z(!1) : Z(!0), C([...h, ...l.reverse()]);
|
|
518
518
|
});
|
|
519
|
-
}, Kt = (t) =>
|
|
519
|
+
}, Kt = (t) => j(void 0, null, function* () {
|
|
520
520
|
var n, r;
|
|
521
521
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
522
522
|
x(t);
|
|
@@ -525,7 +525,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
525
525
|
return;
|
|
526
526
|
x(t);
|
|
527
527
|
}
|
|
528
|
-
}), xe = () =>
|
|
528
|
+
}), xe = () => j(void 0, null, function* () {
|
|
529
529
|
e ? e.fetchData().then((t) => {
|
|
530
530
|
var n;
|
|
531
531
|
(n = e == null ? void 0 : e.data) != null && n.id && (x(t.netOpen), Q(t.enableNetOpen));
|
|
@@ -536,11 +536,11 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
536
536
|
}, [e]), F(() => {
|
|
537
537
|
var t, n;
|
|
538
538
|
if (R.current) {
|
|
539
|
-
const r = document.getElementById("chat-main"), i = (t = R.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"),
|
|
540
|
-
if (!i || !
|
|
539
|
+
const r = document.getElementById("chat-main"), i = (t = R.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), l = (n = R.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
|
|
540
|
+
if (!i || !l || !r)
|
|
541
541
|
return;
|
|
542
542
|
const s = r.offsetHeight;
|
|
543
|
-
if (
|
|
543
|
+
if (l.offsetHeight <= s) {
|
|
544
544
|
if (i.style.height === "100%")
|
|
545
545
|
return;
|
|
546
546
|
i.style.height = "100%";
|
|
@@ -554,31 +554,28 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
554
554
|
if (e)
|
|
555
555
|
return;
|
|
556
556
|
const t = () => {
|
|
557
|
-
const i = ((N == null ? void 0 : N.promptVariables) || []).filter(
|
|
558
|
-
(a) => !((a.type === ge.User || a.type === void 0) && a.key === "query") && !((a.type === ge.System || a.type === void 0) && a.key === "datetime") && a.status === 1
|
|
559
|
-
// 只要求输入被引用的变量
|
|
560
|
-
).map((a, s) => {
|
|
557
|
+
const i = ((N == null ? void 0 : N.promptVariables) || []).filter((l) => l.type ? !(l.type === ge.User && l.key === "query") && !(l.type === ge.System && l.key === "datetime") && l.status === 1 : l.key !== "query" && l.status === 1).map((l, s) => {
|
|
561
558
|
var I, p;
|
|
562
559
|
let d = "";
|
|
563
|
-
return typeof (
|
|
560
|
+
return typeof (a == null ? void 0 : a.promptVariables) == "object" && (d = ((p = (I = a.promptVariables.default) == null ? void 0 : I.find((T) => T.key === l.key && T.type === l.type)) == null ? void 0 : p.value) || ""), {
|
|
564
561
|
id: s + "",
|
|
565
|
-
key:
|
|
566
|
-
name:
|
|
562
|
+
key: l.key,
|
|
563
|
+
name: l.name,
|
|
567
564
|
value: d,
|
|
568
|
-
type:
|
|
565
|
+
type: l.type
|
|
569
566
|
};
|
|
570
567
|
});
|
|
571
|
-
ae([...i].sort((
|
|
568
|
+
ae([...i].sort((l, s) => l.key.localeCompare(s.key)));
|
|
572
569
|
};
|
|
573
570
|
return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
|
|
574
571
|
N == null || N.removeEventListener("ready", t);
|
|
575
572
|
};
|
|
576
|
-
}, [e, N,
|
|
573
|
+
}, [e, N, a == null ? void 0 : a.promptVariables]);
|
|
577
574
|
const Ye = () => w == null ? void 0 : w({
|
|
578
575
|
netOpen: H ? 1 : 2
|
|
579
576
|
}).then((t) => {
|
|
580
577
|
var n, r;
|
|
581
|
-
return
|
|
578
|
+
return b == null || b(t), U(!1), x(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), $e(t), t;
|
|
582
579
|
}), Ke = St(() => {
|
|
583
580
|
var t;
|
|
584
581
|
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(dt, {
|
|
@@ -596,10 +593,10 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
596
593
|
isLoading: !1
|
|
597
594
|
},
|
|
598
595
|
actions: !!h.length,
|
|
599
|
-
markdown:
|
|
596
|
+
markdown: a == null ? void 0 : a.markdown
|
|
600
597
|
}) : null;
|
|
601
598
|
}, [o == null ? void 0 : o.arrange, h]);
|
|
602
|
-
return /* @__PURE__ */
|
|
599
|
+
return /* @__PURE__ */ $("div", {
|
|
603
600
|
className: "agent-chat",
|
|
604
601
|
children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(vn, {
|
|
605
602
|
ref: He,
|
|
@@ -607,8 +604,8 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
607
604
|
currentSession: e,
|
|
608
605
|
promptVariables: E,
|
|
609
606
|
setPromptVariables: ae,
|
|
610
|
-
setCurrentSession:
|
|
611
|
-
}), /* @__PURE__ */
|
|
607
|
+
setCurrentSession: b
|
|
608
|
+
}), /* @__PURE__ */ $("div", {
|
|
612
609
|
className: "chat-main",
|
|
613
610
|
id: "chat-main",
|
|
614
611
|
style: mt,
|
|
@@ -622,8 +619,8 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
622
619
|
flexDirection: "column-reverse"
|
|
623
620
|
},
|
|
624
621
|
ref: R,
|
|
625
|
-
onScroll:
|
|
626
|
-
children: (We = e == null ? void 0 : e.data) != null && We.id && (h != null && h.length) ? /* @__PURE__ */
|
|
622
|
+
onScroll: Bt,
|
|
623
|
+
children: (We = e == null ? void 0 : e.data) != null && We.id && (h != null && h.length) ? /* @__PURE__ */ $(bn, {
|
|
627
624
|
dataLength: h.length,
|
|
628
625
|
next: Yt,
|
|
629
626
|
style: {
|
|
@@ -637,7 +634,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
637
634
|
plain: !0,
|
|
638
635
|
children: "没有更多数据了"
|
|
639
636
|
}) : null,
|
|
640
|
-
hasMore:
|
|
637
|
+
hasMore: ze,
|
|
641
638
|
loader: /* @__PURE__ */ c("div", {
|
|
642
639
|
style: {
|
|
643
640
|
height: "50px",
|
|
@@ -653,34 +650,35 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
653
650
|
history: t,
|
|
654
651
|
docViewerUrl: v,
|
|
655
652
|
isLastHistory: n === 0,
|
|
656
|
-
onRelatedClick:
|
|
657
|
-
onAgainClick:
|
|
658
|
-
onEditClick:
|
|
659
|
-
markdown:
|
|
660
|
-
}, t.messageId + n)), !
|
|
661
|
-
}) : /* @__PURE__ */
|
|
653
|
+
onRelatedClick: qt,
|
|
654
|
+
onAgainClick: At,
|
|
655
|
+
onEditClick: $t,
|
|
656
|
+
markdown: a == null ? void 0 : a.markdown
|
|
657
|
+
}, t.messageId + n)), !ze && Ke]
|
|
658
|
+
}) : /* @__PURE__ */ $("div", {
|
|
662
659
|
className: "main-empty",
|
|
663
|
-
children: [(
|
|
664
|
-
text:
|
|
665
|
-
icon:
|
|
666
|
-
children: !!Ee.length && (((
|
|
667
|
-
ref:
|
|
660
|
+
children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ c(gn, {
|
|
661
|
+
text: a === void 0 || a.greeting === !0 || ((Ge = a.greeting) == null ? void 0 : Ge.text) === void 0 ? at.text : a.greeting.text,
|
|
662
|
+
icon: a === void 0 || a.greeting === !0 || ((Xe = a.greeting) == null ? void 0 : Xe.icon) === void 0 ? yt || at.icon : a.greeting.icon,
|
|
663
|
+
children: !!Ee.length && (((a == null ? void 0 : a.greeting) === void 0 || (a == null ? void 0 : a.greeting)) === !0 || typeof (a == null ? void 0 : a.greeting) == "object" && a.greeting.questions !== !1) && /* @__PURE__ */ c(fn, {
|
|
664
|
+
ref: ke,
|
|
668
665
|
sid: (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id,
|
|
669
666
|
isRecommendClearing: Re,
|
|
670
667
|
data: Ee,
|
|
668
|
+
layoutBreakpoints: typeof (a == null ? void 0 : a.greeting) == "object" ? a.greeting.layoutBreakpoints : void 0,
|
|
671
669
|
onItemClick: (t) => {
|
|
672
|
-
var r, i,
|
|
670
|
+
var r, i, l;
|
|
673
671
|
if (ee(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), Re)
|
|
674
672
|
return;
|
|
675
673
|
t != null && t.id && K(!0);
|
|
676
674
|
const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
|
|
677
|
-
g != null && g.fileUpload ? (
|
|
675
|
+
g != null && g.fileUpload ? (l = (i = se.current) == null ? void 0 : i.clear()) == null || l.then(() => {
|
|
678
676
|
var s, d;
|
|
679
|
-
t != null && t.id && (n ? (s =
|
|
677
|
+
t != null && t.id && (n ? (s = Ae(n, t)) == null || s.finally(() => {
|
|
680
678
|
K(!1);
|
|
681
679
|
}) : (K(!1), U(!0), (d = Ye()) == null || d.then((I) => {
|
|
682
680
|
var p;
|
|
683
|
-
(p =
|
|
681
|
+
(p = Ae(I.id, t)) == null || p.finally(() => {
|
|
684
682
|
K(!1);
|
|
685
683
|
});
|
|
686
684
|
})));
|
|
@@ -704,7 +702,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
704
702
|
fontSize: 16
|
|
705
703
|
}
|
|
706
704
|
}),
|
|
707
|
-
onClick: () =>
|
|
705
|
+
onClick: () => zt(),
|
|
708
706
|
children: "停止回答"
|
|
709
707
|
})
|
|
710
708
|
}), Ue && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ c("div", {
|
|
@@ -725,24 +723,24 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
725
723
|
})]
|
|
726
724
|
}), /* @__PURE__ */ c("div", {
|
|
727
725
|
className: "chat-footer",
|
|
728
|
-
children: /* @__PURE__ */
|
|
726
|
+
children: /* @__PURE__ */ $("div", {
|
|
729
727
|
className: "chat-footer-input",
|
|
730
728
|
children: [X && /* @__PURE__ */ c("div", {
|
|
731
729
|
className: "input-files",
|
|
732
730
|
children: /* @__PURE__ */ c(ln, {
|
|
733
731
|
file: X,
|
|
734
732
|
actions: {
|
|
735
|
-
upload:
|
|
733
|
+
upload: jt,
|
|
736
734
|
remove: () => {
|
|
737
|
-
|
|
735
|
+
A(void 0);
|
|
738
736
|
}
|
|
739
737
|
},
|
|
740
738
|
onUrlChange: (t) => ne(t)
|
|
741
739
|
})
|
|
742
|
-
}), /* @__PURE__ */
|
|
740
|
+
}), /* @__PURE__ */ $(de, {
|
|
743
741
|
className: "footer-upload-action",
|
|
744
742
|
onClick: (t) => t.preventDefault(),
|
|
745
|
-
children: [/* @__PURE__ */
|
|
743
|
+
children: [/* @__PURE__ */ $(de, {
|
|
746
744
|
children: [o.type === 2 && (g == null ? void 0 : g.imageUpload) && /* @__PURE__ */ c(nn, {
|
|
747
745
|
disabled: !!X || M,
|
|
748
746
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
@@ -791,23 +789,23 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
791
789
|
}), ue && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(yn, {
|
|
792
790
|
appId: o == null ? void 0 : o.id,
|
|
793
791
|
ref: se,
|
|
794
|
-
isFirstSession:
|
|
792
|
+
isFirstSession: je,
|
|
795
793
|
docViewerUrl: v,
|
|
796
|
-
onStatusChange: (t) =>
|
|
794
|
+
onStatusChange: (t) => j(void 0, null, function* () {
|
|
797
795
|
t !== "process" ? (re(!0), xe()) : re(!1);
|
|
798
796
|
}),
|
|
799
797
|
createSession: () => new Promise((t) => {
|
|
800
798
|
U(!0), w == null || w({
|
|
801
799
|
netOpen: H ? 1 : 2
|
|
802
800
|
}).then((n) => {
|
|
803
|
-
var i,
|
|
804
|
-
|
|
801
|
+
var i, l, s;
|
|
802
|
+
b == null || b(n), U(!1), x(!!((i = n.data) != null && i.netOpen)), Q(!!((l = n.data) != null && l.enableNetOpen));
|
|
805
803
|
const r = ((s = n.data) == null ? void 0 : s.id) || "";
|
|
806
804
|
t(r);
|
|
807
805
|
});
|
|
808
806
|
}),
|
|
809
807
|
sid: (Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id,
|
|
810
|
-
disabled:
|
|
808
|
+
disabled: be || M,
|
|
811
809
|
afterFileAdd: (t, n) => {
|
|
812
810
|
n && oe((r) => {
|
|
813
811
|
const i = r[n] || [];
|
|
@@ -820,9 +818,9 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
820
818
|
var r;
|
|
821
819
|
const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
|
|
822
820
|
n && oe((i) => {
|
|
823
|
-
const
|
|
821
|
+
const l = i[n] || [];
|
|
824
822
|
return {
|
|
825
|
-
[n]:
|
|
823
|
+
[n]: l.filter((s) => s.id !== t)
|
|
826
824
|
};
|
|
827
825
|
});
|
|
828
826
|
},
|
|
@@ -846,19 +844,19 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
846
844
|
},
|
|
847
845
|
disabled: M
|
|
848
846
|
})]
|
|
849
|
-
}), /* @__PURE__ */
|
|
847
|
+
}), /* @__PURE__ */ $(de, {
|
|
850
848
|
children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((Se = o.arrange) == null ? void 0 : Se.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(wn, {
|
|
851
849
|
sessionId: (et = e == null ? void 0 : e.data) == null ? void 0 : et.id,
|
|
852
850
|
netStatus: H,
|
|
853
|
-
enable: typeof (
|
|
851
|
+
enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : Ht,
|
|
854
852
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
855
853
|
onNetStatusChange: (t) => {
|
|
856
854
|
Kt(t);
|
|
857
855
|
}
|
|
858
|
-
}), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(
|
|
856
|
+
}), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(kn, {
|
|
859
857
|
currentSessionId: (tt = e == null ? void 0 : e.data) == null ? void 0 : tt.id,
|
|
860
858
|
onSessionChange: (t, n) => {
|
|
861
|
-
W(void 0),
|
|
859
|
+
W(void 0), b == null || b(n);
|
|
862
860
|
},
|
|
863
861
|
disabled: M
|
|
864
862
|
}), (g == null ? void 0 : g.sessionOpen) && /* @__PURE__ */ c(_, {
|
|
@@ -868,7 +866,7 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
868
866
|
disabled: Oe || !e || !h.length || M,
|
|
869
867
|
onClick: () => {
|
|
870
868
|
var t, n;
|
|
871
|
-
|
|
869
|
+
b == null || b(void 0), x(!1), (t = He.current) == null || t.clear(), (n = ke.current) == null || n.clear();
|
|
872
870
|
},
|
|
873
871
|
children: "新会话"
|
|
874
872
|
})]
|
|
@@ -882,17 +880,17 @@ ${t}` : t, a = new S(i, r, G.User, n);
|
|
|
882
880
|
networkStatus: !1,
|
|
883
881
|
loading: Ve,
|
|
884
882
|
disabled: Pe || Fe || M || Ve,
|
|
885
|
-
onTextSend:
|
|
883
|
+
onTextSend: Be,
|
|
886
884
|
onChange: (t, n) => {
|
|
887
885
|
W(t);
|
|
888
886
|
const r = n.getText().replace(/[\n\s]+$/, "");
|
|
889
|
-
ee(r), xt(r), De ||
|
|
887
|
+
ee(r), xt(r), De || bt(!0);
|
|
890
888
|
},
|
|
891
889
|
clearAction: /* @__PURE__ */ c(de, {
|
|
892
890
|
size: 0,
|
|
893
891
|
children: /* @__PURE__ */ c(_, {
|
|
894
892
|
type: "link",
|
|
895
|
-
disabled:
|
|
893
|
+
disabled: be || M,
|
|
896
894
|
ghost: !0,
|
|
897
895
|
icon: /* @__PURE__ */ c(fe, {
|
|
898
896
|
style: {
|