@glodon-aiot/agent-cli-ui 2.4.7 → 3.0.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 +97 -110
- package/dist/es/Dialog/AgentChat/index.mjs +516 -467
- package/dist/es/Dialog/ConnectToNetwork/index.mjs +25 -24
- package/dist/es/Dialog/FileCard/index.mjs +48 -55
- package/dist/es/Dialog/FilePreview/index.mjs +35 -42
- package/dist/es/Dialog/HistoryItem/index.mjs +48 -53
- package/dist/es/Dialog/KnowledgeList/index.mjs +55 -48
- package/dist/es/Dialog/PromptManager/index.mjs +29 -36
- package/dist/es/Dialog/PromptSetting/index.mjs +53 -66
- package/dist/es/Dialog/SessionAction/index.mjs +92 -91
- package/dist/es/Dialog/SessionList/index.mjs +135 -121
- package/dist/es/Dialog/SessionListDrawer/index.mjs +8 -7
- package/dist/es/Dialog/SessionRefer/ReferItem/index.mjs +29 -36
- package/dist/es/Dialog/SessionRefer/index.mjs +29 -36
- package/dist/es/Dialog/SessionRelated/index.mjs +17 -14
- package/dist/es/Dialog/UploadKnowledgeFiles/index.mjs +125 -132
- package/dist/es/Dialog/index.mjs +125 -93
- package/dist/es/QuillEditor/index.mjs +91 -86
- package/dist/es/_virtual/index.mjs +2 -2
- package/dist/es/components/Markdown/Image/index.mjs +20 -20
- package/dist/es/components/Markdown/index.mjs +27 -22
- package/dist/es/constant.mjs +8 -5
- package/dist/es/index.mjs +178 -152
- package/dist/es/node_modules/classnames/index.mjs +1 -1
- package/dist/es/node_modules/comma-separated-tokens/index.mjs +13 -0
- package/dist/es/node_modules/devlop/lib/default.mjs +5 -0
- package/dist/es/node_modules/hast-util-from-dom/lib/index.mjs +93 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/create-h.mjs +126 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/index.mjs +8 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/svg-case-sensitive-tag-names.mjs +4 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/index.mjs +12 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/aria.mjs +61 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/find.mjs +33 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/html.mjs +368 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/normalize.mjs +6 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/svg.mjs +566 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-insensitive-transform.mjs +7 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-sensitive-transform.mjs +6 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/create.mjs +14 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/defined-info.mjs +36 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/info.mjs +28 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/merge.mjs +10 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/schema.mjs +21 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/types.mjs +15 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xlink.mjs +19 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xml.mjs +15 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xmlns.mjs +16 -0
- package/dist/es/node_modules/hast-util-from-html-isomorphic/lib/browser.mjs +16 -0
- package/dist/es/node_modules/hast-util-is-element/lib/index.mjs +61 -0
- package/dist/es/node_modules/hast-util-parse-selector/lib/index.mjs +20 -0
- package/dist/es/node_modules/hast-util-to-text/lib/index.mjs +223 -0
- package/dist/es/node_modules/katex/dist/katex.min.css.mjs +4 -0
- package/dist/es/node_modules/katex/dist/katex.mjs +11700 -0
- package/dist/es/node_modules/longest-streak/index.mjs +12 -0
- package/dist/es/node_modules/mdast-util-math/lib/index.mjs +170 -0
- package/dist/es/node_modules/micromark-extension-math/lib/math-flow.mjs +76 -0
- package/dist/es/node_modules/micromark-extension-math/lib/math-text.mjs +48 -0
- package/dist/es/node_modules/micromark-extension-math/lib/syntax.mjs +15 -0
- package/dist/es/node_modules/micromark-factory-space/index.mjs +15 -0
- package/dist/es/node_modules/micromark-util-character/index.mjs +10 -0
- package/dist/es/node_modules/rehype-katex/lib/index.mjs +83 -0
- package/dist/es/node_modules/remark-math/lib/index.mjs +13 -0
- package/dist/es/node_modules/space-separated-tokens/index.mjs +7 -0
- package/dist/es/node_modules/unist-util-find-after/lib/index.mjs +32 -0
- package/dist/es/node_modules/unist-util-is/lib/index.mjs +81 -0
- package/dist/es/node_modules/unist-util-visit-parents/lib/color.mjs +6 -0
- package/dist/es/node_modules/unist-util-visit-parents/lib/index.mjs +56 -0
- package/dist/es/node_modules/web-namespaces/index.mjs +11 -0
- package/dist/es/utils/index.mjs +44 -27
- package/dist/lib/index.js +278 -138
- package/dist/src/Dialog/AgentChat/index.d.ts +4 -2
- package/dist/src/Dialog/ConnectToNetwork/index.d.ts +1 -0
- package/dist/src/Dialog/KnowledgeList/KnowledgeSelect/index.d.ts +1 -1
- package/dist/src/Dialog/KnowledgeList/index.d.ts +2 -3
- package/dist/src/Dialog/PromptSetting/index.d.ts +1 -0
- package/dist/src/Dialog/SessionAction/index.d.ts +2 -0
- package/dist/src/Dialog/SessionList/index.d.ts +5 -4
- package/dist/src/QuillEditor/index.d.ts +1 -0
- package/dist/src/components/Markdown/Text/index.d.ts +8 -0
- package/dist/src/components/MathJaxLoader/index.d.ts +7 -0
- package/dist/src/components/MathJaxRender/index.d.ts +6 -0
- package/dist/src/constant.d.ts +1 -1
- package/dist/src/contexts/MathJaxContext.d.ts +12 -0
- package/dist/src/index.d.ts +4 -1
- package/dist/src/types.d.ts +26 -6
- package/dist/src/utils/index.d.ts +15 -0
- package/package.json +18 -17
- package/dist/es/_virtual/index2.mjs +0 -4
- package/dist/es/_virtual/index3.mjs +0 -4
- package/dist/es/_virtual/index4.mjs +0 -4
- package/dist/es/_virtual/minio-zj.mjs +0 -4
- package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +0 -26485
- package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +0 -54
- package/dist/es/node_modules/base64-js/index.mjs +0 -47
- package/dist/es/node_modules/buffer/index.mjs +0 -927
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +0 -9
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +0 -18
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +0 -24
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +0 -19
- package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +0 -4
- package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +0 -317
- package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +0 -113
- package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +0 -11
- package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +0 -273
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +0 -8
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +0 -87
- package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +0 -52
- package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +0 -21
- package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +0 -23
- package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +0 -21
- package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +0 -14
- package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +0 -39
- package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +0 -28
- package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +0 -105
- package/dist/es/node_modules/ieee754/index.mjs +0 -28
- package/dist/es/node_modules/js-base64/base64.mjs +0 -31
- package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +0 -26
- package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +0 -25
- package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +0 -242
- package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +0 -8
- package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +0 -608
- package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +0 -19
- package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +0 -52
- package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +0 -203
- package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +0 -26
- package/dist/es/packages/agent-cli-sdk/src/AgentSession.mjs +0 -243
- package/dist/es/packages/agent-cli-sdk/src/BotClient.mjs +0 -242
- package/dist/es/packages/agent-cli-sdk/src/Config.mjs +0 -34
- package/dist/es/packages/agent-cli-sdk/src/DialogSession.mjs +0 -281
- package/dist/es/packages/agent-cli-sdk/src/EventBus.mjs +0 -64
- package/dist/es/packages/agent-cli-sdk/src/Logger.mjs +0 -31
- package/dist/es/packages/agent-cli-sdk/src/PayloadTypes.mjs +0 -4
- package/dist/es/packages/agent-cli-sdk/src/Session.mjs +0 -527
- package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/fetch.mjs +0 -112
- package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/parse.mjs +0 -97
- package/dist/es/packages/agent-cli-sdk/src/api/index.mjs +0 -48
- package/dist/es/packages/agent-cli-sdk/src/utils.mjs +0 -11
- package/dist/es/packages/apis/dist/es/aecpilot/cosntant.mjs +0 -5
- package/dist/es/packages/apis/dist/es/aecpilot/model.mjs +0 -9
- package/dist/es/packages/apis/dist/es/aecpilotui/index.mjs +0 -8
- package/dist/es/packages/apis/dist/es/agentcliui/index.mjs +0 -414
- package/dist/es/packages/apis/dist/es/base/index.mjs +0 -154
- package/dist/es/packages/apis/dist/es/cvforce/index.mjs +0 -431
- package/dist/es/packages/apis/dist/es/cvforce/model.mjs +0 -6
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -6
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +0 -10
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -9
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +0 -19
- package/dist/es/packages/apis/dist/es/utils/fetchEventSource/fetch.mjs +0 -106
- package/dist/es/packages/apis/dist/es/utils/fetchEventSource/parse.mjs +0 -97
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Space as
|
|
1
|
+
import { jsxs as o, jsx as e } from "../../_virtual/jsx-runtime.mjs";
|
|
2
|
+
import { Space as r } from "antd";
|
|
3
3
|
import "./style.less.mjs";
|
|
4
4
|
import { removeNewlines as c } from "../../utils/index.mjs";
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import m from "../../Iconfont/index.mjs";
|
|
6
|
+
import l from "../../components/Markdown/index.mjs";
|
|
7
|
+
const x = (n) => {
|
|
7
8
|
const {
|
|
8
|
-
history:
|
|
9
|
+
history: d,
|
|
9
10
|
onRelatedClick: i,
|
|
10
11
|
relatedQuesion: t
|
|
11
|
-
} =
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
} = n;
|
|
13
|
+
return /* @__PURE__ */ o(r, {
|
|
13
14
|
className: "session-related",
|
|
14
15
|
direction: "vertical",
|
|
15
16
|
size: 12,
|
|
16
|
-
children: [/* @__PURE__ */
|
|
17
|
+
children: [/* @__PURE__ */ o(r, {
|
|
17
18
|
className: "session-related-header",
|
|
18
19
|
size: 8,
|
|
19
|
-
children: [/* @__PURE__ */ e(
|
|
20
|
+
children: [/* @__PURE__ */ e(m, {
|
|
20
21
|
type: "icon-xiangguanwenti",
|
|
21
22
|
style: {
|
|
22
23
|
color: "#0A51D1",
|
|
@@ -26,18 +27,20 @@ const N = (o) => {
|
|
|
26
27
|
className: "question-header-title",
|
|
27
28
|
children: "相关问题"
|
|
28
29
|
})]
|
|
29
|
-
}), /* @__PURE__ */ e(
|
|
30
|
+
}), /* @__PURE__ */ e(r, {
|
|
30
31
|
className: "session-related-main",
|
|
31
32
|
direction: "vertical",
|
|
32
33
|
size: 12,
|
|
33
|
-
children: t.map((
|
|
34
|
+
children: t.map((s, a) => /* @__PURE__ */ e("div", {
|
|
34
35
|
className: "question-main-item",
|
|
35
|
-
onClick: () => i == null ? void 0 : i(c(
|
|
36
|
-
children:
|
|
36
|
+
onClick: () => i == null ? void 0 : i(c(s)),
|
|
37
|
+
children: /* @__PURE__ */ e(l, {
|
|
38
|
+
children: s
|
|
39
|
+
})
|
|
37
40
|
}, a))
|
|
38
41
|
})]
|
|
39
42
|
});
|
|
40
43
|
};
|
|
41
44
|
export {
|
|
42
|
-
|
|
45
|
+
x as default
|
|
43
46
|
};
|
|
@@ -1,181 +1,173 @@
|
|
|
1
|
-
var z = (L,
|
|
2
|
-
var
|
|
1
|
+
var z = (L, P, u) => new Promise((a, C) => {
|
|
2
|
+
var R = (h) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
4
|
+
S(u.next(h));
|
|
5
|
+
} catch (F) {
|
|
6
|
+
C(F);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, U = (h) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
10
|
+
S(u.throw(h));
|
|
11
|
+
} catch (F) {
|
|
12
|
+
C(F);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, S = (h) => h.done ? a(h.value) : Promise.resolve(h.value).then(R, U);
|
|
15
|
+
S((u = u.apply(L, P)).next());
|
|
16
16
|
});
|
|
17
|
-
import { jsx as r, Fragment as ce, jsxs as
|
|
18
|
-
import { message as
|
|
19
|
-
import { forwardRef as
|
|
17
|
+
import { jsx as r, Fragment as ce, jsxs as N } from "../../_virtual/jsx-runtime.mjs";
|
|
18
|
+
import { message as p, Upload as W, Button as M, Badge as ue, Spin as fe, Popover as pe, Space as he } from "antd";
|
|
19
|
+
import { forwardRef as me, useState as A, useRef as G, useContext as ge, useEffect as w, useImperativeHandle as ye } from "react";
|
|
20
20
|
import { LoadingOutlined as xe, CloseCircleFilled as Se, CloudUploadOutlined as Ne } from "@ant-design/icons";
|
|
21
21
|
import "./style.less.mjs";
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import "
|
|
25
|
-
import "../../node_modules/@glodon-aiot/minio/dist/minio-zj.mjs";
|
|
26
|
-
import { IFileOrigin as we } from "../../packages/apis/dist/es/aecpilot/model.mjs";
|
|
27
|
-
import "dayjs";
|
|
28
|
-
import "../../packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs";
|
|
29
|
-
import "../../packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs";
|
|
30
|
-
import "../../packages/apis/dist/es/agentcliui/index.mjs";
|
|
31
|
-
import "../../packages/apis/dist/es/aecpilotui/index.mjs";
|
|
22
|
+
import Fe from "../../node_modules/lodash/debounce.mjs";
|
|
23
|
+
import we from "../FileCard/index.mjs";
|
|
24
|
+
import { IFileOrigin as Ce } from "@glodon-aiot/apis";
|
|
32
25
|
import be from "./ClearModal/index.mjs";
|
|
33
26
|
import j from "../../Iconfont/index.mjs";
|
|
34
27
|
import Ie from "../../context.mjs";
|
|
35
|
-
import { isValidImageUrlWithAnyExtension as Ee, extractFileName as ze, FILE_NAME_MAX_LENGTH as X, fileTypes as
|
|
36
|
-
import { MB as
|
|
37
|
-
const
|
|
28
|
+
import { isValidImageUrlWithAnyExtension as Ee, extractFileName as ze, FILE_NAME_MAX_LENGTH as X, fileTypes as Ae } from "../../utils/index.mjs";
|
|
29
|
+
import { MB as Ue } from "../../constant.mjs";
|
|
30
|
+
const ke = me((L, P) => {
|
|
38
31
|
const {
|
|
39
32
|
appId: u,
|
|
40
33
|
sid: a,
|
|
41
|
-
onStatusChange:
|
|
42
|
-
createSession:
|
|
43
|
-
disabled:
|
|
44
|
-
afterFileAdd:
|
|
45
|
-
afterFileDelete:
|
|
46
|
-
onFileListChange:
|
|
47
|
-
shouldContinue:
|
|
34
|
+
onStatusChange: C,
|
|
35
|
+
createSession: R,
|
|
36
|
+
disabled: U = !1,
|
|
37
|
+
afterFileAdd: S,
|
|
38
|
+
afterFileDelete: h,
|
|
39
|
+
onFileListChange: F,
|
|
40
|
+
shouldContinue: D = !0,
|
|
48
41
|
afterFilesClear: K,
|
|
49
42
|
docViewerUrl: q,
|
|
50
43
|
isFirstSession: J
|
|
51
|
-
} = L, [i,
|
|
44
|
+
} = L, [i, f] = A([]), c = G(i), [Q, k] = A([]), [Y, T] = A(!1), [b, v] = A(""), I = G(D), [$, B] = A(!1), {
|
|
52
45
|
Dragger: Z
|
|
53
46
|
} = W, {
|
|
54
47
|
service: o,
|
|
55
|
-
popupContainer:
|
|
48
|
+
popupContainer: m
|
|
56
49
|
} = ge(Ie);
|
|
57
|
-
|
|
58
|
-
I.current =
|
|
59
|
-
}, [
|
|
50
|
+
w(() => {
|
|
51
|
+
I.current = D;
|
|
52
|
+
}, [D]), ye(P, () => ({
|
|
60
53
|
update: H,
|
|
61
54
|
clear: _
|
|
62
|
-
})),
|
|
63
|
-
J || (
|
|
55
|
+
})), w(() => {
|
|
56
|
+
J || (k([]), f([]), H());
|
|
64
57
|
}, [a]);
|
|
65
58
|
const H = () => a ? new Promise((e, s) => {
|
|
66
59
|
o == null || o.getApplicationIdSessionKnowledgeFiles(u, a, {
|
|
67
60
|
enabled: 1
|
|
68
|
-
}).then((
|
|
69
|
-
|
|
61
|
+
}).then((n) => {
|
|
62
|
+
k(n), f(n), ee(n);
|
|
70
63
|
}).finally(() => {
|
|
71
64
|
e();
|
|
72
65
|
});
|
|
73
66
|
}) : Promise.resolve(), ee = (e) => z(void 0, null, function* () {
|
|
74
67
|
a && (e == null || e.map((s) => z(void 0, null, function* () {
|
|
75
|
-
var
|
|
68
|
+
var n;
|
|
76
69
|
try {
|
|
77
70
|
if (yield o == null ? void 0 : o.checkFileReady(u, a, s.id)) {
|
|
78
|
-
const
|
|
79
|
-
|
|
71
|
+
const d = [...c.current], g = e.findIndex((l) => l.id === s.id);
|
|
72
|
+
g !== -1 && (d[g].status = 2), f(d), S && S(s, a);
|
|
80
73
|
}
|
|
81
|
-
} catch (
|
|
82
|
-
if (((
|
|
83
|
-
const
|
|
84
|
-
|
|
74
|
+
} catch (t) {
|
|
75
|
+
if (((n = t.cause) == null ? void 0 : n.code) === -101) {
|
|
76
|
+
const d = [...c.current], g = e.findIndex((l) => l.id === s.id);
|
|
77
|
+
g !== -1 && (d[g].status = 3), f(d);
|
|
85
78
|
return;
|
|
86
79
|
}
|
|
87
80
|
}
|
|
88
81
|
})));
|
|
89
82
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
getContainer: () => (
|
|
83
|
+
w(() => {
|
|
84
|
+
p.config({
|
|
85
|
+
getContainer: () => (m == null ? void 0 : m.current) || document.body
|
|
93
86
|
});
|
|
94
|
-
}, [
|
|
95
|
-
|
|
87
|
+
}, [m]), w(() => {
|
|
88
|
+
C && C(b);
|
|
96
89
|
}, [b]);
|
|
97
90
|
const O = (e) => z(void 0, null, function* () {
|
|
98
91
|
if (e.size <= 0)
|
|
99
|
-
return
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
n.status = 1, p((l) => l.length >= 10 ? l : [...l, n]);
|
|
92
|
+
return p.error("该文件为空,请重新上传文档"), !1;
|
|
93
|
+
if (ze(e.name).length > X)
|
|
94
|
+
return p.error(`文件名称不能超过${X}字符`), !1;
|
|
95
|
+
if (e.size > 50 * Ue)
|
|
96
|
+
return p.error(`${e.name}文件大小不能超过 50M`), !1;
|
|
97
|
+
if (Ae.some((t) => t === e.type)) {
|
|
98
|
+
const t = e;
|
|
99
|
+
t.status = 1, f((d) => d.length >= 10 ? d : [...d, t]);
|
|
108
100
|
} else
|
|
109
101
|
oe("存在文件格式不正确的文件,已自动去除");
|
|
110
102
|
return !1;
|
|
111
103
|
});
|
|
112
|
-
|
|
104
|
+
w(() => {
|
|
113
105
|
if (i.length < 10 ? T(!1) : T(!0), !i.length) {
|
|
114
|
-
|
|
106
|
+
v("");
|
|
115
107
|
return;
|
|
116
108
|
}
|
|
117
|
-
const e = i.find((
|
|
118
|
-
i.every((
|
|
119
|
-
}, [i]),
|
|
109
|
+
const e = i.find((t) => t.status === 1), s = i.find((t) => t.status === 3);
|
|
110
|
+
i.every((t) => t.status === 2) ? v("successed") : e ? v("process") : s && v("failed"), F && F(i);
|
|
111
|
+
}, [i]), w(() => {
|
|
120
112
|
c.current = i;
|
|
121
113
|
const e = i.filter((s) => !Q.includes(s));
|
|
122
|
-
re(e),
|
|
114
|
+
re(e), k(i);
|
|
123
115
|
}, [i]);
|
|
124
|
-
const te = (e, s,
|
|
125
|
-
var
|
|
126
|
-
const
|
|
127
|
-
|
|
116
|
+
const te = (e, s, n) => z(void 0, null, function* () {
|
|
117
|
+
var g;
|
|
118
|
+
const t = [...c.current], d = c.current.findIndex((l) => l === n);
|
|
119
|
+
d !== -1 && (t[d].id = s), f(t);
|
|
128
120
|
try {
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
|
|
121
|
+
const l = yield o == null ? void 0 : o.checkFileReady(u, e, s, () => I.current, void 0, (y) => {
|
|
122
|
+
const x = [...c.current], E = c.current.findIndex((le) => le === n);
|
|
123
|
+
x[E].url = y.url, f(x);
|
|
132
124
|
});
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
|
|
125
|
+
if (l) {
|
|
126
|
+
const y = [...c.current], x = c.current.findIndex((E) => E === n);
|
|
127
|
+
x !== -1 && (y[x].status = 2, y[x].url = l.url), f(y), S && S(l, e);
|
|
136
128
|
}
|
|
137
|
-
} catch (
|
|
138
|
-
if (((
|
|
139
|
-
const
|
|
140
|
-
|
|
129
|
+
} catch (l) {
|
|
130
|
+
if (((g = l.cause) == null ? void 0 : g.code) === -101) {
|
|
131
|
+
const y = [...c.current], x = c.current.findIndex((E) => E === n);
|
|
132
|
+
x !== -1 && (y[x].status = 3), f(y);
|
|
141
133
|
return;
|
|
142
134
|
}
|
|
143
135
|
}
|
|
144
|
-
}), ne = () => a ? Promise.resolve(a) :
|
|
136
|
+
}), ne = () => a ? Promise.resolve(a) : R(), re = (e) => {
|
|
145
137
|
e.length && ne().then((s) => {
|
|
146
|
-
e == null || e.forEach((
|
|
147
|
-
var
|
|
148
|
-
I.current = !0, (
|
|
149
|
-
var
|
|
150
|
-
if (!
|
|
138
|
+
e == null || e.forEach((n) => {
|
|
139
|
+
var t;
|
|
140
|
+
I.current = !0, (t = de(s, n)) == null || t.then((d) => {
|
|
141
|
+
var l;
|
|
142
|
+
if (!d)
|
|
151
143
|
return;
|
|
152
|
-
const
|
|
153
|
-
url:
|
|
154
|
-
name:
|
|
155
|
-
size:
|
|
144
|
+
const g = {
|
|
145
|
+
url: d,
|
|
146
|
+
name: n.name,
|
|
147
|
+
size: n.size,
|
|
156
148
|
type: 1,
|
|
157
|
-
origin:
|
|
149
|
+
origin: Ce.AECPILOT
|
|
158
150
|
};
|
|
159
|
-
I.current && ((
|
|
151
|
+
I.current && ((l = se(s, g)) == null || l.then((y) => te(s, y, n)));
|
|
160
152
|
});
|
|
161
153
|
});
|
|
162
154
|
});
|
|
163
|
-
}, se = (e, s) => o == null ? void 0 : o.postApplicationIdSessionKnowledgeSessionFile(u, e, s), oe =
|
|
164
|
-
|
|
155
|
+
}, se = (e, s) => o == null ? void 0 : o.postApplicationIdSessionKnowledgeSessionFile(u, e, s), oe = Fe((e) => {
|
|
156
|
+
p.error(e);
|
|
165
157
|
}, 300), ie = (e) => {
|
|
166
158
|
a && e != null && e.id && (o == null || o.delApplicationIdSessionKnowledgeFileId(u, a, e.id).then((s) => {
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
getContainer: () => (
|
|
170
|
-
}),
|
|
159
|
+
const n = i.filter((t) => t.id !== e.id);
|
|
160
|
+
f(n), p.config({
|
|
161
|
+
getContainer: () => (m == null ? void 0 : m.current) || document.body
|
|
162
|
+
}), p.success("删除成功"), h && h(e.id);
|
|
171
163
|
}));
|
|
172
164
|
}, ae = /* @__PURE__ */ r(ce, {
|
|
173
|
-
children: /* @__PURE__ */
|
|
165
|
+
children: /* @__PURE__ */ N("div", {
|
|
174
166
|
className: "card-title",
|
|
175
167
|
children: [/* @__PURE__ */ r("span", {
|
|
176
168
|
className: "name",
|
|
177
169
|
children: "上传列表"
|
|
178
|
-
}), /* @__PURE__ */
|
|
170
|
+
}), /* @__PURE__ */ N("div", {
|
|
179
171
|
className: "actions",
|
|
180
172
|
children: [/* @__PURE__ */ r(W, {
|
|
181
173
|
accept: ".doc, .docx, .pdf",
|
|
@@ -189,7 +181,7 @@ const Ue = he((L, R) => {
|
|
|
189
181
|
className: "action",
|
|
190
182
|
type: "link",
|
|
191
183
|
disabled: Y,
|
|
192
|
-
children: /* @__PURE__ */
|
|
184
|
+
children: /* @__PURE__ */ N("div", {
|
|
193
185
|
className: "detail",
|
|
194
186
|
children: [/* @__PURE__ */ r(j, {
|
|
195
187
|
type: "icon-tianjia",
|
|
@@ -208,7 +200,7 @@ const Ue = he((L, R) => {
|
|
|
208
200
|
onClick: () => {
|
|
209
201
|
B(!0);
|
|
210
202
|
},
|
|
211
|
-
children: /* @__PURE__ */
|
|
203
|
+
children: /* @__PURE__ */ N("div", {
|
|
212
204
|
className: "detail",
|
|
213
205
|
children: [/* @__PURE__ */ r(j, {
|
|
214
206
|
type: "icon-shanchu",
|
|
@@ -222,16 +214,16 @@ const Ue = he((L, R) => {
|
|
|
222
214
|
})]
|
|
223
215
|
})]
|
|
224
216
|
})
|
|
225
|
-
}),
|
|
217
|
+
}), de = (e, s) => {
|
|
226
218
|
if (!e)
|
|
227
219
|
throw Error("session is not exist.");
|
|
228
|
-
return o == null ? void 0 : o.uploadFile(e, s).catch(() => (
|
|
220
|
+
return o == null ? void 0 : o.uploadFile(e, s).catch(() => (p.error("服务异常,请稍后再试"), ""));
|
|
229
221
|
}, V = /* @__PURE__ */ r("div", {
|
|
230
|
-
className: `upload-enter ${
|
|
222
|
+
className: `upload-enter ${U ? "disabled" : ""}`,
|
|
231
223
|
children: /* @__PURE__ */ r(ue, {
|
|
232
224
|
size: "small",
|
|
233
225
|
color: "#9C24F2",
|
|
234
|
-
count: b === "successed" ? i.length : b === "process" ? /* @__PURE__ */ r(
|
|
226
|
+
count: b === "successed" ? i.length : b === "process" ? /* @__PURE__ */ r(fe, {
|
|
235
227
|
className: "file-action file-process",
|
|
236
228
|
indicator: /* @__PURE__ */ r(xe, {
|
|
237
229
|
style: {
|
|
@@ -254,21 +246,21 @@ const Ue = he((L, R) => {
|
|
|
254
246
|
})
|
|
255
247
|
}), _ = () => new Promise((e) => {
|
|
256
248
|
const s = c.current;
|
|
257
|
-
if (
|
|
249
|
+
if (!a)
|
|
258
250
|
return e();
|
|
259
|
-
const
|
|
260
|
-
s.filter((
|
|
261
|
-
id:
|
|
262
|
-
status:
|
|
251
|
+
const n = [];
|
|
252
|
+
s.filter((t) => t.id).forEach((t) => n.push({
|
|
253
|
+
id: t.id,
|
|
254
|
+
status: t.status
|
|
263
255
|
})), o == null || o.delApplicationIdSessionKnowledgeFile(u, a, {
|
|
264
|
-
files:
|
|
256
|
+
files: n
|
|
265
257
|
}).then(() => {
|
|
266
|
-
|
|
258
|
+
k([]), f([]), c.current = [], K && K(), I.current = !1, e();
|
|
267
259
|
});
|
|
268
260
|
});
|
|
269
|
-
return /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */ N("div", {
|
|
270
262
|
className: "footer-upload",
|
|
271
|
-
children: [
|
|
263
|
+
children: [U ? V : /* @__PURE__ */ r(pe, {
|
|
272
264
|
overlayClassName: "upload-popover",
|
|
273
265
|
overlayInnerStyle: {
|
|
274
266
|
width: 264,
|
|
@@ -278,6 +270,7 @@ const Ue = he((L, R) => {
|
|
|
278
270
|
zIndex: 1
|
|
279
271
|
},
|
|
280
272
|
placement: "topLeft",
|
|
273
|
+
getPopupContainer: () => (m == null ? void 0 : m.current) || document.body,
|
|
281
274
|
content: /* @__PURE__ */ r("div", {
|
|
282
275
|
className: "file-upload",
|
|
283
276
|
children: i.length > 0 ? /* @__PURE__ */ r("div", {
|
|
@@ -288,33 +281,33 @@ const Ue = he((L, R) => {
|
|
|
288
281
|
display: "flex",
|
|
289
282
|
flexDirection: "column"
|
|
290
283
|
},
|
|
291
|
-
children: i == null ? void 0 : i.map((e, s) => /* @__PURE__ */ r(
|
|
284
|
+
children: i == null ? void 0 : i.map((e, s) => /* @__PURE__ */ r(we, {
|
|
292
285
|
file: e,
|
|
293
286
|
actions: {
|
|
294
287
|
preview: () => {
|
|
295
288
|
if (!(e != null && e.url))
|
|
296
|
-
return
|
|
289
|
+
return p.error("正在上传中");
|
|
297
290
|
if (!Ee(e.url))
|
|
298
|
-
return
|
|
291
|
+
return p.error("链接格式不正确");
|
|
299
292
|
window.open(`${q}#/doc?url=${encodeURIComponent(e == null ? void 0 : e.url)}`);
|
|
300
293
|
},
|
|
301
294
|
remove: () => {
|
|
302
295
|
ie(e);
|
|
303
296
|
},
|
|
304
297
|
download: () => {
|
|
305
|
-
a && (o == null || o.getApplicationIdSessionKnowledgeFileId(u, a, e.id).then((
|
|
306
|
-
if (!(
|
|
307
|
-
|
|
298
|
+
a && (o == null || o.getApplicationIdSessionKnowledgeFileId(u, a, e.id).then((n) => {
|
|
299
|
+
if (!(n != null && n.url)) {
|
|
300
|
+
p.error("下载失败");
|
|
308
301
|
return;
|
|
309
302
|
}
|
|
310
|
-
const
|
|
311
|
-
|
|
303
|
+
const t = document.createElement("a");
|
|
304
|
+
t.href = n.url, t.download = n.name || "", t.click();
|
|
312
305
|
}));
|
|
313
306
|
}
|
|
314
307
|
}
|
|
315
308
|
}, s))
|
|
316
309
|
})
|
|
317
|
-
}) : /* @__PURE__ */
|
|
310
|
+
}) : /* @__PURE__ */ N(Z, {
|
|
318
311
|
name: "file",
|
|
319
312
|
showUploadList: !1,
|
|
320
313
|
multiple: !0,
|
|
@@ -325,7 +318,7 @@ const Ue = he((L, R) => {
|
|
|
325
318
|
children: [/* @__PURE__ */ r("span", {
|
|
326
319
|
className: "file-upload-icon",
|
|
327
320
|
children: /* @__PURE__ */ r(Ne, {})
|
|
328
|
-
}), /* @__PURE__ */
|
|
321
|
+
}), /* @__PURE__ */ N(he, {
|
|
329
322
|
className: "file-upload-action",
|
|
330
323
|
children: ["拖拽文件至此,或者", /* @__PURE__ */ r(M, {
|
|
331
324
|
type: "link",
|
|
@@ -334,7 +327,7 @@ const Ue = he((L, R) => {
|
|
|
334
327
|
},
|
|
335
328
|
children: "上传文件"
|
|
336
329
|
})]
|
|
337
|
-
}), /* @__PURE__ */
|
|
330
|
+
}), /* @__PURE__ */ N("div", {
|
|
338
331
|
className: "file-upload-desc",
|
|
339
332
|
children: [/* @__PURE__ */ r("div", {
|
|
340
333
|
className: "item-upload-desc",
|
|
@@ -362,7 +355,7 @@ const Ue = he((L, R) => {
|
|
|
362
355
|
})]
|
|
363
356
|
});
|
|
364
357
|
});
|
|
365
|
-
|
|
358
|
+
ke.displayName = "UploadFiles";
|
|
366
359
|
export {
|
|
367
|
-
|
|
360
|
+
ke as default
|
|
368
361
|
};
|