@glodon-aiot/agent-cli-ui 3.4.0-alpha.2 → 3.4.0-alpha.4
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 +59 -54
- package/dist/es/Dialog/AgentChat/Tools/SessionHistoryDrawer/index.mjs +45 -66
- package/dist/es/Dialog/AgentChat/index.mjs +415 -382
- package/dist/es/Dialog/SessionList/index.mjs +144 -143
- package/dist/es/Dialog/index.mjs +99 -93
- package/dist/es/QuillEditor/index.mjs +19 -17
- package/dist/es/index.mjs +97 -97
- 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/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/style21.css +1 -1
- package/dist/es/src/style22.css +1 -1
- package/dist/es/src/style27.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/style31.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/lib/index.css +1 -1
- package/dist/lib/index.js +56 -56
- package/dist/src/AgentClientUI.d.ts +1 -0
- package/dist/src/Dialog/AgentChat/Tools/SessionHistoryDrawer/index.d.ts +2 -0
- package/dist/src/Dialog/AgentChat/index.d.ts +4 -1
- package/dist/src/Dialog/index.d.ts +1 -0
- package/dist/src/QuillEditor/index.d.ts +1 -0
- package/package.json +3 -3
package/dist/es/Dialog/index.mjs
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var s in
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var s of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
1
|
+
var z = Object.defineProperty, B = Object.defineProperties;
|
|
2
|
+
var F = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var j = Object.getOwnPropertySymbols;
|
|
4
|
+
var G = Object.prototype.hasOwnProperty, J = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var A = (r, d, s) => d in r ? z(r, d, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[d] = s, H = (r, d) => {
|
|
6
|
+
for (var s in d || (d = {}))
|
|
7
|
+
G.call(d, s) && A(r, s, d[s]);
|
|
8
|
+
if (j)
|
|
9
|
+
for (var s of j(d))
|
|
10
|
+
J.call(d, s) && A(r, s, d[s]);
|
|
11
|
+
return r;
|
|
12
|
+
}, K = (r, d) => B(r, F(d));
|
|
13
|
+
var v = (r, d, s) => new Promise((l, g) => {
|
|
14
|
+
var t = (e) => {
|
|
15
15
|
try {
|
|
16
16
|
f(s.next(e));
|
|
17
|
-
} catch (
|
|
18
|
-
|
|
17
|
+
} catch (p) {
|
|
18
|
+
g(p);
|
|
19
19
|
}
|
|
20
20
|
}, a = (e) => {
|
|
21
21
|
try {
|
|
22
22
|
f(s.throw(e));
|
|
23
|
-
} catch (
|
|
24
|
-
|
|
23
|
+
} catch (p) {
|
|
24
|
+
g(p);
|
|
25
25
|
}
|
|
26
|
-
}, f = (e) => e.done ? l(e.value) : Promise.resolve(e.value).then(
|
|
27
|
-
f((s = s.apply(
|
|
26
|
+
}, f = (e) => e.done ? l(e.value) : Promise.resolve(e.value).then(t, a);
|
|
27
|
+
f((s = s.apply(r, d)).next());
|
|
28
28
|
});
|
|
29
|
-
import { jsx as
|
|
30
|
-
import { forwardRef as
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
/* empty css */const
|
|
29
|
+
import { jsx as i, jsxs as T } from "react/jsx-runtime";
|
|
30
|
+
import { forwardRef as M, useState as h, useContext as Q, useRef as D, useEffect as I, useImperativeHandle as W } from "react";
|
|
31
|
+
import X from "../context.mjs";
|
|
32
|
+
import Y from "./AgentChat/index.mjs";
|
|
33
|
+
import Z from "../components/KnowledgeList/index.mjs";
|
|
34
|
+
import _ from "../components/Sider/index.mjs";
|
|
35
|
+
/* empty css */const ae = M((r, d) => {
|
|
36
36
|
const {
|
|
37
37
|
sessionId: s,
|
|
38
38
|
appId: l,
|
|
39
|
-
docViewerUrl:
|
|
40
|
-
} =
|
|
39
|
+
docViewerUrl: g
|
|
40
|
+
} = r, [t, a] = h(), {
|
|
41
41
|
showHeader: f,
|
|
42
42
|
agentClient: e,
|
|
43
|
-
sider:
|
|
43
|
+
sider: p,
|
|
44
44
|
onSessionLoad: m,
|
|
45
45
|
features: c,
|
|
46
|
-
mode:
|
|
47
|
-
} =
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
S(
|
|
51
|
-
}, [
|
|
52
|
-
const
|
|
46
|
+
mode: O
|
|
47
|
+
} = Q(X), [u, P] = h(), w = D(null), [U, V] = h(""), [N, k] = h(), b = D(null), [x, S] = h(!1), [E, L] = h([]);
|
|
48
|
+
I(() => {
|
|
49
|
+
var n;
|
|
50
|
+
S(t ? !!((n = t.data) != null && n.netOpen) : typeof (c == null ? void 0 : c.connectNetwork) == "object" && typeof (c == null ? void 0 : c.connectNetwork.default) == "boolean" ? c.connectNetwork.default : !1);
|
|
51
|
+
}, [t]), I(() => {
|
|
52
|
+
const n = () => v(void 0, null, function* () {
|
|
53
53
|
const o = e == null ? void 0 : e.application;
|
|
54
54
|
if (!(o != null && o.id))
|
|
55
55
|
return;
|
|
56
|
-
const
|
|
57
|
-
if (!(
|
|
56
|
+
const y = o == null ? void 0 : o.arrange;
|
|
57
|
+
if (!(y != null && y.length))
|
|
58
58
|
return;
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const q = y[0].embeddingService;
|
|
60
|
+
V(q), P(o);
|
|
61
61
|
});
|
|
62
62
|
if (e != null && e.ready) {
|
|
63
|
-
|
|
63
|
+
n();
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
return e == null || e.addEventListener("ready", () =>
|
|
67
|
-
e == null || e.removeEventListener("ready",
|
|
66
|
+
return e == null || e.addEventListener("ready", () => n()), () => {
|
|
67
|
+
e == null || e.removeEventListener("ready", n);
|
|
68
68
|
};
|
|
69
|
-
}, [e]),
|
|
70
|
-
e && s && (e.ready ? e == null || e.getSessions().then((
|
|
71
|
-
a == null || a(
|
|
72
|
-
})) : e.addEventListener("ready", () =>
|
|
73
|
-
e == null || e.getSessions().then((
|
|
74
|
-
a == null || a(
|
|
69
|
+
}, [e]), I(() => {
|
|
70
|
+
e && s && (e.ready ? e == null || e.getSessions().then((n) => v(void 0, null, function* () {
|
|
71
|
+
a == null || a(n.find((o) => o.id === s));
|
|
72
|
+
})) : e.addEventListener("ready", () => v(void 0, null, function* () {
|
|
73
|
+
e == null || e.getSessions().then((n) => v(void 0, null, function* () {
|
|
74
|
+
a == null || a(n.find((o) => o.id === s));
|
|
75
75
|
}));
|
|
76
76
|
}), !0));
|
|
77
|
-
}, [e, s]),
|
|
78
|
-
if (!
|
|
77
|
+
}, [e, s]), I(() => {
|
|
78
|
+
if (!t) {
|
|
79
79
|
m && m({
|
|
80
80
|
applicationId: l,
|
|
81
81
|
sessionId: "",
|
|
@@ -84,48 +84,53 @@ import Z from "../components/Sider/index.mjs";
|
|
|
84
84
|
});
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
t.data && m && m({
|
|
88
88
|
applicationId: l,
|
|
89
|
-
sessionId:
|
|
90
|
-
session:
|
|
91
|
-
sessionInstance:
|
|
92
|
-
}),
|
|
93
|
-
|
|
89
|
+
sessionId: t.data.id,
|
|
90
|
+
session: t.data,
|
|
91
|
+
sessionInstance: t
|
|
92
|
+
}), t.addEventListener("data:loaded", () => {
|
|
93
|
+
t != null && t.data && m && m({
|
|
94
94
|
applicationId: l,
|
|
95
|
-
sessionId:
|
|
96
|
-
session:
|
|
97
|
-
sessionInstance:
|
|
95
|
+
sessionId: t.data.id,
|
|
96
|
+
session: t.data,
|
|
97
|
+
sessionInstance: t
|
|
98
98
|
});
|
|
99
99
|
}, !0);
|
|
100
|
-
}, [
|
|
101
|
-
const
|
|
100
|
+
}, [t]);
|
|
101
|
+
const R = (n) => {
|
|
102
102
|
var o;
|
|
103
|
-
return (o =
|
|
103
|
+
return (o = w.current) == null ? void 0 : o.create(K(H({}, n), {
|
|
104
104
|
knowledges: N
|
|
105
105
|
}));
|
|
106
106
|
};
|
|
107
|
-
return
|
|
108
|
-
createSession: (
|
|
107
|
+
return W(d, () => ({
|
|
108
|
+
createSession: (n) => R(n),
|
|
109
109
|
getSessionList: () => {
|
|
110
110
|
var o;
|
|
111
|
-
const
|
|
112
|
-
return Promise.resolve(
|
|
111
|
+
const n = ((o = w.current) == null ? void 0 : o.list()) || [];
|
|
112
|
+
return Promise.resolve(n);
|
|
113
|
+
},
|
|
114
|
+
// 新增:获取当前输入框内容
|
|
115
|
+
getCurrentInputText: () => {
|
|
116
|
+
var n;
|
|
117
|
+
return (n = b.current) == null ? void 0 : n.getCurrentInputText();
|
|
113
118
|
}
|
|
114
|
-
})), /* @__PURE__ */
|
|
119
|
+
})), /* @__PURE__ */ i("div", {
|
|
115
120
|
className: "dialog",
|
|
116
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ T("div", {
|
|
117
122
|
className: "dialog-pannel",
|
|
118
|
-
children: [/* @__PURE__ */
|
|
123
|
+
children: [/* @__PURE__ */ i("div", {
|
|
119
124
|
className: "dialog-sider",
|
|
120
125
|
style: {
|
|
121
|
-
display:
|
|
126
|
+
display: p && O === "inlay" ? "block" : "none"
|
|
122
127
|
},
|
|
123
|
-
children: /* @__PURE__ */
|
|
124
|
-
ref:
|
|
128
|
+
children: /* @__PURE__ */ i(_, {
|
|
129
|
+
ref: w,
|
|
125
130
|
appId: l,
|
|
126
|
-
networkStatus:
|
|
127
|
-
currentSession:
|
|
128
|
-
application:
|
|
131
|
+
networkStatus: x,
|
|
132
|
+
currentSession: t,
|
|
133
|
+
application: u,
|
|
129
134
|
setCurrentSession: a,
|
|
130
135
|
checkKnowledges: N,
|
|
131
136
|
setCheckKnowledges: f ? k : void 0,
|
|
@@ -133,30 +138,31 @@ import Z from "../components/Sider/index.mjs";
|
|
|
133
138
|
setSessions: L,
|
|
134
139
|
sessionId: s
|
|
135
140
|
})
|
|
136
|
-
}), /* @__PURE__ */
|
|
141
|
+
}), /* @__PURE__ */ i("div", {
|
|
137
142
|
className: "dialog-content",
|
|
138
|
-
children: /* @__PURE__ */
|
|
143
|
+
children: /* @__PURE__ */ T("div", {
|
|
139
144
|
className: "dialog-chat",
|
|
140
|
-
children: [f && /* @__PURE__ */
|
|
145
|
+
children: [f && /* @__PURE__ */ i("div", {
|
|
141
146
|
className: "dialog-chat-header",
|
|
142
|
-
children: /* @__PURE__ */
|
|
147
|
+
children: /* @__PURE__ */ i(Z, {
|
|
143
148
|
setCheckKnowledges: k,
|
|
144
|
-
application:
|
|
145
|
-
currentSession:
|
|
149
|
+
application: u,
|
|
150
|
+
currentSession: t
|
|
146
151
|
})
|
|
147
|
-
}), /* @__PURE__ */
|
|
152
|
+
}), /* @__PURE__ */ i("div", {
|
|
148
153
|
className: "dialog-chat-content",
|
|
149
|
-
children: (
|
|
154
|
+
children: (u == null ? void 0 : u.id) && /* @__PURE__ */ i(Y, {
|
|
150
155
|
setNetworkStatus: S,
|
|
151
|
-
networkStatus:
|
|
152
|
-
application:
|
|
153
|
-
currentSession:
|
|
154
|
-
onCreateSession:
|
|
155
|
-
docViewerUrl:
|
|
156
|
-
embeddingService:
|
|
156
|
+
networkStatus: x,
|
|
157
|
+
application: u,
|
|
158
|
+
currentSession: t,
|
|
159
|
+
onCreateSession: R,
|
|
160
|
+
docViewerUrl: g,
|
|
161
|
+
embeddingService: U,
|
|
157
162
|
setCurrentSession: a,
|
|
158
163
|
sessions: E,
|
|
159
|
-
setSessions: L
|
|
164
|
+
setSessions: L,
|
|
165
|
+
ref: b
|
|
160
166
|
})
|
|
161
167
|
})]
|
|
162
168
|
})
|
|
@@ -165,5 +171,5 @@ import Z from "../components/Sider/index.mjs";
|
|
|
165
171
|
});
|
|
166
172
|
});
|
|
167
173
|
export {
|
|
168
|
-
|
|
174
|
+
ae as default
|
|
169
175
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as X, useState as o, useRef as O, useImperativeHandle as Y, useEffect as
|
|
2
|
+
import { forwardRef as X, useState as o, useRef as O, useImperativeHandle as Y, useEffect as p } from "react";
|
|
3
3
|
import { Popover as Z, Space as ee, Button as te } from "antd";
|
|
4
4
|
import { useKeyPress as P } from "ahooks";
|
|
5
5
|
import T from "classnames";
|
|
6
6
|
import ne from "react-quill";
|
|
7
7
|
import re from "../components/Iconfont/index.mjs";
|
|
8
|
-
import { shortCutEnum as
|
|
8
|
+
import { shortCutEnum as m } from "../utils/index.mjs";
|
|
9
9
|
import "react-quill/dist/quill.snow.css";
|
|
10
10
|
/* empty css */const ie = X((z, F) => {
|
|
11
11
|
var D, q, B;
|
|
@@ -17,14 +17,16 @@ import "react-quill/dist/quill.snow.css";
|
|
|
17
17
|
onChange: y,
|
|
18
18
|
networkStatus: a,
|
|
19
19
|
clearAction: C,
|
|
20
|
-
loading:
|
|
21
|
-
} = z, [b, L] = o(!0), [h, l] = o(), [
|
|
20
|
+
loading: v
|
|
21
|
+
} = z, [b, L] = o(!0), [h, l] = o(), [g, w] = o(), [M, Q] = o(15), [S, U] = o(12), [k, A] = o(0), [I, E] = o(!1), V = O(null), n = O(null);
|
|
22
22
|
Y(F, () => ({
|
|
23
23
|
clear: $,
|
|
24
24
|
prevent: H,
|
|
25
25
|
focus: x,
|
|
26
|
-
update: W
|
|
27
|
-
|
|
26
|
+
update: W,
|
|
27
|
+
// 新增:获取当前输入框内容
|
|
28
|
+
getCurrentText: () => g
|
|
29
|
+
})), p(() => {
|
|
28
30
|
l(N), n.current && (f(), x());
|
|
29
31
|
}, [N]);
|
|
30
32
|
const W = (e) => {
|
|
@@ -40,7 +42,7 @@ import "react-quill/dist/quill.snow.css";
|
|
|
40
42
|
e.getLength() > 0 && e.setSelection(e.getLength(), e.getLength());
|
|
41
43
|
});
|
|
42
44
|
};
|
|
43
|
-
|
|
45
|
+
p(() => {
|
|
44
46
|
if (!n.current)
|
|
45
47
|
return;
|
|
46
48
|
const e = n.current.getEditor();
|
|
@@ -73,20 +75,20 @@ import "react-quill/dist/quill.snow.css";
|
|
|
73
75
|
if (!a)
|
|
74
76
|
return;
|
|
75
77
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
76
|
-
e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k,
|
|
78
|
+
e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, m.NETWORK));
|
|
77
79
|
}, _ = () => {
|
|
78
80
|
var t;
|
|
79
81
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
80
|
-
e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k,
|
|
82
|
+
e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, m.DOCUMENT));
|
|
81
83
|
}, G = () => {
|
|
82
84
|
var t, i, u;
|
|
83
85
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
84
|
-
return e && (e == null ? void 0 : e.getLength()) > 2 && !((i = e.getText()) != null && i.includes(
|
|
86
|
+
return e && (e == null ? void 0 : e.getLength()) > 2 && !((i = e.getText()) != null && i.includes(m.NETWORK)) && !((u = e.getText()) != null && u.includes(m.DOCUMENT));
|
|
85
87
|
};
|
|
86
|
-
return
|
|
88
|
+
return p(() => {
|
|
87
89
|
var e, t;
|
|
88
|
-
|
|
89
|
-
}, [
|
|
90
|
+
v ? (e = n.current) == null || e.getEditor().disable() : (t = n.current) == null || t.getEditor().enable();
|
|
91
|
+
}, [v]), p(() => (window.addEventListener("resize", f), () => {
|
|
90
92
|
window.removeEventListener("resize", f);
|
|
91
93
|
}), []), /* @__PURE__ */ s("div", {
|
|
92
94
|
className: T({
|
|
@@ -110,7 +112,7 @@ import "react-quill/dist/quill.snow.css";
|
|
|
110
112
|
onKeyDown: (e) => {
|
|
111
113
|
if (!e.shiftKey && e.keyCode == 13) {
|
|
112
114
|
const t = h == null ? void 0 : h.replace(/[\n\s]+$/, "");
|
|
113
|
-
l(t), d && d(
|
|
115
|
+
l(t), d && d(g);
|
|
114
116
|
}
|
|
115
117
|
},
|
|
116
118
|
value: h,
|
|
@@ -199,8 +201,8 @@ import "react-quill/dist/quill.snow.css";
|
|
|
199
201
|
}), /* @__PURE__ */ r(te, {
|
|
200
202
|
type: "link",
|
|
201
203
|
ghost: !0,
|
|
202
|
-
disabled: j || !
|
|
203
|
-
loading:
|
|
204
|
+
disabled: j || !g,
|
|
205
|
+
loading: v,
|
|
204
206
|
icon: /* @__PURE__ */ r(re, {
|
|
205
207
|
className: "icon-sendMsg",
|
|
206
208
|
style: {
|
|
@@ -209,7 +211,7 @@ import "react-quill/dist/quill.snow.css";
|
|
|
209
211
|
type: "icon-fasong"
|
|
210
212
|
}),
|
|
211
213
|
onClick: () => {
|
|
212
|
-
d && d(
|
|
214
|
+
d && d(g);
|
|
213
215
|
}
|
|
214
216
|
})]
|
|
215
217
|
})]
|