@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,97 +0,0 @@
1
- var b = (s, t, e) => new Promise((a, c) => {
2
- var f = (r) => {
3
- try {
4
- i(e.next(r));
5
- } catch (n) {
6
- c(n);
7
- }
8
- }, l = (r) => {
9
- try {
10
- i(e.throw(r));
11
- } catch (n) {
12
- c(n);
13
- }
14
- }, i = (r) => r.done ? a(r.value) : Promise.resolve(r.value).then(f, l);
15
- i((e = e.apply(s, t)).next());
16
- });
17
- function w(s, t) {
18
- return b(this, null, function* () {
19
- const e = s.getReader();
20
- let a;
21
- for (; !(a = yield e.read()).done; )
22
- t(a.value);
23
- });
24
- }
25
- function g(s) {
26
- let t, e, a, c = !1, f;
27
- return function(i) {
28
- t === void 0 ? (t = i, e = 0, a = -1, f = !1) : t = h(t, i);
29
- const r = t.length;
30
- let n = 0;
31
- for (; e < r; ) {
32
- c && (t[e] === 10 && (n = ++e), c = !1);
33
- let o = -1;
34
- for (; e < r && o === -1; ++e)
35
- switch (t[e]) {
36
- case 58:
37
- a === -1 && (a = e - n);
38
- break;
39
- case 13:
40
- c = !1, e + 4 < r && t[e + 1] === 10 && t[e + 2] !== 13 && t[e - 1] !== 10 && t[e - 2] !== 13 && (f = !0);
41
- case 10:
42
- o = e;
43
- break;
44
- }
45
- if (o === -1)
46
- break;
47
- s(t.subarray(n, o), a, f), n = e, a = -1, f = !1;
48
- }
49
- n === r ? t = void 0 : n !== 0 && (t = t.subarray(n), e -= n);
50
- };
51
- }
52
- function k(s, t, e) {
53
- let a = y();
54
- const c = new TextDecoder();
55
- return function(l, i, r) {
56
- if (l.length === 0)
57
- e == null || e(a), a = y();
58
- else if (i > 0) {
59
- const n = c.decode(l.subarray(0, i)), o = i + (l[i + 1] === 32 ? 2 : 1);
60
- let d = c.decode(l.subarray(o));
61
- switch (r && (d += `
62
- `), n) {
63
- case "data":
64
- a.data = a.data ? a.data + `
65
- ` + d : d;
66
- break;
67
- case "event":
68
- a.event = d;
69
- break;
70
- case "id":
71
- s(a.id = d);
72
- break;
73
- case "retry":
74
- const u = parseInt(d, 10);
75
- isNaN(u) || t(a.retry = u);
76
- break;
77
- }
78
- }
79
- };
80
- }
81
- function h(s, t) {
82
- const e = new Uint8Array(s.length + t.length);
83
- return e.set(s), e.set(t, s.length), e;
84
- }
85
- function y() {
86
- return {
87
- data: "",
88
- event: "",
89
- id: "",
90
- retry: void 0
91
- };
92
- }
93
- export {
94
- w as getBytes,
95
- g as getLines,
96
- k as getMessages
97
- };
@@ -1,48 +0,0 @@
1
- var d = Object.defineProperty, h = Object.defineProperties;
2
- var S = Object.getOwnPropertyDescriptors;
3
- var s = Object.getOwnPropertySymbols;
4
- var x = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
5
- var a = (t, e, r) => e in t ? d(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, p = (t, e) => {
6
- for (var r in e || (e = {}))
7
- x.call(e, r) && a(t, r, e[r]);
8
- if (s)
9
- for (var r of s(e))
10
- C.call(e, r) && a(t, r, e[r]);
11
- return t;
12
- }, m = (t, e) => h(t, S(e));
13
- import E from "axios";
14
- import { isExpired as F } from "../utils.mjs";
15
- import "../../../../node_modules/@glodon-aiot/minio/dist/minio-zj.mjs";
16
- import "dayjs";
17
- import "../../../apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs";
18
- import "../../../apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs";
19
- import "../../../apis/dist/es/agentcliui/index.mjs";
20
- import "../../../apis/dist/es/aecpilotui/index.mjs";
21
- import { CVForceApi as I } from "../../../apis/dist/es/cvforce/index.mjs";
22
- function j(t, e, r) {
23
- console.log("getCVForceService apiBase", t);
24
- const f = (o) => {
25
- var i;
26
- return e && (F(e) && r(403, "aiotToken is timeout"), o.headers = (i = o.headers) != null ? i : {}, o.headers = m(p({}, o.headers), {
27
- Authorization: e ? `Bearer ${e}` : ""
28
- })), o;
29
- };
30
- function g(o, i = !0) {
31
- const n = `${t}${o}`, c = E.create({
32
- baseURL: n
33
- });
34
- return i && c.interceptors.request.use(f), c;
35
- }
36
- const u = (o, i) => {
37
- o === 401 && r(o, "aiotToken is invalid");
38
- }, v = (o, i) => {
39
- o !== 10001 && o !== 10215 && r(o, i);
40
- }, A = g("/data/v1");
41
- return new I(A, {
42
- onHttpStatusError: u,
43
- onAppStatusError: v
44
- });
45
- }
46
- export {
47
- j as getCVForceService
48
- };
@@ -1,11 +0,0 @@
1
- import { fromBase64 as n } from "../../../node_modules/js-base64/base64.mjs";
2
- const o = (e) => JSON.parse(n(e.split(".")[1])), s = (e) => {
3
- const r = o(e).exp;
4
- return (/* @__PURE__ */ new Date()).valueOf() / 1e3 >= r;
5
- }, t = (e) => e == null ? void 0 : e.replace(/[\r\n]+/gm, ""), i = (e) => e.replace(/\\|\\/g, "");
6
- export {
7
- s as isExpired,
8
- o as parseJWT,
9
- i as removeLeadingAndTrailingBackslashes,
10
- t as removeNewlines
11
- };
@@ -1,5 +0,0 @@
1
- const T = 128, _ = 20;
2
- export {
3
- T as PROMPT_SEARCH_MAX_LENGTH,
4
- _ as PROMPT_TITLE_MAX_LENGTH
5
- };
@@ -1,9 +0,0 @@
1
- var t = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.SourceFile = 1] = "SourceFile", e[e.WebLink = 2] = "WebLink", e))(t || {}), o = /* @__PURE__ */ ((e) => (e.Unprotected = "不受著作权保护", e.ProtectAuthorize = "受著作权保护,已获得授权", e.ProtectUnauthorize = "受著作权保护,未获得授权", e))(o || {}), s = /* @__PURE__ */ ((e) => (e[e.Robot = 1] = "Robot", e[e.User = 2] = "User", e[e.System = 3] = "System", e))(s || {}), i = /* @__PURE__ */ ((e) => (e.Start = "start", e.End = "end", e))(i || {}), n = /* @__PURE__ */ ((e) => (e[e.Processing = 1] = "Processing", e[e.Success = 2] = "Success", e[e.Failed = 3] = "Failed", e))(n || {}), a = /* @__PURE__ */ ((e) => (e.AECPILOT = "aecpilot", e))(a || {});
2
- export {
3
- n as AecKnowledgeFileStatus,
4
- a as IFileOrigin,
5
- s as IHistoryRole,
6
- t as ISourceType,
7
- i as IThinkingStatus,
8
- o as IversionInfo
9
- };
@@ -1,8 +0,0 @@
1
- import "axios";
2
- import "../../../../../node_modules/@glodon-aiot/minio/dist/minio-zj.mjs";
3
- import "dayjs";
4
- import "../../../../../node_modules/buffer/index.mjs";
5
- import "../node_modules/uuid/dist/esm-browser/native.mjs";
6
- import "../node_modules/uuid/dist/esm-browser/stringify.mjs";
7
- import { __exports as r } from "../../../../../_virtual/index.mjs";
8
- globalThis.Buffer = r.Buffer;
@@ -1,414 +0,0 @@
1
- import $ from "axios";
2
- import { BaseApi as w } from "../base/index.mjs";
3
- import { m } from "../../../../../node_modules/@glodon-aiot/minio/dist/minio-zj.mjs";
4
- import { IHistoryRole as S, AecKnowledgeFileStatus as f } from "../aecpilot/model.mjs";
5
- import { fetchEventSource as y } from "../utils/fetchEventSource/fetch.mjs";
6
- import A from "dayjs";
7
- import "../../../../../node_modules/buffer/index.mjs";
8
- import { PROMPT_SEARCH_MAX_LENGTH as b } from "../aecpilot/cosntant.mjs";
9
- import P from "../node_modules/uuid/dist/esm-browser/v4.mjs";
10
- import { __exports as R } from "../../../../../_virtual/index.mjs";
11
- var F = Object.defineProperty, T = Object.defineProperties, K = Object.getOwnPropertyDescriptors, g = Object.getOwnPropertySymbols, k = Object.prototype.hasOwnProperty, O = Object.prototype.propertyIsEnumerable, v = (u, e, t) => e in u ? F(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t, M = (u, e) => {
12
- for (var t in e || (e = {}))
13
- k.call(e, t) && v(u, t, e[t]);
14
- if (g)
15
- for (var t of g(e))
16
- O.call(e, t) && v(u, t, e[t]);
17
- return u;
18
- }, x = (u, e) => T(u, K(e)), n = (u, e, t) => new Promise((s, r) => {
19
- var o = (l) => {
20
- try {
21
- i(t.next(l));
22
- } catch (p) {
23
- r(p);
24
- }
25
- }, d = (l) => {
26
- try {
27
- i(t.throw(l));
28
- } catch (p) {
29
- r(p);
30
- }
31
- }, i = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(o, d);
32
- i((t = t.apply(u, e)).next());
33
- });
34
- window.Buffer = R.Buffer;
35
- class L extends w {
36
- constructor(e, t, s) {
37
- super(e != null ? e : $.create(), s), this.axiosInstance = e, this.getToken = t;
38
- }
39
- getApplicationIdSessions(e) {
40
- return n(this, null, function* () {
41
- return this.get(`/data/v1/application/${e}/session`);
42
- });
43
- }
44
- getApplicationId(e) {
45
- return n(this, null, function* () {
46
- return this.get(`/data/v1/applications/${e}`);
47
- });
48
- }
49
- postApplicationIdSession(e) {
50
- return n(this, null, function* () {
51
- return this.post(`/data/v1/application/${e.applicationId}/sessions`, e);
52
- });
53
- }
54
- getApplicationIdSessionsId(e, t) {
55
- return n(this, null, function* () {
56
- return this.get(`/data/v1/application/${e}/sessions/${t}`);
57
- });
58
- }
59
- patchApplicationIdSessionsId(e, t, s) {
60
- return n(this, null, function* () {
61
- return this.patch(`/data/v1/application/${e}/sessions/${t}`, s);
62
- });
63
- }
64
- patchApplicationIdSessionsIdContext(e, t) {
65
- return n(this, null, function* () {
66
- return this.patch(`/data/v1/application/${e}/sessions/${t}/context`, {});
67
- });
68
- }
69
- delApplicationIdSessionsId(e, t) {
70
- return n(this, null, function* () {
71
- return this.delete(`/data/v1/application/${e}/sessions/${t}`);
72
- });
73
- }
74
- postComments(e, t, s) {
75
- return n(this, null, function* () {
76
- return this.post(`/data/v1/application/${e}/sessions/${t}/comments`, s);
77
- });
78
- }
79
- getChatHistorySessionId(e, t) {
80
- return n(this, null, function* () {
81
- return this.get(`/data/v1/application/${e}/chatHistory/${t}`);
82
- });
83
- }
84
- postChatV2EventSource(e, t, s, r, o, d) {
85
- return n(this, null, function* () {
86
- const i = {
87
- code: 0,
88
- messageId: P(),
89
- content: "",
90
- role: S.Robot,
91
- sessionId: "",
92
- reference: [],
93
- searchReference: [],
94
- messageTime: "",
95
- llmModel: "",
96
- comment: {
97
- isAgree: 0
98
- },
99
- isReplying: !1
100
- }, l = yield this.getToken(), p = x(M({}, s), {
101
- stream: !0
102
- });
103
- y(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`, {
104
- method: "POST",
105
- headers: {
106
- Authorization: `Bearer ${l}`,
107
- "Content-Type": "application/json"
108
- },
109
- body: JSON.stringify(p),
110
- openWhenHidden: !0,
111
- signal: r,
112
- onopen(c) {
113
- return console.log("onopen"), c.ok && o != null && o.onopen && o.onopen(), Promise.resolve();
114
- },
115
- onmessage(c) {
116
- if (!c.data.includes('{"code": ')) {
117
- let h = {};
118
- try {
119
- h = JSON.parse(c.data);
120
- } catch (E) {
121
- }
122
- (h == null ? void 0 : h.mtype) === "search" ? i.searchReference.push(h) : i.content = i.content + c.data;
123
- const I = {
124
- content: i.content,
125
- role: 1,
126
- reference: i.reference,
127
- searchReference: i.searchReference,
128
- messageId: i.messageId,
129
- sessionId: t,
130
- messageTime: A(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
131
- comment: {
132
- isAgree: 0
133
- },
134
- isReplying: !0
135
- };
136
- return (o == null ? void 0 : o.onmessage) && o.onmessage(I);
137
- }
138
- const a = JSON.parse(c.data);
139
- if (i.reference = a.data.reference, i.searchReference = a.data.searchReference, i.messageTime = a.data.messageTime, i.messageId = a.data.messageId, i.llmModel = a.data.llmModel, i.content = a.data.content, i.code = a.code, a.code === 200) {
140
- const h = {
141
- code: i.code,
142
- content: i.content,
143
- role: 1,
144
- reference: i.reference,
145
- searchReference: i.searchReference,
146
- messageId: i.messageId,
147
- sessionId: t,
148
- messageTime: i.messageTime,
149
- isReplying: !0
150
- };
151
- o != null && o.onmessage && o.onmessage(h);
152
- } else
153
- return d && d({
154
- code: a.code,
155
- message: a.message
156
- });
157
- },
158
- onerror() {
159
- o != null && o.onerror && o.onerror();
160
- },
161
- onclose() {
162
- const c = {
163
- code: i.code,
164
- content: i.content,
165
- role: 1,
166
- reference: i.reference,
167
- searchReference: i.searchReference,
168
- messageId: i.messageId,
169
- sessionId: t,
170
- messageTime: i.messageTime,
171
- comment: {
172
- isAgree: 0
173
- },
174
- isReplying: !1
175
- };
176
- o != null && o.onclose && o.onclose(c);
177
- }
178
- });
179
- });
180
- }
181
- getKnowledgeIdFileIdData(e, t, s) {
182
- return n(this, null, function* () {
183
- return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${s}`);
184
- });
185
- }
186
- getKnowledgeIdFileId(e, t) {
187
- return n(this, null, function* () {
188
- return this.get(`/data/v1/knowledge/${e}/file/${t}`);
189
- });
190
- }
191
- getKnowledgeId(e) {
192
- return n(this, null, function* () {
193
- return this.get(`/data/v1/knowledge/${e}`);
194
- });
195
- }
196
- getSessionKnowledgeFile(e, t) {
197
- return n(this, null, function* () {
198
- return this.get(`/data/v1/chatSession/${e}/file/${t}`);
199
- });
200
- }
201
- sleep(e) {
202
- return n(this, null, function* () {
203
- return new Promise((t) => {
204
- setTimeout(() => {
205
- t("");
206
- }, e);
207
- });
208
- });
209
- }
210
- getBaseModelInfo(e) {
211
- return n(this, null, function* () {
212
- return this.get("/data/v1/baseModelInfo", {
213
- serviceId: e
214
- });
215
- });
216
- }
217
- uploadFiles(e, t) {
218
- return n(this, null, function* () {
219
- const s = {
220
- files: t.map((r) => r.name),
221
- isv: "minio",
222
- knowledgeId: e
223
- };
224
- return this.postTicket(s).then((r) => Promise.all(t.map((o) => this.uploadMinioFile(r.minio, o)))).catch((r) => {
225
- throw Error(r);
226
- });
227
- });
228
- }
229
- postFile(e, t, s) {
230
- return n(this, null, function* () {
231
- const r = {
232
- files: [t.name],
233
- isv: "minio",
234
- knowledgeId: e,
235
- type: s
236
- };
237
- return this.postTicket(r).then((o) => this.uploadMinioFile(o.minio, t)).catch((o) => {
238
- throw Error(o);
239
- });
240
- });
241
- }
242
- postTicket(e) {
243
- return n(this, null, function* () {
244
- return this.post("/data/v1/ticket", e);
245
- });
246
- }
247
- uploadFile(e, t) {
248
- return n(this, null, function* () {
249
- const s = {
250
- files: [t.name],
251
- isv: "minio",
252
- knowledgeId: e
253
- };
254
- return this.postTicket(s).then((r) => this.uploadMinioFile(r.minio, t)).catch((r) => {
255
- throw Error(r);
256
- });
257
- });
258
- }
259
- // async postUploadTicket(params: IUploadParam) {
260
- // return this.post<IUploadTicket>(`/data/v1/upload/ticket`, params);
261
- // }
262
- uploadMinioFile(e, t) {
263
- return n(this, null, function* () {
264
- return new Promise((s, r) => {
265
- const o = new FileReader();
266
- o.readAsArrayBuffer(t), o.onload = (d) => {
267
- m.initMinio({
268
- endPoint: e.endpoints[0],
269
- useSSL: e.useSSL,
270
- accessKey: e.accessKey,
271
- secretKey: e.secretKey
272
- });
273
- const i = Buffer.from(d.target.result), l = {
274
- "Content-Type": "application/octet-stream"
275
- };
276
- m.putObjectBuffer(e.bucket, e.fileKeys[0], i, l, (p) => {
277
- if (p)
278
- throw console.error(p), Error(p);
279
- s(e.fileKeys[0]);
280
- });
281
- };
282
- });
283
- });
284
- }
285
- getRecommendQues(e) {
286
- return n(this, null, function* () {
287
- return this.get(`/data/v1/application/${e}/recommendQues`);
288
- });
289
- }
290
- //常用提示词
291
- postPrompts(e, t) {
292
- return n(this, null, function* () {
293
- return this.post(`/data/v1/application/${e}/prompts`, t);
294
- });
295
- }
296
- listPrompt(e, t) {
297
- return n(this, null, function* () {
298
- return t != null && t.title && t.title.length > b ? [] : this.get(`/data/v1/application/${e}/prompts`, t);
299
- });
300
- }
301
- getPrompt(e, t) {
302
- return n(this, null, function* () {
303
- return this.get(`/data/v1/application/${e}/prompts/${t}`);
304
- });
305
- }
306
- updatePrompt(e, t, s) {
307
- return n(this, null, function* () {
308
- return this.put(`/data/v1/application/${e}/prompts/${t}`, s);
309
- });
310
- }
311
- deletePrompt(e, t) {
312
- return n(this, null, function* () {
313
- return this.delete(`/data/v1/application/${e}/prompts/${t}`);
314
- });
315
- }
316
- postGeneques(e, t) {
317
- return n(this, null, function* () {
318
- return this.post("/data/v1/geneques", e, {}, t);
319
- });
320
- }
321
- getApplicationIdSessionKnowledgeFiles(e, t, s) {
322
- return n(this, null, function* () {
323
- return this.get(`/data/v1/application/${e}/session/${t}/file`, s);
324
- });
325
- }
326
- checkFileReady(e, t, s, r = () => !0, o = 1e4, d) {
327
- return n(this, null, function* () {
328
- return new Promise((i, l) => {
329
- const p = () => {
330
- if (!r()) {
331
- clearInterval(c);
332
- return;
333
- }
334
- s ? this.getApplicationIdSessionKnowledgeFileId(e, t, s, {}, !0).then((a) => {
335
- if (d == null || d(a), a.status === f.Success && (clearInterval(c), i(a)), a.status === f.Failed) {
336
- clearInterval(c);
337
- const h = "该文件无法读取,请上传可编辑pdf,doc,docx文档";
338
- l(Error(h, {
339
- cause: {
340
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
341
- // @ts-ignore
342
- code: -101,
343
- message: h,
344
- data: a
345
- }
346
- }));
347
- }
348
- }).catch((a) => {
349
- clearInterval(c), l(a);
350
- }) : i(null);
351
- }, c = setInterval(p, o);
352
- p();
353
- });
354
- });
355
- }
356
- getApplicationIdSessionKnowledgeFileId(e, t, s, r, o) {
357
- return n(this, null, function* () {
358
- return this.get(`/data/v1/application/${e}/session/${t}/file/${s}`, r, o);
359
- });
360
- }
361
- delApplicationIdSessionKnowledgeFileId(e, t, s) {
362
- return n(this, null, function* () {
363
- return this.delete(`/data/v1/application/${e}/session/${t}/file/${s}`);
364
- });
365
- }
366
- postApplicationIdSessionKnowledgeSessionFile(e, t, s, r, o) {
367
- return n(this, null, function* () {
368
- return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`, s, r, o);
369
- });
370
- }
371
- delApplicationIdSessionKnowledgeFile(e, t, s) {
372
- return n(this, null, function* () {
373
- return this.delete(`/data/v1/application/${e}/session/${t}/file`, s);
374
- });
375
- }
376
- deleteSessionKnowledgeFiles(e, t) {
377
- return n(this, null, function* () {
378
- return this.delete(`/data/v1/chatSession/${e}/file`, t);
379
- });
380
- }
381
- patchApplicationIdKnowledgeIdFileId(e, t, s, r) {
382
- return n(this, null, function* () {
383
- return this.patch(`/data/v1/application/${e}/session/${t}/file/${s}`, r);
384
- });
385
- }
386
- getApplicationIdSessionIdPromptVariables(e, t) {
387
- return n(this, null, function* () {
388
- return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`);
389
- });
390
- }
391
- getApplicationIdPromptVariables(e, t) {
392
- return n(this, null, function* () {
393
- return this.get(`/data/v1/application/${e}/promptVariables`, t);
394
- });
395
- }
396
- patchApplicationIdSessionpromptVariablesId(e, t, s, r) {
397
- return n(this, null, function* () {
398
- return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${s}`, r);
399
- });
400
- }
401
- updateSession(e, t, s) {
402
- return n(this, null, function* () {
403
- return this.patch(`/data/v1/application/${e}/sessions/${t}`, s);
404
- });
405
- }
406
- getSession(e, t) {
407
- return n(this, null, function* () {
408
- return this.get(`/data/v1/application/${e}/sessions/${t}`);
409
- });
410
- }
411
- }
412
- export {
413
- L as AgentClientUIApi
414
- };