@glodon-aiot/agent-cli-ui 3.9.0-alpha.6 → 3.9.0-alpha.8
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 +43 -42
- package/dist/es/Dialog/SessionList/index.mjs +178 -166
- 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/style12.css +1 -1
- package/dist/es/src/style13.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style18.css +1 -1
- package/dist/es/src/style20.css +1 -1
- package/dist/es/src/style21.css +1 -1
- package/dist/es/src/style22.css +1 -1
- package/dist/es/src/style24.css +1 -1
- package/dist/es/src/style25.css +1 -1
- package/dist/es/src/style27.css +1 -1
- package/dist/es/src/style28.css +1 -1
- package/dist/es/src/style30.css +1 -1
- package/dist/es/src/style31.css +1 -1
- package/dist/es/src/style32.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/lib/index.js +38 -37
- package/package.json +3 -3
|
@@ -2,15 +2,15 @@ var wn = Object.defineProperty, kn = Object.defineProperties;
|
|
|
2
2
|
var In = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Nt = Object.getOwnPropertySymbols;
|
|
4
4
|
var Nn = Object.prototype.hasOwnProperty, En = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var Ue = (w, h, o) => h in w ? wn(w, h, { enumerable: !0, configurable: !0, writable: !0, value: o }) : w[h] = o, Ae = (w, h) => {
|
|
6
6
|
for (var o in h || (h = {}))
|
|
7
|
-
Nn.call(h, o) &&
|
|
7
|
+
Nn.call(h, o) && Ue(w, o, h[o]);
|
|
8
8
|
if (Nt)
|
|
9
9
|
for (var o of Nt(h))
|
|
10
|
-
En.call(h, o) &&
|
|
10
|
+
En.call(h, o) && Ue(w, o, h[o]);
|
|
11
11
|
return w;
|
|
12
|
-
},
|
|
13
|
-
var U = (w, h, o) => (
|
|
12
|
+
}, Fe = (w, h) => kn(w, In(h));
|
|
13
|
+
var U = (w, h, o) => (Ue(w, typeof h != "symbol" ? h + "" : h, o), o);
|
|
14
14
|
var A = (w, h, o) => new Promise((M, e) => {
|
|
15
15
|
var x = (L) => {
|
|
16
16
|
try {
|
|
@@ -48,7 +48,7 @@ import { PlusOutlined as Yn } from "@ant-design/icons";
|
|
|
48
48
|
import Qn from "./Tools/UploadKnowledgeFiles/index.mjs";
|
|
49
49
|
import Gn from "../UploadingPrompt/index.mjs";
|
|
50
50
|
import Xn from "./PromptSetting/index.mjs";
|
|
51
|
-
import { useMemoizedFn as
|
|
51
|
+
import { useMemoizedFn as Me } from "ahooks";
|
|
52
52
|
import Zn from "./Tools/SessionListDrawer/index.mjs";
|
|
53
53
|
import Jn from "./Tools/SessionHistoryDrawer/index.mjs";
|
|
54
54
|
import Sn from "react-infinite-scroll-component";
|
|
@@ -78,7 +78,7 @@ class ge {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
const Ot = 10,
|
|
81
|
+
const Ot = 10, Ee = 5, je = (w, h, o, M) => {
|
|
82
82
|
let e = w;
|
|
83
83
|
if (M === re.Agent) {
|
|
84
84
|
if (o && o.length > 0) {
|
|
@@ -106,13 +106,13 @@ ${e}` : e;
|
|
|
106
106
|
setCurrentSession: p,
|
|
107
107
|
networkStatus: L,
|
|
108
108
|
setNetworkStatus: P
|
|
109
|
-
} = w, [v, I] = m([]), [Ht, fe] = m(), [
|
|
109
|
+
} = w, [v, I] = m([]), [Ht, fe] = m(), [Le, Ve] = m(), O = Y(null), {
|
|
110
110
|
service: R,
|
|
111
111
|
agentClient: N,
|
|
112
112
|
depId: Ut,
|
|
113
113
|
footer: At,
|
|
114
114
|
transform: f,
|
|
115
|
-
defaultInput:
|
|
115
|
+
defaultInput: Pe,
|
|
116
116
|
onMessage: ue,
|
|
117
117
|
onHistoryLoad: $e,
|
|
118
118
|
beforeMessageSend: B,
|
|
@@ -123,11 +123,11 @@ ${e}` : e;
|
|
|
123
123
|
icon: Mt,
|
|
124
124
|
sider: jt,
|
|
125
125
|
mode: zt
|
|
126
|
-
} = On(Mn), [Be,
|
|
126
|
+
} = On(Mn), [Be, Te] = m(!1), y = Y(v), _e = Y(void 0), [Vt, $t] = m(0), [me, he] = m([]), [Z, ye] = m([]), [qe, We] = m(0), [Ke, Bt] = m(!1);
|
|
127
127
|
k(() => {
|
|
128
128
|
Bt(qe > 0);
|
|
129
129
|
}, [qe]);
|
|
130
|
-
const pe = Y(null), [Ye, _t] = m([]), [Qe, J] = m(!1), [Ge, qt] = m(!1), [Wt, Kt] = m(""), [Yt, S] = m(), [ee, ae] = m({}), ve = Y(null), Xe = Y(null),
|
|
130
|
+
const pe = Y(null), [Ye, _t] = m([]), [Qe, J] = m(!1), [Ge, qt] = m(!1), [Wt, Kt] = m(""), [Yt, S] = m(), [ee, ae] = m({}), ve = Y(null), Xe = Y(null), Oe = Y(null), [Ze, Qt] = m(!1), [Gt, Xt] = m([]), [Zt, be] = m(!0), [Jt, St] = m(!0), [Je, j] = m(!1), [Re, _] = m(!1), [Se, en] = m(!1), [D, le] = m(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [tn, nn] = m(() => {
|
|
131
131
|
const t = typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0;
|
|
132
132
|
if (t) {
|
|
133
133
|
if (Array.isArray(t) && t.some((r) => Array.isArray(r.fileIds) && r.fileIds.length === 0))
|
|
@@ -267,7 +267,7 @@ ${e}` : e;
|
|
|
267
267
|
return;
|
|
268
268
|
} else
|
|
269
269
|
console.error("变量值不能为空", D == null ? void 0 : D.map((C) => !!(C != null && C.value)));
|
|
270
|
-
if (
|
|
270
|
+
if (Re) {
|
|
271
271
|
u.config({
|
|
272
272
|
getContainer: () => (g == null ? void 0 : g.current) || document.body,
|
|
273
273
|
prefixCls: "gbot-message"
|
|
@@ -356,7 +356,7 @@ ${e}` : e;
|
|
|
356
356
|
G(!1);
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
|
-
((K = ee[r]) == null ? void 0 : K.length) > 0 ? dn(l) :
|
|
359
|
+
((K = ee[r]) == null ? void 0 : K.length) > 0 ? dn(l) : De(l);
|
|
360
360
|
}), ke = (t) => new Promise((n, s) => A(void 0, null, function* () {
|
|
361
361
|
const c = (t == null ? void 0 : t.promptVariables).filter((l) => l.type ? !((l.type === Ne.User || l.type === void 0) && l.key === "query") && !((l.type === Ne.System || l.type === void 0) && l.key === "datetime") : l.key !== "query").map((l) => {
|
|
362
362
|
var E;
|
|
@@ -380,12 +380,12 @@ ${e}` : e;
|
|
|
380
380
|
let s = [], r = /* @__PURE__ */ new Set();
|
|
381
381
|
(l = ee[n]) == null || l.forEach((b) => {
|
|
382
382
|
r.has(b.id) || (s.push(b), r.add(b.id));
|
|
383
|
-
}), be(!0),
|
|
383
|
+
}), be(!0), De(t, s);
|
|
384
384
|
};
|
|
385
385
|
k(() => {
|
|
386
|
-
if (!
|
|
386
|
+
if (!Le || !e)
|
|
387
387
|
return;
|
|
388
|
-
const t =
|
|
388
|
+
const t = Le, n = () => A(void 0, null, function* () {
|
|
389
389
|
xe(!0);
|
|
390
390
|
const s = je(t, Z, ee[e.id], (o == null ? void 0 : o.type) || 0);
|
|
391
391
|
let r;
|
|
@@ -407,13 +407,13 @@ ${e}` : e;
|
|
|
407
407
|
G(!1);
|
|
408
408
|
return;
|
|
409
409
|
}
|
|
410
|
-
|
|
410
|
+
De(t), Ve(void 0);
|
|
411
411
|
});
|
|
412
412
|
return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
|
|
413
413
|
e == null || e.removeEventListener("ready", n);
|
|
414
414
|
};
|
|
415
|
-
}, [
|
|
416
|
-
const
|
|
415
|
+
}, [Le, e]);
|
|
416
|
+
const De = (t, n) => A(void 0, null, function* () {
|
|
417
417
|
var W, K, C;
|
|
418
418
|
const s = (W = e == null ? void 0 : e.data) == null ? void 0 : W.id;
|
|
419
419
|
if (!s)
|
|
@@ -498,13 +498,13 @@ ${e}` : e;
|
|
|
498
498
|
};
|
|
499
499
|
}, [e]), k(() => {
|
|
500
500
|
if (!e) {
|
|
501
|
-
|
|
501
|
+
Te(!1);
|
|
502
502
|
return;
|
|
503
503
|
}
|
|
504
504
|
const t = (n) => {
|
|
505
|
-
|
|
505
|
+
Te(n);
|
|
506
506
|
};
|
|
507
|
-
return
|
|
507
|
+
return Te(e.frozen), e.addEventListener("frozen", t), () => {
|
|
508
508
|
e == null || e.removeEventListener("frozen", t);
|
|
509
509
|
};
|
|
510
510
|
}, [e]), k(() => {
|
|
@@ -513,8 +513,8 @@ ${e}` : e;
|
|
|
513
513
|
const t = N.questionContextMaxLength || 4e3;
|
|
514
514
|
$t(t);
|
|
515
515
|
}, [N, R]), k(() => {
|
|
516
|
-
|
|
517
|
-
}, [
|
|
516
|
+
Pe && S(Pe.text);
|
|
517
|
+
}, [Pe]);
|
|
518
518
|
const cn = (t) => {
|
|
519
519
|
const n = t.size;
|
|
520
520
|
return n <= 0 ? (u.config({
|
|
@@ -529,7 +529,7 @@ ${e}` : e;
|
|
|
529
529
|
}), u.error("图片须小于20M"), u.config({
|
|
530
530
|
getContainer: void 0,
|
|
531
531
|
prefixCls: "gbot-message"
|
|
532
|
-
}), !1) : (he((s) => s.length >=
|
|
532
|
+
}), !1) : (he((s) => s.length >= Ee ? s : [...s, t]), !1);
|
|
533
533
|
}, gn = () => A(void 0, null, function* () {
|
|
534
534
|
var t;
|
|
535
535
|
return (t = e == null ? void 0 : e.data) != null && t.id ? e : (ne.current || (ne.current = new Promise((n, s) => {
|
|
@@ -575,7 +575,7 @@ ${e}` : e;
|
|
|
575
575
|
const at = (t, n) => new Promise((s) => {
|
|
576
576
|
if (!n.file.url || !(o != null && o.id))
|
|
577
577
|
return s();
|
|
578
|
-
const r = Ae(
|
|
578
|
+
const r = Fe(Ae({}, n.file), {
|
|
579
579
|
type: 1
|
|
580
580
|
});
|
|
581
581
|
R == null || R.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, r).finally(() => {
|
|
@@ -598,12 +598,12 @@ ${e}` : e;
|
|
|
598
598
|
return;
|
|
599
599
|
const t = O.current.scrollTop <= -80;
|
|
600
600
|
en(t);
|
|
601
|
-
}, pn =
|
|
601
|
+
}, pn = Me((t) => {
|
|
602
602
|
var n, s;
|
|
603
603
|
(n = pe.current) == null || n.update(t), (s = pe.current) == null || s.focus();
|
|
604
|
-
}), vn =
|
|
604
|
+
}), vn = Me((t) => {
|
|
605
605
|
rt(t);
|
|
606
|
-
}), bn =
|
|
606
|
+
}), bn = Me(() => {
|
|
607
607
|
var n;
|
|
608
608
|
if (!((n = e == null ? void 0 : e.data) != null && n.id))
|
|
609
609
|
return;
|
|
@@ -613,7 +613,7 @@ ${e}` : e;
|
|
|
613
613
|
});
|
|
614
614
|
k(() => {
|
|
615
615
|
var t, n;
|
|
616
|
-
_e.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !et && ((n =
|
|
616
|
+
_e.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !et && ((n = Oe.current) == null || n.clear());
|
|
617
617
|
}, [e]);
|
|
618
618
|
const xn = () => {
|
|
619
619
|
var s;
|
|
@@ -640,14 +640,14 @@ ${e}` : e;
|
|
|
640
640
|
return;
|
|
641
641
|
P(t);
|
|
642
642
|
}
|
|
643
|
-
}),
|
|
643
|
+
}), He = () => A(void 0, null, function* () {
|
|
644
644
|
e ? e.fetchData().then((t) => {
|
|
645
645
|
var n;
|
|
646
646
|
(n = e == null ? void 0 : e.data) != null && n.id && (P(t.netOpen), te(t.enableNetOpen));
|
|
647
647
|
}) : (P(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), te(o.arrange[0].enableNetOpen));
|
|
648
648
|
});
|
|
649
649
|
k(() => {
|
|
650
|
-
|
|
650
|
+
He();
|
|
651
651
|
}, [e]), k(() => {
|
|
652
652
|
requestAnimationFrame(() => {
|
|
653
653
|
var n, s;
|
|
@@ -721,7 +721,7 @@ ${e}` : e;
|
|
|
721
721
|
})), k(() => {
|
|
722
722
|
var n;
|
|
723
723
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
724
|
-
t && ae((s) => Ae(
|
|
724
|
+
t && ae((s) => Fe(Ae({}, s), {
|
|
725
725
|
[t]: []
|
|
726
726
|
}));
|
|
727
727
|
}, [(ct = e == null ? void 0 : e.data) == null ? void 0 : ct.id]), /* @__PURE__ */ V("div", {
|
|
@@ -802,7 +802,7 @@ ${e}` : e;
|
|
|
802
802
|
),
|
|
803
803
|
icon: a === void 0 || a.greeting === !0 || ((yt = a.greeting) == null ? void 0 : yt.icon) === void 0 ? Mt || Tt.icon : a.greeting.icon,
|
|
804
804
|
children: !!Ye.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__ */ d(qn, {
|
|
805
|
-
ref:
|
|
805
|
+
ref: Oe,
|
|
806
806
|
sid: (pt = e == null ? void 0 : e.data) == null ? void 0 : pt.id,
|
|
807
807
|
isRecommendClearing: Qe,
|
|
808
808
|
data: Ye,
|
|
@@ -897,17 +897,18 @@ ${e}` : e;
|
|
|
897
897
|
children: [/* @__PURE__ */ V(Ie, {
|
|
898
898
|
children: [(o.type === re.Agent && (f == null ? void 0 : f.imageUpload) || o.type === re.Dialog && ((vt = o.arrange) == null ? void 0 : vt.length) && !!o.arrange[0].visionOpen && (f == null ? void 0 : f.imageUpload)) && /* @__PURE__ */ d(Un, {
|
|
899
899
|
multiple: !0,
|
|
900
|
-
disabled: me.length >=
|
|
900
|
+
disabled: me.length >= Ee || F,
|
|
901
901
|
accept: ".jpg, .png, .jpeg,.bmp",
|
|
902
902
|
listType: "picture-card",
|
|
903
903
|
beforeUpload: cn,
|
|
904
904
|
className: "footer-upload-picture",
|
|
905
905
|
showUploadList: !1,
|
|
906
|
-
children: me.length <
|
|
906
|
+
children: me.length < Ee ? /* @__PURE__ */ d(An, {
|
|
907
907
|
placement: "topLeft",
|
|
908
908
|
overlayClassName: "footer-upload-tooltip",
|
|
909
909
|
title: /* @__PURE__ */ d("div", {
|
|
910
|
-
children:
|
|
910
|
+
children: `支持上传.jpg .png .jpeg
|
|
911
|
+
.bmp格式的图片数据,单文件最大20M,最多${Ee}张`
|
|
911
912
|
}),
|
|
912
913
|
children: /* @__PURE__ */ d(X, {
|
|
913
914
|
type: "text",
|
|
@@ -948,7 +949,7 @@ ${e}` : e;
|
|
|
948
949
|
isFirstSession: et,
|
|
949
950
|
docViewerUrl: M,
|
|
950
951
|
onStatusChange: (t) => A(void 0, null, function* () {
|
|
951
|
-
t !== "process" ? (be(!0),
|
|
952
|
+
t !== "process" ? (be(!0), He()) : be(!1);
|
|
952
953
|
}),
|
|
953
954
|
createSession: () => new Promise((t) => {
|
|
954
955
|
z(!0), x == null || x({
|
|
@@ -961,7 +962,7 @@ ${e}` : e;
|
|
|
961
962
|
});
|
|
962
963
|
}),
|
|
963
964
|
sid: (bt = e == null ? void 0 : e.data) == null ? void 0 : bt.id,
|
|
964
|
-
disabled:
|
|
965
|
+
disabled: Re || F,
|
|
965
966
|
afterFileAdd: (t, n) => {
|
|
966
967
|
n && ae((s) => {
|
|
967
968
|
const r = s[n] || [];
|
|
@@ -989,7 +990,7 @@ ${e}` : e;
|
|
|
989
990
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
990
991
|
t && (ae({
|
|
991
992
|
[t]: []
|
|
992
|
-
}),
|
|
993
|
+
}), He());
|
|
993
994
|
}
|
|
994
995
|
}) : null, (f == null ? void 0 : f.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ d(ti, {
|
|
995
996
|
appId: o.id,
|
|
@@ -1046,7 +1047,7 @@ ${e}` : e;
|
|
|
1046
1047
|
disabled: Je || !e || !v.length || F,
|
|
1047
1048
|
onClick: () => {
|
|
1048
1049
|
var t, n;
|
|
1049
|
-
we(!1), p == null || p(null), ne.current = null, P(!1), (t = Xe.current) == null || t.clear(), (n =
|
|
1050
|
+
we(!1), p == null || p(null), ne.current = null, P(!1), (t = Xe.current) == null || t.clear(), (n = Oe.current) == null || n.clear();
|
|
1050
1051
|
},
|
|
1051
1052
|
children: "新会话"
|
|
1052
1053
|
})]
|
|
@@ -1070,7 +1071,7 @@ ${e}` : e;
|
|
|
1070
1071
|
size: 0,
|
|
1071
1072
|
children: /* @__PURE__ */ d(X, {
|
|
1072
1073
|
type: "link",
|
|
1073
|
-
disabled:
|
|
1074
|
+
disabled: Re || F,
|
|
1074
1075
|
ghost: !0,
|
|
1075
1076
|
icon: /* @__PURE__ */ d(oe, {
|
|
1076
1077
|
style: {
|