@glodon-aiot/agent-cli-ui 2.4.7 → 3.0.5-beta.0

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.
Files changed (151) hide show
  1. package/dist/es/AgentClientUI.mjs +97 -110
  2. package/dist/es/Dialog/AgentChat/index.mjs +516 -467
  3. package/dist/es/Dialog/ConnectToNetwork/index.mjs +25 -24
  4. package/dist/es/Dialog/FileCard/index.mjs +48 -55
  5. package/dist/es/Dialog/FilePreview/index.mjs +35 -42
  6. package/dist/es/Dialog/HistoryItem/index.mjs +48 -53
  7. package/dist/es/Dialog/KnowledgeList/index.mjs +55 -48
  8. package/dist/es/Dialog/PromptManager/index.mjs +29 -36
  9. package/dist/es/Dialog/PromptSetting/index.mjs +53 -66
  10. package/dist/es/Dialog/SessionAction/index.mjs +92 -91
  11. package/dist/es/Dialog/SessionList/index.mjs +135 -121
  12. package/dist/es/Dialog/SessionListDrawer/index.mjs +8 -7
  13. package/dist/es/Dialog/SessionRefer/ReferItem/index.mjs +29 -36
  14. package/dist/es/Dialog/SessionRefer/index.mjs +29 -36
  15. package/dist/es/Dialog/SessionRelated/index.mjs +17 -14
  16. package/dist/es/Dialog/UploadKnowledgeFiles/index.mjs +125 -132
  17. package/dist/es/Dialog/UploadingPrompt/index.mjs +10 -12
  18. package/dist/es/Dialog/index.mjs +125 -93
  19. package/dist/es/QuillEditor/index.mjs +88 -84
  20. package/dist/es/_virtual/index.mjs +2 -2
  21. package/dist/es/components/Markdown/Image/index.mjs +20 -20
  22. package/dist/es/components/Markdown/index.mjs +27 -22
  23. package/dist/es/constant.mjs +8 -5
  24. package/dist/es/index.mjs +178 -152
  25. package/dist/es/node_modules/classnames/index.mjs +1 -1
  26. package/dist/es/node_modules/comma-separated-tokens/index.mjs +13 -0
  27. package/dist/es/node_modules/devlop/lib/default.mjs +5 -0
  28. package/dist/es/node_modules/hast-util-from-dom/lib/index.mjs +93 -0
  29. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/create-h.mjs +126 -0
  30. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/index.mjs +8 -0
  31. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/svg-case-sensitive-tag-names.mjs +4 -0
  32. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/index.mjs +12 -0
  33. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/aria.mjs +61 -0
  34. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/find.mjs +33 -0
  35. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/html.mjs +368 -0
  36. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/normalize.mjs +6 -0
  37. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/svg.mjs +566 -0
  38. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-insensitive-transform.mjs +7 -0
  39. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-sensitive-transform.mjs +6 -0
  40. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/create.mjs +14 -0
  41. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/defined-info.mjs +36 -0
  42. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/info.mjs +28 -0
  43. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/merge.mjs +10 -0
  44. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/schema.mjs +21 -0
  45. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/types.mjs +15 -0
  46. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xlink.mjs +19 -0
  47. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xml.mjs +15 -0
  48. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xmlns.mjs +16 -0
  49. package/dist/es/node_modules/hast-util-from-html-isomorphic/lib/browser.mjs +16 -0
  50. package/dist/es/node_modules/hast-util-is-element/lib/index.mjs +61 -0
  51. package/dist/es/node_modules/hast-util-parse-selector/lib/index.mjs +20 -0
  52. package/dist/es/node_modules/hast-util-to-text/lib/index.mjs +223 -0
  53. package/dist/es/node_modules/katex/dist/katex.min.css.mjs +4 -0
  54. package/dist/es/node_modules/katex/dist/katex.mjs +11700 -0
  55. package/dist/es/node_modules/longest-streak/index.mjs +12 -0
  56. package/dist/es/node_modules/mdast-util-math/lib/index.mjs +170 -0
  57. package/dist/es/node_modules/micromark-extension-math/lib/math-flow.mjs +76 -0
  58. package/dist/es/node_modules/micromark-extension-math/lib/math-text.mjs +48 -0
  59. package/dist/es/node_modules/micromark-extension-math/lib/syntax.mjs +15 -0
  60. package/dist/es/node_modules/micromark-factory-space/index.mjs +15 -0
  61. package/dist/es/node_modules/micromark-util-character/index.mjs +10 -0
  62. package/dist/es/node_modules/rehype-katex/lib/index.mjs +83 -0
  63. package/dist/es/node_modules/remark-math/lib/index.mjs +13 -0
  64. package/dist/es/node_modules/space-separated-tokens/index.mjs +7 -0
  65. package/dist/es/node_modules/unist-util-find-after/lib/index.mjs +32 -0
  66. package/dist/es/node_modules/unist-util-is/lib/index.mjs +81 -0
  67. package/dist/es/node_modules/unist-util-visit-parents/lib/color.mjs +6 -0
  68. package/dist/es/node_modules/unist-util-visit-parents/lib/index.mjs +56 -0
  69. package/dist/es/node_modules/web-namespaces/index.mjs +11 -0
  70. package/dist/es/utils/index.mjs +44 -27
  71. package/dist/lib/index.js +278 -138
  72. package/dist/src/Dialog/AgentChat/index.d.ts +4 -2
  73. package/dist/src/Dialog/ConnectToNetwork/index.d.ts +1 -0
  74. package/dist/src/Dialog/KnowledgeList/KnowledgeSelect/index.d.ts +1 -1
  75. package/dist/src/Dialog/KnowledgeList/index.d.ts +2 -3
  76. package/dist/src/Dialog/PromptSetting/index.d.ts +1 -0
  77. package/dist/src/Dialog/SessionAction/index.d.ts +2 -0
  78. package/dist/src/Dialog/SessionList/index.d.ts +5 -4
  79. package/dist/src/QuillEditor/index.d.ts +1 -0
  80. package/dist/src/components/Markdown/Text/index.d.ts +8 -0
  81. package/dist/src/components/MathJaxLoader/index.d.ts +7 -0
  82. package/dist/src/components/MathJaxRender/index.d.ts +6 -0
  83. package/dist/src/constant.d.ts +1 -1
  84. package/dist/src/contexts/MathJaxContext.d.ts +12 -0
  85. package/dist/src/index.d.ts +4 -1
  86. package/dist/src/types.d.ts +26 -6
  87. package/dist/src/utils/index.d.ts +15 -0
  88. package/package.json +18 -17
  89. package/dist/es/_virtual/index2.mjs +0 -4
  90. package/dist/es/_virtual/index3.mjs +0 -4
  91. package/dist/es/_virtual/index4.mjs +0 -4
  92. package/dist/es/_virtual/minio-zj.mjs +0 -4
  93. package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +0 -26485
  94. package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +0 -54
  95. package/dist/es/node_modules/base64-js/index.mjs +0 -47
  96. package/dist/es/node_modules/buffer/index.mjs +0 -927
  97. package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +0 -9
  98. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +0 -18
  99. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +0 -24
  100. package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +0 -19
  101. package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +0 -4
  102. package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +0 -317
  103. package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +0 -113
  104. package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +0 -11
  105. package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +0 -273
  106. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +0 -8
  107. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +0 -87
  108. package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +0 -52
  109. package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +0 -21
  110. package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +0 -23
  111. package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +0 -21
  112. package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +0 -14
  113. package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +0 -39
  114. package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +0 -28
  115. package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +0 -105
  116. package/dist/es/node_modules/ieee754/index.mjs +0 -28
  117. package/dist/es/node_modules/js-base64/base64.mjs +0 -31
  118. package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +0 -26
  119. package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +0 -25
  120. package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +0 -242
  121. package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +0 -8
  122. package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +0 -608
  123. package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +0 -19
  124. package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +0 -52
  125. package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +0 -203
  126. package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +0 -26
  127. package/dist/es/packages/agent-cli-sdk/src/AgentSession.mjs +0 -243
  128. package/dist/es/packages/agent-cli-sdk/src/BotClient.mjs +0 -242
  129. package/dist/es/packages/agent-cli-sdk/src/Config.mjs +0 -34
  130. package/dist/es/packages/agent-cli-sdk/src/DialogSession.mjs +0 -281
  131. package/dist/es/packages/agent-cli-sdk/src/EventBus.mjs +0 -64
  132. package/dist/es/packages/agent-cli-sdk/src/Logger.mjs +0 -31
  133. package/dist/es/packages/agent-cli-sdk/src/PayloadTypes.mjs +0 -4
  134. package/dist/es/packages/agent-cli-sdk/src/Session.mjs +0 -527
  135. package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/fetch.mjs +0 -112
  136. package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/parse.mjs +0 -97
  137. package/dist/es/packages/agent-cli-sdk/src/api/index.mjs +0 -48
  138. package/dist/es/packages/agent-cli-sdk/src/utils.mjs +0 -11
  139. package/dist/es/packages/apis/dist/es/aecpilot/cosntant.mjs +0 -5
  140. package/dist/es/packages/apis/dist/es/aecpilot/model.mjs +0 -9
  141. package/dist/es/packages/apis/dist/es/aecpilotui/index.mjs +0 -8
  142. package/dist/es/packages/apis/dist/es/agentcliui/index.mjs +0 -414
  143. package/dist/es/packages/apis/dist/es/base/index.mjs +0 -154
  144. package/dist/es/packages/apis/dist/es/cvforce/index.mjs +0 -431
  145. package/dist/es/packages/apis/dist/es/cvforce/model.mjs +0 -6
  146. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -6
  147. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +0 -10
  148. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -9
  149. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +0 -19
  150. package/dist/es/packages/apis/dist/es/utils/fetchEventSource/fetch.mjs +0 -106
  151. package/dist/es/packages/apis/dist/es/utils/fetchEventSource/parse.mjs +0 -97
