@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.
Files changed (150) 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/index.mjs +125 -93
  18. package/dist/es/QuillEditor/index.mjs +91 -86
  19. package/dist/es/_virtual/index.mjs +2 -2
  20. package/dist/es/components/Markdown/Image/index.mjs +20 -20
  21. package/dist/es/components/Markdown/index.mjs +27 -22
  22. package/dist/es/constant.mjs +8 -5
  23. package/dist/es/index.mjs +178 -152
  24. package/dist/es/node_modules/classnames/index.mjs +1 -1
  25. package/dist/es/node_modules/comma-separated-tokens/index.mjs +13 -0
  26. package/dist/es/node_modules/devlop/lib/default.mjs +5 -0
  27. package/dist/es/node_modules/hast-util-from-dom/lib/index.mjs +93 -0
  28. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/create-h.mjs +126 -0
  29. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/index.mjs +8 -0
  30. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/svg-case-sensitive-tag-names.mjs +4 -0
  31. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/index.mjs +12 -0
  32. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/aria.mjs +61 -0
  33. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/find.mjs +33 -0
  34. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/html.mjs +368 -0
  35. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/normalize.mjs +6 -0
  36. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/svg.mjs +566 -0
  37. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-insensitive-transform.mjs +7 -0
  38. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-sensitive-transform.mjs +6 -0
  39. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/create.mjs +14 -0
  40. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/defined-info.mjs +36 -0
  41. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/info.mjs +28 -0
  42. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/merge.mjs +10 -0
  43. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/schema.mjs +21 -0
  44. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/types.mjs +15 -0
  45. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xlink.mjs +19 -0
  46. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xml.mjs +15 -0
  47. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xmlns.mjs +16 -0
  48. package/dist/es/node_modules/hast-util-from-html-isomorphic/lib/browser.mjs +16 -0
  49. package/dist/es/node_modules/hast-util-is-element/lib/index.mjs +61 -0
  50. package/dist/es/node_modules/hast-util-parse-selector/lib/index.mjs +20 -0
  51. package/dist/es/node_modules/hast-util-to-text/lib/index.mjs +223 -0
  52. package/dist/es/node_modules/katex/dist/katex.min.css.mjs +4 -0
  53. package/dist/es/node_modules/katex/dist/katex.mjs +11700 -0
  54. package/dist/es/node_modules/longest-streak/index.mjs +12 -0
  55. package/dist/es/node_modules/mdast-util-math/lib/index.mjs +170 -0
  56. package/dist/es/node_modules/micromark-extension-math/lib/math-flow.mjs +76 -0
  57. package/dist/es/node_modules/micromark-extension-math/lib/math-text.mjs +48 -0
  58. package/dist/es/node_modules/micromark-extension-math/lib/syntax.mjs +15 -0
  59. package/dist/es/node_modules/micromark-factory-space/index.mjs +15 -0
  60. package/dist/es/node_modules/micromark-util-character/index.mjs +10 -0
  61. package/dist/es/node_modules/rehype-katex/lib/index.mjs +83 -0
  62. package/dist/es/node_modules/remark-math/lib/index.mjs +13 -0
  63. package/dist/es/node_modules/space-separated-tokens/index.mjs +7 -0
  64. package/dist/es/node_modules/unist-util-find-after/lib/index.mjs +32 -0
  65. package/dist/es/node_modules/unist-util-is/lib/index.mjs +81 -0
  66. package/dist/es/node_modules/unist-util-visit-parents/lib/color.mjs +6 -0
  67. package/dist/es/node_modules/unist-util-visit-parents/lib/index.mjs +56 -0
  68. package/dist/es/node_modules/web-namespaces/index.mjs +11 -0
  69. package/dist/es/utils/index.mjs +44 -27
  70. package/dist/lib/index.js +278 -138
  71. package/dist/src/Dialog/AgentChat/index.d.ts +4 -2
  72. package/dist/src/Dialog/ConnectToNetwork/index.d.ts +1 -0
  73. package/dist/src/Dialog/KnowledgeList/KnowledgeSelect/index.d.ts +1 -1
  74. package/dist/src/Dialog/KnowledgeList/index.d.ts +2 -3
  75. package/dist/src/Dialog/PromptSetting/index.d.ts +1 -0
  76. package/dist/src/Dialog/SessionAction/index.d.ts +2 -0
  77. package/dist/src/Dialog/SessionList/index.d.ts +5 -4
  78. package/dist/src/QuillEditor/index.d.ts +1 -0
  79. package/dist/src/components/Markdown/Text/index.d.ts +8 -0
  80. package/dist/src/components/MathJaxLoader/index.d.ts +7 -0
  81. package/dist/src/components/MathJaxRender/index.d.ts +6 -0
  82. package/dist/src/constant.d.ts +1 -1
  83. package/dist/src/contexts/MathJaxContext.d.ts +12 -0
  84. package/dist/src/index.d.ts +4 -1
  85. package/dist/src/types.d.ts +26 -6
  86. package/dist/src/utils/index.d.ts +15 -0
  87. package/package.json +18 -17
  88. package/dist/es/_virtual/index2.mjs +0 -4
  89. package/dist/es/_virtual/index3.mjs +0 -4
  90. package/dist/es/_virtual/index4.mjs +0 -4
  91. package/dist/es/_virtual/minio-zj.mjs +0 -4
  92. package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +0 -26485
  93. package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +0 -54
  94. package/dist/es/node_modules/base64-js/index.mjs +0 -47
  95. package/dist/es/node_modules/buffer/index.mjs +0 -927
  96. package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +0 -9
  97. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +0 -18
  98. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +0 -24
  99. package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +0 -19
  100. package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +0 -4
  101. package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +0 -317
  102. package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +0 -113
  103. package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +0 -11
  104. package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +0 -273
  105. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +0 -8
  106. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +0 -87
  107. package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +0 -52
  108. package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +0 -21
  109. package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +0 -23
  110. package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +0 -21
  111. package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +0 -14
  112. package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +0 -39
  113. package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +0 -28
  114. package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +0 -105
  115. package/dist/es/node_modules/ieee754/index.mjs +0 -28
  116. package/dist/es/node_modules/js-base64/base64.mjs +0 -31
  117. package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +0 -26
  118. package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +0 -25
  119. package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +0 -242
  120. package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +0 -8
  121. package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +0 -608
  122. package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +0 -19
  123. package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +0 -52
  124. package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +0 -203
  125. package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +0 -26
  126. package/dist/es/packages/agent-cli-sdk/src/AgentSession.mjs +0 -243
  127. package/dist/es/packages/agent-cli-sdk/src/BotClient.mjs +0 -242
  128. package/dist/es/packages/agent-cli-sdk/src/Config.mjs +0 -34
  129. package/dist/es/packages/agent-cli-sdk/src/DialogSession.mjs +0 -281
  130. package/dist/es/packages/agent-cli-sdk/src/EventBus.mjs +0 -64
  131. package/dist/es/packages/agent-cli-sdk/src/Logger.mjs +0 -31
  132. package/dist/es/packages/agent-cli-sdk/src/PayloadTypes.mjs +0 -4
  133. package/dist/es/packages/agent-cli-sdk/src/Session.mjs +0 -527
  134. package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/fetch.mjs +0 -112
  135. package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/parse.mjs +0 -97
  136. package/dist/es/packages/agent-cli-sdk/src/api/index.mjs +0 -48
  137. package/dist/es/packages/agent-cli-sdk/src/utils.mjs +0 -11
  138. package/dist/es/packages/apis/dist/es/aecpilot/cosntant.mjs +0 -5
  139. package/dist/es/packages/apis/dist/es/aecpilot/model.mjs +0 -9
  140. package/dist/es/packages/apis/dist/es/aecpilotui/index.mjs +0 -8
  141. package/dist/es/packages/apis/dist/es/agentcliui/index.mjs +0 -414
  142. package/dist/es/packages/apis/dist/es/base/index.mjs +0 -154
  143. package/dist/es/packages/apis/dist/es/cvforce/index.mjs +0 -431
  144. package/dist/es/packages/apis/dist/es/cvforce/model.mjs +0 -6
  145. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -6
  146. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +0 -10
  147. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -9
  148. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +0 -19
  149. package/dist/es/packages/apis/dist/es/utils/fetchEventSource/fetch.mjs +0 -106
  150. package/dist/es/packages/apis/dist/es/utils/fetchEventSource/parse.mjs +0 -97
