@glodon-aiot/agent-cli-ui 3.15.0-alpha.2 → 3.16.0-alpha.35
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/Tools/UploadKnowledgeFiles/index.mjs +235 -199
- package/dist/es/Dialog/AgentChat/index.mjs +526 -528
- 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/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/style23.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/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/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 +54 -54
- package/dist/src/Dialog/AgentChat/Tools/UploadKnowledgeFiles/index.d.ts +0 -1
- package/package.json +3 -3
|
@@ -1,201 +1,213 @@
|
|
|
1
|
-
var
|
|
2
|
-
var R = (
|
|
1
|
+
var I = (L, P, g) => new Promise((c, N) => {
|
|
2
|
+
var R = (h) => {
|
|
3
3
|
try {
|
|
4
|
-
C(
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
4
|
+
C(g.next(h));
|
|
5
|
+
} catch (S) {
|
|
6
|
+
N(S);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, A = (h) => {
|
|
9
9
|
try {
|
|
10
|
-
C(
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
10
|
+
C(g.throw(h));
|
|
11
|
+
} catch (S) {
|
|
12
|
+
N(S);
|
|
13
13
|
}
|
|
14
|
-
}, C = (
|
|
15
|
-
C((
|
|
14
|
+
}, C = (h) => h.done ? c(h.value) : Promise.resolve(h.value).then(R, A);
|
|
15
|
+
C((g = g.apply(L, P)).next());
|
|
16
16
|
});
|
|
17
|
-
import { jsx as r, Fragment as
|
|
18
|
-
import {
|
|
19
|
-
import { forwardRef as
|
|
20
|
-
import { LoadingOutlined as
|
|
21
|
-
/* empty css */import
|
|
22
|
-
import
|
|
23
|
-
import { IFileOrigin as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import { MB as
|
|
29
|
-
const
|
|
17
|
+
import { jsx as r, Fragment as le, jsxs as b } from "react/jsx-runtime";
|
|
18
|
+
import { Upload as W, Button as M, message as o, Badge as ue, Spin as fe, Popover as ge, Space as me } from "antd";
|
|
19
|
+
import { forwardRef as he, useState as E, useRef as G, useContext as pe, useEffect as z, useImperativeHandle as xe } from "react";
|
|
20
|
+
import { LoadingOutlined as ye, CloseCircleFilled as Ce, CloudUploadOutlined as be } from "@ant-design/icons";
|
|
21
|
+
/* empty css */import Se from "lodash/debounce";
|
|
22
|
+
import Ne from "./FileCard/index.mjs";
|
|
23
|
+
import { IFileOrigin as we } from "@glodon-aiot/apis";
|
|
24
|
+
import Fe from "./ClearModal/index.mjs";
|
|
25
|
+
import j from "../../../../components/Iconfont/index.mjs";
|
|
26
|
+
import ve from "../../../../context.mjs";
|
|
27
|
+
import { isValidImageUrlWithAnyExtension as Ie, FILE_NAME_MAX_LENGTH as X, fileTypes as Ee } from "../../../../utils/index.mjs";
|
|
28
|
+
import { MB as ze } from "../../../../constant.mjs";
|
|
29
|
+
const Ae = he((L, P) => {
|
|
30
30
|
const {
|
|
31
|
-
appId:
|
|
32
|
-
sid:
|
|
33
|
-
onStatusChange:
|
|
31
|
+
appId: g,
|
|
32
|
+
sid: c,
|
|
33
|
+
onStatusChange: N,
|
|
34
34
|
createSession: R,
|
|
35
|
-
disabled:
|
|
35
|
+
disabled: A = !1,
|
|
36
36
|
afterFileAdd: C,
|
|
37
|
-
afterFileDelete:
|
|
38
|
-
onFileListChange:
|
|
37
|
+
afterFileDelete: h,
|
|
38
|
+
onFileListChange: S,
|
|
39
39
|
shouldContinue: D = !0,
|
|
40
40
|
afterFilesClear: K,
|
|
41
|
-
docViewerUrl:
|
|
42
|
-
isFirstSession:
|
|
43
|
-
} =
|
|
44
|
-
Dragger:
|
|
45
|
-
} =
|
|
46
|
-
service:
|
|
47
|
-
popupContainer:
|
|
48
|
-
} =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [D]),
|
|
52
|
-
update:
|
|
53
|
-
clear:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
})), N(() => {
|
|
62
|
-
ee || (k([]), p([]), V());
|
|
63
|
-
}, [a]);
|
|
64
|
-
const V = () => a ? new Promise((e, s) => {
|
|
65
|
-
o == null || o.getApplicationIdSessionKnowledgeFiles(u, a, {
|
|
41
|
+
docViewerUrl: q,
|
|
42
|
+
isFirstSession: J
|
|
43
|
+
} = L, [d, m] = E([]), f = G(d), [Q, U] = E([]), [Y, T] = E(!1), [w, k] = E(""), F = G(D), [$, B] = E(!1), {
|
|
44
|
+
Dragger: Z
|
|
45
|
+
} = W, {
|
|
46
|
+
service: a,
|
|
47
|
+
popupContainer: t
|
|
48
|
+
} = pe(ve);
|
|
49
|
+
z(() => {
|
|
50
|
+
F.current = D;
|
|
51
|
+
}, [D]), xe(P, () => ({
|
|
52
|
+
update: H,
|
|
53
|
+
clear: _
|
|
54
|
+
})), z(() => {
|
|
55
|
+
J || (U([]), m([]), H());
|
|
56
|
+
}, [c]);
|
|
57
|
+
const H = () => c ? new Promise((e, i) => {
|
|
58
|
+
a == null || a.getApplicationIdSessionKnowledgeFiles(g, c, {
|
|
66
59
|
//1是未开启
|
|
67
60
|
enabled: 1
|
|
68
|
-
}).then((
|
|
69
|
-
|
|
61
|
+
}).then((s) => {
|
|
62
|
+
U(s), m(s), ee(s);
|
|
70
63
|
}).finally(() => {
|
|
71
64
|
e();
|
|
72
65
|
});
|
|
73
|
-
}) : Promise.resolve(),
|
|
74
|
-
|
|
75
|
-
var
|
|
66
|
+
}) : Promise.resolve(), ee = (e) => I(void 0, null, function* () {
|
|
67
|
+
c && (e == null || e.map((i) => I(void 0, null, function* () {
|
|
68
|
+
var s;
|
|
76
69
|
try {
|
|
77
|
-
if (yield
|
|
78
|
-
const l = [...
|
|
79
|
-
|
|
70
|
+
if (yield a == null ? void 0 : a.checkFileReady(g, c, i.id)) {
|
|
71
|
+
const l = [...f.current], p = e.findIndex((u) => u.id === i.id);
|
|
72
|
+
p !== -1 && (l[p].status = 2), m(l), C && C(i, c);
|
|
80
73
|
}
|
|
81
|
-
} catch (
|
|
82
|
-
if (((
|
|
83
|
-
const l = [...
|
|
84
|
-
|
|
74
|
+
} catch (n) {
|
|
75
|
+
if (((s = n.cause) == null ? void 0 : s.code) === -101) {
|
|
76
|
+
const l = [...f.current], p = e.findIndex((u) => u.id === i.id);
|
|
77
|
+
p !== -1 && (l[p].status = 3), m(l);
|
|
85
78
|
return;
|
|
86
79
|
}
|
|
87
80
|
}
|
|
88
81
|
})));
|
|
89
82
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
maxCount: 5
|
|
95
|
-
});
|
|
96
|
-
}, [S]), N(() => {
|
|
97
|
-
I && I(E);
|
|
98
|
-
}, [E]);
|
|
99
|
-
const y = (e, s) => {
|
|
100
|
-
Z.open({
|
|
101
|
-
type: e,
|
|
102
|
-
content: s
|
|
103
|
-
});
|
|
104
|
-
}, T = (e) => L(void 0, null, function* () {
|
|
83
|
+
z(() => {
|
|
84
|
+
N && N(w);
|
|
85
|
+
}, [w]);
|
|
86
|
+
const O = (e) => I(void 0, null, function* () {
|
|
105
87
|
if (e.size <= 0)
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
88
|
+
return o.config({
|
|
89
|
+
getContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
90
|
+
prefixCls: "gbot-message"
|
|
91
|
+
}), o.error("该文件为空,请重新上传文档"), o.config({
|
|
92
|
+
getContainer: void 0,
|
|
93
|
+
prefixCls: "gbot-message"
|
|
94
|
+
}), !1;
|
|
95
|
+
if (e.name.length > X)
|
|
96
|
+
return o.config({
|
|
97
|
+
getContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
98
|
+
prefixCls: "gbot-message"
|
|
99
|
+
}), o.error(`文件名称不能超过${X}字符`), o.config({
|
|
100
|
+
getContainer: void 0,
|
|
101
|
+
prefixCls: "gbot-message"
|
|
102
|
+
}), !1;
|
|
103
|
+
if (e.size > 50 * ze)
|
|
104
|
+
return o.config({
|
|
105
|
+
getContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
106
|
+
prefixCls: "gbot-message"
|
|
107
|
+
}), o.error(`${e.name}文件大小不能超过 50M`), o.config({
|
|
108
|
+
getContainer: void 0,
|
|
109
|
+
prefixCls: "gbot-message"
|
|
110
|
+
}), !1;
|
|
111
|
+
if (Ee.some((n) => n === e.type)) {
|
|
112
|
+
const n = e;
|
|
113
|
+
n.status = 1, m((l) => l.length >= 10 ? l : [...l, n]);
|
|
114
114
|
} else
|
|
115
|
-
|
|
115
|
+
oe("存在文件格式不正确的文件,已自动去除");
|
|
116
116
|
return !1;
|
|
117
117
|
});
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
118
|
+
z(() => {
|
|
119
|
+
if (d.length < 10 ? T(!1) : T(!0), !d.length) {
|
|
120
|
+
k("");
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
const e =
|
|
124
|
-
|
|
125
|
-
}, [
|
|
126
|
-
|
|
127
|
-
const e =
|
|
128
|
-
|
|
129
|
-
}, [
|
|
130
|
-
const
|
|
131
|
-
var
|
|
132
|
-
const
|
|
133
|
-
l !== -1 && (
|
|
123
|
+
const e = d.find((n) => n.status === 1), i = d.find((n) => n.status === 3);
|
|
124
|
+
d.every((n) => n.status === 2) ? k("successed") : e ? k("process") : i && k("failed"), S && S(d);
|
|
125
|
+
}, [d]), z(() => {
|
|
126
|
+
f.current = d;
|
|
127
|
+
const e = d.filter((i) => !Q.includes(i));
|
|
128
|
+
se(e), U(d);
|
|
129
|
+
}, [d]);
|
|
130
|
+
const te = (e, i, s) => I(void 0, null, function* () {
|
|
131
|
+
var p;
|
|
132
|
+
const n = [...f.current], l = f.current.findIndex((u) => u === s);
|
|
133
|
+
l !== -1 && (n[l].id = i), m(n);
|
|
134
134
|
try {
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
|
|
135
|
+
const u = yield a == null ? void 0 : a.checkFileReady(g, e, i, () => F.current, void 0, (x) => {
|
|
136
|
+
const y = [...f.current], v = f.current.findIndex((ce) => ce === s);
|
|
137
|
+
y[v].url = x.url, m(y);
|
|
138
138
|
});
|
|
139
|
-
if (
|
|
140
|
-
const
|
|
141
|
-
|
|
139
|
+
if (u) {
|
|
140
|
+
const x = [...f.current], y = f.current.findIndex((v) => v === s);
|
|
141
|
+
y !== -1 && (x[y].status = 2, x[y].url = u.url), m(x), C && C(u, e);
|
|
142
142
|
}
|
|
143
|
-
} catch (
|
|
144
|
-
if (((
|
|
145
|
-
const
|
|
146
|
-
|
|
143
|
+
} catch (u) {
|
|
144
|
+
if (((p = u.cause) == null ? void 0 : p.code) === -101) {
|
|
145
|
+
const x = [...f.current], y = f.current.findIndex((v) => v === s);
|
|
146
|
+
y !== -1 && (x[y].status = 3), m(x);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
}),
|
|
151
|
-
e.length &&
|
|
152
|
-
e == null || e.forEach((
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
var
|
|
150
|
+
}), ne = () => c ? Promise.resolve(c) : R(), se = (e) => {
|
|
151
|
+
e.length && ne().then((i) => {
|
|
152
|
+
e == null || e.forEach((s) => {
|
|
153
|
+
var n;
|
|
154
|
+
F.current = !0, (n = de(i, s)) == null || n.then((l) => {
|
|
155
|
+
var u;
|
|
156
156
|
if (!l)
|
|
157
157
|
return;
|
|
158
|
-
const
|
|
158
|
+
const p = {
|
|
159
159
|
url: l,
|
|
160
|
-
name:
|
|
161
|
-
size:
|
|
160
|
+
name: s.name,
|
|
161
|
+
size: s.size,
|
|
162
162
|
type: 1,
|
|
163
|
-
origin:
|
|
163
|
+
origin: we.AECPILOT
|
|
164
164
|
};
|
|
165
|
-
|
|
165
|
+
F.current && ((u = re(i, p)) == null || u.then((x) => te(i, x, s)));
|
|
166
166
|
});
|
|
167
167
|
});
|
|
168
168
|
});
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
}, re = (e, i) => a == null ? void 0 : a.postApplicationIdSessionKnowledgeSessionFile(g, e, i), oe = Se((e) => {
|
|
170
|
+
o.config({
|
|
171
|
+
getContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
172
|
+
prefixCls: "gbot-message"
|
|
173
|
+
}), o.error(e), o.config({
|
|
174
|
+
getContainer: void 0,
|
|
175
|
+
prefixCls: "gbot-message"
|
|
176
|
+
});
|
|
177
|
+
}, 300), ie = (e) => {
|
|
178
|
+
c && e != null && e.id && (a == null || a.delApplicationIdSessionKnowledgeFileId(g, c, e.id).then((i) => {
|
|
179
|
+
const s = d.filter((n) => n.id !== e.id);
|
|
180
|
+
m(s), o.config({
|
|
181
|
+
getContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
182
|
+
prefixCls: "gbot-message"
|
|
183
|
+
}), o.success("删除成功"), o.config({
|
|
184
|
+
getContainer: void 0,
|
|
185
|
+
prefixCls: "gbot-message"
|
|
186
|
+
}), h && h(e.id);
|
|
175
187
|
}));
|
|
176
|
-
},
|
|
177
|
-
children: /* @__PURE__ */
|
|
188
|
+
}, ae = /* @__PURE__ */ r(le, {
|
|
189
|
+
children: /* @__PURE__ */ b("div", {
|
|
178
190
|
className: "card-title",
|
|
179
191
|
children: [/* @__PURE__ */ r("span", {
|
|
180
192
|
className: "name",
|
|
181
193
|
children: "上传列表"
|
|
182
|
-
}), /* @__PURE__ */
|
|
194
|
+
}), /* @__PURE__ */ b("div", {
|
|
183
195
|
className: "actions",
|
|
184
|
-
children: [/* @__PURE__ */ r(
|
|
196
|
+
children: [/* @__PURE__ */ r(W, {
|
|
185
197
|
accept: ".doc, .docx, .pdf",
|
|
186
|
-
beforeUpload:
|
|
198
|
+
beforeUpload: O,
|
|
187
199
|
showUploadList: !1,
|
|
188
200
|
style: {
|
|
189
201
|
margin: 0
|
|
190
202
|
},
|
|
191
203
|
multiple: !0,
|
|
192
|
-
children: /* @__PURE__ */ r(
|
|
204
|
+
children: /* @__PURE__ */ r(M, {
|
|
193
205
|
className: "action",
|
|
194
206
|
type: "link",
|
|
195
|
-
disabled:
|
|
196
|
-
children: /* @__PURE__ */
|
|
207
|
+
disabled: Y,
|
|
208
|
+
children: /* @__PURE__ */ b("div", {
|
|
197
209
|
className: "detail",
|
|
198
|
-
children: [/* @__PURE__ */ r(
|
|
210
|
+
children: [/* @__PURE__ */ r(j, {
|
|
199
211
|
type: "icon-tianjia",
|
|
200
212
|
style: {
|
|
201
213
|
fontSize: 16
|
|
@@ -205,16 +217,16 @@ const j = 50, U = 10, ve = xe((M, P) => {
|
|
|
205
217
|
})]
|
|
206
218
|
})
|
|
207
219
|
})
|
|
208
|
-
}), /* @__PURE__ */ r(
|
|
220
|
+
}), /* @__PURE__ */ r(M, {
|
|
209
221
|
className: "action",
|
|
210
222
|
type: "link",
|
|
211
|
-
disabled: !
|
|
223
|
+
disabled: !d.length,
|
|
212
224
|
onClick: () => {
|
|
213
|
-
|
|
225
|
+
B(!0);
|
|
214
226
|
},
|
|
215
|
-
children: /* @__PURE__ */
|
|
227
|
+
children: /* @__PURE__ */ b("div", {
|
|
216
228
|
className: "detail",
|
|
217
|
-
children: [/* @__PURE__ */ r(
|
|
229
|
+
children: [/* @__PURE__ */ r(j, {
|
|
218
230
|
type: "icon-shanchu",
|
|
219
231
|
style: {
|
|
220
232
|
fontSize: 16
|
|
@@ -226,53 +238,59 @@ const j = 50, U = 10, ve = xe((M, P) => {
|
|
|
226
238
|
})]
|
|
227
239
|
})]
|
|
228
240
|
})
|
|
229
|
-
}),
|
|
241
|
+
}), de = (e, i) => {
|
|
230
242
|
if (!e)
|
|
231
243
|
throw Error("session is not exist.");
|
|
232
|
-
return
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
244
|
+
return a == null ? void 0 : a.uploadFile(e, i).catch(() => (o.config({
|
|
245
|
+
getContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
246
|
+
prefixCls: "gbot-message"
|
|
247
|
+
}), o.error("服务异常,请稍后再试"), o.config({
|
|
248
|
+
getContainer: void 0,
|
|
249
|
+
prefixCls: "gbot-message"
|
|
250
|
+
}), ""));
|
|
251
|
+
}, V = /* @__PURE__ */ r("div", {
|
|
252
|
+
className: `upload-enter ${A ? "disabled" : ""}`,
|
|
253
|
+
children: /* @__PURE__ */ r(ue, {
|
|
236
254
|
size: "small",
|
|
237
255
|
color: "#9C24F2",
|
|
238
|
-
count:
|
|
256
|
+
count: w === "successed" ? d.length : w === "process" ? /* @__PURE__ */ r(fe, {
|
|
239
257
|
className: "file-action file-process",
|
|
240
|
-
indicator: /* @__PURE__ */ r(
|
|
258
|
+
indicator: /* @__PURE__ */ r(ye, {
|
|
241
259
|
style: {
|
|
242
260
|
fontSize: 14
|
|
243
261
|
},
|
|
244
262
|
spin: !0
|
|
245
263
|
})
|
|
246
|
-
}) :
|
|
264
|
+
}) : w === "failed" ? /* @__PURE__ */ r(Ce, {
|
|
247
265
|
style: {
|
|
248
266
|
color: "#dc4446",
|
|
249
267
|
fontSize: 14
|
|
250
268
|
}
|
|
251
269
|
}) : 0,
|
|
252
|
-
children: /* @__PURE__ */ r(
|
|
270
|
+
children: /* @__PURE__ */ r(j, {
|
|
253
271
|
type: "icon-shangchuanwenjian",
|
|
254
272
|
style: {
|
|
255
273
|
fontSize: 24
|
|
256
274
|
}
|
|
257
275
|
})
|
|
258
276
|
})
|
|
259
|
-
}),
|
|
260
|
-
const
|
|
261
|
-
if (!
|
|
277
|
+
}), _ = () => new Promise((e) => {
|
|
278
|
+
const i = f.current;
|
|
279
|
+
if (!c)
|
|
262
280
|
return e();
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
id:
|
|
266
|
-
status:
|
|
267
|
-
})),
|
|
268
|
-
files:
|
|
281
|
+
const s = [];
|
|
282
|
+
i.filter((n) => n.id).forEach((n) => s.push({
|
|
283
|
+
id: n.id,
|
|
284
|
+
status: n.status
|
|
285
|
+
})), a == null || a.delApplicationIdSessionKnowledgeFile(g, c, {
|
|
286
|
+
files: s
|
|
269
287
|
}).then(() => {
|
|
270
|
-
|
|
288
|
+
U([]), m([]), f.current = [], K && K(), F.current = !1, e();
|
|
271
289
|
});
|
|
272
290
|
});
|
|
273
|
-
return /* @__PURE__ */
|
|
291
|
+
return /* @__PURE__ */ b("div", {
|
|
274
292
|
className: "footer-upload",
|
|
275
|
-
children: [
|
|
293
|
+
children: [A ? V : /* @__PURE__ */ r(ge, {
|
|
276
294
|
overlayClassName: "upload-popover",
|
|
277
295
|
overlayInnerStyle: {
|
|
278
296
|
width: 264,
|
|
@@ -282,10 +300,10 @@ const j = 50, U = 10, ve = xe((M, P) => {
|
|
|
282
300
|
zIndex: 1
|
|
283
301
|
},
|
|
284
302
|
placement: "topLeft",
|
|
285
|
-
getPopupContainer: () => (
|
|
303
|
+
getPopupContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
286
304
|
content: /* @__PURE__ */ r("div", {
|
|
287
305
|
className: "file-upload",
|
|
288
|
-
children:
|
|
306
|
+
children: d.length > 0 ? /* @__PURE__ */ r("div", {
|
|
289
307
|
className: "upload-wrapper",
|
|
290
308
|
children: /* @__PURE__ */ r("div", {
|
|
291
309
|
className: "input-files",
|
|
@@ -293,85 +311,103 @@ const j = 50, U = 10, ve = xe((M, P) => {
|
|
|
293
311
|
display: "flex",
|
|
294
312
|
flexDirection: "column"
|
|
295
313
|
},
|
|
296
|
-
children:
|
|
314
|
+
children: d == null ? void 0 : d.map((e, i) => /* @__PURE__ */ r(Ne, {
|
|
297
315
|
file: e,
|
|
298
316
|
actions: {
|
|
299
317
|
preview: () => {
|
|
300
318
|
if (!(e != null && e.url)) {
|
|
301
|
-
|
|
319
|
+
o.config({
|
|
320
|
+
getContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
321
|
+
prefixCls: "gbot-message"
|
|
322
|
+
}), o.error("正在上传中"), o.config({
|
|
323
|
+
getContainer: void 0,
|
|
324
|
+
prefixCls: "gbot-message"
|
|
325
|
+
});
|
|
302
326
|
return;
|
|
303
327
|
}
|
|
304
|
-
if (!
|
|
305
|
-
|
|
328
|
+
if (!Ie(e.url)) {
|
|
329
|
+
o.config({
|
|
330
|
+
getContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
331
|
+
prefixCls: "gbot-message"
|
|
332
|
+
}), o.error("链接格式不正确"), o.config({
|
|
333
|
+
getContainer: void 0,
|
|
334
|
+
prefixCls: "gbot-message"
|
|
335
|
+
});
|
|
306
336
|
return;
|
|
307
337
|
}
|
|
308
|
-
window.open(`${
|
|
338
|
+
window.open(`${q}?url=${encodeURIComponent(e == null ? void 0 : e.url)}`);
|
|
309
339
|
},
|
|
310
340
|
remove: () => {
|
|
311
|
-
|
|
341
|
+
ie(e);
|
|
312
342
|
},
|
|
313
343
|
download: () => {
|
|
314
|
-
|
|
315
|
-
if (!(
|
|
316
|
-
|
|
344
|
+
c && (a == null || a.getApplicationIdSessionKnowledgeFileId(g, c, e.id).then((s) => {
|
|
345
|
+
if (!(s != null && s.url)) {
|
|
346
|
+
o.config({
|
|
347
|
+
getContainer: () => (t == null ? void 0 : t.current) || document.body,
|
|
348
|
+
prefixCls: "gbot-message"
|
|
349
|
+
}), o.error("下载失败"), o.config({
|
|
350
|
+
getContainer: void 0,
|
|
351
|
+
prefixCls: "gbot-message"
|
|
352
|
+
});
|
|
317
353
|
return;
|
|
318
354
|
}
|
|
319
|
-
const
|
|
320
|
-
|
|
355
|
+
const n = document.createElement("a");
|
|
356
|
+
n.href = s.url, n.download = s.name || "", n.click();
|
|
321
357
|
}));
|
|
322
358
|
}
|
|
323
359
|
}
|
|
324
|
-
},
|
|
360
|
+
}, i))
|
|
325
361
|
})
|
|
326
|
-
}) : /* @__PURE__ */
|
|
362
|
+
}) : /* @__PURE__ */ b(Z, {
|
|
327
363
|
name: "file",
|
|
328
364
|
showUploadList: !1,
|
|
329
365
|
multiple: !0,
|
|
330
|
-
beforeUpload:
|
|
366
|
+
beforeUpload: O,
|
|
331
367
|
accept: ".pdf, .doc, .docx",
|
|
332
|
-
maxCount:
|
|
368
|
+
maxCount: 10,
|
|
333
369
|
listType: "picture",
|
|
334
370
|
children: [/* @__PURE__ */ r("span", {
|
|
335
371
|
className: "file-upload-icon",
|
|
336
|
-
children: /* @__PURE__ */ r(
|
|
337
|
-
}), /* @__PURE__ */
|
|
372
|
+
children: /* @__PURE__ */ r(be, {})
|
|
373
|
+
}), /* @__PURE__ */ b(me, {
|
|
338
374
|
className: "file-upload-action",
|
|
339
|
-
children: ["拖拽文件至此,或者", /* @__PURE__ */ r(
|
|
375
|
+
children: ["拖拽文件至此,或者", /* @__PURE__ */ r(M, {
|
|
340
376
|
type: "link",
|
|
341
377
|
style: {
|
|
342
378
|
padding: 0
|
|
343
379
|
},
|
|
344
380
|
children: "上传文件"
|
|
345
381
|
})]
|
|
346
|
-
}), /* @__PURE__ */
|
|
382
|
+
}), /* @__PURE__ */ b("div", {
|
|
347
383
|
className: "file-upload-desc",
|
|
348
384
|
children: [/* @__PURE__ */ r("div", {
|
|
349
385
|
className: "item-upload-desc",
|
|
350
386
|
children: /* @__PURE__ */ r("span", {
|
|
351
387
|
children: "1.支持 doc、pdf、docx 格式;"
|
|
352
388
|
})
|
|
353
|
-
}), /* @__PURE__ */
|
|
389
|
+
}), /* @__PURE__ */ r("div", {
|
|
354
390
|
className: "item-upload-desc",
|
|
355
|
-
children:
|
|
356
|
-
}), /* @__PURE__ */
|
|
391
|
+
children: "2.单个文件不超过 50 M;"
|
|
392
|
+
}), /* @__PURE__ */ r("div", {
|
|
357
393
|
className: "item-upload-desc",
|
|
358
|
-
children:
|
|
394
|
+
children: "3.最多上传 10 个文件。"
|
|
359
395
|
})]
|
|
360
396
|
})]
|
|
361
397
|
})
|
|
362
398
|
}),
|
|
363
|
-
title:
|
|
399
|
+
title: ae,
|
|
364
400
|
trigger: "click",
|
|
365
|
-
children:
|
|
366
|
-
}),
|
|
367
|
-
isvisible:
|
|
401
|
+
children: V
|
|
402
|
+
}), $ && /* @__PURE__ */ r(Fe, {
|
|
403
|
+
isvisible: $,
|
|
368
404
|
onClose: (e) => {
|
|
369
|
-
e === "clear" &&
|
|
405
|
+
e === "clear" && _(), B(!1);
|
|
370
406
|
}
|
|
371
407
|
})]
|
|
372
408
|
});
|
|
373
409
|
});
|
|
374
|
-
|
|
410
|
+
Ae.displayName = "UploadFiles";
|
|
375
411
|
export {
|
|
376
|
-
|
|
412
|
+
Ae as default
|
|
377
413
|
};
|