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