@@ -1,121 +1,153 @@
1
- var m = (y, i, r) => new Promise((p, u) => {
2
- var d = (a) => {
1
+ var q = Object.defineProperty, z = Object.defineProperties;
2
+ var B = Object.getOwnPropertyDescriptors;
3
+ var L = Object.getOwnPropertySymbols;
4
+ var F = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
5
+ var x = (t, n, s) => n in t ? q(t, n, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[n] = s, j = (t, n) => {
6
+ for (var s in n || (n = {}))
7
+ F.call(n, s) && x(t, s, n[s]);
8
+ if (L)
9
+ for (var s of L(n))
10
+ G.call(n, s) && x(t, s, n[s]);
11
+ return t;
12
+ }, A = (t, n) => z(t, B(n));
13
+ var p = (t, n, s) => new Promise((I, N) => {
14
+ var e = (r) => {
3
15
  try {
4
- h(r.next(a));
5
- } catch (l) {
6
- u(l);
16
+ u(s.next(r));
17
+ } catch (h) {
18
+ N(h);
7
19
  }
8
- }, o = (a) => {
20
+ }, a = (r) => {
9
21
  try {
10
- h(r.throw(a));
11
- } catch (l) {
12
- u(l);
22
+ u(s.throw(r));
23
+ } catch (h) {
24
+ N(h);
13
25
  }
14
- }, h = (a) => a.done ? p(a.value) : Promise.resolve(a.value).then(d, o);
15
- h((r = r.apply(y, i)).next());
26
+ }, u = (r) => r.done ? I(r.value) : Promise.resolve(r.value).then(e, a);
27
+ u((s = s.apply(t, n)).next());
16
28
  });
17
- import { jsx as n, jsxs as x } from "../_virtual/jsx-runtime.mjs";
18
- import { useState as f, useContext as U, useRef as D, useEffect as v } from "react";
19
- import O from "../context.mjs";
20
- import V from "./AgentChat/index.mjs";
21
- import q from "./KnowledgeList/index.mjs";
22
- import z from "./SessionList/index.mjs";
29
+ import { jsx as c, jsxs as R } from "../_virtual/jsx-runtime.mjs";
30
+ import { useState as v, useContext as J, useRef as M, useEffect as y } from "react";
31
+ import P from "../context.mjs";
32
+ import Q from "./AgentChat/index.mjs";
33
+ import T from "./KnowledgeList/index.mjs";
34
+ import W from "./SessionList/index.mjs";
23
35
  import "./style.less.mjs";
24
- const $ = (y) => {
36
+ const re = (t) => {
25
37
  const {
26
- sessionId: i,
27
- appId: r,
28
- docViewerUrl: p,
29
- bodyStyle: u
30
- } = y, [d, o] = f(), {
31
- service: h,
32
- mode: a,
33
- showHeader: l,
34
- token: B,
35
- agentClient: e,
36
- sider: E,
37
- onSessionLoad: N,
38
- onSessionUnload: F,
39
- footer: G,
40
- transform: J,
41
- depId: b
42
- } = U(O), [c, L] = f(), w = D(null), [A, R] = f(""), [j, I] = f([]), [k, S] = f(!1);
43
- v(() => {
44
- var t, s;
45
- b && ((t = d == null ? void 0 : d.data) != null && t.id ? S(!!((s = d.data) != null && s.netOpen)) : S(!1));
46
- }, [b]), v(() => {
47
- const t = () => m(void 0, null, function* () {
48
- const s = e == null ? void 0 : e.application;
49
- if (!(s != null && s.id))
38
+ sessionId: n,
39
+ appId: s,
40
+ docViewerUrl: I,
41
+ bodyStyle: N
42
+ } = t, [e, a] = v(), {
43
+ service: u,
44
+ mode: r,
45
+ showHeader: h,
46
+ token: X,
47
+ agentClient: o,
48
+ sider: H,
49
+ onSessionLoad: f,
50
+ onSessionUnload: Y,
51
+ footer: Z,
52
+ transform: _,
53
+ depId: $,
54
+ features: l
55
+ } = J(P), [m, K] = v(), w = M(null), [U, D] = v(""), [k, b] = v(), [E, S] = v(!1);
56
+ y(() => {
57
+ var i;
58
+ S(e ? !!((i = e.data) != null && i.netOpen) : typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.default) == "boolean" ? l.connectNetwork.default : !1);
59
+ }, [e]), y(() => {
60
+ const i = () => p(void 0, null, function* () {
61
+ const d = o == null ? void 0 : o.application;
62
+ if (!(d != null && d.id))
50
63
  return;
51
- const g = s == null ? void 0 : s.arrange;
64
+ const g = d == null ? void 0 : d.arrange;
52
65
  if (!(g != null && g.length))
53
66
  return;
54
- const K = g[0].embeddingService;
55
- R(K), L(s);
67
+ const V = g[0].embeddingService;
68
+ D(V), K(d);
56
69
  });
57
- return e == null || e.addEventListener("ready", () => t()), () => {
58
- e == null || e.removeEventListener("ready", t);
70
+ return o == null || o.addEventListener("ready", () => i()), () => {
71
+ o == null || o.removeEventListener("ready", i);
59
72
  };
60
- }, []), v(() => {
61
- e && i && (console.log("load sessionId", i), e.ready ? (console.log("agentClient is ready"), e == null || e.getSessions().then((t) => m(void 0, null, function* () {
62
- o == null || o(t.find((s) => s.id === i));
63
- }))) : e.addEventListener("ready", () => m(void 0, null, function* () {
64
- console.log("agentClient is ready"), e == null || e.getSessions().then((t) => m(void 0, null, function* () {
65
- o == null || o(t.find((s) => s.id === i));
73
+ }, []), y(() => {
74
+ o && n && (o.ready ? o == null || o.getSessions().then((i) => p(void 0, null, function* () {
75
+ a == null || a(i.find((d) => d.id === n));
76
+ })) : o.addEventListener("ready", () => p(void 0, null, function* () {
77
+ o == null || o.getSessions().then((i) => p(void 0, null, function* () {
78
+ a == null || a(i.find((d) => d.id === n));
66
79
  }));
67
80
  }), !0));
68
- }, [e, i]), v(() => {
69
- d != null && d.data && N && N({
70
- applicationId: r,
71
- sessionId: d.data.id,
72
- session: d.data
73
- });
74
- }, [d]);
75
- const H = (t) => {
76
- var s;
77
- return (s = w.current) == null ? void 0 : s.create(t);
81
+ }, [o, n]), y(() => {
82
+ if (!e) {
83
+ f && f({
84
+ applicationId: s,
85
+ sessionId: "",
86
+ session: null,
87
+ sessionInstance: null
88
+ });
89
+ return;
90
+ }
91
+ e.data && f && f({
92
+ applicationId: s,
93
+ sessionId: e.data.id,
94
+ session: e.data,
95
+ sessionInstance: e
96
+ }), e.addEventListener("data:loaded", () => {
97
+ e != null && e.data && f && f({
98
+ applicationId: s,
99
+ sessionId: e.data.id,
100
+ session: e.data,
101
+ sessionInstance: e
102
+ });
103
+ }, !0);
104
+ }, [e]);
105
+ const O = (i) => {
106
+ var d;
107
+ return (d = w.current) == null ? void 0 : d.create(A(j({}, i), {
108
+ knowledges: k
109
+ }));
78
110
  };
79
- return /* @__PURE__ */ n("div", {
111
+ return /* @__PURE__ */ c("div", {
80
112
  className: "dialog",
81
- children: /* @__PURE__ */ x("div", {
113
+ children: /* @__PURE__ */ R("div", {
82
114
  className: "dialog-pannel",
83
- children: [/* @__PURE__ */ n("div", {
115
+ children: [/* @__PURE__ */ c("div", {
84
116
  className: "dialog-sider",
85
- children: /* @__PURE__ */ n(z, {
117
+ children: /* @__PURE__ */ c(W, {
86
118
  ref: w,
87
- sider: E,
88
- appId: r,
89
- networkStatus: k,
90
- currentSession: d,
91
- application: c,
92
- setCurrentSession: o,
93
- checkKnowledges: j,
94
- setCheckKnowledges: I
119
+ sider: H,
120
+ appId: s,
121
+ networkStatus: E,
122
+ currentSession: e,
123
+ application: m,
124
+ setCurrentSession: a,
125
+ checkKnowledges: k,
126
+ setCheckKnowledges: b
95
127
  })
96
- }), /* @__PURE__ */ n("div", {
128
+ }), /* @__PURE__ */ c("div", {
97
129
  className: "dialog-content",
98
- children: /* @__PURE__ */ x("div", {
130
+ children: /* @__PURE__ */ R("div", {
99
131
  className: "dialog-chat",
100
- children: [l && /* @__PURE__ */ n("div", {
132
+ children: [h && /* @__PURE__ */ c("div", {
101
133
  className: "dialog-chat-header",
102
- children: /* @__PURE__ */ n(q, {
103
- setCheckKnowledges: I,
104
- application: c,
105
- currentSession: d,
106
- setCurrentSession: o
134
+ children: /* @__PURE__ */ c(T, {
135
+ setCheckKnowledges: b,
136
+ application: m,
137
+ currentSession: e,
138
+ setCurrentSession: a
107
139
  })
108
- }), /* @__PURE__ */ n("div", {
140
+ }), /* @__PURE__ */ c("div", {
109
141
  className: "dialog-chat-content",
110
- children: (c == null ? void 0 : c.id) && /* @__PURE__ */ n(V, {
142
+ children: (m == null ? void 0 : m.id) && /* @__PURE__ */ c(Q, {
111
143
  setNetworkStatus: S,
112
- networkStatus: k,
113
- application: c,
114
- currentSession: d,
115
- onCreateSession: H,
116
- docViewerUrl: p,
117
- embeddingService: A,
118
- setCurrentSession: o
144
+ networkStatus: E,
145
+ application: m,
146
+ currentSession: e,
147
+ onCreateSession: O,
148
+ docViewerUrl: I,
149
+ embeddingService: U,
150
+ setCurrentSession: a
119
151
  })
120
152
  })]
121
153
  })
@@ -124,5 +156,5 @@ const $ = (y) => {
124
156
  });
125
157
  };
126
158
  export {
127
- $ as default
159
+ re as default
128
160
  };
@@ -1,153 +1,157 @@
1
- import { jsxs as i, jsx as r } from "../_virtual/jsx-runtime.mjs";
2
- import { forwardRef as J, useState as o, useRef as D, useImperativeHandle as X, useEffect as v } from "react";
3
- import Y from "react-quill";
4
- import E from "../node_modules/classnames/index.mjs";
5
- import Z from "../Iconfont/index.mjs";
6
- import { Popover as ee, Space as te, Button as ne } from "antd";
1
+ import { jsxs as s, jsx as r } from "../_virtual/jsx-runtime.mjs";
2
+ import { forwardRef as X, useState as o, useRef as O, useImperativeHandle as Y, useEffect as f } from "react";
3
+ import Z from "react-quill";
4
+ import T from "../node_modules/classnames/index.mjs";
5
+ import ee from "../Iconfont/index.mjs";
6
+ import { Popover as te, Space as ne, Button as re } from "antd";
7
7
  import "../node_modules/react-quill/dist/quill.snow.css.mjs";
8
8
  import "./style.less.mjs";
9
- import q from "../node_modules/ahooks/es/useKeyPress/index.mjs";
10
- import { shortCutEnum as g } from "../utils/index.mjs";
11
- const re = J((B, O) => {
12
- var K, R, _;
9
+ import P from "../node_modules/ahooks/es/useKeyPress/index.mjs";
10
+ import { shortCutEnum as p } from "../utils/index.mjs";
11
+ const ie = X((z, F) => {
12
+ var D, q, B;
13
13
  const {
14
- text: x,
14
+ text: N,
15
15
  onTextSend: d,
16
- disabled: P,
16
+ disabled: j,
17
17
  maxLength: c = 0,
18
- onChange: T,
18
+ onChange: y,
19
19
  networkStatus: a,
20
- clearAction: N
21
- } = B, [z, y] = o(!0), [h, l] = o(), [p, C] = o(), [F, j] = o(15), [L, M] = o(12), [w, Q] = o(0), [b, m] = o(!1), U = D(null), n = D(null);
22
- X(O, () => ({
23
- clear: V,
24
- prevent: W,
25
- focus: $,
26
- update: A
27
- })), v(() => {
28
- l(x), n.current && f();
29
- }, [x]);
30
- const A = (e) => {
20
+ clearAction: C,
21
+ loading: m
22
+ } = z, [b, L] = o(!0), [h, l] = o(), [v, w] = o(), [M, Q] = o(15), [S, U] = o(12), [k, A] = o(0), [I, E] = o(!1), V = O(null), n = O(null);
23
+ Y(F, () => ({
24
+ clear: $,
25
+ prevent: H,
26
+ focus: x,
27
+ update: W
28
+ })), f(() => {
29
+ l(N), n.current && (g(), x());
30
+ }, [N]);
31
+ const W = (e) => {
31
32
  l(e);
32
- }, V = () => {
33
- l(void 0), C(void 0);
34
- }, W = () => {
35
- console.log("prevent");
36
33
  }, $ = () => {
37
- if (!n.current)
34
+ l(void 0), w(void 0);
35
+ }, H = () => {
36
+ console.log("prevent");
37
+ }, x = () => {
38
+ if (!n.current || b)
38
39
  return;
39
40
  const e = n.current.getEditor();
40
41
  e.focus(), setTimeout(() => {
41
42
  e.getLength() > 0 && e.setSelection(e.getLength(), e.getLength());
42
43
  });
43
44
  };
44
- v(() => {
45
+ f(() => {
45
46
  if (!n.current)
46
47
  return;
47
48
  const e = n.current.getEditor();
48
49
  c && (e.on("text-change", () => {
49
- e.getLength() > c && e.deleteText(c, e.getLength()), f(), S();
50
- }), e.on("selection-change", S));
50
+ e.getLength() > c && e.deleteText(c, e.getLength()), g(), K(), x();
51
+ }), e.on("selection-change", K));
51
52
  }, [n, c]);
52
- const f = () => {
53
+ const g = () => {
53
54
  if (!n.current)
54
55
  return;
55
56
  const e = n.current.getEditor();
56
- j(e.getBounds(e.getLength() - 1, e.getLength()).left), M(e.getBounds(e.getLength() - 1, e.getLength()).top);
57
- }, S = (e) => {
57
+ Q(e.getBounds(e.getLength() - 1, e.getLength()).left), U(e.getBounds(e.getLength() - 1, e.getLength()).top);
58
+ }, K = (e) => {
58
59
  if (!n.current)
59
60
  return;
60
- const t = n.current.getEditor(), s = e || t.getSelection();
61
- (s == null ? void 0 : s.index) !== void 0 && Q(s == null ? void 0 : s.index);
61
+ const t = n.current.getEditor(), i = e || t.getSelection();
62
+ (i == null ? void 0 : i.index) !== void 0 && A(i == null ? void 0 : i.index);
62
63
  };
63
- q("1", () => {
64
+ P("1", () => {
64
65
  var t;
65
66
  const e = (t = n.current) == null ? void 0 : t.getEditor();
66
- b && a && (e == null || e.blur(), setTimeout(() => k()));
67
- }), q("2", () => {
67
+ I && a && (e == null || e.blur(), setTimeout(() => R()));
68
+ }), P("2", () => {
68
69
  var t;
69
70
  const e = (t = n.current) == null ? void 0 : t.getEditor();
70
- b && (e == null || e.blur(), setTimeout(() => I()));
71
+ I && (e == null || e.blur(), setTimeout(() => _()));
71
72
  });
72
- const k = () => {
73
+ const R = () => {
73
74
  var t;
74
75
  if (!a)
75
76
  return;
76
77
  const e = (t = n.current) == null ? void 0 : t.getEditor();
77
- e == null || e.focus(), m(!1), setTimeout(() => e == null ? void 0 : e.insertText(w, g.NETWORK));
78
- }, I = () => {
78
+ e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, p.NETWORK));
79
+ }, _ = () => {
79
80
  var t;
80
81
  const e = (t = n.current) == null ? void 0 : t.getEditor();
81
- e == null || e.focus(), m(!1), setTimeout(() => e == null ? void 0 : e.insertText(w, g.DOCUMENT));
82
- }, H = () => {
83
- var t, s, u;
82
+ e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, p.DOCUMENT));
83
+ }, G = () => {
84
+ var t, i, u;
84
85
  const e = (t = n.current) == null ? void 0 : t.getEditor();
85
- return e && (e == null ? void 0 : e.getLength()) > 2 && !((s = e.getText()) != null && s.includes(g.NETWORK)) && !((u = e.getText()) != null && u.includes(g.DOCUMENT));
86
+ return e && (e == null ? void 0 : e.getLength()) > 2 && !((i = e.getText()) != null && i.includes(p.NETWORK)) && !((u = e.getText()) != null && u.includes(p.DOCUMENT));
86
87
  };
87
- return v(() => (window.addEventListener("resize", f), () => {
88
- window.removeEventListener("resize", f);
89
- }), []), /* @__PURE__ */ i("div", {
90
- className: E({
88
+ return f(() => {
89
+ var e, t;
90
+ m ? (e = n.current) == null || e.getEditor().disable() : (t = n.current) == null || t.getEditor().enable();
91
+ }, [m]), f(() => (window.addEventListener("resize", g), () => {
92
+ window.removeEventListener("resize", g);
93
+ }), []), /* @__PURE__ */ s("div", {
94
+ className: T({
91
95
  "quill-editor": !0,
92
- "quill-editor__active": z
96
+ "quill-editor__active": b
93
97
  }),
94
- children: [/* @__PURE__ */ i("div", {
95
- className: E({
98
+ children: [/* @__PURE__ */ s("div", {
99
+ className: T({
96
100
  "quill-editor-wrapper": !0,
97
- "quill-editor-wrapper__scroll": L >= 200
101
+ "quill-editor-wrapper__scroll": S >= 200
98
102
  }),
99
103
  onKeyDownCapture: (e) => {
100
104
  !e.shiftKey && e.code === "Enter" && e.preventDefault();
101
105
  },
102
- children: [/* @__PURE__ */ r(Y, {
106
+ children: [/* @__PURE__ */ r(Z, {
103
107
  theme: "snow",
104
108
  placeholder: "输入你想问的,shift+enter 换行。",
105
109
  ref: n,
106
- onFocus: () => y(!0),
107
- onBlur: () => y(!1),
110
+ onFocus: () => L(!0),
111
+ onBlur: () => L(!1),
108
112
  onKeyDown: (e) => {
109
113
  if (!e.shiftKey && e.keyCode == 13) {
110
114
  const t = h == null ? void 0 : h.replace(/[\n\s]+$/, "");
111
- l(t), d && d(p);
115
+ l(t), d && d(v);
112
116
  }
113
117
  },
114
118
  value: h,
115
119
  modules: {
116
120
  toolbar: !1
117
121
  },
118
- onChange: (e, t, s, u) => {
122
+ onChange: (e, t, i, u) => {
119
123
  if (!t)
120
124
  return;
121
125
  l(e);
122
- const G = u.getText().replace(/[\n\s]+$/, "");
123
- C(G), T && T(e, u);
126
+ const J = u.getText().replace(/[\n\s]+$/, "");
127
+ w(J), y && y(e, u);
124
128
  }
125
129
  }), /* @__PURE__ */ r("div", {
126
130
  className: "shortcut-direct",
127
- ref: U,
131
+ ref: V,
128
132
  style: {
129
133
  position: "absolute",
130
- left: F + 4,
131
- top: L,
134
+ left: M + 4,
135
+ top: S,
132
136
  cursor: "pointer",
133
- visibility: H() ? "visible" : "hidden"
137
+ visibility: G() ? "visible" : "hidden"
134
138
  },
135
- children: /* @__PURE__ */ r(ee, {
139
+ children: /* @__PURE__ */ r(te, {
136
140
  autoAdjustOverflow: !0,
137
141
  placement: "top",
138
142
  trigger: "hover",
139
143
  getPopupContainer: (e) => e.parentNode,
140
144
  onVisibleChange: (e) => {
141
- m(e);
145
+ E(e);
142
146
  },
143
- content: /* @__PURE__ */ i("div", {
147
+ content: /* @__PURE__ */ s("div", {
144
148
  className: "shortcut-direct-pannel",
145
- children: [/* @__PURE__ */ i("div", {
146
- className: E({
149
+ children: [/* @__PURE__ */ s("div", {
150
+ className: T({
147
151
  "shortcut-direct-item": a,
148
152
  "shortcut-direct-item__disabled": !a
149
153
  }),
150
- onClick: k,
154
+ onClick: R,
151
155
  children: [/* @__PURE__ */ r("span", {
152
156
  className: "title",
153
157
  children: "指定联网回答"
@@ -155,9 +159,9 @@ const re = J((B, O) => {
155
159
  className: "text",
156
160
  children: "快捷键1"
157
161
  })]
158
- }), /* @__PURE__ */ i("div", {
162
+ }), /* @__PURE__ */ s("div", {
159
163
  className: "shortcut-direct-item",
160
- onClick: I,
164
+ onClick: _,
161
165
  children: [/* @__PURE__ */ r("span", {
162
166
  className: "title",
163
167
  children: "指定文档回答"
@@ -169,36 +173,37 @@ const re = J((B, O) => {
169
173
  })
170
174
  })
171
175
  })]
172
- }), /* @__PURE__ */ i("div", {
176
+ }), /* @__PURE__ */ s("div", {
173
177
  className: "quill-editor-send",
174
178
  children: [/* @__PURE__ */ r("div", {
175
179
  style: {
176
180
  height: 32
177
181
  },
178
- children: N || /* @__PURE__ */ r("span", {})
179
- }), /* @__PURE__ */ i("div", {
182
+ children: C || /* @__PURE__ */ r("span", {})
183
+ }), /* @__PURE__ */ s("div", {
180
184
  style: {
181
185
  height: 32,
182
186
  display: "flex",
183
187
  alignItems: "center"
184
188
  },
185
- children: [/* @__PURE__ */ i(te, {
189
+ children: [/* @__PURE__ */ s(ne, {
186
190
  size: 2,
187
191
  style: {
188
192
  color: "#84868C"
189
193
  },
190
194
  children: [/* @__PURE__ */ r("span", {
191
- children: ((K = n.current) == null ? void 0 : K.getEditor()) && ((_ = (R = n.current) == null ? void 0 : R.getEditor()) == null ? void 0 : _.getLength()) - 1
195
+ children: ((D = n.current) == null ? void 0 : D.getEditor()) && ((B = (q = n.current) == null ? void 0 : q.getEditor()) == null ? void 0 : B.getLength()) - 1
192
196
  }), /* @__PURE__ */ r("span", {
193
197
  children: "/"
194
198
  }), /* @__PURE__ */ r("span", {
195
199
  children: c
196
200
  })]
197
- }), /* @__PURE__ */ r(ne, {
201
+ }), /* @__PURE__ */ r(re, {
198
202
  type: "link",
199
203
  ghost: !0,
200
- disabled: P || !p,
201
- icon: /* @__PURE__ */ r(Z, {
204
+ disabled: j || !v,
205
+ loading: m,
206
+ icon: /* @__PURE__ */ r(ee, {
202
207
  className: "icon-sendMsg",
203
208
  style: {
204
209
  fontSize: 24
@@ -206,14 +211,14 @@ const re = J((B, O) => {
206
211
  type: "icon-fasong"
207
212
  }),
208
213
  onClick: () => {
209
- d && d(p);
214
+ d && d(v);
210
215
  }
211
216
  })]
212
217
  })]
213
218
  })]
214
219
  });
215
220
  });
216
- re.displayName = "QuillEditor";
221
+ ie.displayName = "QuillEditor";
217
222
  export {
218
- re as default
223
+ ie as default
219
224
  };
@@ -1,4 +1,4 @@
1
- var r = {};
1
+ var s = { exports: {} };
2
2
  export {
3
- r as __exports
3
+ s as __module
4
4
  };
@@ -1,26 +1,26 @@
1
- var t = Object.defineProperty, r = Object.defineProperties;
2
- var g = Object.getOwnPropertyDescriptors;
3
- var l = Object.getOwnPropertySymbols;
4
- var i = Object.prototype.hasOwnProperty, f = Object.prototype.propertyIsEnumerable;
5
- var a = (o, n, e) => n in o ? t(o, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[n] = e, c = (o, n) => {
6
- for (var e in n || (n = {}))
7
- i.call(n, e) && a(o, e, n[e]);
8
- if (l)
9
- for (var e of l(n))
10
- f.call(n, e) && a(o, e, n[e]);
11
- return o;
12
- }, m = (o, n) => r(o, g(n));
13
- import { jsx as k } from "../../../_virtual/jsx-runtime.mjs";
14
- import { Image as d } from "antd";
15
- const C = (o) => (console.log(o), /* @__PURE__ */ k(d, m(c({}, o), {
16
- onClick: (n) => {
17
- var e;
18
- return (e = o.onClick) == null ? void 0 : e.call(o, n);
1
+ var c = Object.defineProperty, i = Object.defineProperties;
2
+ var l = Object.getOwnPropertyDescriptors;
3
+ var a = Object.getOwnPropertySymbols;
4
+ var f = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable;
5
+ var e = (n, o, r) => o in n ? c(n, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[o] = r, m = (n, o) => {
6
+ for (var r in o || (o = {}))
7
+ f.call(o, r) && e(n, r, o[r]);
8
+ if (a)
9
+ for (var r of a(o))
10
+ k.call(o, r) && e(n, r, o[r]);
11
+ return n;
12
+ }, t = (n, o) => i(n, l(o));
13
+ import { jsx as d } from "../../../_virtual/jsx-runtime.mjs";
14
+ import { Image as g } from "antd";
15
+ const C = (n) => /* @__PURE__ */ d(g, t(m({}, n), {
16
+ onClick: (o) => {
17
+ var r;
18
+ return (r = n.onClick) == null ? void 0 : r.call(n, o);
19
19
  },
20
20
  onError: () => {
21
- console.log(o), console.warn("图片加载失败");
21
+ console.warn("图片加载失败");
22
22
  }
23
- })));
23
+ }));
24
24
  export {
25
25
  C as default
26
26
  };