@glodon-aiot/agent-cli-ui 3.3.4-beta.2 → 3.3.4-beta.3
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 +78 -78
- package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +13 -13
- 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/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/style20.css +1 -1
- package/dist/es/src/style23.css +1 -1
- package/dist/es/src/style27.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/lib/index.js +32 -32
- package/package.json +3 -3
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var Wt = Object.defineProperty, Qt = Object.defineProperties;
|
|
2
2
|
var _t = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var ot = Object.getOwnPropertySymbols;
|
|
4
4
|
var Gt = Object.prototype.hasOwnProperty, Xt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Ie = (L, o, v) => o in L ? Wt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v,
|
|
5
|
+
var Ie = (L, o, v) => o in L ? Wt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v, st = (L, o) => {
|
|
6
6
|
for (var v in o || (o = {}))
|
|
7
7
|
Gt.call(o, v) && Ie(L, v, o[v]);
|
|
8
|
-
if (
|
|
9
|
-
for (var v of
|
|
8
|
+
if (ot)
|
|
9
|
+
for (var v of ot(o))
|
|
10
10
|
Xt.call(o, v) && Ie(L, v, o[v]);
|
|
11
11
|
return L;
|
|
12
|
-
},
|
|
12
|
+
}, rt = (L, o) => Qt(L, _t(o));
|
|
13
13
|
var D = (L, o, v) => (Ie(L, typeof o != "symbol" ? o + "" : o, v), v);
|
|
14
14
|
var z = (L, o, v) => new Promise((e, w) => {
|
|
15
15
|
var ue = (x) => {
|
|
@@ -31,10 +31,10 @@ import { jsx as c, jsxs as A } from "react/jsx-runtime";
|
|
|
31
31
|
import { memo as Zt, useState as m, useRef as B, 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
|
-
import { IHistoryRole as G, ChatMessageRole as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import { v4 as
|
|
34
|
+
import { IHistoryRole as G, ChatMessageRole as at, PromptVariableType as ge } from "@glodon-aiot/apis";
|
|
35
|
+
import ct from "./HistoryItem/index.mjs";
|
|
36
|
+
import ft from "dayjs";
|
|
37
|
+
import { v4 as Ce } from "uuid";
|
|
38
38
|
import sn from "../../context.mjs";
|
|
39
39
|
import { configuration as rn } from "@glodon-aiot/bot-client-sdk";
|
|
40
40
|
import { MB as an } from "../../constant.mjs";
|
|
@@ -54,7 +54,7 @@ import kn 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";
|
|
57
|
-
const Ln = Zt(
|
|
57
|
+
const Ln = Zt(ct), lt = {
|
|
58
58
|
icon: In,
|
|
59
59
|
text: "今天我能帮你什么?"
|
|
60
60
|
};
|
|
@@ -69,13 +69,13 @@ class S {
|
|
|
69
69
|
D(this, "isSensitive");
|
|
70
70
|
D(this, "isSuspend");
|
|
71
71
|
D(this, "comment");
|
|
72
|
-
this.content = o, this.sessionId = v, this.role = e, this.files = w, this.content = o, this.role = e, this.sessionId = v, this.files = w, this.messageTime =
|
|
72
|
+
this.content = o, this.sessionId = v, this.role = e, this.files = w, this.content = o, this.role = e, this.sessionId = v, this.files = w, this.messageTime = ft(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Ce(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
|
|
73
73
|
isAgree: 0
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
var
|
|
77
|
+
const dt = 10, ei = (L) => {
|
|
78
|
+
var Qe, _e, Ge, Xe, Ze, Je, Se, et, tt, nt, it;
|
|
79
79
|
const {
|
|
80
80
|
application: o,
|
|
81
81
|
docViewerUrl: v = "",
|
|
@@ -85,7 +85,7 @@ const lt = 10, ei = (L) => {
|
|
|
85
85
|
setCurrentSession: k,
|
|
86
86
|
networkStatus: H,
|
|
87
87
|
setNetworkStatus: x
|
|
88
|
-
} = L, [h, C] = m([]), [gt, ee] = m(), [he,
|
|
88
|
+
} = L, [h, C] = m([]), [gt, ee] = m(), [he, Ne] = m(), R = B(null), {
|
|
89
89
|
service: P,
|
|
90
90
|
agentClient: N,
|
|
91
91
|
depId: ut,
|
|
@@ -93,14 +93,14 @@ const lt = 10, ei = (L) => {
|
|
|
93
93
|
transform: g,
|
|
94
94
|
defaultInput: me,
|
|
95
95
|
onMessage: te,
|
|
96
|
-
onHistoryLoad:
|
|
96
|
+
onHistoryLoad: Pe,
|
|
97
97
|
beforeMessageSend: j,
|
|
98
98
|
bodyStyle: mt,
|
|
99
99
|
disabled: M,
|
|
100
100
|
features: a,
|
|
101
101
|
popupContainer: f,
|
|
102
102
|
icon: yt
|
|
103
|
-
} = Jt(sn), [
|
|
103
|
+
} = Jt(sn), [Te, ye] = m(!1), y = B(h), Fe = B(), [pt, vt] = m(0), [X, q] = m(), [Y, ne] = m(""), [Ee, pe] = m(!1), ve = B(null), [Re, bt] = m([]), [De, K] = m(!1), [He, kt] = m(!1), [wt, xt] = m(""), [It, W] = m(), [ie, oe] = m({}), se = B(null), Me = B(null), be = B(null), [Oe, Lt] = m(!1), [Ct, Nt] = m([]), [Pt, re] = m(!0), [Tt, Ft] = m(!0), [Ue, O] = m(!1), [ke, V] = m(!1), [ze, 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), [Ve, 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), [$e, le] = m(!1);
|
|
104
104
|
F(() => {
|
|
105
105
|
var r, i;
|
|
106
106
|
e && (y.current = []), C([]);
|
|
@@ -115,7 +115,7 @@ const lt = 10, ei = (L) => {
|
|
|
115
115
|
}
|
|
116
116
|
const n = (l) => {
|
|
117
117
|
var s;
|
|
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),
|
|
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), Pe && Pe({
|
|
119
119
|
applicationId: o.id,
|
|
120
120
|
sessionId: e.data.id,
|
|
121
121
|
histories: l
|
|
@@ -173,7 +173,7 @@ const lt = 10, ei = (L) => {
|
|
|
173
173
|
bt(t);
|
|
174
174
|
}));
|
|
175
175
|
}, [ut, o]);
|
|
176
|
-
const
|
|
176
|
+
const Ae = (t) => z(void 0, null, function* () {
|
|
177
177
|
var p, T;
|
|
178
178
|
if (M) {
|
|
179
179
|
u.config({
|
|
@@ -210,7 +210,7 @@ const lt = 10, ei = (L) => {
|
|
|
210
210
|
});
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
|
-
if (
|
|
213
|
+
if (Te) {
|
|
214
214
|
u.config({
|
|
215
215
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
216
216
|
}), u.error("等待初始化"), u.config({
|
|
@@ -226,7 +226,7 @@ const lt = 10, ei = (L) => {
|
|
|
226
226
|
});
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
|
-
if (
|
|
229
|
+
if (Ee) {
|
|
230
230
|
u.config({
|
|
231
231
|
getContainer: () => (f == null ? void 0 : f.current) || document.body
|
|
232
232
|
}), u.error("正在上传图片"), u.config({
|
|
@@ -241,8 +241,8 @@ const lt = 10, ei = (L) => {
|
|
|
241
241
|
netOpen: H ? 1 : 2
|
|
242
242
|
}).then((b) => {
|
|
243
243
|
var $, J;
|
|
244
|
-
U(!0), x(!!(($ = b.data) != null && $.netOpen)), Q(!!((J = b.data) != null && J.enableNetOpen)),
|
|
245
|
-
k == null || k(b), U(!1),
|
|
244
|
+
U(!0), x(!!(($ = b.data) != null && $.netOpen)), Q(!!((J = b.data) != null && J.enableNetOpen)), Be(b).then(() => {
|
|
245
|
+
k == null || k(b), U(!1), Ne(n);
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
248
|
return;
|
|
@@ -258,7 +258,7 @@ ${n}` : n;
|
|
|
258
258
|
message: {
|
|
259
259
|
content: l,
|
|
260
260
|
sessionId: i,
|
|
261
|
-
role:
|
|
261
|
+
role: at.User,
|
|
262
262
|
files: ie[i]
|
|
263
263
|
}
|
|
264
264
|
}) : s = !0;
|
|
@@ -269,7 +269,7 @@ ${n}` : n;
|
|
|
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
|
-
}),
|
|
272
|
+
}), Be = (t) => new Promise((n, r) => z(void 0, null, function* () {
|
|
273
273
|
const s = (t == null ? void 0 : t.promptVariables).filter((d) => !(d.type === ge.User && d.key === "query") && !(d.type === ge.System && d.key === "datetime")).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;
|
|
@@ -315,14 +315,14 @@ ${t}` : t;
|
|
|
315
315
|
message: {
|
|
316
316
|
content: r,
|
|
317
317
|
sessionId: e.id,
|
|
318
|
-
role:
|
|
318
|
+
role: at.User,
|
|
319
319
|
files: ie[e.id]
|
|
320
320
|
}
|
|
321
321
|
}) : i = !0;
|
|
322
322
|
} catch (l) {
|
|
323
323
|
i = !1;
|
|
324
324
|
}
|
|
325
|
-
le(!1), i !== !1 && (we(t),
|
|
325
|
+
le(!1), i !== !1 && (we(t), Ne(void 0));
|
|
326
326
|
});
|
|
327
327
|
return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
|
|
328
328
|
e == null || e.removeEventListener("ready", n);
|
|
@@ -368,14 +368,14 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
368
368
|
if (!t)
|
|
369
369
|
return;
|
|
370
370
|
const n = (i) => {
|
|
371
|
-
if (!i.sessionId || i.sessionId && i.sessionId !==
|
|
371
|
+
if (!i.sessionId || i.sessionId && i.sessionId !== Fe.current || i.role === G.User)
|
|
372
372
|
return;
|
|
373
373
|
if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (O(!1), V(!1), y.current = y.current.filter((d) => !d.isWaiting), C([...y.current]), y.current = [...y.current], i.content))
|
|
374
374
|
return ce.error({
|
|
375
375
|
message: i.content
|
|
376
376
|
});
|
|
377
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({
|
|
378
|
+
s.messageId = i.messageId || Ce(), 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
|
|
@@ -418,20 +418,20 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
418
418
|
}), !1) : (q(t), !1);
|
|
419
419
|
}, zt = (t) => z(void 0, null, function* () {
|
|
420
420
|
var n;
|
|
421
|
-
return q(t), (n = e == null ? void 0 : e.data) != null && n.id ?
|
|
421
|
+
return q(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
425
|
var l, s;
|
|
426
|
-
k == null || k(i), U(!1), x(!!((l = i.data) != null && l.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(
|
|
426
|
+
k == null || k(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
433
|
const l = {
|
|
434
|
-
files: [`${
|
|
434
|
+
files: [`${Ce()}.${r}`],
|
|
435
435
|
isv: "minio",
|
|
436
436
|
knowledgeId: ((s = t.data) == null ? void 0 : s.id) || "",
|
|
437
437
|
type: 1
|
|
@@ -453,14 +453,14 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
453
453
|
};
|
|
454
454
|
F(() => {
|
|
455
455
|
const t = R.current;
|
|
456
|
-
t && !
|
|
456
|
+
t && !ze && t.scrollTo({
|
|
457
457
|
top: t.scrollHeight
|
|
458
458
|
});
|
|
459
459
|
}, [h]);
|
|
460
|
-
const
|
|
460
|
+
const Ye = (t, n) => new Promise((r) => {
|
|
461
461
|
if (!n.file.url || !(o != null && o.id))
|
|
462
462
|
return r();
|
|
463
|
-
const i = st(
|
|
463
|
+
const i = rt(st({}, n.file), {
|
|
464
464
|
type: 1
|
|
465
465
|
});
|
|
466
466
|
P == null || P.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
|
|
@@ -487,7 +487,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
487
487
|
var n, r;
|
|
488
488
|
(n = ve.current) == null || n.update(t), (r = ve.current) == null || r.focus();
|
|
489
489
|
}), Bt = Le((t) => {
|
|
490
|
-
|
|
490
|
+
Ae(t);
|
|
491
491
|
}), qt = Le(() => {
|
|
492
492
|
var n;
|
|
493
493
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
@@ -498,7 +498,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
498
498
|
});
|
|
499
499
|
F(() => {
|
|
500
500
|
var t, n;
|
|
501
|
-
|
|
501
|
+
Fe.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !je && ((n = be.current) == null || n.clear());
|
|
502
502
|
}, [e]);
|
|
503
503
|
const Yt = () => {
|
|
504
504
|
var r;
|
|
@@ -507,7 +507,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
507
507
|
const n = h[h.length - 1].messageTime;
|
|
508
508
|
e.fetchMessages({
|
|
509
509
|
endTime: n,
|
|
510
|
-
pageSize:
|
|
510
|
+
pageSize: dt
|
|
511
511
|
}).then((i) => {
|
|
512
512
|
const l = i || [];
|
|
513
513
|
if (!l || !(l != null && l.length)) {
|
|
@@ -574,14 +574,14 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
574
574
|
N == null || N.removeEventListener("ready", t);
|
|
575
575
|
};
|
|
576
576
|
}, [e, N, a == null ? void 0 : a.promptVariables]);
|
|
577
|
-
const
|
|
577
|
+
const Ke = () => w == null ? void 0 : w({
|
|
578
578
|
netOpen: H ? 1 : 2
|
|
579
579
|
}).then((t) => {
|
|
580
580
|
var n, r;
|
|
581
|
-
return k == null || k(t), U(!1), x(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)),
|
|
582
|
-
}),
|
|
581
|
+
return k == null || k(t), U(!1), x(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), Be(t), t;
|
|
582
|
+
}), We = St(() => {
|
|
583
583
|
var t;
|
|
584
|
-
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(
|
|
584
|
+
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(ct, {
|
|
585
585
|
application: o,
|
|
586
586
|
history: {
|
|
587
587
|
role: 1,
|
|
@@ -591,7 +591,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
591
591
|
sessionId: "",
|
|
592
592
|
reference: [],
|
|
593
593
|
searchReference: [],
|
|
594
|
-
messageTime:
|
|
594
|
+
messageTime: ft(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
|
|
595
595
|
actions: [],
|
|
596
596
|
isLoading: !1
|
|
597
597
|
},
|
|
@@ -602,7 +602,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
602
602
|
return /* @__PURE__ */ A("div", {
|
|
603
603
|
className: "agent-chat",
|
|
604
604
|
children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ c(vn, {
|
|
605
|
-
ref:
|
|
605
|
+
ref: Me,
|
|
606
606
|
appId: o.id,
|
|
607
607
|
currentSession: e,
|
|
608
608
|
promptVariables: E,
|
|
@@ -623,7 +623,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
623
623
|
},
|
|
624
624
|
ref: R,
|
|
625
625
|
onScroll: $t,
|
|
626
|
-
children: (
|
|
626
|
+
children: (Qe = e == null ? void 0 : e.data) != null && Qe.id && (h != null && h.length) ? /* @__PURE__ */ A(kn, {
|
|
627
627
|
dataLength: h.length,
|
|
628
628
|
next: Yt,
|
|
629
629
|
style: {
|
|
@@ -632,12 +632,12 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
632
632
|
overflowX: "hidden"
|
|
633
633
|
},
|
|
634
634
|
inverse: !0,
|
|
635
|
-
endMessage: h.length >
|
|
636
|
-
((
|
|
635
|
+
endMessage: h.length > dt && // 少于一页不展示这个提示
|
|
636
|
+
((_e = R.current) != null && _e.scrollTop) && ((Ge = R.current) == null ? void 0 : Ge.scrollTop) < -10 ? /* @__PURE__ */ c(en, {
|
|
637
637
|
plain: !0,
|
|
638
638
|
children: "没有更多数据了"
|
|
639
639
|
}) : null,
|
|
640
|
-
hasMore:
|
|
640
|
+
hasMore: Ve,
|
|
641
641
|
loader: /* @__PURE__ */ c("div", {
|
|
642
642
|
style: {
|
|
643
643
|
height: "50px",
|
|
@@ -657,39 +657,39 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
657
657
|
onAgainClick: qt,
|
|
658
658
|
onEditClick: At,
|
|
659
659
|
markdown: a == null ? void 0 : a.markdown
|
|
660
|
-
}, t.messageId + n)), !
|
|
660
|
+
}, t.messageId + n)), !Ve && We]
|
|
661
661
|
}) : /* @__PURE__ */ A("div", {
|
|
662
662
|
className: "main-empty",
|
|
663
663
|
children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ c(gn, {
|
|
664
|
-
text: a === void 0 || a.greeting === !0 || ((
|
|
665
|
-
icon: a === void 0 || a.greeting === !0 || ((
|
|
666
|
-
children: !!
|
|
664
|
+
text: a === void 0 || a.greeting === !0 || ((Xe = a.greeting) == null ? void 0 : Xe.text) === void 0 ? lt.text : a.greeting.text,
|
|
665
|
+
icon: a === void 0 || a.greeting === !0 || ((Ze = a.greeting) == null ? void 0 : Ze.icon) === void 0 ? yt || lt.icon : a.greeting.icon,
|
|
666
|
+
children: !!Re.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, {
|
|
667
667
|
ref: be,
|
|
668
|
-
sid: (
|
|
669
|
-
isRecommendClearing:
|
|
670
|
-
data:
|
|
668
|
+
sid: (Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id,
|
|
669
|
+
isRecommendClearing: De,
|
|
670
|
+
data: Re,
|
|
671
671
|
onItemClick: (t) => {
|
|
672
672
|
var r, i, l;
|
|
673
|
-
if (ee(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question),
|
|
673
|
+
if (ee(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), De)
|
|
674
674
|
return;
|
|
675
675
|
t != null && t.id && K(!0);
|
|
676
676
|
const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
|
|
677
677
|
g != null && g.fileUpload ? (l = (i = se.current) == null ? void 0 : i.clear()) == null || l.then(() => {
|
|
678
678
|
var s, d;
|
|
679
|
-
t != null && t.id && (n ? (s =
|
|
679
|
+
t != null && t.id && (n ? (s = Ye(n, t)) == null || s.finally(() => {
|
|
680
680
|
K(!1);
|
|
681
|
-
}) : (K(!1), U(!0), (d =
|
|
681
|
+
}) : (K(!1), U(!0), (d = Ke()) == null || d.then((I) => {
|
|
682
682
|
var p;
|
|
683
|
-
(p =
|
|
683
|
+
(p = Ye(I.id, t)) == null || p.finally(() => {
|
|
684
684
|
K(!1);
|
|
685
685
|
});
|
|
686
686
|
})));
|
|
687
|
-
}) : n ? K(!1) : (K(!1), U(!0),
|
|
687
|
+
}) : n ? K(!1) : (K(!1), U(!0), Ke());
|
|
688
688
|
}
|
|
689
689
|
})
|
|
690
|
-
}),
|
|
690
|
+
}), We]
|
|
691
691
|
})
|
|
692
|
-
}),
|
|
692
|
+
}), Ue && /* @__PURE__ */ c("div", {
|
|
693
693
|
className: "session-stop",
|
|
694
694
|
children: /* @__PURE__ */ c(_, {
|
|
695
695
|
type: "primary",
|
|
@@ -707,7 +707,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
707
707
|
onClick: () => jt(),
|
|
708
708
|
children: "停止回答"
|
|
709
709
|
})
|
|
710
|
-
}),
|
|
710
|
+
}), ze && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ c("div", {
|
|
711
711
|
className: "back-bottom",
|
|
712
712
|
children: /* @__PURE__ */ c(_, {
|
|
713
713
|
size: "small",
|
|
@@ -791,7 +791,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
791
791
|
}), ue && (g != null && g.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(yn, {
|
|
792
792
|
appId: o == null ? void 0 : o.id,
|
|
793
793
|
ref: se,
|
|
794
|
-
isFirstSession:
|
|
794
|
+
isFirstSession: je,
|
|
795
795
|
docViewerUrl: v,
|
|
796
796
|
onStatusChange: (t) => z(void 0, null, function* () {
|
|
797
797
|
t !== "process" ? (re(!0), xe()) : re(!1);
|
|
@@ -806,7 +806,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
806
806
|
t(r);
|
|
807
807
|
});
|
|
808
808
|
}),
|
|
809
|
-
sid: (
|
|
809
|
+
sid: (Se = e == null ? void 0 : e.data) == null ? void 0 : Se.id,
|
|
810
810
|
disabled: ke || M,
|
|
811
811
|
afterFileAdd: (t, n) => {
|
|
812
812
|
n && oe((r) => {
|
|
@@ -840,15 +840,15 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
840
840
|
}) : null, (g == null ? void 0 : g.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(xn, {
|
|
841
841
|
appId: o.id,
|
|
842
842
|
list: [],
|
|
843
|
-
search:
|
|
843
|
+
search: He ? wt : "",
|
|
844
844
|
onPromptSelect: (t) => {
|
|
845
845
|
W(t.context), ee(t.context);
|
|
846
846
|
},
|
|
847
847
|
disabled: M
|
|
848
848
|
})]
|
|
849
849
|
}), /* @__PURE__ */ A(de, {
|
|
850
|
-
children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((
|
|
851
|
-
sessionId: (
|
|
850
|
+
children: [(g == null ? void 0 : g.connectNetwork) && o.type === 0 && ((et = o.arrange) == null ? void 0 : et.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(wn, {
|
|
851
|
+
sessionId: (tt = e == null ? void 0 : e.data) == null ? void 0 : tt.id,
|
|
852
852
|
netStatus: H,
|
|
853
853
|
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
854
|
disabledTip: e ? void 0 : "网络访问已被禁用",
|
|
@@ -856,7 +856,7 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
856
856
|
Kt(t);
|
|
857
857
|
}
|
|
858
858
|
}), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ c(bn, {
|
|
859
|
-
currentSessionId: (
|
|
859
|
+
currentSessionId: (nt = e == null ? void 0 : e.data) == null ? void 0 : nt.id,
|
|
860
860
|
onSessionChange: (t, n) => {
|
|
861
861
|
W(void 0), k == null || k(n);
|
|
862
862
|
},
|
|
@@ -865,10 +865,10 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
865
865
|
icon: /* @__PURE__ */ c(mn, {}),
|
|
866
866
|
className: "add-btn",
|
|
867
867
|
type: "primary",
|
|
868
|
-
disabled:
|
|
868
|
+
disabled: Ue || !e || !h.length || M,
|
|
869
869
|
onClick: () => {
|
|
870
870
|
var t, n;
|
|
871
|
-
k == null || k(void 0), x(!1), (t =
|
|
871
|
+
k == null || k(void 0), x(!1), (t = Me.current) == null || t.clear(), (n = be.current) == null || n.clear();
|
|
872
872
|
},
|
|
873
873
|
children: "新会话"
|
|
874
874
|
})]
|
|
@@ -880,13 +880,13 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
880
880
|
maxLength: pt,
|
|
881
881
|
text: It,
|
|
882
882
|
networkStatus: !1,
|
|
883
|
-
loading:
|
|
884
|
-
disabled:
|
|
885
|
-
onTextSend:
|
|
883
|
+
loading: $e,
|
|
884
|
+
disabled: Te || Ee || M || $e,
|
|
885
|
+
onTextSend: Ae,
|
|
886
886
|
onChange: (t, n) => {
|
|
887
887
|
W(t);
|
|
888
888
|
const r = n.getText().replace(/[\n\s]+$/, "");
|
|
889
|
-
ee(r), xt(r),
|
|
889
|
+
ee(r), xt(r), He || kt(!0);
|
|
890
890
|
},
|
|
891
891
|
clearAction: /* @__PURE__ */ c(de, {
|
|
892
892
|
size: 0,
|
|
@@ -908,10 +908,10 @@ ${t}` : t, l = new S(i, r, G.User, n);
|
|
|
908
908
|
})
|
|
909
909
|
}), /* @__PURE__ */ c(un, {
|
|
910
910
|
tips: ht
|
|
911
|
-
}),
|
|
912
|
-
isvisible:
|
|
911
|
+
}), Oe && /* @__PURE__ */ c(pn, {
|
|
912
|
+
isvisible: Oe,
|
|
913
913
|
files: Ct,
|
|
914
|
-
sessionId: (
|
|
914
|
+
sessionId: (it = e == null ? void 0 : e.data) == null ? void 0 : it.id,
|
|
915
915
|
onClose: (t) => {
|
|
916
916
|
Lt(!1), Ft(!1);
|
|
917
917
|
}
|
|
@@ -27,7 +27,7 @@ var p = (n, d, l) => new Promise((u, v) => {
|
|
|
27
27
|
x((l = l.apply(n, d)).next());
|
|
28
28
|
});
|
|
29
29
|
import { jsxs as w, jsx as o, Fragment as ve } from "react/jsx-runtime";
|
|
30
|
-
import { useState as h, useRef as Se, useContext as xe, useEffect as
|
|
30
|
+
import { useState as h, useRef as Se, useContext as xe, useEffect as N } from "react";
|
|
31
31
|
import { Form as M, Collapse as _, Input as K, Button as be, message as C, notification as Pe } from "antd";
|
|
32
32
|
import { PromptVariableType as y } from "@glodon-aiot/apis";
|
|
33
33
|
import { v4 as pe } from "uuid";
|
|
@@ -45,7 +45,7 @@ const {
|
|
|
45
45
|
sessionId: d,
|
|
46
46
|
docViewerUrl: l
|
|
47
47
|
}) => {
|
|
48
|
-
const u = n.id, [v, q] = h(""), [S, x] = h(""), [f, b] = h(), [L,
|
|
48
|
+
const u = n.id, [v, q] = h(""), [S, x] = h(""), [f, b] = h(), [L, T] = h(!1), D = Se(null), [H, ee] = h([]), [A, O] = h([]), [te, Y] = h(0), [$, j] = h(), [c, R] = h(), [E] = M.useForm(), [U, re] = h({}), [B, se] = h({}), [ne, ae] = h(0), {
|
|
49
49
|
service: g,
|
|
50
50
|
agentClient: I,
|
|
51
51
|
popupContainer: P,
|
|
@@ -131,7 +131,7 @@ const {
|
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
};
|
|
134
|
-
|
|
134
|
+
N(() => {
|
|
135
135
|
if (!(n != null && n.id))
|
|
136
136
|
return;
|
|
137
137
|
const e = n.arrange;
|
|
@@ -141,7 +141,7 @@ const {
|
|
|
141
141
|
ee(i), Y(i.length);
|
|
142
142
|
const t = i.map((r) => r.id);
|
|
143
143
|
O(t);
|
|
144
|
-
}, [n]),
|
|
144
|
+
}, [n]), N(() => {
|
|
145
145
|
if (!(n != null && n.id) || !I)
|
|
146
146
|
return;
|
|
147
147
|
const e = I.questionContextMaxLength || 4e3;
|
|
@@ -156,7 +156,7 @@ const {
|
|
|
156
156
|
});
|
|
157
157
|
j(e);
|
|
158
158
|
});
|
|
159
|
-
|
|
159
|
+
N(() => {
|
|
160
160
|
!u || !g || Promise.all([g.getApplicationIdPromptVariables(u, {
|
|
161
161
|
type: y.User,
|
|
162
162
|
status: 1
|
|
@@ -173,7 +173,7 @@ const {
|
|
|
173
173
|
}));
|
|
174
174
|
R(r);
|
|
175
175
|
});
|
|
176
|
-
}, [g, u]),
|
|
176
|
+
}, [g, u]), N(() => {
|
|
177
177
|
if (!c)
|
|
178
178
|
return;
|
|
179
179
|
const e = c.filter((r) => r.type === y.User), a = c.filter((r) => r.type === y.System), i = {};
|
|
@@ -197,7 +197,7 @@ const {
|
|
|
197
197
|
}, ue = () => p(void 0, null, function* () {
|
|
198
198
|
if (!u || !g || !I)
|
|
199
199
|
return;
|
|
200
|
-
|
|
200
|
+
T(!0);
|
|
201
201
|
for (const t in U)
|
|
202
202
|
U[t] || (C.config({
|
|
203
203
|
getContainer: () => (P == null ? void 0 : P.current) || document.body
|
|
@@ -224,8 +224,8 @@ const {
|
|
|
224
224
|
return s.value = m[0].value, s;
|
|
225
225
|
});
|
|
226
226
|
yield Promise.all(r.map((s) => ie(s.id, s.value))), R(r);
|
|
227
|
-
})).
|
|
228
|
-
|
|
227
|
+
})).catch((t) => {
|
|
228
|
+
console.log(t), T(!1);
|
|
229
229
|
});
|
|
230
230
|
const i = {
|
|
231
231
|
content: v,
|
|
@@ -236,21 +236,21 @@ const {
|
|
|
236
236
|
};
|
|
237
237
|
le(u, e.id, i, {
|
|
238
238
|
onmessage: (t) => {
|
|
239
|
-
|
|
239
|
+
b(void 0), x(t.content);
|
|
240
240
|
},
|
|
241
241
|
onclose: (t) => p(void 0, null, function* () {
|
|
242
|
-
if (
|
|
242
|
+
if (T(!1), t.code == 200) {
|
|
243
243
|
x(t.content);
|
|
244
244
|
const r = yield Promise.all(t.reference.map((s) => g.getKnowledgeIdFileId(s.knowledgeId, s.docId)));
|
|
245
245
|
t.reference = t.reference.map((s, m) => V(V({}, s), r[m])), b(t);
|
|
246
246
|
}
|
|
247
247
|
}),
|
|
248
248
|
onerror: () => {
|
|
249
|
-
|
|
249
|
+
T(!1);
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
});
|
|
253
|
-
|
|
253
|
+
N(() => {
|
|
254
254
|
if (!S)
|
|
255
255
|
return;
|
|
256
256
|
const e = D.current;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e = "@glodon-aiot/agent-cli-ui", t = "3.3.4-beta.
|
|
1
|
+
const e = "@glodon-aiot/agent-cli-ui", t = "3.3.4-beta.3", s = "./dist/es/index.mjs", i = "./dist/lib/index.js", o = "./dist/src/index.d.ts", n = {
|
|
2
2
|
import: "./dist/es/index.mjs",
|
|
3
3
|
require: "./dist/lib/index.js",
|
|
4
4
|
types: "./dist/src/index.d.ts"
|
|
@@ -22,8 +22,8 @@ const e = "@glodon-aiot/agent-cli-ui", t = "3.3.4-beta.2", s = "./dist/es/index.
|
|
|
22
22
|
webpack: "*"
|
|
23
23
|
}, p = {
|
|
24
24
|
"@ant-design/icons": "^5.3.4",
|
|
25
|
-
"@glodon-aiot/apis": "^3.3.4-beta.
|
|
26
|
-
"@glodon-aiot/bot-client-sdk": "^3.3.4-beta.
|
|
25
|
+
"@glodon-aiot/apis": "^3.3.4-beta.3",
|
|
26
|
+
"@glodon-aiot/bot-client-sdk": "^3.3.4-beta.3",
|
|
27
27
|
"@matejmazur/react-mathjax": "^0.1.10",
|
|
28
28
|
"@react-pdf-viewer/core": "^3.12.0",
|
|
29
29
|
"@react-pdf-viewer/default-layout": "^3.12.0",
|