@@ -1,22 +1,23 @@
1
- import { jsxs as n, jsx as e } from "../../_virtual/jsx-runtime.mjs";
2
- import { Space as s } from "antd";
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 l from "../../Iconfont/index.mjs";
6
- const N = (o) => {
5
+ import m from "../../Iconfont/index.mjs";
6
+ import l from "../../components/Markdown/index.mjs";
7
+ const x = (n) => {
7
8
  const {
8
- history: m,
9
+ history: d,
9
10
  onRelatedClick: i,
10
11
  relatedQuesion: t
11
- } = o;
12
- return /* @__PURE__ */ n(s, {
12
+ } = n;
13
+ return /* @__PURE__ */ o(r, {
13
14
  className: "session-related",
14
15
  direction: "vertical",
15
16
  size: 12,
16
- children: [/* @__PURE__ */ n(s, {
17
+ children: [/* @__PURE__ */ o(r, {
17
18
  className: "session-related-header",
18
19
  size: 8,
19
- children: [/* @__PURE__ */ e(l, {
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(s, {
30
+ }), /* @__PURE__ */ e(r, {
30
31
  className: "session-related-main",
31
32
  direction: "vertical",
32
33
  size: 12,
33
- children: t.map((r, a) => /* @__PURE__ */ e("div", {
34
+ children: t.map((s, a) => /* @__PURE__ */ e("div", {
34
35
  className: "question-main-item",
35
- onClick: () => i == null ? void 0 : i(c(r)),
36
- children: r
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
- N as default
45
+ x as default
43
46
  };
@@ -1,181 +1,173 @@
1
- var z = (L, R, u) => new Promise((a, w) => {
2
- var D = (m) => {
1
+ var z = (L, P, u) => new Promise((a, C) => {
2
+ var R = (h) => {
3
3
  try {
4
- x(u.next(m));
5
- } catch (C) {
6
- w(C);
4
+ S(u.next(h));
5
+ } catch (F) {
6
+ C(F);
7
7
  }
8
- }, A = (m) => {
8
+ }, U = (h) => {
9
9
  try {
10
- x(u.throw(m));
11
- } catch (C) {
12
- w(C);
10
+ S(u.throw(h));
11
+ } catch (F) {
12
+ C(F);
13
13
  }
14
- }, x = (m) => m.done ? a(m.value) : Promise.resolve(m.value).then(D, A);
15
- x((u = u.apply(L, R)).next());
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 S } from "../../_virtual/jsx-runtime.mjs";
18
- import { message as f, Upload as W, Button as M, Badge as ue, Spin as pe, Popover as fe, Space as me } from "antd";
19
- import { forwardRef as he, useState as v, useRef as G, useContext as ge, useEffect as F, useImperativeHandle as ye } from "react";
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 Ce from "../../node_modules/lodash/debounce.mjs";
23
- import Fe from "../FileCard/index.mjs";
24
- import "axios";
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 ve } from "../../utils/index.mjs";
36
- import { MB as Ae } from "../../constant.mjs";
37
- const Ue = he((L, R) => {
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: w,
42
- createSession: D,
43
- disabled: A = !1,
44
- afterFileAdd: x,
45
- afterFileDelete: m,
46
- onFileListChange: C,
47
- shouldContinue: P = !0,
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, p] = v([]), c = G(i), [Q, U] = v([]), [Y, T] = v(!1), [b, k] = v(""), I = G(P), [$, B] = v(!1), {
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: N
48
+ popupContainer: m
56
49
  } = ge(Ie);
57
- F(() => {
58
- I.current = P;
59
- }, [P]), ye(R, () => ({
50
+ w(() => {
51
+ I.current = D;
52
+ }, [D]), ye(P, () => ({
60
53
  update: H,
61
54
  clear: _
62
- })), F(() => {
63
- J || (U([]), p([]), H());
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((t) => {
69
- U(t), p(t), ee(t);
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 t;
68
+ var n;
76
69
  try {
77
70
  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), x && x(s, a);
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 (n) {
82
- if (((t = n.cause) == null ? void 0 : t.code) === -101) {
83
- const l = [...c.current], h = e.findIndex((d) => d.id === s.id);
84
- h !== -1 && (l[h].status = 3), p(l);
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
- F(() => {
91
- f.config({
92
- getContainer: () => (N == null ? void 0 : N.current) || document.body
83
+ w(() => {
84
+ p.config({
85
+ getContainer: () => (m == null ? void 0 : m.current) || document.body
93
86
  });
94
- }, [N]), F(() => {
95
- w && w(b);
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 f.error("该文件为空,请重新上传文档"), !1;
100
- const t = ze(e.name);
101
- if (console.log(t, "filename"), t.length > X)
102
- return f.error(`文件名称不能超过${X}字符`), !1;
103
- if (e.size > 50 * Ae)
104
- return f.error(`${e.name}文件大小不能超过 50M`), !1;
105
- if (ve.some((n) => n === e.type)) {
106
- const n = e;
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
- F(() => {
104
+ w(() => {
113
105
  if (i.length < 10 ? T(!1) : T(!0), !i.length) {
114
- k("");
106
+ v("");
115
107
  return;
116
108
  }
117
- const e = i.find((n) => n.status === 1), s = i.find((n) => n.status === 3);
118
- i.every((n) => n.status === 2) ? k("successed") : e ? k("process") : s && k("failed"), C && C(i);
119
- }, [i]), F(() => {
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), U(i);
114
+ re(e), k(i);
123
115
  }, [i]);
124
- const te = (e, s, t) => z(void 0, null, function* () {
125
- var h;
126
- const n = [...c.current], l = c.current.findIndex((d) => d === t);
127
- l !== -1 && (n[l].id = s), p(n);
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 d = yield o == null ? void 0 : o.checkFileReady(u, e, s, () => I.current, void 0, (g) => {
130
- const y = [...c.current], E = c.current.findIndex((de) => de === t);
131
- y[E].url = g.url, p(y);
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 (d) {
134
- const g = [...c.current], y = c.current.findIndex((E) => E === t);
135
- y !== -1 && (g[y].status = 2, g[y].url = d.url), p(g), x && x(d, e);
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 (d) {
138
- if (((h = d.cause) == null ? void 0 : h.code) === -101) {
139
- const g = [...c.current], y = c.current.findIndex((E) => E === t);
140
- y !== -1 && (g[y].status = 3), p(g);
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) : D(), re = (e) => {
136
+ }), ne = () => a ? Promise.resolve(a) : R(), re = (e) => {
145
137
  e.length && ne().then((s) => {
146
- e == null || e.forEach((t) => {
147
- var n;
148
- I.current = !0, (n = le(s, t)) == null || n.then((l) => {
149
- var d;
150
- if (!l)
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 h = {
153
- url: l,
154
- name: t.name,
155
- size: t.size,
144
+ const g = {
145
+ url: d,
146
+ name: n.name,
147
+ size: n.size,
156
148
  type: 1,
157
- origin: we.AECPILOT
149
+ origin: Ce.AECPILOT
158
150
  };
159
- I.current && ((d = se(s, h)) == null || d.then((g) => te(s, g, t)));
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 = Ce((e) => {
164
- f.error(e);
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 t = i.filter((n) => n.id !== e.id);
168
- p(t), f.config({
169
- getContainer: () => (N == null ? void 0 : N.current) || document.body
170
- }), f.success("删除成功"), m && m(e.id);
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__ */ S("div", {
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__ */ S("div", {
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__ */ S("div", {
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__ */ S("div", {
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
- }), le = (e, s) => {
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(() => (f.error("服务异常,请稍后再试"), ""));
220
+ return o == null ? void 0 : o.uploadFile(e, s).catch(() => (p.error("服务异常,请稍后再试"), ""));
229
221
  }, V = /* @__PURE__ */ r("div", {
230
- className: `upload-enter ${A ? "disabled" : ""}`,
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(pe, {
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 (console.log(s), !a)
249
+ if (!a)
258
250
  return e();
259
- const t = [];
260
- s.filter((n) => n.id).forEach((n) => t.push({
261
- id: n.id,
262
- status: n.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: t
256
+ files: n
265
257
  }).then(() => {
266
- U([]), p([]), c.current = [], K && K(), I.current = !1, e();
258
+ k([]), f([]), c.current = [], K && K(), I.current = !1, e();
267
259
  });
268
260
  });
269
- return /* @__PURE__ */ S("div", {
261
+ return /* @__PURE__ */ N("div", {
270
262
  className: "footer-upload",
271
- children: [A ? V : /* @__PURE__ */ r(fe, {
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(Fe, {
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 f.error("正在上传中");
289
+ return p.error("正在上传中");
297
290
  if (!Ee(e.url))
298
- return f.error("链接格式不正确");
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((t) => {
306
- if (!(t != null && t.url)) {
307
- f.error("下载失败");
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 n = document.createElement("a");
311
- n.href = t.url, n.download = t.name || "", n.click();
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__ */ S(Z, {
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__ */ S(me, {
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__ */ S("div", {
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
- Ue.displayName = "UploadFiles";
358
+ ke.displayName = "UploadFiles";
366
359
  export {
367
- Ue as default
360
+ ke as default
368
361
  };
@@ -1,4 +1,4 @@
1
- import { jsx as o, jsxs as p } from "../../_virtual/jsx-runtime.mjs";
1
+ import { jsx as e, jsxs as p } from "../../_virtual/jsx-runtime.mjs";
2
2
  import { ExclamationCircleFilled as f } from "@ant-design/icons";
3
3
  import { Modal as u, Button as s } from "antd";
4
4
  import { useContext as h } from "react";
@@ -14,28 +14,26 @@ const E = (r) => {
14
14
  service: n
15
15
  } = h(C), d = /* @__PURE__ */ p("div", {
16
16
  className: "title",
17
- children: [/* @__PURE__ */ o(f, {
17
+ children: [/* @__PURE__ */ e(f, {
18
18
  style: {
19
19
  color: "#FF9326",
20
20
  fontSize: 20
21
21
  }
22
- }), /* @__PURE__ */ o("span", {
22
+ }), /* @__PURE__ */ e("span", {
23
23
  children: "文件任务正在处理"
24
24
  })]
25
25
  }), m = () => {
26
26
  if (!l)
27
27
  return;
28
28
  const i = [];
29
- a.filter((e) => e.id).forEach((e) => i.push({
30
- id: e.id,
31
- status: e.status
29
+ a.filter((o) => o.id).forEach((o) => i.push({
30
+ id: o.id,
31
+ status: o.status
32
32
  })), n == null || n.deleteSessionKnowledgeFiles(l, {
33
33
  files: i
34
- }).then((e) => {
35
- console.log(e);
36
34
  }), t("abandon");
37
35
  };
38
- return /* @__PURE__ */ o(u, {
36
+ return /* @__PURE__ */ e(u, {
39
37
  className: "prompt-modal",
40
38
  width: 340,
41
39
  open: c,
@@ -44,19 +42,19 @@ const E = (r) => {
44
42
  maskClosable: !1,
45
43
  onCancel: () => t("close"),
46
44
  getContainer: document.getElementById("dialog-modal") || !1,
47
- footer: [/* @__PURE__ */ o(s, {
45
+ footer: [/* @__PURE__ */ e(s, {
48
46
  onClick: () => {
49
47
  m();
50
48
  },
51
49
  children: "放弃文件"
52
- }, "cancel"), /* @__PURE__ */ o(s, {
50
+ }, "cancel"), /* @__PURE__ */ e(s, {
53
51
  type: "primary",
54
52
  onClick: () => {
55
53
  t("continue");
56
54
  },
57
55
  children: "继续上传"
58
56
  }, "confirm")],
59
- children: /* @__PURE__ */ o("div", {
57
+ children: /* @__PURE__ */ e("div", {
60
58
  className: "content",
61
59
  children: "你可以选择后台继续上传,也可以直接离开放弃上传中的文件。"
62
60
  })