@glodon-aiot/agent-cli-ui 3.3.5-alpha.21 → 3.3.5-alpha.23
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/AgentClientUI.mjs +89 -102
- package/dist/es/Dialog/index.mjs +29 -25
- package/dist/es/index.mjs +222 -242
- 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/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/style17.css +1 -1
- package/dist/es/src/style19.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/style25.css +1 -1
- package/dist/es/src/style28.css +1 -1
- package/dist/es/src/style29.css +1 -1
- package/dist/es/src/style30.css +1 -1
- package/dist/es/src/style4.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style6.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style8.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.js +50 -50
- package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/fetch.d.ts +44 -0
- package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/index.d.ts +1 -0
- package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/parse.d.ts +36 -0
- package/dist/src/utils/reactCompatibility.d.ts +27 -0
- package/package.json +3 -3
|
@@ -1,149 +1,136 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Q = Object.defineProperty, T = Object.defineProperties;
|
|
2
|
+
var X = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var y = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var Y = Object.prototype.hasOwnProperty, Z = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var R = (o, t, e) => t in o ? Q(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, f = (o, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
7
|
+
Y.call(t, e) && R(o, e, t[e]);
|
|
8
8
|
if (y)
|
|
9
9
|
for (var e of y(t))
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
10
|
+
Z.call(t, e) && R(o, e, t[e]);
|
|
11
|
+
return o;
|
|
12
|
+
}, g = (o, t) => T(o, X(t));
|
|
13
13
|
import { jsx as s, jsxs as x } from "react/jsx-runtime";
|
|
14
|
-
import { forwardRef as
|
|
15
|
-
/* empty css */import { AgentClientProvider as
|
|
16
|
-
import { Resizable as
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
import he from "antd/es/locale/zh_CN";
|
|
22
|
-
const ke = ie((n, t) => {
|
|
14
|
+
import { forwardRef as _, useRef as U, useState as r, useEffect as k, useImperativeHandle as B } from "react";
|
|
15
|
+
/* empty css */import { AgentClientProvider as z } from "./context.mjs";
|
|
16
|
+
import { Resizable as ee } from "react-resizable";
|
|
17
|
+
import te from "./Dialog/index.mjs";
|
|
18
|
+
import { ConfigProvider as A, Spin as ne, Button as L } from "antd";
|
|
19
|
+
import oe from "antd/es/locale/zh_CN";
|
|
20
|
+
const Ne = _((o, t) => {
|
|
23
21
|
const {
|
|
24
22
|
className: e,
|
|
25
23
|
triggerButton: l,
|
|
26
|
-
size:
|
|
24
|
+
size: n,
|
|
27
25
|
theme: $,
|
|
28
|
-
icon:
|
|
26
|
+
icon: p,
|
|
29
27
|
docViewerUrl: H,
|
|
30
|
-
token:
|
|
31
|
-
debug:
|
|
32
|
-
env:
|
|
33
|
-
plugins:
|
|
34
|
-
mcp:
|
|
35
|
-
footer:
|
|
36
|
-
defaultInput:
|
|
37
|
-
onComment:
|
|
38
|
-
onSessionLoad:
|
|
39
|
-
onSessionUnload:
|
|
40
|
-
onMessage:
|
|
41
|
-
beforeMessageSend:
|
|
42
|
-
bodyStyle:
|
|
43
|
-
apiUrl:
|
|
44
|
-
sessionId:
|
|
45
|
-
disabled:
|
|
46
|
-
transform:
|
|
47
|
-
features:
|
|
48
|
-
stream:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
debug: W,
|
|
56
|
-
env: j,
|
|
57
|
-
apiRoot: q
|
|
58
|
-
});
|
|
59
|
-
const r = new me(m, {
|
|
60
|
-
plugins: M,
|
|
61
|
-
mcp: P,
|
|
62
|
-
stream: X
|
|
63
|
-
});
|
|
64
|
-
_(r);
|
|
65
|
-
}, [m]), L.config({
|
|
28
|
+
token: ie,
|
|
29
|
+
debug: se,
|
|
30
|
+
env: le,
|
|
31
|
+
plugins: ae,
|
|
32
|
+
mcp: de,
|
|
33
|
+
footer: j,
|
|
34
|
+
defaultInput: M,
|
|
35
|
+
onComment: P,
|
|
36
|
+
onSessionLoad: S,
|
|
37
|
+
onSessionUnload: W,
|
|
38
|
+
onMessage: D,
|
|
39
|
+
beforeMessageSend: E,
|
|
40
|
+
bodyStyle: u,
|
|
41
|
+
apiUrl: re,
|
|
42
|
+
sessionId: O,
|
|
43
|
+
disabled: V,
|
|
44
|
+
transform: q,
|
|
45
|
+
features: F,
|
|
46
|
+
stream: me,
|
|
47
|
+
agentClient: m,
|
|
48
|
+
application: d
|
|
49
|
+
} = o, b = U(null), [G, ce] = r(!1), [C, J] = r(), [i, v] = r(n), [w, N] = r(o.open), c = U(null);
|
|
50
|
+
k(() => {
|
|
51
|
+
d && (console.log("[AgentClientUI] token", m, d), J(d.id));
|
|
52
|
+
}, [d]), A.config({
|
|
66
53
|
theme: $
|
|
67
|
-
}),
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
const
|
|
71
|
-
element:
|
|
72
|
-
size:
|
|
54
|
+
}), k(() => {
|
|
55
|
+
n && v(n);
|
|
56
|
+
}, [n]);
|
|
57
|
+
const K = (a, {
|
|
58
|
+
element: h,
|
|
59
|
+
size: I
|
|
73
60
|
}) => {
|
|
74
|
-
|
|
75
|
-
width: Number(
|
|
76
|
-
height:
|
|
61
|
+
v({
|
|
62
|
+
width: Number(I.width),
|
|
63
|
+
height: I.height
|
|
77
64
|
});
|
|
78
65
|
};
|
|
79
|
-
return
|
|
66
|
+
return B(t, () => ({
|
|
80
67
|
sessionCreate: (a) => {
|
|
81
|
-
var
|
|
82
|
-
return (
|
|
68
|
+
var h;
|
|
69
|
+
return (h = c.current) == null ? void 0 : h.sessionCreate(a);
|
|
83
70
|
},
|
|
84
71
|
getSessionList: () => {
|
|
85
72
|
var a;
|
|
86
73
|
return (a = c.current) == null ? void 0 : a.getSessionList();
|
|
87
74
|
}
|
|
88
|
-
})), /* @__PURE__ */ s(
|
|
89
|
-
locale:
|
|
90
|
-
children: /* @__PURE__ */ x(
|
|
91
|
-
value:
|
|
92
|
-
popupContainer:
|
|
93
|
-
agentClient:
|
|
94
|
-
footer:
|
|
95
|
-
defaultInput:
|
|
96
|
-
onComment:
|
|
97
|
-
onSessionLoad:
|
|
98
|
-
onSessionUnload:
|
|
99
|
-
onMessage:
|
|
100
|
-
beforeMessageSend:
|
|
101
|
-
bodyStyle:
|
|
102
|
-
disabled:
|
|
103
|
-
transform:
|
|
104
|
-
features:
|
|
75
|
+
})), /* @__PURE__ */ s(A, {
|
|
76
|
+
locale: oe,
|
|
77
|
+
children: /* @__PURE__ */ x(z, {
|
|
78
|
+
value: g(f({}, o), {
|
|
79
|
+
popupContainer: b,
|
|
80
|
+
agentClient: m,
|
|
81
|
+
footer: j,
|
|
82
|
+
defaultInput: M,
|
|
83
|
+
onComment: P,
|
|
84
|
+
onSessionLoad: S,
|
|
85
|
+
onSessionUnload: W,
|
|
86
|
+
onMessage: D,
|
|
87
|
+
beforeMessageSend: E,
|
|
88
|
+
bodyStyle: u,
|
|
89
|
+
disabled: V,
|
|
90
|
+
transform: q,
|
|
91
|
+
features: F
|
|
105
92
|
}),
|
|
106
|
-
children: [/* @__PURE__ */ s(
|
|
93
|
+
children: [/* @__PURE__ */ s(ee, {
|
|
107
94
|
height: (i == null ? void 0 : i.height) || "100%",
|
|
108
95
|
width: (i == null ? void 0 : i.width) || "100%",
|
|
109
96
|
maxConstraints: [document.body.clientWidth - 45],
|
|
110
|
-
minConstraints: [Number(
|
|
111
|
-
onResize:
|
|
97
|
+
minConstraints: [Number(n == null ? void 0 : n.minWidth)],
|
|
98
|
+
onResize: K,
|
|
112
99
|
handle: /* @__PURE__ */ s("span", {
|
|
113
100
|
className: "resize-handle-ew"
|
|
114
101
|
}),
|
|
115
102
|
resizeHandles: e == "float" ? ["w"] : [],
|
|
116
103
|
children: /* @__PURE__ */ x("div", {
|
|
117
104
|
id: "dialog-modal",
|
|
118
|
-
className: `gbot-dialog-modal ${e} ${
|
|
119
|
-
style:
|
|
120
|
-
width: e == "float" ? i == null ? void 0 : i.width :
|
|
121
|
-
height: e === "float" ? i == null ? void 0 : i.height :
|
|
105
|
+
className: `gbot-dialog-modal ${e} ${w ? "opened" : "closed"}`,
|
|
106
|
+
style: g(f({}, n), {
|
|
107
|
+
width: e == "float" ? i == null ? void 0 : i.width : n == null ? void 0 : n.width,
|
|
108
|
+
height: e === "float" ? i == null ? void 0 : i.height : n == null ? void 0 : n.height,
|
|
122
109
|
maxHeight: "100vh"
|
|
123
110
|
}),
|
|
124
|
-
ref:
|
|
125
|
-
children: [
|
|
111
|
+
ref: b,
|
|
112
|
+
children: [G ? /* @__PURE__ */ s("div", {
|
|
126
113
|
className: "loading",
|
|
127
|
-
children: /* @__PURE__ */ s(
|
|
128
|
-
}) : C &&
|
|
114
|
+
children: /* @__PURE__ */ s(ne, {})
|
|
115
|
+
}) : C && m ? /* @__PURE__ */ s(te, {
|
|
129
116
|
ref: c,
|
|
130
117
|
appId: C,
|
|
131
118
|
docViewerUrl: H,
|
|
132
|
-
bodyStyle:
|
|
133
|
-
sessionId:
|
|
134
|
-
}) : null, (l == null ? void 0 : l.visible) && /* @__PURE__ */ s(
|
|
119
|
+
bodyStyle: u,
|
|
120
|
+
sessionId: O
|
|
121
|
+
}) : null, (l == null ? void 0 : l.visible) && /* @__PURE__ */ s(L, {
|
|
135
122
|
className: "trigger-btn close-btn",
|
|
136
123
|
icon: /* @__PURE__ */ s("img", {
|
|
137
|
-
src:
|
|
124
|
+
src: p
|
|
138
125
|
}),
|
|
139
126
|
onClick: () => N(!1)
|
|
140
127
|
})]
|
|
141
128
|
})
|
|
142
|
-
}), (l == null ? void 0 : l.visible) && !
|
|
129
|
+
}), (l == null ? void 0 : l.visible) && !w && /* @__PURE__ */ s(L, {
|
|
143
130
|
className: `${e}-trigger-btn open-btn`,
|
|
144
131
|
style: l.style,
|
|
145
132
|
icon: /* @__PURE__ */ s("img", {
|
|
146
|
-
src:
|
|
133
|
+
src: p
|
|
147
134
|
}),
|
|
148
135
|
onClick: () => N(!0)
|
|
149
136
|
})]
|
|
@@ -151,5 +138,5 @@ const ke = ie((n, t) => {
|
|
|
151
138
|
});
|
|
152
139
|
});
|
|
153
140
|
export {
|
|
154
|
-
|
|
141
|
+
Ne as default
|
|
155
142
|
};
|
package/dist/es/Dialog/index.mjs
CHANGED
|
@@ -17,17 +17,17 @@ var v = (i, o, n) => new Promise((l, g) => {
|
|
|
17
17
|
} catch (u) {
|
|
18
18
|
g(u);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, r = (e) => {
|
|
21
21
|
try {
|
|
22
22
|
f(n.throw(e));
|
|
23
23
|
} catch (u) {
|
|
24
24
|
g(u);
|
|
25
25
|
}
|
|
26
|
-
}, f = (e) => e.done ? l(e.value) : Promise.resolve(e.value).then(s,
|
|
26
|
+
}, f = (e) => e.done ? l(e.value) : Promise.resolve(e.value).then(s, r);
|
|
27
27
|
f((n = n.apply(i, o)).next());
|
|
28
28
|
});
|
|
29
|
-
import { jsx as
|
|
30
|
-
import { forwardRef as B, useState as p, useContext as F, useRef as G, useEffect as
|
|
29
|
+
import { jsx as a, jsxs as A } from "react/jsx-runtime";
|
|
30
|
+
import { forwardRef as B, useState as p, useContext as F, useRef as G, useEffect as y, useImperativeHandle as J } from "react";
|
|
31
31
|
import M from "../context.mjs";
|
|
32
32
|
import Q from "./AgentChat/index.mjs";
|
|
33
33
|
import T from "../components/KnowledgeList/index.mjs";
|
|
@@ -37,17 +37,17 @@ import W from "./SessionList/index.mjs";
|
|
|
37
37
|
sessionId: n,
|
|
38
38
|
appId: l,
|
|
39
39
|
docViewerUrl: g
|
|
40
|
-
} = i, [s,
|
|
40
|
+
} = i, [s, r] = p(), {
|
|
41
41
|
showHeader: f,
|
|
42
42
|
agentClient: e,
|
|
43
43
|
sider: u,
|
|
44
44
|
onSessionLoad: m,
|
|
45
45
|
features: c
|
|
46
|
-
} = F(M), [h, H] = p(),
|
|
47
|
-
|
|
46
|
+
} = F(M), [h, H] = p(), I = G(null), [K, D] = p(""), [S, k] = p(), [b, N] = p(!1);
|
|
47
|
+
y(() => {
|
|
48
48
|
var d;
|
|
49
49
|
N(s ? !!((d = s.data) != null && d.netOpen) : typeof (c == null ? void 0 : c.connectNetwork) == "object" && typeof (c == null ? void 0 : c.connectNetwork.default) == "boolean" ? c.connectNetwork.default : !1);
|
|
50
|
-
}, [s]),
|
|
50
|
+
}, [s]), y(() => {
|
|
51
51
|
const d = () => v(void 0, null, function* () {
|
|
52
52
|
const t = e == null ? void 0 : e.application;
|
|
53
53
|
if (!(t != null && t.id))
|
|
@@ -58,18 +58,22 @@ import W from "./SessionList/index.mjs";
|
|
|
58
58
|
const O = w[0].embeddingService;
|
|
59
59
|
D(O), H(t);
|
|
60
60
|
});
|
|
61
|
+
if (e != null && e.ready) {
|
|
62
|
+
d();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
61
65
|
return e == null || e.addEventListener("ready", () => d()), () => {
|
|
62
66
|
e == null || e.removeEventListener("ready", d);
|
|
63
67
|
};
|
|
64
|
-
}, []),
|
|
68
|
+
}, [e]), y(() => {
|
|
65
69
|
e && n && (e.ready ? e == null || e.getSessions().then((d) => v(void 0, null, function* () {
|
|
66
|
-
|
|
70
|
+
r == null || r(d.find((t) => t.id === n));
|
|
67
71
|
})) : e.addEventListener("ready", () => v(void 0, null, function* () {
|
|
68
72
|
e == null || e.getSessions().then((d) => v(void 0, null, function* () {
|
|
69
|
-
|
|
73
|
+
r == null || r(d.find((t) => t.id === n));
|
|
70
74
|
}));
|
|
71
75
|
}), !0));
|
|
72
|
-
}, [e, n]),
|
|
76
|
+
}, [e, n]), y(() => {
|
|
73
77
|
if (!s) {
|
|
74
78
|
m && m({
|
|
75
79
|
applicationId: l,
|
|
@@ -95,7 +99,7 @@ import W from "./SessionList/index.mjs";
|
|
|
95
99
|
}, [s]);
|
|
96
100
|
const L = (d) => {
|
|
97
101
|
var t;
|
|
98
|
-
return (t =
|
|
102
|
+
return (t = I.current) == null ? void 0 : t.create(j(R({}, d), {
|
|
99
103
|
knowledges: S
|
|
100
104
|
}));
|
|
101
105
|
};
|
|
@@ -103,40 +107,40 @@ import W from "./SessionList/index.mjs";
|
|
|
103
107
|
sessionCreate: (d) => L(d),
|
|
104
108
|
getSessionList: () => {
|
|
105
109
|
var t;
|
|
106
|
-
const d = ((t =
|
|
110
|
+
const d = ((t = I.current) == null ? void 0 : t.list()) || [];
|
|
107
111
|
return Promise.resolve(d);
|
|
108
112
|
}
|
|
109
|
-
})), /* @__PURE__ */
|
|
113
|
+
})), /* @__PURE__ */ a("div", {
|
|
110
114
|
className: "dialog",
|
|
111
115
|
children: /* @__PURE__ */ A("div", {
|
|
112
116
|
className: "dialog-pannel",
|
|
113
|
-
children: [/* @__PURE__ */
|
|
117
|
+
children: [/* @__PURE__ */ a("div", {
|
|
114
118
|
className: "dialog-sider",
|
|
115
|
-
children: /* @__PURE__ */
|
|
116
|
-
ref:
|
|
119
|
+
children: /* @__PURE__ */ a(W, {
|
|
120
|
+
ref: I,
|
|
117
121
|
sider: u,
|
|
118
122
|
appId: l,
|
|
119
123
|
networkStatus: b,
|
|
120
124
|
currentSession: s,
|
|
121
125
|
application: h,
|
|
122
|
-
setCurrentSession:
|
|
126
|
+
setCurrentSession: r,
|
|
123
127
|
checkKnowledges: S,
|
|
124
128
|
setCheckKnowledges: f ? k : void 0
|
|
125
129
|
})
|
|
126
|
-
}), /* @__PURE__ */
|
|
130
|
+
}), /* @__PURE__ */ a("div", {
|
|
127
131
|
className: "dialog-content",
|
|
128
132
|
children: /* @__PURE__ */ A("div", {
|
|
129
133
|
className: "dialog-chat",
|
|
130
|
-
children: [f && /* @__PURE__ */
|
|
134
|
+
children: [f && /* @__PURE__ */ a("div", {
|
|
131
135
|
className: "dialog-chat-header",
|
|
132
|
-
children: /* @__PURE__ */
|
|
136
|
+
children: /* @__PURE__ */ a(T, {
|
|
133
137
|
setCheckKnowledges: k,
|
|
134
138
|
application: h,
|
|
135
139
|
currentSession: s
|
|
136
140
|
})
|
|
137
|
-
}), /* @__PURE__ */
|
|
141
|
+
}), /* @__PURE__ */ a("div", {
|
|
138
142
|
className: "dialog-chat-content",
|
|
139
|
-
children: (h == null ? void 0 : h.id) && /* @__PURE__ */
|
|
143
|
+
children: (h == null ? void 0 : h.id) && /* @__PURE__ */ a(Q, {
|
|
140
144
|
setNetworkStatus: N,
|
|
141
145
|
networkStatus: b,
|
|
142
146
|
application: h,
|
|
@@ -144,7 +148,7 @@ import W from "./SessionList/index.mjs";
|
|
|
144
148
|
onCreateSession: L,
|
|
145
149
|
docViewerUrl: g,
|
|
146
150
|
embeddingService: K,
|
|
147
|
-
setCurrentSession:
|
|
151
|
+
setCurrentSession: r
|
|
148
152
|
})
|
|
149
153
|
})]
|
|
150
154
|
})
|