@glodon-aiot/agent-cli-ui 3.3.2-beta.1 → 3.3.2-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/HistoryItem/index.mjs +161 -147
- package/dist/es/Dialog/AgentChat/index.mjs +41 -39
- package/dist/es/index.mjs +46 -46
- package/dist/es/packages/react-components/dist/es/components/Markdown/ATag/index.mjs +27 -25
- package/dist/es/packages/react-components/dist/es/components/Markdown/Image/index.mjs +29 -27
- package/dist/es/packages/react-components/dist/es/components/Markdown/index.mjs +58 -47
- package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
- package/dist/es/src/style10.css +1 -1
- package/dist/es/src/style11.css +1 -1
- package/dist/es/src/style12.css +1 -1
- package/dist/es/src/style13.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.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/style23.css +1 -1
- package/dist/es/src/style26.css +1 -1
- package/dist/es/src/style28.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.js +50 -50
- package/dist/src/Dialog/AgentChat/HistoryItem/index.d.ts +2 -0
- package/dist/src/types.d.ts +2 -0
- package/package.json +3 -3
|
@@ -2,15 +2,15 @@ var Yt = Object.defineProperty, Kt = Object.defineProperties;
|
|
|
2
2
|
var Wt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var et = Object.getOwnPropertySymbols;
|
|
4
4
|
var Qt = Object.prototype.hasOwnProperty, _t = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var be = (L, o, v) => o in L ? Yt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v, tt = (L, o) => {
|
|
6
6
|
for (var v in o || (o = {}))
|
|
7
|
-
Qt.call(o, v) &&
|
|
7
|
+
Qt.call(o, v) && be(L, v, o[v]);
|
|
8
8
|
if (et)
|
|
9
9
|
for (var v of et(o))
|
|
10
|
-
_t.call(o, v) &&
|
|
10
|
+
_t.call(o, v) && be(L, v, o[v]);
|
|
11
11
|
return L;
|
|
12
12
|
}, nt = (L, o) => Kt(L, Wt(o));
|
|
13
|
-
var D = (L, o, v) => (
|
|
13
|
+
var D = (L, o, v) => (be(L, typeof o != "symbol" ? o + "" : o, v), v);
|
|
14
14
|
var z = (L, o, v) => new Promise((e, x) => {
|
|
15
15
|
var ce = (I) => {
|
|
16
16
|
try {
|
|
@@ -18,13 +18,13 @@ var z = (L, o, v) => new Promise((e, x) => {
|
|
|
18
18
|
} catch (h) {
|
|
19
19
|
x(h);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, b = (I) => {
|
|
22
22
|
try {
|
|
23
23
|
H(v.throw(I));
|
|
24
24
|
} catch (h) {
|
|
25
25
|
x(h);
|
|
26
26
|
}
|
|
27
|
-
}, H = (I) => I.done ? e(I.value) : Promise.resolve(I.value).then(ce,
|
|
27
|
+
}, H = (I) => I.done ? e(I.value) : Promise.resolve(I.value).then(ce, b);
|
|
28
28
|
H((v = v.apply(L, o)).next());
|
|
29
29
|
});
|
|
30
30
|
import { jsx as c, jsxs as A } from "react/jsx-runtime";
|
|
@@ -50,8 +50,8 @@ import pn from "../UploadingPrompt/index.mjs";
|
|
|
50
50
|
import yn from "./PromptSetting/index.mjs";
|
|
51
51
|
import { useMemoizedFn as we } from "ahooks";
|
|
52
52
|
import vn from "./Tools/SessionListDrawer/index.mjs";
|
|
53
|
-
import
|
|
54
|
-
import
|
|
53
|
+
import kn from "react-infinite-scroll-component";
|
|
54
|
+
import bn from "./Tools/ConnectToNetwork/index.mjs";
|
|
55
55
|
import wn from "./Tools/PromptManager/index.mjs";
|
|
56
56
|
import xn from "../../assets/icon.svg.mjs";
|
|
57
57
|
const In = Gt(rt), ot = {
|
|
@@ -82,7 +82,7 @@ const st = 10, Sn = (L) => {
|
|
|
82
82
|
currentSession: e,
|
|
83
83
|
onCreateSession: x,
|
|
84
84
|
embeddingService: ce,
|
|
85
|
-
setCurrentSession:
|
|
85
|
+
setCurrentSession: b,
|
|
86
86
|
networkStatus: H,
|
|
87
87
|
setNetworkStatus: I
|
|
88
88
|
} = L, [h, C] = m([]), [dt, S] = m(), [fe, xe] = m(), P = B(null), {
|
|
@@ -100,7 +100,7 @@ const st = 10, Sn = (L) => {
|
|
|
100
100
|
features: l,
|
|
101
101
|
popupContainer: g,
|
|
102
102
|
icon: ut
|
|
103
|
-
} = Xt(on), [Le, ue] = m(!1), p = B(h), Ce = B(), [ht, mt] = m(0), [X, q] = m(), [Y, te] = m(""), [Ne, he] = m(!1), me = B(null), [Fe, pt] = m([]), [Te, K] = m(!1), [Ee, yt] = m(!1), [vt,
|
|
103
|
+
} = Xt(on), [Le, ue] = m(!1), p = B(h), Ce = B(), [ht, mt] = m(0), [X, q] = m(), [Y, te] = m(""), [Ne, he] = m(!1), me = B(null), [Fe, pt] = m([]), [Te, K] = m(!1), [Ee, yt] = m(!1), [vt, kt] = m(""), [bt, W] = m(), [ne, ie] = m({}), oe = B(null), Pe = B(null), pe = B(null), [Re, wt] = m(!1), [xt, It] = m([]), [Lt, se] = m(!0), [Ct, Nt] = m(!0), [De, O] = m(!1), [ye, V] = m(!1), [He, Ft] = m(!1), [E, re] = m(typeof (l == null ? void 0 : l.promptVariables) == "object" ? l.promptVariables.default || [] : []), [Tt, Et] = m(typeof (l == null ? void 0 : l.knowledges) == "object" && l.knowledges.default || void 0), [Me, U] = m(!1), [Oe, Z] = m(!1), [Pt, Q] = m(typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.default) == "boolean" ? l.connectNetwork.default : !1), [Ue, ae] = m(!1);
|
|
104
104
|
T(() => {
|
|
105
105
|
var r, i;
|
|
106
106
|
e && (p.current = []), C([]);
|
|
@@ -185,7 +185,7 @@ const st = 10, Sn = (L) => {
|
|
|
185
185
|
});
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
|
-
if (!(E == null ? void 0 : E.every((
|
|
188
|
+
if (!(E == null ? void 0 : E.every((k) => !!(k != null && k.value))))
|
|
189
189
|
if (f != null && f.promptVariables) {
|
|
190
190
|
u.config({
|
|
191
191
|
getContainer: () => (g == null ? void 0 : g.current) || document.body
|
|
@@ -194,7 +194,7 @@ const st = 10, Sn = (L) => {
|
|
|
194
194
|
});
|
|
195
195
|
return;
|
|
196
196
|
} else
|
|
197
|
-
console.error("变量值不能为空", E == null ? void 0 : E.map((
|
|
197
|
+
console.error("变量值不能为空", E == null ? void 0 : E.map((k) => !!(k != null && k.value)));
|
|
198
198
|
if (ye) {
|
|
199
199
|
u.config({
|
|
200
200
|
getContainer: () => (g == null ? void 0 : g.current) || document.body
|
|
@@ -232,10 +232,10 @@ const st = 10, Sn = (L) => {
|
|
|
232
232
|
if (!i) {
|
|
233
233
|
x == null || x({
|
|
234
234
|
netOpen: H ? 1 : 2
|
|
235
|
-
}).then((
|
|
235
|
+
}).then((k) => {
|
|
236
236
|
var R, $;
|
|
237
|
-
U(!0), I(!!((R =
|
|
238
|
-
|
|
237
|
+
U(!0), I(!!((R = k.data) != null && R.netOpen)), Q(!!(($ = k.data) != null && $.enableNetOpen)), Dt(k).then(() => {
|
|
238
|
+
b == null || b(k), U(!1), xe(n);
|
|
239
239
|
});
|
|
240
240
|
});
|
|
241
241
|
return;
|
|
@@ -255,7 +255,7 @@ ${n}` : n;
|
|
|
255
255
|
files: ne[i]
|
|
256
256
|
}
|
|
257
257
|
}) : s = !0;
|
|
258
|
-
} catch (
|
|
258
|
+
} catch (k) {
|
|
259
259
|
s = !1;
|
|
260
260
|
}
|
|
261
261
|
if (ae(!1), s === !1)
|
|
@@ -265,7 +265,7 @@ ${n}` : n;
|
|
|
265
265
|
}), Dt = (t) => new Promise((n, r) => z(void 0, null, function* () {
|
|
266
266
|
const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.key !== "query").map((d) => {
|
|
267
267
|
var y;
|
|
268
|
-
const w = (y = E.find((
|
|
268
|
+
const w = (y = E.find((k) => k.key === d.key)) == null ? void 0 : y.value;
|
|
269
269
|
return d.value = w || "", d;
|
|
270
270
|
});
|
|
271
271
|
re(s.sort((d, w) => d.key.localeCompare(w.key))), yield t == null ? void 0 : t.setPromptVariables(s), n();
|
|
@@ -279,7 +279,7 @@ ${n}` : n;
|
|
|
279
279
|
a.has(y.id) || (i.push(y), a.add(y.id));
|
|
280
280
|
}), Promise.all(i.map((y) => F == null ? void 0 : F.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, y.id, {
|
|
281
281
|
enabled: 1
|
|
282
|
-
}).then((
|
|
282
|
+
}).then((k) => {
|
|
283
283
|
r.push(y);
|
|
284
284
|
}))).then((y) => {
|
|
285
285
|
se(!0), ve(t, r);
|
|
@@ -316,7 +316,7 @@ ${t}` : t;
|
|
|
316
316
|
};
|
|
317
317
|
}, [fe, e]);
|
|
318
318
|
const ve = (t, n) => z(void 0, null, function* () {
|
|
319
|
-
var y,
|
|
319
|
+
var y, k;
|
|
320
320
|
const r = (y = e == null ? void 0 : e.data) == null ? void 0 : y.id;
|
|
321
321
|
if (!r)
|
|
322
322
|
return;
|
|
@@ -347,7 +347,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
347
347
|
fileIds: d
|
|
348
348
|
}, w), ie({
|
|
349
349
|
[r]: []
|
|
350
|
-
}), (
|
|
350
|
+
}), (k = oe.current) == null || k.update();
|
|
351
351
|
});
|
|
352
352
|
T(() => {
|
|
353
353
|
var r;
|
|
@@ -410,7 +410,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
410
410
|
netOpen: H ? 1 : 2
|
|
411
411
|
}).then((i) => {
|
|
412
412
|
var a, s;
|
|
413
|
-
|
|
413
|
+
b == null || b(i), U(!1), I(!!((a = i.data) != null && a.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(je(i, t));
|
|
414
414
|
});
|
|
415
415
|
});
|
|
416
416
|
}), je = (t, n) => {
|
|
@@ -426,8 +426,8 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
426
426
|
he(!0), F == null || F.postTicket(a).then((d) => {
|
|
427
427
|
F.uploadMinioFile(d.minio, n).then(() => {
|
|
428
428
|
var R, $;
|
|
429
|
-
const w = (R = d.minio.endpoints) == null ? void 0 : R[0], y = d.minio.bucket,
|
|
430
|
-
i(`${location.protocol}//${w}/${y}/${
|
|
429
|
+
const w = (R = d.minio.endpoints) == null ? void 0 : R[0], y = d.minio.bucket, k = ($ = d.minio.fileKeys) == null ? void 0 : $[0];
|
|
430
|
+
i(`${location.protocol}//${w}/${y}/${k}`);
|
|
431
431
|
}).catch(() => {
|
|
432
432
|
te(""), q(void 0);
|
|
433
433
|
}).finally(() => {
|
|
@@ -512,14 +512,14 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
512
512
|
return;
|
|
513
513
|
I(t);
|
|
514
514
|
}
|
|
515
|
-
}),
|
|
515
|
+
}), ke = () => z(void 0, null, function* () {
|
|
516
516
|
e ? e.fetchData().then((t) => {
|
|
517
517
|
var n;
|
|
518
518
|
(n = e == null ? void 0 : e.data) != null && n.id && (I(t.netOpen), Q(t.enableNetOpen));
|
|
519
519
|
}) : (I(!1), Q(o.arrange[0].enableNetOpen));
|
|
520
520
|
});
|
|
521
521
|
T(() => {
|
|
522
|
-
|
|
522
|
+
ke();
|
|
523
523
|
}, [e]), T(() => {
|
|
524
524
|
var t, n;
|
|
525
525
|
if (P.current) {
|
|
@@ -547,7 +547,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
547
547
|
).map((a, s) => {
|
|
548
548
|
var w, y;
|
|
549
549
|
let d = "";
|
|
550
|
-
return typeof (l == null ? void 0 : l.promptVariables) == "object" && (d = ((y = (w = l.promptVariables.default) == null ? void 0 : w.find((
|
|
550
|
+
return typeof (l == null ? void 0 : l.promptVariables) == "object" && (d = ((y = (w = l.promptVariables.default) == null ? void 0 : w.find((k) => k.key === a.key)) == null ? void 0 : y.value) || ""), {
|
|
551
551
|
id: s + "",
|
|
552
552
|
key: a.key,
|
|
553
553
|
name: a.name,
|
|
@@ -564,7 +564,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
564
564
|
netOpen: H ? 1 : 2
|
|
565
565
|
}).then((t) => {
|
|
566
566
|
var n, r;
|
|
567
|
-
return
|
|
567
|
+
return b == null || b(t), U(!1), I(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), t;
|
|
568
568
|
}), Ae = Zt(() => {
|
|
569
569
|
var t;
|
|
570
570
|
return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(rt, {
|
|
@@ -581,7 +581,8 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
581
581
|
actions: [],
|
|
582
582
|
isLoading: !1
|
|
583
583
|
},
|
|
584
|
-
actions: !!h.length
|
|
584
|
+
actions: !!h.length,
|
|
585
|
+
markdown: l == null ? void 0 : l.markdown
|
|
585
586
|
}) : null;
|
|
586
587
|
}, [o == null ? void 0 : o.arrange, h]);
|
|
587
588
|
return /* @__PURE__ */ A("div", {
|
|
@@ -592,7 +593,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
592
593
|
currentSession: e,
|
|
593
594
|
promptVariables: E,
|
|
594
595
|
setPromptVariables: re,
|
|
595
|
-
setCurrentSession:
|
|
596
|
+
setCurrentSession: b
|
|
596
597
|
}), /* @__PURE__ */ A("div", {
|
|
597
598
|
className: "chat-main",
|
|
598
599
|
id: "chat-main",
|
|
@@ -608,7 +609,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
608
609
|
},
|
|
609
610
|
ref: P,
|
|
610
611
|
onScroll: jt,
|
|
611
|
-
children: (Be = e == null ? void 0 : e.data) != null && Be.id && (h != null && h.length) ? /* @__PURE__ */ A(
|
|
612
|
+
children: (Be = e == null ? void 0 : e.data) != null && Be.id && (h != null && h.length) ? /* @__PURE__ */ A(kn, {
|
|
612
613
|
dataLength: h.length,
|
|
613
614
|
next: Bt,
|
|
614
615
|
style: {
|
|
@@ -640,7 +641,8 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
640
641
|
isLastHistory: n === 0,
|
|
641
642
|
onRelatedClick: $t,
|
|
642
643
|
onAgainClick: At,
|
|
643
|
-
onEditClick: Vt
|
|
644
|
+
onEditClick: Vt,
|
|
645
|
+
markdown: l == null ? void 0 : l.markdown
|
|
644
646
|
}, t.messageId + n)), !Oe && Ae]
|
|
645
647
|
}) : /* @__PURE__ */ A("div", {
|
|
646
648
|
className: "main-empty",
|
|
@@ -778,14 +780,14 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
778
780
|
isFirstSession: Me,
|
|
779
781
|
docViewerUrl: v,
|
|
780
782
|
onStatusChange: (t) => z(void 0, null, function* () {
|
|
781
|
-
t !== "process" ? (se(!0),
|
|
783
|
+
t !== "process" ? (se(!0), ke()) : se(!1);
|
|
782
784
|
}),
|
|
783
785
|
createSession: () => new Promise((t) => {
|
|
784
786
|
U(!0), x == null || x({
|
|
785
787
|
netOpen: H ? 1 : 2
|
|
786
788
|
}).then((n) => {
|
|
787
789
|
var i, a, s;
|
|
788
|
-
|
|
790
|
+
b == null || b(n), U(!1), I(!!((i = n.data) != null && i.netOpen)), Q(!!((a = n.data) != null && a.enableNetOpen));
|
|
789
791
|
const r = ((s = n.data) == null ? void 0 : s.id) || "";
|
|
790
792
|
t(r);
|
|
791
793
|
});
|
|
@@ -819,7 +821,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
819
821
|
const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
|
|
820
822
|
t && (ie({
|
|
821
823
|
[t]: []
|
|
822
|
-
}),
|
|
824
|
+
}), ke());
|
|
823
825
|
}
|
|
824
826
|
}) : null, (f == null ? void 0 : f.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(wn, {
|
|
825
827
|
appId: o.id,
|
|
@@ -831,7 +833,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
831
833
|
disabled: M
|
|
832
834
|
})]
|
|
833
835
|
}), /* @__PURE__ */ A(le, {
|
|
834
|
-
children: [(f == null ? void 0 : f.connectNetwork) && o.type === 0 && ((Ge = o.arrange) == null ? void 0 : Ge.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(
|
|
836
|
+
children: [(f == null ? void 0 : f.connectNetwork) && o.type === 0 && ((Ge = o.arrange) == null ? void 0 : Ge.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(bn, {
|
|
835
837
|
sessionId: (Xe = e == null ? void 0 : e.data) == null ? void 0 : Xe.id,
|
|
836
838
|
netStatus: H,
|
|
837
839
|
enable: typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.diabled) == "boolean" ? !(l != null && l.connectNetwork.diabled) : Pt,
|
|
@@ -842,7 +844,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
842
844
|
}), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ c(vn, {
|
|
843
845
|
currentSessionId: (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id,
|
|
844
846
|
onSessionChange: (t, n) => {
|
|
845
|
-
W(void 0),
|
|
847
|
+
W(void 0), b == null || b(n);
|
|
846
848
|
},
|
|
847
849
|
disabled: M
|
|
848
850
|
}), (f == null ? void 0 : f.sessionOpen) && /* @__PURE__ */ c(_, {
|
|
@@ -852,7 +854,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
852
854
|
disabled: De || !e || !h.length || M,
|
|
853
855
|
onClick: () => {
|
|
854
856
|
var t, n;
|
|
855
|
-
|
|
857
|
+
b == null || b(void 0), I(!1), (t = Pe.current) == null || t.clear(), (n = pe.current) == null || n.clear();
|
|
856
858
|
},
|
|
857
859
|
children: "新会话"
|
|
858
860
|
})]
|
|
@@ -862,7 +864,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
862
864
|
children: /* @__PURE__ */ c(dn, {
|
|
863
865
|
ref: me,
|
|
864
866
|
maxLength: ht,
|
|
865
|
-
text:
|
|
867
|
+
text: bt,
|
|
866
868
|
networkStatus: !1,
|
|
867
869
|
loading: Ue,
|
|
868
870
|
disabled: Le || Ne || M || Ue,
|
|
@@ -870,7 +872,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
|
|
|
870
872
|
onChange: (t, n) => {
|
|
871
873
|
W(t);
|
|
872
874
|
const r = n.getText().replace(/[\n\s]+$/, "");
|
|
873
|
-
S(r),
|
|
875
|
+
S(r), kt(r), Ee || yt(!0);
|
|
874
876
|
},
|
|
875
877
|
clearAction: /* @__PURE__ */ c(le, {
|
|
876
878
|
size: 0,
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var w = (g, i, s) => i in g ?
|
|
1
|
+
var Y = Object.defineProperty, Z = Object.defineProperties;
|
|
2
|
+
var q = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var P = Object.getOwnPropertySymbols;
|
|
4
|
+
var ee = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var w = (g, i, s) => i in g ? Y(g, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : g[i] = s, o = (g, i) => {
|
|
6
6
|
for (var s in i || (i = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var s of
|
|
10
|
-
|
|
7
|
+
ee.call(i, s) && w(g, s, i[s]);
|
|
8
|
+
if (P)
|
|
9
|
+
for (var s of P(i))
|
|
10
|
+
ie.call(i, s) && w(g, s, i[s]);
|
|
11
11
|
return g;
|
|
12
|
-
}, m = (g, i) =>
|
|
12
|
+
}, m = (g, i) => Z(g, q(i));
|
|
13
13
|
var a = (g, i, s) => (w(g, typeof i != "symbol" ? i + "" : i, s), s);
|
|
14
|
-
import { jsx as
|
|
14
|
+
import { jsx as J, Fragment as te } from "react/jsx-runtime";
|
|
15
15
|
import l from "lodash/merge";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { notification as
|
|
19
|
-
import
|
|
20
|
-
import { defaultUIConfig as
|
|
21
|
-
import { ApiUrl as
|
|
22
|
-
/* empty css */import { BotClientApi as
|
|
23
|
-
import { JWT as
|
|
16
|
+
import Q from "react-dom";
|
|
17
|
+
import oe from "./AgentClientUI.mjs";
|
|
18
|
+
import { notification as G } from "antd";
|
|
19
|
+
import se from "axios";
|
|
20
|
+
import { defaultUIConfig as ne, defaultApiUrl as re, defaultDovViewerUrl as he } from "./constant.mjs";
|
|
21
|
+
import { ApiUrl as ae } from "./types.mjs";
|
|
22
|
+
/* empty css */import { BotClientApi as ge } from "@glodon-aiot/apis";
|
|
23
|
+
import { JWT as le, isExpired as de } from "./utils/index.mjs";
|
|
24
24
|
const b = {};
|
|
25
|
-
class
|
|
25
|
+
class ye {
|
|
26
26
|
constructor(i) {
|
|
27
27
|
a(this, "_token");
|
|
28
28
|
a(this, "_activeSession", null);
|
|
@@ -36,10 +36,10 @@ class xe {
|
|
|
36
36
|
a(this, "service");
|
|
37
37
|
a(this, "rId", 0);
|
|
38
38
|
a(this, "_mode", "float");
|
|
39
|
-
a(this, "uiConfig",
|
|
39
|
+
a(this, "uiConfig", ne);
|
|
40
40
|
a(this, "errorHandlers", {});
|
|
41
41
|
a(this, "wrapper", document.createElement("div"));
|
|
42
|
-
var _, y, x, U, S, B, H, z, L, M, V, A, N, E, F, D, j, T, R, W, $, O
|
|
42
|
+
var _, y, x, U, S, B, H, z, L, M, V, A, N, E, F, D, j, T, R, W, $, O;
|
|
43
43
|
const {
|
|
44
44
|
env: s,
|
|
45
45
|
token: d,
|
|
@@ -51,42 +51,42 @@ class xe {
|
|
|
51
51
|
errorHandlers: r,
|
|
52
52
|
features: e,
|
|
53
53
|
sessionId: u,
|
|
54
|
-
icon:
|
|
55
|
-
logo:
|
|
54
|
+
icon: K,
|
|
55
|
+
logo: X
|
|
56
56
|
// greeting,
|
|
57
57
|
} = i;
|
|
58
|
-
this.uiConfig.icon =
|
|
58
|
+
this.uiConfig.icon = K || this.uiConfig.icon, this.uiConfig.logo = X || this.uiConfig.logo, (e == null ? void 0 : e.greeting) !== void 0 && (typeof e.greeting == "object" ? this.uiConfig.features = m(o({}, this.uiConfig.features), {
|
|
59
59
|
greeting: o(o({}, typeof ((_ = this.uiConfig.features) == null ? void 0 : _.greeting) != "object" ? {} : (y = this.uiConfig.features) == null ? void 0 : y.greeting), e.greeting)
|
|
60
60
|
}) : this.uiConfig.features = m(o({}, this.uiConfig.features), {
|
|
61
61
|
greeting: e.greeting
|
|
62
|
-
})),
|
|
62
|
+
})), this._token = d, this.rId = 0, this._defatulSessionId = u, this.errorHandlers = o(o({}, this.errorHandlers), r);
|
|
63
63
|
const k = {
|
|
64
64
|
sessionOpen: f === "float",
|
|
65
65
|
sessionList: f === "float"
|
|
66
|
-
}, I = (
|
|
67
|
-
(
|
|
66
|
+
}, I = (S = (U = (x = e == null ? void 0 : e.botMessageBox) == null ? void 0 : x.footer) == null ? void 0 : U.items) == null ? void 0 : S.find((c) => c.componentName === "AnswerAgain");
|
|
67
|
+
(z = (H = (B = e == null ? void 0 : e.botMessageBox) == null ? void 0 : B.footer) == null ? void 0 : H.items) == null || z.find((c) => c.componentName === "Copy");
|
|
68
68
|
const C = {
|
|
69
69
|
sessionList: e == null ? void 0 : e.sessionList,
|
|
70
70
|
sessionOpen: e == null ? void 0 : e.newSession,
|
|
71
71
|
fileUpload: e == null ? void 0 : e.fileUpload,
|
|
72
|
-
userCopy: (
|
|
73
|
-
userEdit: (
|
|
72
|
+
userCopy: (L = e == null ? void 0 : e.userMessageBox) == null ? void 0 : L.copy,
|
|
73
|
+
userEdit: (M = e == null ? void 0 : e.userMessageBox) == null ? void 0 : M.editAgain,
|
|
74
74
|
userPrompt: e == null ? void 0 : e.fileUpload,
|
|
75
75
|
prompt: e == null ? void 0 : e.prompts,
|
|
76
|
-
relate: (
|
|
76
|
+
relate: (V = e == null ? void 0 : e.botMessageBox) == null ? void 0 : V.relatedQuesions,
|
|
77
77
|
again: !(I && I.visible === !1),
|
|
78
78
|
reference: {
|
|
79
|
-
iconVisible: (
|
|
80
|
-
referenceFirst: (
|
|
81
|
-
isExpand: (
|
|
79
|
+
iconVisible: (N = (A = e == null ? void 0 : e.botMessageBox) == null ? void 0 : A.reference) == null ? void 0 : N.file,
|
|
80
|
+
referenceFirst: (E = e == null ? void 0 : e.botMessageBox) == null ? void 0 : E.referenceFirst,
|
|
81
|
+
isExpand: (D = (F = e == null ? void 0 : e.botMessageBox) == null ? void 0 : F.reference) == null ? void 0 : D.itemExpanded
|
|
82
82
|
},
|
|
83
|
-
searchReference: (
|
|
83
|
+
searchReference: (j = e == null ? void 0 : e.botMessageBox) == null ? void 0 : j.searchReference,
|
|
84
84
|
knowledges: !!(e != null && e.knowledges),
|
|
85
85
|
metadata: e == null ? void 0 : e.metadata,
|
|
86
86
|
greet: (e == null ? void 0 : e.greeting) !== !1,
|
|
87
87
|
imageUpload: e == null ? void 0 : e.imageUpload,
|
|
88
|
-
promptVariables: (e == null ? void 0 : e.promptVariables) === void 0 ? (
|
|
89
|
-
connectNetwork: (e == null ? void 0 : e.connectNetwork) === void 0 ? (
|
|
88
|
+
promptVariables: (e == null ? void 0 : e.promptVariables) === void 0 ? (T = this.uiConfig.transform) == null ? void 0 : T.promptVariables : (e == null ? void 0 : e.promptVariables) === !0 || typeof (e == null ? void 0 : e.promptVariables) == "object" && ((R = e == null ? void 0 : e.promptVariables) == null ? void 0 : R.visible) !== !1 ? (W = this.uiConfig.transform) == null ? void 0 : W.promptVariables : !1,
|
|
89
|
+
connectNetwork: (e == null ? void 0 : e.connectNetwork) === void 0 ? ($ = this.uiConfig.transform) == null ? void 0 : $.connectNetwork : (e == null ? void 0 : e.connectNetwork) === !0 || (typeof (e == null ? void 0 : e.connectNetwork) == "object" && typeof (e == null ? void 0 : e.connectNetwork.visible) == "boolean" ? e == null ? void 0 : e.connectNetwork.visible : (O = this.uiConfig.transform) == null ? void 0 : O.connectNetwork)
|
|
90
90
|
}, v = {
|
|
91
91
|
sider: f === "inlay"
|
|
92
92
|
};
|
|
@@ -122,7 +122,7 @@ class xe {
|
|
|
122
122
|
transform: o(o(o(o({}, this.uiConfig.transform), k), i.transform), C)
|
|
123
123
|
}), this.uiConfig.getContainer().append(this.wrapper);
|
|
124
124
|
}
|
|
125
|
-
this._mode = f, this.env = s || "prod", this._applicationId =
|
|
125
|
+
this._mode = f, this.env = s || "prod", this._applicationId = le(d).rid, this.apiUrl = n || ae[this.env] || re, this.docViewerUrl = t || he, this.service = this.setService(), this.render();
|
|
126
126
|
}
|
|
127
127
|
get token() {
|
|
128
128
|
return this._token;
|
|
@@ -174,7 +174,7 @@ class xe {
|
|
|
174
174
|
const r = this.token;
|
|
175
175
|
if (!r)
|
|
176
176
|
return t;
|
|
177
|
-
if (
|
|
177
|
+
if (de(r)) {
|
|
178
178
|
const u = "token is timeout";
|
|
179
179
|
this.errorHandlers.token ? typeof this.errorHandlers.token == "function" ? this.errorHandlers.token(
|
|
180
180
|
// @ts-ignore
|
|
@@ -191,7 +191,7 @@ class xe {
|
|
|
191
191
|
}), t;
|
|
192
192
|
};
|
|
193
193
|
function d(t, r = !0) {
|
|
194
|
-
const e = `${i}${t}`, u =
|
|
194
|
+
const e = `${i}${t}`, u = se.create({
|
|
195
195
|
baseURL: e
|
|
196
196
|
});
|
|
197
197
|
return r && u.interceptors.request.use(s), u;
|
|
@@ -210,13 +210,13 @@ class xe {
|
|
|
210
210
|
) : console.error("errorHandlers.token is not a function") : console.error(e);
|
|
211
211
|
}
|
|
212
212
|
}, p = (t, r, e) => {
|
|
213
|
-
t !== 10001 && t !== 10215 && (e || (
|
|
213
|
+
t !== 10001 && t !== 10215 && (e || (G.config({
|
|
214
214
|
getContainer: this.uiConfig.getContainer
|
|
215
|
-
}),
|
|
215
|
+
}), G.error({
|
|
216
216
|
message: r
|
|
217
217
|
})));
|
|
218
218
|
}, h = d("");
|
|
219
|
-
return new
|
|
219
|
+
return new ge(h, () => this.token, {
|
|
220
220
|
onHttpStatusError: f,
|
|
221
221
|
onAppStatusError: p
|
|
222
222
|
});
|
|
@@ -243,7 +243,7 @@ class xe {
|
|
|
243
243
|
render() {
|
|
244
244
|
var s, d, f, p;
|
|
245
245
|
let i = this.wrapper.getBoundingClientRect().height;
|
|
246
|
-
this.wrapper.style.height = `${i}px`,
|
|
246
|
+
this.wrapper.style.height = `${i}px`, Q.render(/* @__PURE__ */ J(oe, {
|
|
247
247
|
rId: this.rId,
|
|
248
248
|
sessionId: this._defatulSessionId,
|
|
249
249
|
showHeader: this.uiConfig.showHeader,
|
|
@@ -339,9 +339,9 @@ class xe {
|
|
|
339
339
|
}), this.wrapper), this._defaultInputText = "";
|
|
340
340
|
}
|
|
341
341
|
destroy(i) {
|
|
342
|
-
|
|
342
|
+
Q.render(/* @__PURE__ */ J(te, {}), this.wrapper, i);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
export {
|
|
346
|
-
|
|
346
|
+
ye as default
|
|
347
347
|
};
|
|
@@ -1,42 +1,44 @@
|
|
|
1
1
|
import { jsx as f, jsxs as h, Fragment as O } from "react/jsx-runtime";
|
|
2
|
-
var
|
|
3
|
-
for (var
|
|
4
|
-
u.call(e,
|
|
2
|
+
var g = Object.defineProperty, m = Object.defineProperties, j = Object.getOwnPropertyDescriptors, l = Object.getOwnPropertySymbols, u = Object.prototype.hasOwnProperty, d = Object.prototype.propertyIsEnumerable, v = (r, e, n) => e in r ? g(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n, w = (r, e) => {
|
|
3
|
+
for (var n in e || (e = {}))
|
|
4
|
+
u.call(e, n) && v(r, n, e[n]);
|
|
5
5
|
if (l)
|
|
6
|
-
for (var
|
|
7
|
-
d.call(e,
|
|
6
|
+
for (var n of l(e))
|
|
7
|
+
d.call(e, n) && v(r, n, e[n]);
|
|
8
8
|
return r;
|
|
9
|
-
}, y = (r, e) =>
|
|
10
|
-
var
|
|
11
|
-
for (var
|
|
12
|
-
u.call(r,
|
|
9
|
+
}, y = (r, e) => m(r, j(e)), x = (r, e) => {
|
|
10
|
+
var n = {};
|
|
11
|
+
for (var a in r)
|
|
12
|
+
u.call(r, a) && e.indexOf(a) < 0 && (n[a] = r[a]);
|
|
13
13
|
if (r != null && l)
|
|
14
|
-
for (var
|
|
15
|
-
e.indexOf(
|
|
16
|
-
return
|
|
14
|
+
for (var a of l(r))
|
|
15
|
+
e.indexOf(a) < 0 && d.call(r, a) && (n[a] = r[a]);
|
|
16
|
+
return n;
|
|
17
17
|
};
|
|
18
18
|
const P = (r) => {
|
|
19
|
-
var e,
|
|
20
|
-
const
|
|
19
|
+
var e, n;
|
|
20
|
+
const a = r, {
|
|
21
21
|
node: o
|
|
22
|
-
} =
|
|
22
|
+
} = a, i = x(a, [
|
|
23
23
|
"node"
|
|
24
24
|
]);
|
|
25
25
|
if (o.tagName === "a" && ((e = o.children) == null ? void 0 : e.length) > 0) {
|
|
26
|
-
const
|
|
27
|
-
let
|
|
26
|
+
const p = ((n = o.children[0]) == null ? void 0 : n.value) || "";
|
|
27
|
+
let s = /(^https?:\/\/|^www\.)(?:www\.)?[\w\-]+(\.[\w\-]+)+(\/[\w\- .\/?%&=]*)?/g, c = p.match(s), b = p.replace(s, "").trim();
|
|
28
28
|
if (!(c != null && c.length))
|
|
29
|
-
return /* @__PURE__ */ f("a",
|
|
30
|
-
const
|
|
29
|
+
return /* @__PURE__ */ f("a", w({}, i));
|
|
30
|
+
const t = c[0];
|
|
31
31
|
return /* @__PURE__ */ h(O, {
|
|
32
|
-
children: [/* @__PURE__ */ f("a", y(
|
|
33
|
-
href: /^www\./.test(
|
|
34
|
-
|
|
32
|
+
children: [/* @__PURE__ */ f("a", y(w({
|
|
33
|
+
href: /^www\./.test(t) ? "//" + t : t,
|
|
34
|
+
onClick: () => window.open(r.href, r.target || "_blank")
|
|
35
|
+
}, i), {
|
|
36
|
+
children: t
|
|
35
37
|
})), b]
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
|
-
return /* @__PURE__ */ f("a",
|
|
39
|
-
},
|
|
40
|
+
return /* @__PURE__ */ f("a", w({}, i));
|
|
41
|
+
}, A = P;
|
|
40
42
|
export {
|
|
41
|
-
|
|
43
|
+
A as default
|
|
42
44
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { Image as
|
|
1
|
+
import { jsx as e, jsxs as v, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { Image as g } from "antd";
|
|
3
3
|
import "../../../../../../../node_modules/antd-mobile/es/global/index.mjs";
|
|
4
|
-
import
|
|
5
|
-
import { useState as
|
|
6
|
-
import { isMobile as
|
|
7
|
-
import
|
|
8
|
-
import { checkMediaType as
|
|
9
|
-
var
|
|
4
|
+
import y from "../../../../../../../node_modules/antd-mobile/es/components/image-viewer/index.mjs";
|
|
5
|
+
import { useState as i, useEffect as O } from "react";
|
|
6
|
+
import { isMobile as j } from "../../../../../../../node_modules/react-device-detect/dist/lib.mjs";
|
|
7
|
+
import h from "../Video/index.mjs";
|
|
8
|
+
import { checkMediaType as w } from "../../../utils/markdown/index.mjs";
|
|
9
|
+
var P = Object.defineProperty, k = Object.defineProperties, x = Object.getOwnPropertyDescriptors, m = Object.getOwnPropertySymbols, C = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable, p = (r, o, t) => o in r ? P(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t, l = (r, o) => {
|
|
10
10
|
for (var t in o || (o = {}))
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
for (var t of
|
|
14
|
-
|
|
11
|
+
C.call(o, t) && p(r, t, o[t]);
|
|
12
|
+
if (m)
|
|
13
|
+
for (var t of m(o))
|
|
14
|
+
E.call(o, t) && p(r, t, o[t]);
|
|
15
15
|
return r;
|
|
16
|
-
},
|
|
17
|
-
const
|
|
18
|
-
const [o, t] =
|
|
19
|
-
return
|
|
20
|
-
r.src &&
|
|
21
|
-
}, [r.src]),
|
|
16
|
+
}, f = (r, o) => k(r, x(o));
|
|
17
|
+
const M = (r) => {
|
|
18
|
+
const [o, t] = i(!1), [b, u] = i();
|
|
19
|
+
return O(() => {
|
|
20
|
+
r.src && u(w(r.src));
|
|
21
|
+
}, [r.src]), b == "video" ? /* @__PURE__ */ e(h, {
|
|
22
22
|
src: r.src,
|
|
23
23
|
controls: !0
|
|
24
|
-
}) :
|
|
25
|
-
children: [/* @__PURE__ */ e("img", {
|
|
24
|
+
}) : j ? /* @__PURE__ */ v(d, {
|
|
25
|
+
children: [/* @__PURE__ */ e("img", l({
|
|
26
26
|
style: {
|
|
27
27
|
maxWidth: "100%"
|
|
28
28
|
},
|
|
@@ -30,27 +30,29 @@ const C = (r) => {
|
|
|
30
30
|
onClick: () => {
|
|
31
31
|
t(!0);
|
|
32
32
|
}
|
|
33
|
-
}), /* @__PURE__ */ e(
|
|
33
|
+
}, r)), /* @__PURE__ */ e(y, {
|
|
34
34
|
image: (r == null ? void 0 : r.src) || "",
|
|
35
35
|
visible: o,
|
|
36
36
|
onClose: () => {
|
|
37
37
|
t(!1);
|
|
38
38
|
}
|
|
39
39
|
})]
|
|
40
|
-
}) : /* @__PURE__ */ e(
|
|
40
|
+
}) : /* @__PURE__ */ e(g, f(l({
|
|
41
41
|
style: {
|
|
42
42
|
maxWidth: "100%"
|
|
43
43
|
}
|
|
44
44
|
}, r), {
|
|
45
|
-
onClick: (
|
|
46
|
-
var
|
|
47
|
-
|
|
45
|
+
onClick: (s) => {
|
|
46
|
+
var a, n, c;
|
|
47
|
+
(c = r.onClick) == null || c.call(r, f(l({}, s), {
|
|
48
|
+
target: (n = (a = s.target) == null ? void 0 : a.offsetParent) == null ? void 0 : n.children[0]
|
|
49
|
+
}));
|
|
48
50
|
},
|
|
49
51
|
onError: () => {
|
|
50
52
|
console.log(r), console.warn("图片加载失败");
|
|
51
53
|
}
|
|
52
54
|
}));
|
|
53
|
-
},
|
|
55
|
+
}, _ = M;
|
|
54
56
|
export {
|
|
55
|
-
|
|
57
|
+
_ as default
|
|
56
58
|
};
|