@glodon-aiot/agent-cli-ui 3.3.7-beta.2 → 3.3.8-alpha.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/AgentClientUI.mjs +107 -94
- package/dist/es/Dialog/AgentChat/HistoryItem/SessionRefer/index.mjs +46 -59
- package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +46 -47
- package/dist/es/Dialog/AgentChat/index.mjs +378 -376
- package/dist/es/Dialog/SessionList/index.mjs +115 -119
- package/dist/es/Dialog/index.mjs +26 -30
- package/dist/es/QuillEditor/index.mjs +59 -70
- package/dist/es/components/Recommend/index.mjs +34 -52
- package/dist/es/constant.mjs +3 -11
- package/dist/es/index.mjs +293 -285
- package/dist/es/packages/agent-cli-ui/package.json.mjs +23 -25
- 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/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/style22.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/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.css +1 -1
- package/dist/lib/index.js +54 -54
- package/dist/src/AgentClientUI.d.ts +1 -1
- package/dist/src/Dialog/AgentChat/HistoryItem/SessionRefer/index.d.ts +0 -2
- package/dist/src/Dialog/index.d.ts +1 -1
- package/dist/src/Footer/index.d.ts +1 -2
- package/dist/src/QuillEditor/index.d.ts +1 -1
- package/dist/src/components/Greeting/index.d.ts +1 -2
- package/dist/src/components/Header/index.d.ts +1 -2
- package/dist/src/components/Recommend/index.d.ts +0 -1
- package/dist/src/constant.d.ts +0 -4
- package/dist/src/index.d.ts +1 -5
- package/dist/src/types.d.ts +2 -3
- package/dist/src/utils/antdConfig.d.ts +7 -0
- package/dist/src/utils/testAntdPrefix.d.ts +3 -0
- package/package.json +11 -13
|
@@ -1,110 +1,100 @@
|
|
|
1
1
|
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as X, useState as
|
|
2
|
+
import { forwardRef as X, useState as o, useRef as O, useImperativeHandle as Y, useEffect as g } from "react";
|
|
3
3
|
import { Popover as Z, Space as ee, Button as te } from "antd";
|
|
4
|
-
import { useKeyPress as
|
|
5
|
-
import
|
|
6
|
-
import ne from "react-quill
|
|
4
|
+
import { useKeyPress as P } from "ahooks";
|
|
5
|
+
import T from "classnames";
|
|
6
|
+
import ne from "react-quill";
|
|
7
7
|
import re from "../components/Iconfont/index.mjs";
|
|
8
|
-
import { shortCutEnum as
|
|
9
|
-
import "react-quill
|
|
10
|
-
/* empty css */const
|
|
11
|
-
var D, q,
|
|
8
|
+
import { shortCutEnum as p } from "../utils/index.mjs";
|
|
9
|
+
import "react-quill/dist/quill.snow.css";
|
|
10
|
+
/* empty css */const ie = X((z, F) => {
|
|
11
|
+
var D, q, B;
|
|
12
12
|
const {
|
|
13
|
-
text:
|
|
14
|
-
onTextSend:
|
|
13
|
+
text: N,
|
|
14
|
+
onTextSend: d,
|
|
15
15
|
disabled: j,
|
|
16
16
|
maxLength: c = 0,
|
|
17
17
|
onChange: y,
|
|
18
|
-
networkStatus:
|
|
19
|
-
clearAction:
|
|
20
|
-
loading:
|
|
21
|
-
} =
|
|
18
|
+
networkStatus: a,
|
|
19
|
+
clearAction: C,
|
|
20
|
+
loading: m
|
|
21
|
+
} = z, [b, L] = o(!0), [h, l] = o(), [v, 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
|
-
focus:
|
|
25
|
+
focus: x,
|
|
26
26
|
update: W
|
|
27
|
-
})),
|
|
28
|
-
l(
|
|
29
|
-
}, [
|
|
30
|
-
if (!n.current)
|
|
31
|
-
return;
|
|
32
|
-
const e = n.current.getEditor();
|
|
33
|
-
if (e && e.bounds !== document.body)
|
|
34
|
-
try {
|
|
35
|
-
console.log("设置 bounds"), e.bounds = document.body;
|
|
36
|
-
} catch (t) {
|
|
37
|
-
console.warn("设置 bounds 失败:", t);
|
|
38
|
-
}
|
|
39
|
-
}, [n.current]);
|
|
27
|
+
})), g(() => {
|
|
28
|
+
l(N), n.current && (f(), x());
|
|
29
|
+
}, [N]);
|
|
40
30
|
const W = (e) => {
|
|
41
31
|
l(e);
|
|
42
32
|
}, $ = () => {
|
|
43
|
-
l(void 0),
|
|
33
|
+
l(void 0), w(void 0);
|
|
44
34
|
}, H = () => {
|
|
45
|
-
},
|
|
46
|
-
if (!n.current ||
|
|
35
|
+
}, x = () => {
|
|
36
|
+
if (!n.current || b)
|
|
47
37
|
return;
|
|
48
38
|
const e = n.current.getEditor();
|
|
49
39
|
e.focus(), setTimeout(() => {
|
|
50
40
|
e.getLength() > 0 && e.setSelection(e.getLength(), e.getLength());
|
|
51
41
|
});
|
|
52
42
|
};
|
|
53
|
-
|
|
43
|
+
g(() => {
|
|
54
44
|
if (!n.current)
|
|
55
45
|
return;
|
|
56
46
|
const e = n.current.getEditor();
|
|
57
47
|
c && (e.on("text-change", () => {
|
|
58
|
-
e.getLength() > c && e.deleteText(c, e.getLength()),
|
|
48
|
+
e.getLength() > c && e.deleteText(c, e.getLength()), f(), K(), x();
|
|
59
49
|
}), e.on("selection-change", K));
|
|
60
50
|
}, [n, c]);
|
|
61
|
-
const
|
|
51
|
+
const f = () => {
|
|
62
52
|
if (!n.current)
|
|
63
53
|
return;
|
|
64
|
-
const e = n.current.getEditor()
|
|
65
|
-
|
|
54
|
+
const e = n.current.getEditor();
|
|
55
|
+
Q(e.getBounds(e.getLength() - 1, e.getLength()).left), U(e.getBounds(e.getLength() - 1, e.getLength()).top);
|
|
66
56
|
}, K = (e) => {
|
|
67
57
|
if (!n.current)
|
|
68
58
|
return;
|
|
69
|
-
const t = n.current.getEditor(),
|
|
70
|
-
(
|
|
59
|
+
const t = n.current.getEditor(), i = e || t.getSelection();
|
|
60
|
+
(i == null ? void 0 : i.index) !== void 0 && A(i == null ? void 0 : i.index);
|
|
71
61
|
};
|
|
72
|
-
|
|
62
|
+
P("1", () => {
|
|
73
63
|
var t;
|
|
74
64
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
75
|
-
I &&
|
|
76
|
-
}),
|
|
65
|
+
I && a && (e == null || e.blur(), setTimeout(() => R()));
|
|
66
|
+
}), P("2", () => {
|
|
77
67
|
var t;
|
|
78
68
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
79
69
|
I && (e == null || e.blur(), setTimeout(() => _()));
|
|
80
70
|
});
|
|
81
71
|
const R = () => {
|
|
82
72
|
var t;
|
|
83
|
-
if (!
|
|
73
|
+
if (!a)
|
|
84
74
|
return;
|
|
85
75
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
86
|
-
e == null || e.focus(),
|
|
76
|
+
e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, p.NETWORK));
|
|
87
77
|
}, _ = () => {
|
|
88
78
|
var t;
|
|
89
79
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
90
|
-
e == null || e.focus(),
|
|
80
|
+
e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, p.DOCUMENT));
|
|
91
81
|
}, G = () => {
|
|
92
|
-
var t,
|
|
82
|
+
var t, i, u;
|
|
93
83
|
const e = (t = n.current) == null ? void 0 : t.getEditor();
|
|
94
|
-
return e && (e == null ? void 0 : e.getLength()) > 2 && !((
|
|
84
|
+
return e && (e == null ? void 0 : e.getLength()) > 2 && !((i = e.getText()) != null && i.includes(p.NETWORK)) && !((u = e.getText()) != null && u.includes(p.DOCUMENT));
|
|
95
85
|
};
|
|
96
|
-
return
|
|
86
|
+
return g(() => {
|
|
97
87
|
var e, t;
|
|
98
|
-
|
|
99
|
-
}, [
|
|
100
|
-
window.removeEventListener("resize",
|
|
88
|
+
m ? (e = n.current) == null || e.getEditor().disable() : (t = n.current) == null || t.getEditor().enable();
|
|
89
|
+
}, [m]), g(() => (window.addEventListener("resize", f), () => {
|
|
90
|
+
window.removeEventListener("resize", f);
|
|
101
91
|
}), []), /* @__PURE__ */ s("div", {
|
|
102
|
-
className:
|
|
92
|
+
className: T({
|
|
103
93
|
"quill-editor": !0,
|
|
104
|
-
"quill-editor__active":
|
|
94
|
+
"quill-editor__active": b
|
|
105
95
|
}),
|
|
106
96
|
children: [/* @__PURE__ */ s("div", {
|
|
107
|
-
className:
|
|
97
|
+
className: T({
|
|
108
98
|
"quill-editor-wrapper": !0,
|
|
109
99
|
"quill-editor-wrapper__scroll": S >= 200
|
|
110
100
|
}),
|
|
@@ -115,25 +105,24 @@ import "react-quill-new/dist/quill.snow.css";
|
|
|
115
105
|
theme: "snow",
|
|
116
106
|
placeholder: "输入你想问的,shift+enter 换行。",
|
|
117
107
|
ref: n,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
onBlur: () => w(!1),
|
|
108
|
+
onFocus: () => L(!0),
|
|
109
|
+
onBlur: () => L(!1),
|
|
121
110
|
onKeyDown: (e) => {
|
|
122
111
|
if (!e.shiftKey && e.keyCode == 13) {
|
|
123
112
|
const t = h == null ? void 0 : h.replace(/[\n\s]+$/, "");
|
|
124
|
-
l(t),
|
|
113
|
+
l(t), d && d(v);
|
|
125
114
|
}
|
|
126
115
|
},
|
|
127
116
|
value: h,
|
|
128
117
|
modules: {
|
|
129
118
|
toolbar: !1
|
|
130
119
|
},
|
|
131
|
-
onChange: (e, t,
|
|
120
|
+
onChange: (e, t, i, u) => {
|
|
132
121
|
if (!t)
|
|
133
122
|
return;
|
|
134
123
|
l(e);
|
|
135
124
|
const J = u.getText().replace(/[\n\s]+$/, "");
|
|
136
|
-
|
|
125
|
+
w(J), y && y(e, u);
|
|
137
126
|
}
|
|
138
127
|
}), /* @__PURE__ */ r("div", {
|
|
139
128
|
className: "shortcut-direct",
|
|
@@ -151,14 +140,14 @@ import "react-quill-new/dist/quill.snow.css";
|
|
|
151
140
|
trigger: "hover",
|
|
152
141
|
getPopupContainer: (e) => e.parentNode,
|
|
153
142
|
onVisibleChange: (e) => {
|
|
154
|
-
|
|
143
|
+
E(e);
|
|
155
144
|
},
|
|
156
145
|
content: /* @__PURE__ */ s("div", {
|
|
157
146
|
className: "shortcut-direct-pannel",
|
|
158
147
|
children: [/* @__PURE__ */ s("div", {
|
|
159
|
-
className:
|
|
160
|
-
"shortcut-direct-item":
|
|
161
|
-
"shortcut-direct-item__disabled": !
|
|
148
|
+
className: T({
|
|
149
|
+
"shortcut-direct-item": a,
|
|
150
|
+
"shortcut-direct-item__disabled": !a
|
|
162
151
|
}),
|
|
163
152
|
onClick: R,
|
|
164
153
|
children: [/* @__PURE__ */ r("span", {
|
|
@@ -188,7 +177,7 @@ import "react-quill-new/dist/quill.snow.css";
|
|
|
188
177
|
style: {
|
|
189
178
|
height: 32
|
|
190
179
|
},
|
|
191
|
-
children:
|
|
180
|
+
children: C || /* @__PURE__ */ r("span", {})
|
|
192
181
|
}), /* @__PURE__ */ s("div", {
|
|
193
182
|
style: {
|
|
194
183
|
height: 32,
|
|
@@ -201,7 +190,7 @@ import "react-quill-new/dist/quill.snow.css";
|
|
|
201
190
|
color: "#84868C"
|
|
202
191
|
},
|
|
203
192
|
children: [/* @__PURE__ */ r("span", {
|
|
204
|
-
children: ((D = n.current) == null ? void 0 : D.getEditor()) && ((
|
|
193
|
+
children: ((D = n.current) == null ? void 0 : D.getEditor()) && ((B = (q = n.current) == null ? void 0 : q.getEditor()) == null ? void 0 : B.getLength()) - 1
|
|
205
194
|
}), /* @__PURE__ */ r("span", {
|
|
206
195
|
children: "/"
|
|
207
196
|
}), /* @__PURE__ */ r("span", {
|
|
@@ -210,8 +199,8 @@ import "react-quill-new/dist/quill.snow.css";
|
|
|
210
199
|
}), /* @__PURE__ */ r(te, {
|
|
211
200
|
type: "link",
|
|
212
201
|
ghost: !0,
|
|
213
|
-
disabled: j || !
|
|
214
|
-
loading:
|
|
202
|
+
disabled: j || !v,
|
|
203
|
+
loading: m,
|
|
215
204
|
icon: /* @__PURE__ */ r(re, {
|
|
216
205
|
className: "icon-sendMsg",
|
|
217
206
|
style: {
|
|
@@ -220,14 +209,14 @@ import "react-quill-new/dist/quill.snow.css";
|
|
|
220
209
|
type: "icon-fasong"
|
|
221
210
|
}),
|
|
222
211
|
onClick: () => {
|
|
223
|
-
|
|
212
|
+
d && d(v);
|
|
224
213
|
}
|
|
225
214
|
})]
|
|
226
215
|
})]
|
|
227
216
|
})]
|
|
228
217
|
});
|
|
229
218
|
});
|
|
230
|
-
|
|
219
|
+
ie.displayName = "QuillEditor";
|
|
231
220
|
export {
|
|
232
|
-
|
|
221
|
+
ie as default
|
|
233
222
|
};
|
|
@@ -1,76 +1,58 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
/* empty css */import { Space as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as I, useState as r, useImperativeHandle as Q, useEffect as l } from "react";
|
|
3
|
+
/* empty css */import { Space as g, Row as w, Col as N } from "antd";
|
|
4
|
+
import q from "./tip.svg.mjs";
|
|
5
|
+
import v from "./RecommendItem.mjs";
|
|
6
|
+
const x = I((a, u) => {
|
|
7
7
|
const {
|
|
8
|
-
onItemClick:
|
|
8
|
+
onItemClick: f,
|
|
9
9
|
data: s,
|
|
10
|
-
isRecommendClearing:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = g, [t, C] = l(), [x, u] = l(), [y, f] = l(!1), [z, Q] = l(2);
|
|
14
|
-
return q(R, () => ({
|
|
10
|
+
isRecommendClearing: p
|
|
11
|
+
} = a, [e, d] = r(), [h, i] = r(), [R, m] = r(!1);
|
|
12
|
+
return Q(u, () => ({
|
|
15
13
|
clear() {
|
|
16
|
-
|
|
14
|
+
i(void 0);
|
|
17
15
|
}
|
|
18
|
-
})),
|
|
19
|
-
const e = document.getElementById("dialog-modal");
|
|
20
|
-
if (!e)
|
|
21
|
-
return;
|
|
22
|
-
const n = (c) => {
|
|
23
|
-
const p = [...a].sort((d, E) => d - E), w = p.findIndex((d) => c < d);
|
|
24
|
-
return w === -1 ? p.length + 1 : w + 1;
|
|
25
|
-
}, i = () => {
|
|
26
|
-
const c = e.clientWidth;
|
|
27
|
-
Q(n(c));
|
|
28
|
-
};
|
|
29
|
-
i();
|
|
30
|
-
let o = null;
|
|
31
|
-
return window.ResizeObserver ? (o = new ResizeObserver(i), o.observe(e)) : window.addEventListener("resize", i), () => {
|
|
32
|
-
o == null || o.disconnect(), window.removeEventListener("resize", i);
|
|
33
|
-
};
|
|
34
|
-
}, [a]), m(() => {
|
|
16
|
+
})), l(() => {
|
|
35
17
|
if (s != null && s.length) {
|
|
36
|
-
|
|
18
|
+
d(s);
|
|
37
19
|
return;
|
|
38
20
|
}
|
|
39
|
-
}, [s]),
|
|
40
|
-
if (!
|
|
21
|
+
}, [s]), l(() => {
|
|
22
|
+
if (!e)
|
|
41
23
|
return;
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
}, [
|
|
24
|
+
const o = e.find((n) => n.file.url || n.icon || n.name);
|
|
25
|
+
m(!o);
|
|
26
|
+
}, [e]), /* @__PURE__ */ c("div", {
|
|
45
27
|
className: "questions",
|
|
46
|
-
children: [/* @__PURE__ */
|
|
28
|
+
children: [/* @__PURE__ */ c(g, {
|
|
47
29
|
size: 8,
|
|
48
30
|
className: "question-tip",
|
|
49
|
-
children: [/* @__PURE__ */
|
|
50
|
-
src:
|
|
31
|
+
children: [/* @__PURE__ */ t("img", {
|
|
32
|
+
src: q,
|
|
51
33
|
alt: ""
|
|
52
|
-
}), /* @__PURE__ */
|
|
34
|
+
}), /* @__PURE__ */ t("span", {
|
|
53
35
|
children: "请试试这样提问:"
|
|
54
36
|
})]
|
|
55
|
-
}), /* @__PURE__ */
|
|
37
|
+
}), /* @__PURE__ */ t(w, {
|
|
56
38
|
gutter: [12, 12],
|
|
57
39
|
wrap: !0,
|
|
58
40
|
className: "question-row",
|
|
59
|
-
children:
|
|
60
|
-
span:
|
|
61
|
-
children: /* @__PURE__ */
|
|
62
|
-
item:
|
|
63
|
-
isRecommendClearing:
|
|
64
|
-
isOnlyQuestion:
|
|
65
|
-
question:
|
|
66
|
-
setQuestion:
|
|
67
|
-
onItemClick:
|
|
41
|
+
children: e == null ? void 0 : e.map((o, n) => /* @__PURE__ */ t(N, {
|
|
42
|
+
span: 12,
|
|
43
|
+
children: /* @__PURE__ */ t(v, {
|
|
44
|
+
item: o,
|
|
45
|
+
isRecommendClearing: p,
|
|
46
|
+
isOnlyQuestion: R,
|
|
47
|
+
question: h,
|
|
48
|
+
setQuestion: i,
|
|
49
|
+
onItemClick: f
|
|
68
50
|
})
|
|
69
51
|
}, n))
|
|
70
52
|
})]
|
|
71
53
|
});
|
|
72
54
|
});
|
|
73
|
-
|
|
55
|
+
x.displayName = "Recommend";
|
|
74
56
|
export {
|
|
75
|
-
|
|
57
|
+
x as default
|
|
76
58
|
};
|
package/dist/es/constant.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import e from "./assets/icon.svg.mjs";
|
|
|
2
2
|
import t from "./assets/brand.svg.mjs";
|
|
3
3
|
import o from "./assets/doc-icons/pdf.svg.mjs";
|
|
4
4
|
import r from "./assets/doc-icons/doc.svg.mjs";
|
|
5
|
-
import
|
|
5
|
+
import n from "./assets/doc-icons/docx.svg.mjs";
|
|
6
6
|
const u = {
|
|
7
7
|
triggerButton: {
|
|
8
8
|
visible: !0
|
|
@@ -52,11 +52,7 @@ const u = {
|
|
|
52
52
|
promptVariables: !0
|
|
53
53
|
},
|
|
54
54
|
features: {
|
|
55
|
-
greeting:
|
|
56
|
-
questions: !0,
|
|
57
|
-
layoutBreakpoints: [450]
|
|
58
|
-
// 默认临界值
|
|
59
|
-
},
|
|
55
|
+
greeting: !0,
|
|
60
56
|
sessionList: !0,
|
|
61
57
|
newSession: !0,
|
|
62
58
|
fileUpload: !0,
|
|
@@ -101,18 +97,14 @@ const u = {
|
|
|
101
97
|
}
|
|
102
98
|
}, c = "https://copilot.glodon.com/api/cvforcepd", f = "https://copilot.glodon.com/portal/_/aecpilot/fe/", m = 1024, d = 1024 * 1024, g = 1024 * 1024 * 1024, h = {
|
|
103
99
|
doc: r,
|
|
104
|
-
docx:
|
|
100
|
+
docx: n,
|
|
105
101
|
pdf: o
|
|
106
|
-
}, b = {
|
|
107
|
-
OPEN: 1,
|
|
108
|
-
CLOSE: 2
|
|
109
102
|
};
|
|
110
103
|
export {
|
|
111
104
|
h as FILE_ICONS,
|
|
112
105
|
g as GB,
|
|
113
106
|
m as KB,
|
|
114
107
|
d as MB,
|
|
115
|
-
b as NET_OPEN_STATUS,
|
|
116
108
|
t as brand,
|
|
117
109
|
c as defaultApiUrl,
|
|
118
110
|
f as defaultDovViewerUrl,
|