@glodon-aiot/agent-cli-ui 3.5.0-alpha.3 → 3.5.0-beta.1
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/FileItem/index.mjs +52 -48
- package/dist/es/Dialog/AgentChat/HistoryItem/SessionAction/index.mjs +112 -94
- package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +26 -24
- package/dist/es/Dialog/AgentChat/Tools/SessionListDrawer/HistorySessionList/index.mjs +65 -59
- package/dist/es/Dialog/AgentChat/Tools/UploadKnowledgeFiles/index.mjs +179 -161
- package/dist/es/Dialog/AgentChat/index.mjs +520 -465
- package/dist/es/QuillEditor/index.mjs +72 -65
- package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +182 -170
- package/dist/es/components/Recommend/RecommendItem.mjs +20 -18
- package/dist/es/index.mjs +223 -214
- 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/style.css +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/style23.css +1 -1
- package/dist/es/src/style24.css +1 -1
- package/dist/es/src/style25.css +1 -1
- package/dist/es/src/style26.css +1 -1
- package/dist/es/src/style27.css +1 -1
- package/dist/es/src/style28.css +1 -1
- package/dist/es/src/style3.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/style33.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/es/utils/antdConfig.mjs +15 -0
- package/dist/lib/index.css +1 -1
- package/dist/lib/index.js +57 -57
- package/dist/src/utils/antdConfig.d.ts +7 -0
- package/dist/src/utils/testAntdPrefix.d.ts +3 -0
- package/package.json +3 -3
|
@@ -1,40 +1,47 @@
|
|
|
1
1
|
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as X, useState as o, useRef as
|
|
2
|
+
import { forwardRef as X, useState as o, useRef as B, useImperativeHandle as Y, useEffect as v } from "react";
|
|
3
3
|
import { Popover as Z, Space as ee, Button as te } from "antd";
|
|
4
|
-
import { useKeyPress as
|
|
5
|
-
import
|
|
4
|
+
import { useKeyPress as O } from "ahooks";
|
|
5
|
+
import C 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 x } from "../utils/index.mjs";
|
|
9
9
|
import "react-quill/dist/quill.snow.css";
|
|
10
10
|
/* empty css */const ie = X((z, F) => {
|
|
11
|
-
var
|
|
11
|
+
var _, P, q;
|
|
12
12
|
const {
|
|
13
|
-
text:
|
|
14
|
-
onTextSend:
|
|
15
|
-
disabled:
|
|
13
|
+
text: d,
|
|
14
|
+
onTextSend: a,
|
|
15
|
+
disabled: M,
|
|
16
16
|
maxLength: c = 0,
|
|
17
17
|
onChange: y,
|
|
18
|
-
networkStatus:
|
|
19
|
-
clearAction:
|
|
20
|
-
loading:
|
|
21
|
-
} = z, [b,
|
|
18
|
+
networkStatus: h,
|
|
19
|
+
clearAction: L,
|
|
20
|
+
loading: E
|
|
21
|
+
} = z, [b, w] = o(!0), [f, l] = o(), [g, p] = o(), [j, Q] = o(15), [S, U] = o(12), [k, $] = o(0), [D, T] = o(!1), A = B(null), n = B(null);
|
|
22
22
|
Y(F, () => ({
|
|
23
|
-
clear:
|
|
24
|
-
prevent:
|
|
25
|
-
focus:
|
|
26
|
-
update:
|
|
23
|
+
clear: V,
|
|
24
|
+
prevent: W,
|
|
25
|
+
focus: N,
|
|
26
|
+
update: H,
|
|
27
27
|
// 新增:获取当前输入框内容
|
|
28
28
|
getCurrentText: () => g
|
|
29
|
-
})),
|
|
30
|
-
l(
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
})), v(() => {
|
|
30
|
+
if (l(d), d) {
|
|
31
|
+
const e = document.createElement("div");
|
|
32
|
+
e.innerHTML = d;
|
|
33
|
+
const t = e.textContent || e.innerText || "";
|
|
34
|
+
p(t.replace(/[\n\s]+$/, ""));
|
|
35
|
+
} else
|
|
36
|
+
p(void 0);
|
|
37
|
+
n.current && (m(), N());
|
|
38
|
+
}, [d]);
|
|
39
|
+
const H = (e) => {
|
|
33
40
|
l(e);
|
|
34
|
-
},
|
|
35
|
-
l(void 0),
|
|
36
|
-
},
|
|
37
|
-
},
|
|
41
|
+
}, V = () => {
|
|
42
|
+
l(void 0), p(void 0);
|
|
43
|
+
}, W = () => {
|
|
44
|
+
}, N = () => {
|
|
38
45
|
if (!n.current || b)
|
|
39
46
|
return;
|
|
40
47
|
const e = n.current.getEditor();
|
|
@@ -42,61 +49,61 @@ import "react-quill/dist/quill.snow.css";
|
|
|
42
49
|
e.getLength() > 0 && e.setSelection(e.getLength(), e.getLength());
|
|
43
50
|
});
|
|
44
51
|
};
|
|
45
|
-
|
|
52
|
+
v(() => {
|
|
46
53
|
if (!n.current)
|
|
47
54
|
return;
|
|
48
55
|
const e = n.current.getEditor();
|
|
49
56
|
c && (e.on("text-change", () => {
|
|
50
|
-
e.getLength() > c && e.deleteText(c, e.getLength()),
|
|
51
|
-
}), e.on("selection-change",
|
|
57
|
+
e.getLength() > c && e.deleteText(c, e.getLength()), m(), I(), N();
|
|
58
|
+
}), e.on("selection-change", I));
|
|
52
59
|
}, [n, c]);
|
|
53
|
-
const
|
|
60
|
+
const m = () => {
|
|
54
61
|
if (!n.current)
|
|
55
62
|
return;
|
|
56
63
|
const e = n.current.getEditor();
|
|
57
64
|
Q(e.getBounds(e.getLength() - 1, e.getLength()).left), U(e.getBounds(e.getLength() - 1, e.getLength()).top);
|
|
58
|
-
},
|
|
65
|
+
}, I = (e) => {
|
|
59
66
|
if (!n.current)
|
|
60
67
|
return;
|
|
61
68
|
const t = n.current.getEditor(), i = e || t.getSelection();
|
|
62
|
-
(i == null ? void 0 : i.index) !== void 0 &&
|
|
69
|
+
(i == null ? void 0 : i.index) !== void 0 && $(i == null ? void 0 : i.index);
|
|
63
70
|
};
|
|
64
|
-
|
|
71
|
+
O("1", () => {
|
|
65
72
|
var t;
|
|
66
73
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
67
|
-
|
|
68
|
-
}),
|
|
74
|
+
D && h && (e == null || e.blur(), setTimeout(() => K()));
|
|
75
|
+
}), O("2", () => {
|
|
69
76
|
var t;
|
|
70
77
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
71
|
-
|
|
78
|
+
D && (e == null || e.blur(), setTimeout(() => R()));
|
|
72
79
|
});
|
|
73
|
-
const
|
|
80
|
+
const K = () => {
|
|
74
81
|
var t;
|
|
75
|
-
if (!
|
|
82
|
+
if (!h)
|
|
76
83
|
return;
|
|
77
84
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
78
|
-
e == null || e.focus(),
|
|
79
|
-
},
|
|
85
|
+
e == null || e.focus(), T(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, x.NETWORK));
|
|
86
|
+
}, R = () => {
|
|
80
87
|
var t;
|
|
81
88
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
82
|
-
e == null || e.focus(),
|
|
89
|
+
e == null || e.focus(), T(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, x.DOCUMENT));
|
|
83
90
|
}, G = () => {
|
|
84
91
|
var t, i, u;
|
|
85
92
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
86
|
-
return e && (e == null ? void 0 : e.getLength()) > 2 && !((i = e.getText()) != null && i.includes(
|
|
93
|
+
return e && (e == null ? void 0 : e.getLength()) > 2 && !((i = e.getText()) != null && i.includes(x.NETWORK)) && !((u = e.getText()) != null && u.includes(x.DOCUMENT));
|
|
87
94
|
};
|
|
88
|
-
return
|
|
95
|
+
return v(() => {
|
|
89
96
|
var e, t;
|
|
90
|
-
|
|
91
|
-
}, [
|
|
92
|
-
window.removeEventListener("resize",
|
|
97
|
+
E ? (e = n.current) == null || e.getEditor().disable() : (t = n.current) == null || t.getEditor().enable();
|
|
98
|
+
}, [E]), v(() => (window.addEventListener("resize", m), () => {
|
|
99
|
+
window.removeEventListener("resize", m);
|
|
93
100
|
}), []), /* @__PURE__ */ s("div", {
|
|
94
|
-
className:
|
|
101
|
+
className: C({
|
|
95
102
|
"quill-editor": !0,
|
|
96
103
|
"quill-editor__active": b
|
|
97
104
|
}),
|
|
98
105
|
children: [/* @__PURE__ */ s("div", {
|
|
99
|
-
className:
|
|
106
|
+
className: C({
|
|
100
107
|
"quill-editor-wrapper": !0,
|
|
101
108
|
"quill-editor-wrapper__scroll": S >= 200
|
|
102
109
|
}),
|
|
@@ -107,15 +114,15 @@ import "react-quill/dist/quill.snow.css";
|
|
|
107
114
|
theme: "snow",
|
|
108
115
|
placeholder: "输入你想问的,shift+enter 换行。",
|
|
109
116
|
ref: n,
|
|
110
|
-
onFocus: () =>
|
|
111
|
-
onBlur: () =>
|
|
117
|
+
onFocus: () => w(!0),
|
|
118
|
+
onBlur: () => w(!1),
|
|
112
119
|
onKeyDown: (e) => {
|
|
113
120
|
if (!e.shiftKey && e.keyCode == 13) {
|
|
114
|
-
const t =
|
|
115
|
-
l(t),
|
|
121
|
+
const t = f == null ? void 0 : f.replace(/[\n\s]+$/, "");
|
|
122
|
+
l(t), a && a(g);
|
|
116
123
|
}
|
|
117
124
|
},
|
|
118
|
-
value:
|
|
125
|
+
value: f,
|
|
119
126
|
modules: {
|
|
120
127
|
toolbar: !1
|
|
121
128
|
},
|
|
@@ -124,14 +131,14 @@ import "react-quill/dist/quill.snow.css";
|
|
|
124
131
|
return;
|
|
125
132
|
l(e);
|
|
126
133
|
const J = u.getText().replace(/[\n\s]+$/, "");
|
|
127
|
-
|
|
134
|
+
p(J), y && y(e, u);
|
|
128
135
|
}
|
|
129
136
|
}), /* @__PURE__ */ r("div", {
|
|
130
137
|
className: "shortcut-direct",
|
|
131
|
-
ref:
|
|
138
|
+
ref: A,
|
|
132
139
|
style: {
|
|
133
140
|
position: "absolute",
|
|
134
|
-
left:
|
|
141
|
+
left: j + 4,
|
|
135
142
|
top: S,
|
|
136
143
|
cursor: "pointer",
|
|
137
144
|
visibility: G() ? "visible" : "hidden"
|
|
@@ -142,16 +149,16 @@ import "react-quill/dist/quill.snow.css";
|
|
|
142
149
|
trigger: "hover",
|
|
143
150
|
getPopupContainer: (e) => e.parentNode,
|
|
144
151
|
onVisibleChange: (e) => {
|
|
145
|
-
|
|
152
|
+
T(e);
|
|
146
153
|
},
|
|
147
154
|
content: /* @__PURE__ */ s("div", {
|
|
148
155
|
className: "shortcut-direct-pannel",
|
|
149
156
|
children: [/* @__PURE__ */ s("div", {
|
|
150
|
-
className:
|
|
151
|
-
"shortcut-direct-item":
|
|
152
|
-
"shortcut-direct-item__disabled": !
|
|
157
|
+
className: C({
|
|
158
|
+
"shortcut-direct-item": h,
|
|
159
|
+
"shortcut-direct-item__disabled": !h
|
|
153
160
|
}),
|
|
154
|
-
onClick:
|
|
161
|
+
onClick: K,
|
|
155
162
|
children: [/* @__PURE__ */ r("span", {
|
|
156
163
|
className: "title",
|
|
157
164
|
children: "指定联网回答"
|
|
@@ -161,7 +168,7 @@ import "react-quill/dist/quill.snow.css";
|
|
|
161
168
|
})]
|
|
162
169
|
}), /* @__PURE__ */ s("div", {
|
|
163
170
|
className: "shortcut-direct-item",
|
|
164
|
-
onClick:
|
|
171
|
+
onClick: R,
|
|
165
172
|
children: [/* @__PURE__ */ r("span", {
|
|
166
173
|
className: "title",
|
|
167
174
|
children: "指定文档回答"
|
|
@@ -179,7 +186,7 @@ import "react-quill/dist/quill.snow.css";
|
|
|
179
186
|
style: {
|
|
180
187
|
height: 32
|
|
181
188
|
},
|
|
182
|
-
children:
|
|
189
|
+
children: L || /* @__PURE__ */ r("span", {})
|
|
183
190
|
}), /* @__PURE__ */ s("div", {
|
|
184
191
|
style: {
|
|
185
192
|
height: 32,
|
|
@@ -192,7 +199,7 @@ import "react-quill/dist/quill.snow.css";
|
|
|
192
199
|
color: "#84868C"
|
|
193
200
|
},
|
|
194
201
|
children: [/* @__PURE__ */ r("span", {
|
|
195
|
-
children: ((
|
|
202
|
+
children: ((_ = n.current) == null ? void 0 : _.getEditor()) && ((q = (P = n.current) == null ? void 0 : P.getEditor()) == null ? void 0 : q.getLength()) - 1
|
|
196
203
|
}), /* @__PURE__ */ r("span", {
|
|
197
204
|
children: "/"
|
|
198
205
|
}), /* @__PURE__ */ r("span", {
|
|
@@ -201,8 +208,8 @@ import "react-quill/dist/quill.snow.css";
|
|
|
201
208
|
}), /* @__PURE__ */ r(te, {
|
|
202
209
|
type: "link",
|
|
203
210
|
ghost: !0,
|
|
204
|
-
disabled:
|
|
205
|
-
loading:
|
|
211
|
+
disabled: M || !g,
|
|
212
|
+
loading: E,
|
|
206
213
|
icon: /* @__PURE__ */ r(re, {
|
|
207
214
|
className: "icon-sendMsg",
|
|
208
215
|
style: {
|
|
@@ -211,7 +218,7 @@ import "react-quill/dist/quill.snow.css";
|
|
|
211
218
|
type: "icon-fasong"
|
|
212
219
|
}),
|
|
213
220
|
onClick: () => {
|
|
214
|
-
|
|
221
|
+
a && a(g);
|
|
215
222
|
}
|
|
216
223
|
})]
|
|
217
224
|
})]
|