@glodon-aiot/agent-cli-ui 3.19.2-alpha.4 → 3.20.0
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/index.mjs +102 -100
- package/dist/lib/index.js +5 -5
- package/package.json +4 -4
package/dist/es/index.mjs
CHANGED
|
@@ -913,7 +913,7 @@ const CI = (M) => {
|
|
|
913
913
|
children: [N.type === 0 && ((a = j == null ? void 0 : j.imageContent) == null ? void 0 : a.length) && /* @__PURE__ */ i("div", {
|
|
914
914
|
className: "item-user-images",
|
|
915
915
|
children: /* @__PURE__ */ i(Ke, {
|
|
916
|
-
children: j.imageContent.map((W,
|
|
916
|
+
children: j.imageContent.map((W, lM) => ``).join(`
|
|
917
917
|
|
|
918
918
|
`)
|
|
919
919
|
})
|
|
@@ -1005,8 +1005,8 @@ const CI = (M) => {
|
|
|
1005
1005
|
children: [/* @__PURE__ */ i(ON, {
|
|
1006
1006
|
ghost: !0,
|
|
1007
1007
|
expandIconPosition: "right",
|
|
1008
|
-
children: (K = j.actions) == null ? void 0 : K.map((W,
|
|
1009
|
-
var RM, iM, MN, BM, E, J, cM,
|
|
1008
|
+
children: (K = j.actions) == null ? void 0 : K.map((W, lM) => {
|
|
1009
|
+
var RM, iM, MN, BM, E, J, cM, OM, HM, C, B, H;
|
|
1010
1010
|
return /* @__PURE__ */ o(R, {
|
|
1011
1011
|
collapsible: L ? "header" : "icon",
|
|
1012
1012
|
showArrow: L,
|
|
@@ -1042,7 +1042,7 @@ const CI = (M) => {
|
|
|
1042
1042
|
}), (W[W.length - 1].type === "RESULT" || W[W.length - 1].type === "AFTER_CALL") && qe((cM = W.find((d) => d.type === "RESULT")) == null ? void 0 : cM.data.result) && /* @__PURE__ */ i("span", {
|
|
1043
1043
|
className: "bot-plugin-result",
|
|
1044
1044
|
children: "执行成功"
|
|
1045
|
-
}), (W[W.length - 1].type === "RESULT" || W[W.length - 1].type === "AFTER_CALL") && !qe((
|
|
1045
|
+
}), (W[W.length - 1].type === "RESULT" || W[W.length - 1].type === "AFTER_CALL") && !qe((OM = W.find((d) => d.type === "RESULT")) == null ? void 0 : OM.data.result) && /* @__PURE__ */ i("span", {
|
|
1046
1046
|
className: "bot-plugin-result",
|
|
1047
1047
|
children: "执行失败"
|
|
1048
1048
|
}), W[W.length - 1].type === "ABORT" && /* @__PURE__ */ i("span", {
|
|
@@ -1083,7 +1083,7 @@ const CI = (M) => {
|
|
|
1083
1083
|
josn: lI((H = W.find((d) => d.type === "RESULT")) == null ? void 0 : H.data.result)
|
|
1084
1084
|
})
|
|
1085
1085
|
})]
|
|
1086
|
-
},
|
|
1086
|
+
}, lM);
|
|
1087
1087
|
})
|
|
1088
1088
|
}), j.isLoading && /* @__PURE__ */ i("div", {
|
|
1089
1089
|
className: "history-input-progress",
|
|
@@ -1320,18 +1320,18 @@ const gD = bN((M, N) => {
|
|
|
1320
1320
|
if (!Y.current)
|
|
1321
1321
|
return;
|
|
1322
1322
|
const E = Y.current.getEditor(), J = E.root;
|
|
1323
|
-
let
|
|
1324
|
-
if (!
|
|
1323
|
+
let OM = E.getText().trim().length > 0;
|
|
1324
|
+
if (!OM) {
|
|
1325
1325
|
const C = J.querySelectorAll("p");
|
|
1326
1326
|
for (const B of Array.from(C)) {
|
|
1327
1327
|
const H = Array.from(B.childNodes);
|
|
1328
1328
|
if (H.length > 1 || H.length === 1 && ((HM = H[0].nodeName) == null ? void 0 : HM.toLowerCase()) !== "br") {
|
|
1329
|
-
|
|
1329
|
+
OM = !0;
|
|
1330
1330
|
break;
|
|
1331
1331
|
}
|
|
1332
1332
|
}
|
|
1333
1333
|
}
|
|
1334
|
-
|
|
1334
|
+
OM ? J.classList.add("hide-placeholder") : J.classList.remove("hide-placeholder");
|
|
1335
1335
|
};
|
|
1336
1336
|
U(() => {
|
|
1337
1337
|
eM();
|
|
@@ -1390,7 +1390,7 @@ const gD = bN((M, N) => {
|
|
|
1390
1390
|
}), di("2", () => {
|
|
1391
1391
|
var J;
|
|
1392
1392
|
const E = (J = Y.current) == null ? void 0 : J.getEditor();
|
|
1393
|
-
b && (E == null || E.blur(), setTimeout(() =>
|
|
1393
|
+
b && (E == null || E.blur(), setTimeout(() => lM()));
|
|
1394
1394
|
});
|
|
1395
1395
|
const W = () => {
|
|
1396
1396
|
var J;
|
|
@@ -1398,14 +1398,14 @@ const gD = bN((M, N) => {
|
|
|
1398
1398
|
return;
|
|
1399
1399
|
const E = (J = Y.current) == null ? void 0 : J.getEditor();
|
|
1400
1400
|
E == null || E.focus(), $(!1), setTimeout(() => E == null ? void 0 : E.insertText(k, Qe.NETWORK));
|
|
1401
|
-
},
|
|
1401
|
+
}, lM = () => {
|
|
1402
1402
|
var J;
|
|
1403
1403
|
const E = (J = Y.current) == null ? void 0 : J.getEditor();
|
|
1404
1404
|
E == null || E.focus(), $(!1), setTimeout(() => E == null ? void 0 : E.insertText(k, Qe.DOCUMENT));
|
|
1405
1405
|
}, RM = () => {
|
|
1406
|
-
var J, cM,
|
|
1406
|
+
var J, cM, OM;
|
|
1407
1407
|
const E = (J = Y.current) == null ? void 0 : J.getEditor();
|
|
1408
|
-
return E && (E == null ? void 0 : E.getLength()) > 2 && !((cM = E.getText()) != null && cM.includes(Qe.NETWORK)) && !((
|
|
1408
|
+
return E && (E == null ? void 0 : E.getLength()) > 2 && !((cM = E.getText()) != null && cM.includes(Qe.NETWORK)) && !((OM = E.getText()) != null && OM.includes(Qe.DOCUMENT));
|
|
1409
1409
|
};
|
|
1410
1410
|
return U(() => {
|
|
1411
1411
|
var E, J;
|
|
@@ -1442,12 +1442,12 @@ const gD = bN((M, N) => {
|
|
|
1442
1442
|
modules: {
|
|
1443
1443
|
toolbar: !1
|
|
1444
1444
|
},
|
|
1445
|
-
onChange: (E, J, cM,
|
|
1445
|
+
onChange: (E, J, cM, OM) => {
|
|
1446
1446
|
if (!J)
|
|
1447
1447
|
return;
|
|
1448
1448
|
y(E);
|
|
1449
|
-
const HM =
|
|
1450
|
-
f(HM), z && z(E,
|
|
1449
|
+
const HM = OM.getText().replace(/[\n\s]+$/, "");
|
|
1450
|
+
f(HM), z && z(E, OM);
|
|
1451
1451
|
}
|
|
1452
1452
|
}), /* @__PURE__ */ i("div", {
|
|
1453
1453
|
className: "shortcut-direct",
|
|
@@ -1484,7 +1484,7 @@ const gD = bN((M, N) => {
|
|
|
1484
1484
|
})]
|
|
1485
1485
|
}), /* @__PURE__ */ o("div", {
|
|
1486
1486
|
className: "shortcut-direct-item",
|
|
1487
|
-
onClick:
|
|
1487
|
+
onClick: lM,
|
|
1488
1488
|
children: [/* @__PURE__ */ i("span", {
|
|
1489
1489
|
className: "title",
|
|
1490
1490
|
children: "指定文档回答"
|
|
@@ -2026,8 +2026,8 @@ const SI = (M) => {
|
|
|
2026
2026
|
return;
|
|
2027
2027
|
}
|
|
2028
2028
|
}
|
|
2029
|
-
}),
|
|
2030
|
-
C.length &&
|
|
2029
|
+
}), lM = () => j ? Promise.resolve(j) : D(), RM = (C) => {
|
|
2030
|
+
C.length && lM().then((B) => {
|
|
2031
2031
|
C == null || C.forEach((H) => {
|
|
2032
2032
|
var d;
|
|
2033
2033
|
$.current = !0, (d = cM(B, H)) == null || d.then((_) => {
|
|
@@ -2109,7 +2109,7 @@ const SI = (M) => {
|
|
|
2109
2109
|
if (!C)
|
|
2110
2110
|
throw Error("session is not exist.");
|
|
2111
2111
|
return O == null ? void 0 : O.uploadFile(C, B).catch(() => (jM("error", "服务异常,请稍后再试"), ""));
|
|
2112
|
-
},
|
|
2112
|
+
}, OM = /* @__PURE__ */ i("div", {
|
|
2113
2113
|
className: `upload-enter ${z ? "disabled" : ""}`,
|
|
2114
2114
|
children: /* @__PURE__ */ i(bz, {
|
|
2115
2115
|
size: "small",
|
|
@@ -2151,7 +2151,7 @@ const SI = (M) => {
|
|
|
2151
2151
|
});
|
|
2152
2152
|
return /* @__PURE__ */ o("div", {
|
|
2153
2153
|
className: "footer-upload",
|
|
2154
|
-
children: [z ?
|
|
2154
|
+
children: [z ? OM : /* @__PURE__ */ i($N, {
|
|
2155
2155
|
overlayClassName: "upload-popover",
|
|
2156
2156
|
overlayInnerStyle: {
|
|
2157
2157
|
width: 264,
|
|
@@ -2241,7 +2241,7 @@ const SI = (M) => {
|
|
|
2241
2241
|
}),
|
|
2242
2242
|
title: J,
|
|
2243
2243
|
trigger: "click",
|
|
2244
|
-
children:
|
|
2244
|
+
children: OM
|
|
2245
2245
|
}), K && /* @__PURE__ */ i(SI, {
|
|
2246
2246
|
isvisible: K,
|
|
2247
2247
|
onClose: (C) => {
|
|
@@ -2733,23 +2733,23 @@ const LD = Vi(void 0), bI = ({
|
|
|
2733
2733
|
} = VM(XM), [R, w] = r(t), {
|
|
2734
2734
|
sessions: m,
|
|
2735
2735
|
setSessions: k
|
|
2736
|
-
} = zt(), [a, b] = r(0), [$, K] = r(""), [Y, eM] = r(null), O = 30, [l, v] = r(!1), [q, jM] = r(!0), [mM, W] = r(!1),
|
|
2736
|
+
} = zt(), [a, b] = r(0), [$, K] = r(""), [Y, eM] = r(null), O = 30, [l, v] = r(!1), [q, jM] = r(!0), [mM, W] = r(!1), lM = bM(void 0), RM = bM(0), iM = bM(null), MN = bM(null), BM = (S) => {
|
|
2737
2737
|
var gM, ZM;
|
|
2738
2738
|
if (!(S != null && S.length))
|
|
2739
2739
|
return;
|
|
2740
2740
|
let V = (ZM = (gM = S[0]) == null ? void 0 : gM.data) == null ? void 0 : ZM.createdAt;
|
|
2741
2741
|
return S.forEach((sM) => {
|
|
2742
|
-
var
|
|
2743
|
-
V ? (hM = sM.data) != null && hM.createdAt && KM((WM = sM.data) == null ? void 0 : WM.createdAt).valueOf() < KM(V).valueOf() && (V = (_M = sM.data) == null ? void 0 : _M.createdAt) : V = (
|
|
2742
|
+
var YM, hM, WM, _M;
|
|
2743
|
+
V ? (hM = sM.data) != null && hM.createdAt && KM((WM = sM.data) == null ? void 0 : WM.createdAt).valueOf() < KM(V).valueOf() && (V = (_M = sM.data) == null ? void 0 : _M.createdAt) : V = (YM = sM.data) == null ? void 0 : YM.createdAt;
|
|
2744
2744
|
}), V;
|
|
2745
2745
|
}, E = Se((S) => {
|
|
2746
2746
|
S.id && k((V) => [...V.map((sM) => {
|
|
2747
|
-
var
|
|
2748
|
-
return ((
|
|
2749
|
-
})].sort((sM,
|
|
2747
|
+
var YM;
|
|
2748
|
+
return ((YM = sM.data) == null ? void 0 : YM.id) === S.id && (sM.data = DM({}, S)), sM;
|
|
2749
|
+
})].sort((sM, YM) => {
|
|
2750
2750
|
var _M, iN;
|
|
2751
2751
|
const hM = KM((_M = sM.data) == null ? void 0 : _M.createdAt).valueOf();
|
|
2752
|
-
return KM((iN =
|
|
2752
|
+
return KM((iN = YM.data) == null ? void 0 : iN.createdAt).valueOf() - hM;
|
|
2753
2753
|
}));
|
|
2754
2754
|
});
|
|
2755
2755
|
U(() => {
|
|
@@ -2757,11 +2757,11 @@ const LD = Vi(void 0), bI = ({
|
|
|
2757
2757
|
e === void 0 && !A && (j == null || j(null));
|
|
2758
2758
|
return;
|
|
2759
2759
|
}
|
|
2760
|
-
v(!0),
|
|
2760
|
+
v(!0), lM.current = void 0, RM.current = 0, L == null || L.getSessions({
|
|
2761
2761
|
pageSize: O
|
|
2762
2762
|
}).then((S) => tM(void 0, null, function* () {
|
|
2763
2763
|
var V;
|
|
2764
|
-
if (k([...S]), RM.current = S.length,
|
|
2764
|
+
if (k([...S]), RM.current = S.length, lM.current = BM(S), jM(S.length >= O), W(S.length < O), !((V = e == null ? void 0 : e.data) != null && V.id) && (S != null && S.length) && y === "inlay") {
|
|
2765
2765
|
const gM = S[0];
|
|
2766
2766
|
A || j == null || j(gM);
|
|
2767
2767
|
} else
|
|
@@ -2799,7 +2799,7 @@ const LD = Vi(void 0), bI = ({
|
|
|
2799
2799
|
netOpen: (D == null ? void 0 : D.type) === 0 ? S != null && S.netOpen ? S.netOpen : V ? ZN.OPEN : ZN.CLOSE : void 0,
|
|
2800
2800
|
knowledges: (hM = e == null ? void 0 : e.data) != null && hM.id ? S == null ? void 0 : S.knowledges : R,
|
|
2801
2801
|
promptVariables: ZM
|
|
2802
|
-
}),
|
|
2802
|
+
}), YM = (WM) => {
|
|
2803
2803
|
var _M;
|
|
2804
2804
|
FM.config({
|
|
2805
2805
|
getContainer: () => (f == null ? void 0 : f.current) || document.body,
|
|
@@ -2811,8 +2811,8 @@ const LD = Vi(void 0), bI = ({
|
|
|
2811
2811
|
prefixCls: "gbot-notification"
|
|
2812
2812
|
});
|
|
2813
2813
|
};
|
|
2814
|
-
sM == null || sM.addEventListener("error",
|
|
2815
|
-
sM == null || sM.removeEventListener("error",
|
|
2814
|
+
sM == null || sM.addEventListener("error", YM), sM == null || sM.addEventListener("data:created", () => tM(void 0, null, function* () {
|
|
2815
|
+
sM == null || sM.removeEventListener("error", YM), k([sM, ...m]), gM(sM);
|
|
2816
2816
|
}));
|
|
2817
2817
|
}));
|
|
2818
2818
|
}, cM = () => {
|
|
@@ -2821,12 +2821,12 @@ const LD = Vi(void 0), bI = ({
|
|
|
2821
2821
|
}).then((S) => {
|
|
2822
2822
|
j == null || j(S);
|
|
2823
2823
|
});
|
|
2824
|
-
},
|
|
2824
|
+
}, OM = (S) => {
|
|
2825
2825
|
L == null || L.removeSession(S, !0).then(() => tM(void 0, null, function* () {
|
|
2826
2826
|
var gM, ZM;
|
|
2827
2827
|
const V = m.filter((sM) => {
|
|
2828
|
-
var
|
|
2829
|
-
return ((
|
|
2828
|
+
var YM, hM;
|
|
2829
|
+
return ((YM = sM.data) == null ? void 0 : YM.id) !== ((hM = S.data) == null ? void 0 : hM.id);
|
|
2830
2830
|
});
|
|
2831
2831
|
((gM = S.data) == null ? void 0 : gM.id) === ((ZM = e == null ? void 0 : e.data) == null ? void 0 : ZM.id) && (V != null && V.length ? j == null || j(V[0]) : j == null || j(null)), k([...V]);
|
|
2832
2832
|
}));
|
|
@@ -2836,9 +2836,9 @@ const LD = Vi(void 0), bI = ({
|
|
|
2836
2836
|
try {
|
|
2837
2837
|
const S = yield L == null ? void 0 : L.getSessions({
|
|
2838
2838
|
pageSize: O,
|
|
2839
|
-
beforeTime:
|
|
2839
|
+
beforeTime: lM.current
|
|
2840
2840
|
}), V = (S == null ? void 0 : S.length) || 0, gM = V - RM.current;
|
|
2841
|
-
k([...S || []]),
|
|
2841
|
+
k([...S || []]), lM.current = BM(S || []), gM <= 0 ? (jM(!1), W(!0)) : gM < O ? (jM(!1), W(!0), RM.current = V) : (jM(!0), W(!1), RM.current = V);
|
|
2842
2842
|
} finally {
|
|
2843
2843
|
v(!1);
|
|
2844
2844
|
}
|
|
@@ -2890,7 +2890,7 @@ const LD = Vi(void 0), bI = ({
|
|
|
2890
2890
|
typeof (n == null ? void 0 : n.promptVariables) == "object" && ((ZM = n == null ? void 0 : n.promptVariables) != null && ZM.default) && (S.promptVariables = (sM = n == null ? void 0 : n.promptVariables) == null ? void 0 : sM.default), L == null || L.loadSession(e.id, S);
|
|
2891
2891
|
}, [e]);
|
|
2892
2892
|
const dM = Se((S) => {
|
|
2893
|
-
const V = KM().endOf("day"), gM = V.subtract(1, "day"), ZM = V.subtract(7, "day"), sM = V.subtract(30, "day"),
|
|
2893
|
+
const V = KM().endOf("day"), gM = V.subtract(1, "day"), ZM = V.subtract(7, "day"), sM = V.subtract(30, "day"), YM = [], hM = [], WM = [], _M = [], iN = {};
|
|
2894
2894
|
return S.forEach((vM) => {
|
|
2895
2895
|
var tN;
|
|
2896
2896
|
const xM = KM((tN = vM.data) == null ? void 0 : tN.createdAt);
|
|
@@ -2904,21 +2904,21 @@ const LD = Vi(void 0), bI = ({
|
|
|
2904
2904
|
const eN = xM.format("YYYY-MM");
|
|
2905
2905
|
iN[eN] || (iN[eN] = []), iN[eN].push(vM);
|
|
2906
2906
|
}
|
|
2907
|
-
}), hM.length > 0 &&
|
|
2907
|
+
}), hM.length > 0 && YM.push({
|
|
2908
2908
|
title: "今天",
|
|
2909
2909
|
sessions: hM.sort((vM, xM) => {
|
|
2910
2910
|
var tN, eN;
|
|
2911
2911
|
return KM((tN = xM.data) == null ? void 0 : tN.createdAt).valueOf() - KM((eN = vM.data) == null ? void 0 : eN.createdAt).valueOf();
|
|
2912
2912
|
}),
|
|
2913
2913
|
key: "today"
|
|
2914
|
-
}), WM.length > 0 &&
|
|
2914
|
+
}), WM.length > 0 && YM.push({
|
|
2915
2915
|
title: "7天内",
|
|
2916
2916
|
sessions: WM.sort((vM, xM) => {
|
|
2917
2917
|
var tN, eN;
|
|
2918
2918
|
return KM((tN = xM.data) == null ? void 0 : tN.createdAt).valueOf() - KM((eN = vM.data) == null ? void 0 : eN.createdAt).valueOf();
|
|
2919
2919
|
}),
|
|
2920
2920
|
key: "seven-days"
|
|
2921
|
-
}), _M.length > 0 &&
|
|
2921
|
+
}), _M.length > 0 && YM.push({
|
|
2922
2922
|
title: "30天内",
|
|
2923
2923
|
sessions: _M.sort((vM, xM) => {
|
|
2924
2924
|
var tN, eN;
|
|
@@ -2930,12 +2930,12 @@ const LD = Vi(void 0), bI = ({
|
|
|
2930
2930
|
var Je, qN;
|
|
2931
2931
|
return KM((Je = eN.data) == null ? void 0 : Je.createdAt).valueOf() - KM((qN = tN.data) == null ? void 0 : qN.createdAt).valueOf();
|
|
2932
2932
|
});
|
|
2933
|
-
|
|
2933
|
+
YM.push({
|
|
2934
2934
|
title: KM(vM).format("YYYY年MM月"),
|
|
2935
2935
|
sessions: xM,
|
|
2936
2936
|
key: `month-${vM}`
|
|
2937
2937
|
});
|
|
2938
|
-
}),
|
|
2938
|
+
}), YM;
|
|
2939
2939
|
}), fM = Xi(() => dM(m), [m, dM]);
|
|
2940
2940
|
return /* @__PURE__ */ i("div", {
|
|
2941
2941
|
className: "bot-session-container",
|
|
@@ -2970,7 +2970,7 @@ const LD = Vi(void 0), bI = ({
|
|
|
2970
2970
|
},
|
|
2971
2971
|
children: S.title
|
|
2972
2972
|
}), (V = S.sessions) == null ? void 0 : V.map((gM) => {
|
|
2973
|
-
var ZM, sM,
|
|
2973
|
+
var ZM, sM, YM, hM, WM, _M, iN, KN, vM;
|
|
2974
2974
|
return /* @__PURE__ */ i("div", {
|
|
2975
2975
|
className: yN({
|
|
2976
2976
|
"session-item": !0,
|
|
@@ -2990,7 +2990,7 @@ const LD = Vi(void 0), bI = ({
|
|
|
2990
2990
|
ellipsis: {
|
|
2991
2991
|
rows: 1,
|
|
2992
2992
|
tooltip: {
|
|
2993
|
-
title: ((
|
|
2993
|
+
title: ((YM = gM.data) == null ? void 0 : YM.name) || "-",
|
|
2994
2994
|
placement: "topLeft"
|
|
2995
2995
|
}
|
|
2996
2996
|
},
|
|
@@ -3037,7 +3037,7 @@ const LD = Vi(void 0), bI = ({
|
|
|
3037
3037
|
})]
|
|
3038
3038
|
}),
|
|
3039
3039
|
onConfirm: () => {
|
|
3040
|
-
|
|
3040
|
+
OM(gM), b((xM) => xM + 1);
|
|
3041
3041
|
},
|
|
3042
3042
|
onCancel: () => {
|
|
3043
3043
|
b((xM) => xM + 1);
|
|
@@ -3503,11 +3503,11 @@ ${t}` : t;
|
|
|
3503
3503
|
sider: jM,
|
|
3504
3504
|
mode: mM,
|
|
3505
3505
|
silencedSeconds: W
|
|
3506
|
-
} = VM(XM), [
|
|
3506
|
+
} = VM(XM), [lM, RM] = r(!1), iM = bM(g), MN = bM(void 0), [BM, E] = r(0), [J, cM] = r([]), [OM, HM] = r([]), [C, B] = r(0), [H, d] = r(!1);
|
|
3507
3507
|
U(() => {
|
|
3508
3508
|
d(C > 0);
|
|
3509
3509
|
}, [C]);
|
|
3510
|
-
const _ = bM(null), [zM, nM] = r([]), [dM, fM] = r(!1), [S, V] = r(!1), [gM, ZM] = r(""), [sM,
|
|
3510
|
+
const _ = bM(null), [zM, nM] = r([]), [dM, fM] = r(!1), [S, V] = r(!1), [gM, ZM] = r(""), [sM, YM] = r(), [hM, WM] = r({}), _M = bM(null), iN = bM(null), KN = bM(null), [vM, xM] = r(!1), [tN, eN] = r([]), [Je, qN] = r(!0), [Iz, gz] = r(!0), [St, EN] = r(!1), [Sj, WN] = r(!1), [kt, Tz] = r(!1), [nN, le] = r(typeof (l == null ? void 0 : l.promptVariables) == "object" ? l.promptVariables.default || [] : []), [uz, sz] = r(() => {
|
|
3511
3511
|
const s = typeof (l == null ? void 0 : l.knowledges) == "object" && l.knowledges.default || void 0;
|
|
3512
3512
|
if (s) {
|
|
3513
3513
|
if (Array.isArray(s) && s.some((G) => Array.isArray(G.fileIds) && G.fileIds.length === 0))
|
|
@@ -3632,7 +3632,7 @@ ${t}` : t;
|
|
|
3632
3632
|
DN("error", "正在回复中");
|
|
3633
3633
|
return;
|
|
3634
3634
|
}
|
|
3635
|
-
if (
|
|
3635
|
+
if (lM) {
|
|
3636
3636
|
DN("error", "等待初始化");
|
|
3637
3637
|
return;
|
|
3638
3638
|
}
|
|
@@ -3652,8 +3652,8 @@ ${t}` : t;
|
|
|
3652
3652
|
Ne(!0), D == null || D({
|
|
3653
3653
|
netOpen: T ? ZN.OPEN : ZN.CLOSE
|
|
3654
3654
|
}).then((PM) => {
|
|
3655
|
-
var
|
|
3656
|
-
Me(!0), A(!!((
|
|
3655
|
+
var CM, xN;
|
|
3656
|
+
Me(!0), A(!!((CM = PM.data) != null && CM.netOpen)), Ye(!!((xN = PM.data) != null && xN.enableNetOpen)), Uj(PM).then(() => {
|
|
3657
3657
|
I == null || I(PM), Me(!1), f(c);
|
|
3658
3658
|
});
|
|
3659
3659
|
}).catch((PM) => {
|
|
@@ -3664,7 +3664,7 @@ ${t}` : t;
|
|
|
3664
3664
|
if (He)
|
|
3665
3665
|
return;
|
|
3666
3666
|
Ne(!0), Be(!0);
|
|
3667
|
-
const p = Wj(c,
|
|
3667
|
+
const p = Wj(c, OM, hM[G], (e == null ? void 0 : e.type) || 0);
|
|
3668
3668
|
let MM;
|
|
3669
3669
|
try {
|
|
3670
3670
|
Y ? MM = yield Y == null ? void 0 : Y({
|
|
@@ -3687,7 +3687,7 @@ ${t}` : t;
|
|
|
3687
3687
|
let F = c;
|
|
3688
3688
|
typeof MM == "object" && (F = MM.content || c);
|
|
3689
3689
|
const NM = yield (() => new Promise((PM) => {
|
|
3690
|
-
le((
|
|
3690
|
+
le((CM) => (PM(CM), CM));
|
|
3691
3691
|
}))();
|
|
3692
3692
|
if (!(yield t.setPromptVariables(NM))) {
|
|
3693
3693
|
Ne(!1);
|
|
@@ -3718,7 +3718,7 @@ ${t}` : t;
|
|
|
3718
3718
|
return;
|
|
3719
3719
|
const s = n, c = () => tM(void 0, null, function* () {
|
|
3720
3720
|
Be(!0);
|
|
3721
|
-
const x = Wj(s,
|
|
3721
|
+
const x = Wj(s, OM, hM[t.id], (e == null ? void 0 : e.type) || 0);
|
|
3722
3722
|
let G;
|
|
3723
3723
|
try {
|
|
3724
3724
|
Y ? G = yield Y == null ? void 0 : Y({
|
|
@@ -3750,13 +3750,13 @@ ${t}` : t;
|
|
|
3750
3750
|
if (!x)
|
|
3751
3751
|
return;
|
|
3752
3752
|
WN(!0), EN(!0);
|
|
3753
|
-
const G = Wj(s,
|
|
3753
|
+
const G = Wj(s, OM, c, (e == null ? void 0 : e.type) || 0);
|
|
3754
3754
|
let p;
|
|
3755
3755
|
if (e.type === IN.Agent)
|
|
3756
3756
|
p = void 0;
|
|
3757
3757
|
else if (e.type === IN.Dialog && (($M = e.arrange) != null && $M.length) && e.arrange[0].visionOpen) {
|
|
3758
|
-
const
|
|
3759
|
-
p =
|
|
3758
|
+
const CM = OM && OM.length ? OM.filter(Boolean) : [];
|
|
3759
|
+
p = CM.length ? CM : void 0;
|
|
3760
3760
|
} else
|
|
3761
3761
|
p = void 0;
|
|
3762
3762
|
const MM = new we(
|
|
@@ -3767,31 +3767,33 @@ ${t}` : t;
|
|
|
3767
3767
|
p
|
|
3768
3768
|
// 新增:传入图片内容
|
|
3769
3769
|
);
|
|
3770
|
-
y(void 0),
|
|
3770
|
+
y(void 0), YM(void 0), iM.current = [MM, ...g], u(iM.current), e.id && $ && $({
|
|
3771
3771
|
applicationId: e.id,
|
|
3772
3772
|
sessionId: x,
|
|
3773
3773
|
message: MM
|
|
3774
3774
|
});
|
|
3775
3775
|
const F = new we("", x, RN.System);
|
|
3776
3776
|
F.isWaiting = !0, iM.current = [F, ...iM.current], u(iM.current);
|
|
3777
|
-
const QM = (c == null ? void 0 : c.map((
|
|
3777
|
+
const QM = (c == null ? void 0 : c.map((CM) => CM.id)) || [], NM = {
|
|
3778
3778
|
stream: MD.stream,
|
|
3779
3779
|
referenceFirst: !1
|
|
3780
3780
|
};
|
|
3781
3781
|
if (a != null && a.promptVariables) {
|
|
3782
|
-
const
|
|
3783
|
-
NM.formatValues =
|
|
3782
|
+
const CM = nN == null ? void 0 : nN.reduce((xN, se) => (xN[se.key] = se.value, xN), {});
|
|
3783
|
+
NM.formatValues = CM;
|
|
3784
3784
|
}
|
|
3785
3785
|
if (a != null && a.knowledges) {
|
|
3786
|
-
const
|
|
3787
|
-
NM.knowledges =
|
|
3786
|
+
const CM = uz;
|
|
3787
|
+
NM.knowledges = CM;
|
|
3788
3788
|
}
|
|
3789
3789
|
const GM = {
|
|
3790
3790
|
text: G,
|
|
3791
3791
|
fileIds: QM,
|
|
3792
3792
|
files: c
|
|
3793
3793
|
};
|
|
3794
|
-
p && p.length > 0 && (GM.imageContent = p),
|
|
3794
|
+
p && p.length > 0 && (GM.imageContent = p), t.ready || (yield new Promise((CM) => {
|
|
3795
|
+
t.addEventListener("ready", () => CM(), !0);
|
|
3796
|
+
})), yield t.send(GM, NM), WM({
|
|
3795
3797
|
[x]: []
|
|
3796
3798
|
}), (PM = _M.current) == null || PM.update(), cM([]), HM([]), Ne(!1);
|
|
3797
3799
|
});
|
|
@@ -3853,7 +3855,7 @@ ${t}` : t;
|
|
|
3853
3855
|
const s = w.questionContextMaxLength || 4e3;
|
|
3854
3856
|
E(s);
|
|
3855
3857
|
}, [w, R]), U(() => {
|
|
3856
|
-
b &&
|
|
3858
|
+
b && YM(b.text);
|
|
3857
3859
|
}, [b]);
|
|
3858
3860
|
const DN = (s, c, x) => {
|
|
3859
3861
|
sN(v, () => {
|
|
@@ -3876,15 +3878,15 @@ ${t}` : t;
|
|
|
3876
3878
|
return;
|
|
3877
3879
|
const x = oz(), G = Cz(), p = [], MM = [];
|
|
3878
3880
|
let F = 0, QM = 0, NM = 0;
|
|
3879
|
-
c.forEach((
|
|
3881
|
+
c.forEach((CM) => {
|
|
3880
3882
|
var Ti, ui, si;
|
|
3881
|
-
if (((Ti =
|
|
3882
|
-
x ? p.push(
|
|
3883
|
+
if (((Ti = CM.type) == null ? void 0 : Ti.startsWith("image/")) || !!xi(CM.name)) {
|
|
3884
|
+
x ? p.push(CM) : F++;
|
|
3883
3885
|
return;
|
|
3884
3886
|
}
|
|
3885
|
-
const se = (si = (ui =
|
|
3886
|
-
if (zD.includes(
|
|
3887
|
-
G ? MM.push(
|
|
3887
|
+
const se = (si = (ui = CM.name) == null ? void 0 : ui.split(".").pop()) == null ? void 0 : si.toLowerCase();
|
|
3888
|
+
if (zD.includes(CM.type) || ["pdf", "doc", "docx"].includes(se || "")) {
|
|
3889
|
+
G ? MM.push(CM) : QM++;
|
|
3888
3890
|
return;
|
|
3889
3891
|
}
|
|
3890
3892
|
NM++;
|
|
@@ -3893,15 +3895,15 @@ ${t}` : t;
|
|
|
3893
3895
|
if (!G && !x)
|
|
3894
3896
|
TM && GM.push(`当前不支持上传文件/图片,已忽略${TM}个文件`);
|
|
3895
3897
|
else if (G && !x) {
|
|
3896
|
-
const
|
|
3897
|
-
|
|
3898
|
+
const CM = F + NM;
|
|
3899
|
+
CM && GM.push(`仅支持上传 .doc/.docx/.pdf 文件,已忽略${CM}个其他类型文件`);
|
|
3898
3900
|
} else if (!G && x) {
|
|
3899
|
-
const
|
|
3900
|
-
|
|
3901
|
+
const CM = QM + NM;
|
|
3902
|
+
CM && GM.push(`仅支持上传图片(.jpg/.jpeg/.png/.bmp),已忽略${CM}个其他类型文件`);
|
|
3901
3903
|
} else
|
|
3902
3904
|
NM && GM.push(`存在不支持的文件类型,已忽略${NM}个文件`);
|
|
3903
3905
|
if (GM.length && DN("warning", GM.join(";"), "precheck-warn"), p.length) {
|
|
3904
|
-
const
|
|
3906
|
+
const CM = Math.max(0, je - J.length), xN = p.slice(0, CM);
|
|
3905
3907
|
xN.forEach((se) => Wt(se)), p.length > xN.length && DN("warning", `最多上传${je}张图片`);
|
|
3906
3908
|
}
|
|
3907
3909
|
MM.length && ((PM = ($M = _M.current) == null ? void 0 : $M.appendFiles) == null || PM.call($M, MM));
|
|
@@ -4209,7 +4211,7 @@ ${t}` : t;
|
|
|
4209
4211
|
layoutBreakpoints: typeof (l == null ? void 0 : l.greeting) == "object" ? l.greeting.layoutBreakpoints : void 0,
|
|
4210
4212
|
onItemClick: (s) => {
|
|
4211
4213
|
var x, G, p;
|
|
4212
|
-
if (y(s == null ? void 0 : s.question),
|
|
4214
|
+
if (y(s == null ? void 0 : s.question), YM(s == null ? void 0 : s.question), dM)
|
|
4213
4215
|
return;
|
|
4214
4216
|
s != null && s.id && fM(!0);
|
|
4215
4217
|
const c = (x = t == null ? void 0 : t.data) == null ? void 0 : x.id;
|
|
@@ -4393,7 +4395,7 @@ ${t}` : t;
|
|
|
4393
4395
|
list: [],
|
|
4394
4396
|
search: S ? gM : "",
|
|
4395
4397
|
onPromptSelect: (s) => {
|
|
4396
|
-
|
|
4398
|
+
YM(s.context), y(s.context);
|
|
4397
4399
|
},
|
|
4398
4400
|
disabled: O
|
|
4399
4401
|
})]
|
|
@@ -4409,7 +4411,7 @@ ${t}` : t;
|
|
|
4409
4411
|
}), (a == null ? void 0 : a.sessionList) && /* @__PURE__ */ i(pI, {
|
|
4410
4412
|
currentSessionId: (Ii = t == null ? void 0 : t.data) == null ? void 0 : Ii.id,
|
|
4411
4413
|
onSessionChange: (s, c) => {
|
|
4412
|
-
|
|
4414
|
+
YM(void 0), Fe(!0), I == null || I(c);
|
|
4413
4415
|
},
|
|
4414
4416
|
disabled: O
|
|
4415
4417
|
}), jM && mM === "float" && /* @__PURE__ */ i("div", {
|
|
@@ -4465,10 +4467,10 @@ ${t}` : t;
|
|
|
4465
4467
|
text: sM,
|
|
4466
4468
|
networkStatus: !1,
|
|
4467
4469
|
loading: ft || He,
|
|
4468
|
-
disabled:
|
|
4470
|
+
disabled: lM || H || O || ft || He,
|
|
4469
4471
|
onTextSend: Gt,
|
|
4470
4472
|
onChange: (s, c) => {
|
|
4471
|
-
|
|
4473
|
+
YM(s);
|
|
4472
4474
|
const x = c.getText().replace(/[\n\s]+$/, "");
|
|
4473
4475
|
y(x), ZM(x), S || V(!0);
|
|
4474
4476
|
},
|
|
@@ -4815,7 +4817,7 @@ const $I = bN((M, N) => {
|
|
|
4815
4817
|
stream: eM,
|
|
4816
4818
|
agentClient: O,
|
|
4817
4819
|
application: l
|
|
4818
|
-
} = M, v = bM(null), [q, jM] = r(!1), [mM, W] = r(), [
|
|
4820
|
+
} = M, v = bM(null), [q, jM] = r(!1), [mM, W] = r(), [lM, RM] = r(t), [iM, MN] = r(M.open), BM = bM(null);
|
|
4819
4821
|
U(() => {
|
|
4820
4822
|
l && (console.log("[AgentClientUI] token", O, l), W(l.id));
|
|
4821
4823
|
}, [l]), Ue.config({
|
|
@@ -4825,11 +4827,11 @@ const $I = bN((M, N) => {
|
|
|
4825
4827
|
}, [t]);
|
|
4826
4828
|
const E = (J, {
|
|
4827
4829
|
element: cM,
|
|
4828
|
-
size:
|
|
4830
|
+
size: OM
|
|
4829
4831
|
}) => {
|
|
4830
4832
|
RM({
|
|
4831
|
-
width: Number(
|
|
4832
|
-
height:
|
|
4833
|
+
width: Number(OM.width),
|
|
4834
|
+
height: OM.height
|
|
4833
4835
|
});
|
|
4834
4836
|
};
|
|
4835
4837
|
return XN(N, () => ({
|
|
@@ -4865,8 +4867,8 @@ const $I = bN((M, N) => {
|
|
|
4865
4867
|
features: Y
|
|
4866
4868
|
}),
|
|
4867
4869
|
children: [/* @__PURE__ */ i(fz, {
|
|
4868
|
-
height: (
|
|
4869
|
-
width: (
|
|
4870
|
+
height: (lM == null ? void 0 : lM.height) || "100%",
|
|
4871
|
+
width: (lM == null ? void 0 : lM.width) || "100%",
|
|
4870
4872
|
maxConstraints: [document.body.clientWidth - 45],
|
|
4871
4873
|
minConstraints: [Number(t == null ? void 0 : t.minWidth)],
|
|
4872
4874
|
onResize: E,
|
|
@@ -4878,8 +4880,8 @@ const $I = bN((M, N) => {
|
|
|
4878
4880
|
id: "dialog-modal",
|
|
4879
4881
|
className: `gbot-dialog-modal ${e} ${iM ? "opened" : "closed"}`,
|
|
4880
4882
|
style: NN(DM({}, t), {
|
|
4881
|
-
width: e == "float" ?
|
|
4882
|
-
height: e === "float" ?
|
|
4883
|
+
width: e == "float" ? lM == null ? void 0 : lM.width : t == null ? void 0 : t.width,
|
|
4884
|
+
height: e === "float" ? lM == null ? void 0 : lM.height : t == null ? void 0 : t.height,
|
|
4883
4885
|
maxHeight: "100vh"
|
|
4884
4886
|
}),
|
|
4885
4887
|
ref: v,
|
|
@@ -4912,7 +4914,7 @@ const $I = bN((M, N) => {
|
|
|
4912
4914
|
})]
|
|
4913
4915
|
})
|
|
4914
4916
|
});
|
|
4915
|
-
}), qI = "@glodon-aiot/agent-cli-ui", Mg = "3.
|
|
4917
|
+
}), qI = "@glodon-aiot/agent-cli-ui", Mg = "3.20.0", Ng = "./dist/es/index.mjs", eg = "./dist/lib/index.js", jg = "./dist/src/index.d.ts", tg = {
|
|
4916
4918
|
import: "./dist/es/index.mjs",
|
|
4917
4919
|
require: "./dist/lib/index.js",
|
|
4918
4920
|
types: "./dist/src/index.d.ts"
|
|
@@ -4934,9 +4936,9 @@ const $I = bN((M, N) => {
|
|
|
4934
4936
|
commit: "cz"
|
|
4935
4937
|
}, gg = {
|
|
4936
4938
|
"@ant-design/icons": "^5.3.4",
|
|
4937
|
-
"@glodon-aiot/apis": "^3.
|
|
4938
|
-
"@glodon-aiot/bot-client-sdk": "^3.
|
|
4939
|
-
"@glodon-aiot/react-components": "^3.
|
|
4939
|
+
"@glodon-aiot/apis": "^3.20.0",
|
|
4940
|
+
"@glodon-aiot/bot-client-sdk": "^3.20.0",
|
|
4941
|
+
"@glodon-aiot/react-components": "^3.20.0",
|
|
4940
4942
|
"@matejmazur/react-mathjax": "^0.1.10",
|
|
4941
4943
|
"@react-pdf-viewer/core": "^3.12.0",
|
|
4942
4944
|
"@react-pdf-viewer/default-layout": "^3.12.0",
|
|
@@ -7509,7 +7511,7 @@ const {
|
|
|
7509
7511
|
agentClient: jM,
|
|
7510
7512
|
popupContainer: mM,
|
|
7511
7513
|
token: W,
|
|
7512
|
-
apiUrl:
|
|
7514
|
+
apiUrl: lM
|
|
7513
7515
|
} = VM(XM), RM = (C, B, H, d) => {
|
|
7514
7516
|
const _ = {
|
|
7515
7517
|
messageId: me(),
|
|
@@ -7523,7 +7525,7 @@ const {
|
|
|
7523
7525
|
}, zM = NN(DM({}, H), {
|
|
7524
7526
|
stream: !0
|
|
7525
7527
|
});
|
|
7526
|
-
ls(`${
|
|
7528
|
+
ls(`${lM}/chat/v2/chat?applicationId=${C}&sessionId=${B}`, {
|
|
7527
7529
|
method: "POST",
|
|
7528
7530
|
headers: {
|
|
7529
7531
|
Authorization: `Bearer ${W}`,
|
|
@@ -7726,7 +7728,7 @@ const {
|
|
|
7726
7728
|
a && (a.map((H) => {
|
|
7727
7729
|
H.id === C && (H.value = B.target.value);
|
|
7728
7730
|
}), b([...a]));
|
|
7729
|
-
},
|
|
7731
|
+
}, OM = (a == null ? void 0 : a.filter((C) => C.type === SM.System)) || [], HM = (a == null ? void 0 : a.filter((C) => C.type === SM.User)) || [];
|
|
7730
7732
|
return /* @__PURE__ */ o("div", {
|
|
7731
7733
|
className: "text-main",
|
|
7732
7734
|
children: [/* @__PURE__ */ o("div", {
|
|
@@ -7747,9 +7749,9 @@ const {
|
|
|
7747
7749
|
ghost: !0,
|
|
7748
7750
|
className: "prompt-variables-collapse",
|
|
7749
7751
|
defaultActiveKey: [SM.System, SM.User],
|
|
7750
|
-
children: [
|
|
7752
|
+
children: [OM.length && /* @__PURE__ */ i(_i, {
|
|
7751
7753
|
header: "角色设定变量",
|
|
7752
|
-
children:
|
|
7754
|
+
children: OM.map((C) => /* @__PURE__ */ i(_N.Item, {
|
|
7753
7755
|
label: C.name,
|
|
7754
7756
|
name: ["systemPrompts", C.key],
|
|
7755
7757
|
style: {
|