@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,457 +1,502 @@
1
- var Rt = Object.defineProperty, Dt = Object.defineProperties;
2
- var Ot = Object.getOwnPropertyDescriptors;
1
+ var Mt = Object.defineProperty, zt = Object.defineProperties;
2
+ var Ut = Object.getOwnPropertyDescriptors;
3
3
  var Xe = Object.getOwnPropertySymbols;
4
- var zt = Object.prototype.hasOwnProperty, Ut = Object.prototype.propertyIsEnumerable;
5
- var fe = (x, n, u) => n in x ? Rt(x, n, { enumerable: !0, configurable: !0, writable: !0, value: u }) : x[n] = u, he = (x, n) => {
6
- for (var u in n || (n = {}))
7
- zt.call(n, u) && fe(x, u, n[u]);
4
+ var jt = Object.prototype.hasOwnProperty, Vt = Object.prototype.propertyIsEnumerable;
5
+ var ye = (x, s, y) => s in x ? Mt(x, s, { enumerable: !0, configurable: !0, writable: !0, value: y }) : x[s] = y, ve = (x, s) => {
6
+ for (var y in s || (s = {}))
7
+ jt.call(s, y) && ye(x, y, s[y]);
8
8
  if (Xe)
9
- for (var u of Xe(n))
10
- Ut.call(n, u) && fe(x, u, n[u]);
9
+ for (var y of Xe(s))
10
+ Vt.call(s, y) && ye(x, y, s[y]);
11
11
  return x;
12
- }, ue = (x, n) => Dt(x, Ot(n));
13
- var N = (x, n, u) => (fe(x, typeof n != "symbol" ? n + "" : n, u), u);
14
- var j = (x, n, u) => new Promise((e, y) => {
15
- var te = (k) => {
12
+ }, ke = (x, s) => zt(x, Ut(s));
13
+ var P = (x, s, y) => (ye(x, typeof s != "symbol" ? s + "" : s, y), y);
14
+ var j = (x, s, y) => new Promise((e, w) => {
15
+ var se = (b) => {
16
16
  try {
17
- T(u.next(k));
18
- } catch (c) {
19
- y(c);
17
+ O(y.next(b));
18
+ } catch (p) {
19
+ w(p);
20
20
  }
21
- }, g = (k) => {
21
+ }, v = (b) => {
22
22
  try {
23
- T(u.throw(k));
24
- } catch (c) {
25
- y(c);
23
+ O(y.throw(b));
24
+ } catch (p) {
25
+ w(p);
26
26
  }
27
- }, T = (k) => k.done ? e(k.value) : Promise.resolve(k.value).then(te, g);
28
- T((u = u.apply(x, n)).next());
27
+ }, O = (b) => b.done ? e(b.value) : Promise.resolve(b.value).then(se, v);
28
+ O((y = y.apply(x, s)).next());
29
29
  });
30
- import { jsxs as A, jsx as d } from "../../_virtual/jsx-runtime.mjs";
31
- import { memo as jt, useState as h, useRef as D, useContext as At, useEffect as b } from "react";
30
+ import { jsxs as q, jsx as d } from "../../_virtual/jsx-runtime.mjs";
31
+ import { memo as At, useState as u, useRef as V, useContext as Bt, useEffect as F } from "react";
32
32
  import "./style.less.mjs";
33
- import { Divider as Bt, Spin as $t, Button as B, Space as ee, Upload as qt, Tooltip as Vt, message as P, notification as Wt } from "antd";
34
- import pe from "../../Iconfont/index.mjs";
35
- import "axios";
36
- import "../../node_modules/@glodon-aiot/minio/dist/minio-zj.mjs";
37
- import { IHistoryRole as $ } from "../../packages/apis/dist/es/aecpilot/model.mjs";
38
- import Kt from "dayjs";
39
- import "../../packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs";
40
- import "../../packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs";
41
- import "../../packages/apis/dist/es/agentcliui/index.mjs";
42
- import "../../packages/apis/dist/es/aecpilotui/index.mjs";
43
- import Qt from "../HistoryItem/index.mjs";
44
- import Yt from "../../context.mjs";
45
- import { MB as _t } from "../../constant.mjs";
46
- import Gt from "../FilePreview/index.mjs";
47
- import { getImageExtension as Xt } from "../../utils/index.mjs";
48
- import Zt from "../../QuillEditor/index.mjs";
49
- import Jt from "../Recommend/index.mjs";
50
- import St from "../Greeting/index.mjs";
51
- import ei from "../PromptManager/index.mjs";
52
- import ti from "../../Footer/index.mjs";
53
- import { CameraOutlined as Ze, PlusOutlined as ii } from "@ant-design/icons";
54
- import ni from "../UploadKnowledgeFiles/index.mjs";
55
- import oi from "../UploadingPrompt/index.mjs";
56
- import ai from "../PromptSetting/index.mjs";
57
- import ge from "../../node_modules/ahooks/es/useMemoizedFn/index.mjs";
58
- import li from "../SessionListDrawer/index.mjs";
59
- import ri from "../../node_modules/react-infinite-scroll-component/dist/index.es.mjs";
60
- import si from "../ConnectToNetwork/index.mjs";
61
- import di from "../../assets/icon.svg.mjs";
33
+ import { Divider as $t, Spin as qt, Button as K, Space as oe, Upload as Kt, Tooltip as Wt, message as R, notification as Qt } from "antd";
34
+ import we from "../../Iconfont/index.mjs";
35
+ import { IHistoryRole as W, ChatMessageRole as Yt } from "@glodon-aiot/apis";
36
+ import _t from "../HistoryItem/index.mjs";
37
+ import Gt from "dayjs";
38
+ import Xt from "../../context.mjs";
39
+ import { MB as Zt } from "../../constant.mjs";
40
+ import Jt from "../FilePreview/index.mjs";
41
+ import { getImageExtension as St } from "../../utils/index.mjs";
42
+ import en from "../../QuillEditor/index.mjs";
43
+ import tn from "../Recommend/index.mjs";
44
+ import nn from "../Greeting/index.mjs";
45
+ import on from "../PromptManager/index.mjs";
46
+ import sn from "../../Footer/index.mjs";
47
+ import { CameraOutlined as Ze, PlusOutlined as ln } from "@ant-design/icons";
48
+ import rn from "../UploadKnowledgeFiles/index.mjs";
49
+ import an from "../UploadingPrompt/index.mjs";
50
+ import dn from "../PromptSetting/index.mjs";
51
+ import be from "../../node_modules/ahooks/es/useMemoizedFn/index.mjs";
52
+ import cn from "../SessionListDrawer/index.mjs";
53
+ import fn from "../../node_modules/react-infinite-scroll-component/dist/index.es.mjs";
54
+ import un from "../ConnectToNetwork/index.mjs";
55
+ import pn from "../../assets/icon.svg.mjs";
62
56
  import Se from "../../node_modules/uuid/dist/esm-browser/v4.mjs";
63
- const ci = jt(Qt), fi = {
64
- icon: di,
57
+ const hn = At(_t), gn = {
58
+ icon: pn,
65
59
  text: "今天我能帮你什么?"
66
60
  };
67
- class Q {
68
- constructor(n, u, e, y) {
69
- N(this, "messageTime");
70
- N(this, "isWaiting");
71
- N(this, "messageId");
72
- N(this, "isContext");
73
- N(this, "actions");
74
- N(this, "reference");
75
- N(this, "isSensitive");
76
- N(this, "isSuspend");
77
- N(this, "comment");
78
- this.content = n, this.sessionId = u, this.role = e, this.files = y, this.content = n, this.role = e, this.sessionId = u, this.files = y, this.messageTime = Kt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Se(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
61
+ class _ {
62
+ constructor(s, y, e, w) {
63
+ P(this, "messageTime");
64
+ P(this, "isWaiting");
65
+ P(this, "messageId");
66
+ P(this, "isContext");
67
+ P(this, "actions");
68
+ P(this, "reference");
69
+ P(this, "isSensitive");
70
+ P(this, "isSuspend");
71
+ P(this, "comment");
72
+ this.content = s, this.sessionId = y, this.role = e, this.files = w, this.content = s, this.role = e, this.sessionId = y, this.files = w, this.messageTime = Gt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Se(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
79
73
  isAgree: 0
80
74
  };
81
75
  }
82
76
  }
83
- const Je = 10, Qi = (x) => {
84
- var Oe, ze, Ue, je, Ae, Be, $e, qe, Ve, We, Ke, Qe, Ye, _e, Ge;
77
+ const Je = 10, Kn = (x) => {
78
+ var Ae, Be, $e, qe, Ke, We, Qe, Ye, _e;
85
79
  const {
86
- application: n,
87
- docViewerUrl: u = "",
80
+ application: s,
81
+ docViewerUrl: y = "",
88
82
  currentSession: e,
89
- onCreateSession: y,
90
- embeddingService: te,
91
- setCurrentSession: g,
92
- networkStatus: T,
93
- setNetworkStatus: k
94
- } = x, [c, I] = h([]), [et, Y] = h(), [O, ie] = h(), C = D(null), {
95
- service: m,
96
- agentClient: ne,
83
+ onCreateSession: w,
84
+ embeddingService: se,
85
+ setCurrentSession: v,
86
+ networkStatus: O,
87
+ setNetworkStatus: b
88
+ } = x, [p, I] = u([]), [et, G] = u(), [le, xe] = u(), T = V(null), {
89
+ service: C,
90
+ agentClient: L,
97
91
  depId: tt,
98
- footer: it,
99
- transform: v,
100
- defaultInput: oe,
101
- onMessage: _,
102
- onHistoryLoad: me,
103
- bodyStyle: nt
104
- } = At(Yt), [ye, ve] = h(!1), f = D(c), xe = D(), [ot, at] = h(0), [q, z] = h(), [ke, G] = h(""), [Ie, ae] = h(!1), le = D(null), [we, lt] = h([]), [be, re] = h(!1), [Ce, rt] = h(!1), [st, dt] = h(""), [ct, U] = h(), [Le, X] = h({}), Z = D(null), Fe = D(null), se = D(null), [Ne, ft] = h(!1), [ht, ut] = h([]), [pt, J] = h(!0), [gt, mt] = h(!0), [Te, H] = h(!1), [de, R] = h(!1), [Ee, yt] = h(!1), [E, Pe] = h([]), [He, M] = h(!1), [vt, V] = h(!0), [xt, W] = h(!0);
105
- b(() => {
106
- var a, o;
107
- f.current = [], I([]);
108
- const t = C.current;
92
+ footer: nt,
93
+ transform: f,
94
+ defaultInput: re,
95
+ onMessage: X,
96
+ onHistoryLoad: Ie,
97
+ beforeMessageSend: Z,
98
+ bodyStyle: it,
99
+ disabled: D,
100
+ features: c
101
+ } = Bt(Xt), [Le, ae] = u(!1), h = V(p), Ne = V(), [ot, st] = u(0), [Q, A] = u(), [J, S] = u(""), [Ce, de] = u(!1), ce = V(null), [Fe, lt] = u([]), [Ee, fe] = u(!1), [Te, rt] = u(!1), [at, dt] = u(""), [ct, B] = u(), [ue, ee] = u({}), te = V(null), Pe = V(null), pe = V(null), [Re, ft] = u(!1), [ut, pt] = u([]), [ht, ne] = u(!0), [gt, mt] = u(!0), [Oe, H] = u(!1), [he, M] = u(!1), [De, yt] = u(!1), [E, ie] = u(typeof (c == null ? void 0 : c.promptVariables) == "object" ? c.promptVariables.default || [] : []), [vt, kt] = u(typeof (c == null ? void 0 : c.knowledges) == "object" && c.knowledges.default || void 0), [He, z] = u(!1), [wt, Y] = u(!0), [bt, $] = u(typeof (c == null ? void 0 : c.connectNetwork) == "object" && typeof (c == null ? void 0 : c.connectNetwork.default) == "boolean" ? c.connectNetwork.default : !1), [Me, ze] = u(!1);
102
+ F(() => {
103
+ var l, i;
104
+ e && (h.current = []), I([]);
105
+ const t = T.current;
109
106
  if (t && t.scrollTo({
110
107
  top: 0
111
- }), !((a = e == null ? void 0 : e.data) != null && a.id))
108
+ }), !((l = e == null ? void 0 : e.data) != null && l.id))
112
109
  return;
113
- if (R(!1), H(!1), (o = e.messages) != null && o.length) {
114
- const l = [...e.messages.filter((s) => s == null ? void 0 : s.messageId)].reverse();
115
- f.current = [...l], I([...l]);
110
+ if (M(!1), H(!1), (i = e.messages) != null && i.length) {
111
+ const o = [...e.messages.filter((a) => a == null ? void 0 : a.messageId)].reverse();
112
+ h.current = [...o], I([...o]);
116
113
  }
117
- const i = (r) => {
118
- var l;
119
- (l = e == null ? void 0 : e.data) != null && l.id && (f.current = [...r].reverse(), I([...r].reverse()), !r || r.length < 10 ? V(!1) : V(!0), me && me({
120
- applicationId: n.id,
114
+ const n = (r) => {
115
+ var o;
116
+ (o = e == null ? void 0 : e.data) != null && o.id && (h.current = [...r].reverse(), I([...r].reverse()), !r || r.length < 10 ? Y(!1) : Y(!0), Ie && Ie({
117
+ applicationId: s.id,
121
118
  sessionId: e.data.id,
122
119
  histories: r
123
120
  }));
124
121
  };
125
- return e.addEventListener("history:loaded", i), () => {
126
- f.current = [], I([]), e == null || e.removeEventListener("history:loaded", i);
122
+ return e.addEventListener("history:loaded", n), () => {
123
+ h.current = [], I([]), e == null || e.removeEventListener("history:loaded", n);
127
124
  };
128
- }, [(Oe = e == null ? void 0 : e.data) == null ? void 0 : Oe.id]), b(() => {
129
- var i;
130
- if (!((i = e == null ? void 0 : e.data) != null && i.id))
125
+ }, [e]), F(() => {
126
+ const t = () => {
127
+ var n;
128
+ (n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && ie(e.promptVariables.sort((l, i) => l.key.localeCompare(i.key))), e.knowledges && kt(e.knowledges), b(e.netOpen));
129
+ };
130
+ return e == null || e.addEventListener("data:updated", t), () => {
131
+ e == null || e.removeEventListener("data:updated", t);
132
+ };
133
+ }, [e]), F(() => {
134
+ var n;
135
+ if (!((n = e == null ? void 0 : e.data) != null && n.id))
131
136
  return;
132
- const t = (a) => {
133
- console.log(a.message, a.cause, "e.case");
137
+ const t = (l) => {
138
+ console.error(l.message, l.cause, "e.case");
134
139
  };
135
140
  return e.addEventListener("error", t), () => {
136
141
  e == null || e.removeEventListener("error", t);
137
142
  };
138
- }, [(ze = e == null ? void 0 : e.data) == null ? void 0 : ze.id]), b(() => {
139
- }, [c]);
140
- const kt = () => {
141
- var a;
142
- if (!((a = e == null ? void 0 : e.data) != null && a.id) || !(n != null && n.id))
143
+ }, [e]);
144
+ const xt = () => {
145
+ var l;
146
+ if (!((l = e == null ? void 0 : e.data) != null && l.id) || !(s != null && s.id))
143
147
  return;
144
- const t = e.data.id, i = c[c.length - 1];
145
- if (i && i.isContext)
146
- return P.success("已开启新话题");
148
+ const t = e.data.id, n = p[p.length - 1];
149
+ if (n && n.isContext)
150
+ return R.success("已开启新话题");
147
151
  e.clear().then(() => {
148
- const o = new Q("", t, $.System);
149
- o.isContext = !0, I([o, ...c]);
152
+ const i = new _("", t, W.System);
153
+ i.isContext = !0, I([i, ...p]);
150
154
  });
151
155
  };
152
- b(() => {
153
- n != null && n.id && (m == null || m.getRecommendQues(n.id).then((t) => {
156
+ F(() => {
157
+ s != null && s.id && (C == null || C.getRecommendQues(s.id).then((t) => {
154
158
  lt(t);
155
159
  }));
156
- }, [tt, n]);
157
- const Me = (t) => j(void 0, null, function* () {
158
- var r, l;
159
- const i = t || et;
160
- if (!(i != null && i.trim()))
161
- return P.error("请输入你想问的");
162
- if (!(E == null ? void 0 : E.every((s) => !!(s != null && s.value))))
163
- return P.error("变量值不能为空");
164
- if (de)
165
- return P.error("正在回复中");
166
- if (ye)
167
- return P.error("等待初始化");
168
- if (!pt)
169
- return P.error("正在解析文件");
170
- if (Ie)
171
- return P.error("正在上传图片");
172
- z(void 0), G("");
173
- const o = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
174
- if (!o) {
175
- y == null || y({
176
- netOpen: T ? 1 : 2
177
- }).then((s) => {
178
- var w, p;
179
- M(!0), k(!!((w = s.data) != null && w.netOpen)), W(!!((p = s.data) != null && p.enableNetOpen)), It(s).then(() => {
180
- g == null || g(s), M(!1), ie(i);
160
+ }, [tt, s]);
161
+ const Ue = (t) => j(void 0, null, function* () {
162
+ var k, g;
163
+ if (D)
164
+ return R.error("发送功能被禁用");
165
+ const n = t || et;
166
+ if (!(n != null && n.trim()))
167
+ return R.error("请输入你想问的");
168
+ if (!(E == null ? void 0 : E.every((m) => !!(m != null && m.value)))) {
169
+ if (f != null && f.promptVariables)
170
+ return R.error("变量值不能为空");
171
+ console.error("变量值不能为空", E == null ? void 0 : E.map((m) => !!(m != null && m.value)));
172
+ }
173
+ if (he)
174
+ return R.error("正在回复中");
175
+ if (Le)
176
+ return R.error("等待初始化");
177
+ if (!ht)
178
+ return R.error("正在解析文件");
179
+ if (Ce)
180
+ return R.error("正在上传图片");
181
+ A(void 0), S("");
182
+ const i = (k = e == null ? void 0 : e.data) == null ? void 0 : k.id;
183
+ if (!i) {
184
+ w == null || w({
185
+ netOpen: O ? 1 : 2
186
+ }).then((m) => {
187
+ var N, U;
188
+ z(!0), b(!!((N = m.data) != null && N.netOpen)), $(!!((U = m.data) != null && U.enableNetOpen)), It(m).then(() => {
189
+ v == null || v(m), z(!1), xe(n);
181
190
  });
182
191
  });
183
192
  return;
184
193
  }
185
- ((l = Le[o]) == null ? void 0 : l.length) > 0 ? wt(i) : S(i);
186
- }), It = (t) => new Promise((i, a) => j(void 0, null, function* () {
187
- const l = (t == null ? void 0 : t.promptVariables).filter((s) => s.key !== "query").map((s) => {
188
- var p;
189
- const w = (p = E.find((L) => L.key === s.key)) == null ? void 0 : p.value;
190
- return s.value = w || "", s;
194
+ ze(!0);
195
+ const r = J ? `![](${J})
196
+ ${n}` : n;
197
+ let o;
198
+ try {
199
+ Z ? o = yield Z == null ? void 0 : Z({
200
+ applicationId: s.id,
201
+ sessionId: i,
202
+ message: {
203
+ content: r,
204
+ sessionId: i,
205
+ role: Yt.User,
206
+ files: ue[i]
207
+ }
208
+ }) : o = !0;
209
+ } catch (m) {
210
+ o = !1;
211
+ }
212
+ if (ze(!1), o === !1)
213
+ return;
214
+ let a = n;
215
+ typeof o == "object" && (a = o.content || n), ((g = ue[i]) == null ? void 0 : g.length) > 0 ? Lt(a) : ge(a);
216
+ }), It = (t) => new Promise((n, l) => j(void 0, null, function* () {
217
+ const o = (t == null ? void 0 : t.promptVariables).filter((a) => a.key !== "query").map((a) => {
218
+ var g;
219
+ const k = (g = E.find((m) => m.key === a.key)) == null ? void 0 : g.value;
220
+ return a.value = k || "", a;
191
221
  });
192
- Pe(l.sort((s, w) => s.key.localeCompare(w.key))), yield t == null ? void 0 : t.setPromptVariables(l), i();
193
- })), wt = (t) => {
194
- var l, s, w;
195
- if (J(!1), !((l = e == null ? void 0 : e.data) != null && l.id) || !(n != null && n.id))
222
+ ie(o.sort((a, k) => a.key.localeCompare(k.key))), yield t == null ? void 0 : t.setPromptVariables(o), n();
223
+ })), Lt = (t) => {
224
+ var o, a, k;
225
+ if (ne(!1), !((o = e == null ? void 0 : e.data) != null && o.id) || !(s != null && s.id))
196
226
  return;
197
- const i = ((s = e.data) == null ? void 0 : s.id) || "", a = [];
198
- let o = [], r = /* @__PURE__ */ new Set();
199
- (w = Le[i]) == null || w.forEach((p) => {
200
- r.has(p.id) || (o.push(p), r.add(p.id));
201
- }), Promise.all(o.map((p) => m == null ? void 0 : m.patchApplicationIdKnowledgeIdFileId(n == null ? void 0 : n.id, i, p.id, {
227
+ const n = ((a = e.data) == null ? void 0 : a.id) || "", l = [];
228
+ let i = [], r = /* @__PURE__ */ new Set();
229
+ (k = ue[n]) == null || k.forEach((g) => {
230
+ r.has(g.id) || (i.push(g), r.add(g.id));
231
+ }), Promise.all(i.map((g) => C == null ? void 0 : C.patchApplicationIdKnowledgeIdFileId(s == null ? void 0 : s.id, n, g.id, {
202
232
  enabled: 1
203
- }).then((L) => {
204
- a.push(p);
205
- }))).then((p) => {
206
- J(!0), S(t, a);
207
- }).catch((p) => {
208
- throw Error(p);
233
+ }).then((m) => {
234
+ l.push(g);
235
+ }))).then((g) => {
236
+ ne(!0), ge(t, l);
237
+ }).catch((g) => {
238
+ throw Error(g);
209
239
  });
210
240
  };
211
- b(() => {
212
- var a;
213
- if (n.type !== 0 || !O || !((a = e == null ? void 0 : e.data) != null && a.id))
214
- return;
215
- const t = O, i = () => {
216
- ie(void 0), S(t);
217
- };
218
- return e.addEventListener("history:loaded", i), () => {
219
- e == null || e.removeEventListener("history:loaded", i);
220
- };
221
- }, [O, e]), b(() => {
222
- var a;
223
- if (n.type !== 2 || !O || !((a = e == null ? void 0 : e.data) != null && a.id))
241
+ F(() => {
242
+ if (!le || !e)
224
243
  return;
225
- const t = O, i = () => {
226
- setTimeout(() => {
227
- ie(void 0), S(t);
228
- }, 1e3);
244
+ const t = le, n = () => {
245
+ ge(t), xe(void 0);
229
246
  };
230
- return e.addEventListener("history:loaded", i), () => {
231
- e == null || e.removeEventListener("history:loaded", i);
247
+ return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
248
+ e == null || e.removeEventListener("ready", n);
232
249
  };
233
- }, [O, e]);
234
- const S = (t, i) => {
235
- var p, L;
236
- const a = (p = e == null ? void 0 : e.data) == null ? void 0 : p.id;
237
- if (!a)
250
+ }, [le, e]);
251
+ const ge = (t, n) => j(void 0, null, function* () {
252
+ var g, m;
253
+ const l = (g = e == null ? void 0 : e.data) == null ? void 0 : g.id;
254
+ if (!l)
238
255
  return;
239
- R(!0), H(!0);
240
- const o = ke ? `![](${ke})
241
- ${t}` : t;
242
- Y(void 0), U(void 0);
243
- const r = new Q(o, a, $.User, i);
244
- f.current = [r, ...c], I(f.current), n.id && _ && _({
245
- applicationId: n.id,
246
- sessionId: a,
256
+ M(!0), H(!0);
257
+ const i = J ? `![](${J})
258
+ ${t}` : t, r = new _(i, l, W.User, n);
259
+ G(void 0), B(void 0), h.current = [r, ...p], I(h.current), s.id && X && X({
260
+ applicationId: s.id,
261
+ sessionId: l,
247
262
  message: r
248
263
  });
249
- const l = new Q("", a, $.System);
250
- l.isWaiting = !0, f.current = [l, ...f.current], I(f.current);
251
- const s = (i == null ? void 0 : i.map((F) => F.id)) || [], w = E == null ? void 0 : E.reduce((F, K) => (F[K.key] = K.value, F), {});
252
- e.setPromptVariables(E), e.send({
253
- text: o,
254
- fileIds: s
255
- }, {
264
+ const o = new _("", l, W.System);
265
+ o.isWaiting = !0, h.current = [o, ...h.current], I(h.current);
266
+ const a = (n == null ? void 0 : n.map((N) => N.id)) || [], k = {
256
267
  stream: !0,
257
- referenceFirst: !1,
258
- formatValues: w
259
- }), X({
260
- [a]: []
261
- }), (L = Z.current) == null || L.update();
262
- };
263
- b(() => {
264
- var a;
265
- const t = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
268
+ referenceFirst: !1
269
+ };
270
+ if (f != null && f.promptVariables) {
271
+ const N = E == null ? void 0 : E.reduce((U, Ge) => (U[Ge.key] = Ge.value, U), {});
272
+ k.formatValues = N, e.setPromptVariables(E);
273
+ }
274
+ if (f != null && f.knowledges) {
275
+ const N = vt;
276
+ k.knowledges = N, e.setKnowledges(N);
277
+ }
278
+ yield e.send({
279
+ text: i,
280
+ fileIds: a
281
+ }, k), ee({
282
+ [l]: []
283
+ }), (m = te.current) == null || m.update();
284
+ });
285
+ F(() => {
286
+ var l;
287
+ const t = (l = e == null ? void 0 : e.data) == null ? void 0 : l.id;
266
288
  if (!t)
267
289
  return;
268
- const i = (o) => {
269
- if (o.sessionId && o.sessionId !== xe.current || o.role === $.User)
290
+ const n = (i) => {
291
+ if (i.sessionId && i.sessionId !== Ne.current || i.role === W.User)
270
292
  return;
271
- if (o.index === -1 && o.code !== 200 && o.code !== 11915 && (H(!1), R(!1), f.current = f.current.filter((s) => !s.isWaiting), I([...f.current]), f.current = [...f.current], o.content))
272
- return Wt.error({
273
- message: o.content
293
+ if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (H(!1), M(!1), h.current = h.current.filter((a) => !a.isWaiting), I([...h.current]), h.current = [...h.current], i.content))
294
+ return Qt.error({
295
+ message: i.content
274
296
  });
275
- const r = o.actions || [], l = new Q(o.content, t, $.Robot);
276
- l.messageId = o.messageId, l.reasoningContent = o.reasoningContent, l.searchReference = o.searchReference, l.thinkingSecs = o.thinkingSecs, l.thinkingStatus = o.thinkingStatus, l.actions = r, l.isLoading = !0, f.current = f.current.filter((s) => !s.isWaiting).filter((s) => !s.isReplying), o.index === void 0 && I([l, ...f.current]), o.code === 11915 && (H(!1), R(!1), l.isLoading = !1, l.content = "请您换个问题问我吧~", l.isSensitive = !0, I([l, ...f.current])), o.index === -2 && (H(!1), R(!1), l.isLoading = !1, l.content = "回答已中止~", l.isSuspend = !0, I([l, ...f.current])), o.index === -1 && (H(!1), R(!1), l.isLoading = !1, l.reference = o.reference, I([l, ...f.current]), n.id && _ && _({
277
- applicationId: n.id,
297
+ const r = i.actions || [], o = new _(i.content, t, W.Robot);
298
+ o.messageId = i.messageId, o.reasoningContent = i.reasoningContent, o.searchReference = i.searchReference, o.thinkingSecs = i.thinkingSecs, o.thinkingStatus = i.thinkingStatus, o.actions = r, o.isLoading = !0, h.current = h.current.filter((a) => !a.isWaiting).filter((a) => !a.isReplying), i.index === void 0 && I([o, ...h.current]), i.code === 11915 && (H(!1), M(!1), o.isLoading = !1, o.content = "请您换个问题问我吧~", o.isSensitive = !0, I([o, ...h.current])), i.index === -2 && (H(!1), M(!1), o.isLoading = !1, o.content = "回答已中止~", o.isSuspend = !0, I([o, ...h.current])), i.index === -1 && (H(!1), M(!1), o.isLoading = !1, o.reference = i.reference, I([o, ...h.current]), s.id && X && X({
299
+ applicationId: s.id,
278
300
  sessionId: t,
279
- message: l
280
- })), o.index === -3 && (H(!1), R(!1), l.isLoading = !1, l.reference = o.reference, l.relatedQuesion = o.relatedQuesion, I([l, ...f.current]));
301
+ message: o
302
+ })), i.index === -3 && (H(!1), M(!1), o.isLoading = !1, o.reference = i.reference, o.relatedQuesion = i.relatedQuesion, I([o, ...h.current]));
281
303
  };
282
- return e.ready ? e.addEventListener("message:updated", i) : e.addEventListener("ready", () => {
283
- e.addEventListener("message:updated", i);
304
+ return e.ready ? e.addEventListener("message:updated", n) : e.addEventListener("ready", () => {
305
+ e.addEventListener("message:updated", n);
284
306
  }), () => {
285
- e == null || e.removeEventListener("message:updated", i);
307
+ e == null || e.removeEventListener("message:updated", n);
286
308
  };
287
- }, [(Ue = e == null ? void 0 : e.data) == null ? void 0 : Ue.id]), b(() => {
288
- var i;
289
- if (!((i = e == null ? void 0 : e.data) != null && i.id))
309
+ }, [e]), F(() => {
310
+ if (!e) {
311
+ ae(!1);
290
312
  return;
291
- const t = (a) => {
292
- ve(a);
313
+ }
314
+ const t = (n) => {
315
+ ae(n);
293
316
  };
294
- return ve(e.frozen), e.addEventListener("frozen", t), () => {
317
+ return ae(e.frozen), e.addEventListener("frozen", t), () => {
295
318
  e == null || e.removeEventListener("frozen", t);
296
319
  };
297
- }, [(je = e == null ? void 0 : e.data) == null ? void 0 : je.id]), b(() => {
298
- if (!ne)
320
+ }, [e]), F(() => {
321
+ if (!L)
299
322
  return;
300
- const t = ne.questionContextMaxLength || 4e3;
301
- at(t);
302
- }, [ne, m]), b(() => {
303
- oe && U(oe.text);
304
- }, [oe]);
305
- const bt = (t) => {
306
- const i = t.size;
307
- return i <= 0 ? (P.error("该文件为空,请重新上传"), !1) : i > 20 * _t ? (P.error("图片须小于20M"), !1) : (z(t), !1);
323
+ const t = L.questionContextMaxLength || 4e3;
324
+ st(t);
325
+ }, [L, C]), F(() => {
326
+ re && B(re.text);
327
+ }, [re]);
328
+ const Nt = (t) => {
329
+ const n = t.size;
330
+ return n <= 0 ? (R.error("该文件为空,请重新上传"), !1) : n > 20 * Zt ? (R.error("图片须小于20M"), !1) : (A(t), !1);
308
331
  }, Ct = (t) => j(void 0, null, function* () {
309
- var i;
310
- return z(t), (i = e == null ? void 0 : e.data) != null && i.id ? Re(e, t) : new Promise((a) => {
311
- M(!0), y == null || y({
312
- netOpen: T ? 1 : 2
313
- }).then((o) => {
314
- var r, l;
315
- g == null || g(o), M(!1), k(!!((r = o.data) != null && r.netOpen)), W(!!((l = o.data) != null && l.enableNetOpen)), a(Re(o, t));
332
+ var n;
333
+ return A(t), (n = e == null ? void 0 : e.data) != null && n.id ? je(e, t) : new Promise((l) => {
334
+ z(!0), w == null || w({
335
+ netOpen: O ? 1 : 2
336
+ }).then((i) => {
337
+ var r, o;
338
+ v == null || v(i), z(!1), b(!!((r = i.data) != null && r.netOpen)), $(!!((o = i.data) != null && o.enableNetOpen)), l(je(i, t));
316
339
  });
317
340
  });
318
- }), Re = (t, i) => {
319
- const a = Xt(i.name);
320
- return new Promise((o) => {
321
- var l;
341
+ }), je = (t, n) => {
342
+ const l = St(n.name);
343
+ return new Promise((i) => {
344
+ var o;
322
345
  const r = {
323
- files: [`${Se()}.${a}`],
346
+ files: [`${Se()}.${l}`],
324
347
  isv: "minio",
325
- knowledgeId: ((l = t.data) == null ? void 0 : l.id) || "",
348
+ knowledgeId: ((o = t.data) == null ? void 0 : o.id) || "",
326
349
  type: 1
327
350
  };
328
- ae(!0), m == null || m.postTicket(r).then((s) => {
329
- m.uploadMinioFile(s.minio, i).then(() => {
330
- var F, K;
331
- const w = (F = s.minio.endpoints) == null ? void 0 : F[0], p = s.minio.bucket, L = (K = s.minio.fileKeys) == null ? void 0 : K[0];
332
- o(`${location.protocol}//${w}/${p}/${L}`);
351
+ de(!0), C == null || C.postTicket(r).then((a) => {
352
+ C.uploadMinioFile(a.minio, n).then(() => {
353
+ var N, U;
354
+ const k = (N = a.minio.endpoints) == null ? void 0 : N[0], g = a.minio.bucket, m = (U = a.minio.fileKeys) == null ? void 0 : U[0];
355
+ i(`${location.protocol}//${k}/${g}/${m}`);
333
356
  }).catch(() => {
334
- G(""), z(void 0);
357
+ S(""), A(void 0);
335
358
  }).finally(() => {
336
- ae(!1);
359
+ de(!1);
337
360
  });
338
361
  }).catch(() => {
339
- G(""), z(void 0), ae(!1);
362
+ S(""), A(void 0), de(!1);
340
363
  });
341
364
  });
342
365
  };
343
- b(() => {
344
- const t = C.current;
345
- t && !Ee && t.scrollTo({
366
+ F(() => {
367
+ const t = T.current;
368
+ t && !De && t.scrollTo({
346
369
  top: t.scrollHeight
347
370
  });
348
- }, [c]);
349
- const De = (t, i) => new Promise((a) => {
350
- if (!i.file.url || !(n != null && n.id))
351
- return a();
352
- const o = ue(he({}, i.file), {
371
+ }, [p]);
372
+ const Ve = (t, n) => new Promise((l) => {
373
+ if (!n.file.url || !(s != null && s.id))
374
+ return l();
375
+ const i = ke(ve({}, n.file), {
353
376
  type: 1
354
377
  });
355
- m == null || m.postApplicationIdSessionKnowledgeSessionFile(n == null ? void 0 : n.id, t, o).finally(() => {
378
+ C == null || C.postApplicationIdSessionKnowledgeSessionFile(s == null ? void 0 : s.id, t, i).finally(() => {
356
379
  var r;
357
- (r = Z.current) == null || r.update().finally(a);
380
+ (r = te.current) == null || r.update().finally(l);
358
381
  });
359
- }), Lt = () => {
382
+ }), Ft = () => {
360
383
  var t;
361
384
  (t = e == null ? void 0 : e.data) != null && t.id && (H(!1), e.suspend());
362
- }, Ft = (t) => {
363
- const i = C.current;
364
- i && setTimeout(() => {
365
- i.scrollTo({
366
- top: i.scrollHeight,
385
+ }, Et = (t) => {
386
+ const n = T.current;
387
+ n && setTimeout(() => {
388
+ n.scrollTo({
389
+ top: n.scrollHeight,
367
390
  behavior: t == null ? void 0 : t.behavior
368
391
  });
369
392
  }, t == null ? void 0 : t.ms);
370
- }, Nt = () => {
371
- if (!C.current)
393
+ }, Tt = () => {
394
+ if (!T.current)
372
395
  return;
373
- const t = C.current.scrollTop <= -80;
396
+ const t = T.current.scrollTop <= -80;
374
397
  yt(t);
375
- }, Tt = ge((t) => {
376
- var i, a;
377
- (i = le.current) == null || i.update(t), (a = le.current) == null || a.focus();
378
- }), Et = ge((t) => {
379
- Me(t);
380
- }), Pt = ge(() => {
381
- var i;
382
- if (!((i = e == null ? void 0 : e.data) != null && i.id))
398
+ }, Pt = be((t) => {
399
+ var n, l;
400
+ (n = ce.current) == null || n.update(t), (l = ce.current) == null || l.focus();
401
+ }), Rt = be((t) => {
402
+ Ue(t);
403
+ }), Ot = be(() => {
404
+ var n;
405
+ if (!((n = e == null ? void 0 : e.data) != null && n.id))
383
406
  return;
384
- f.current = [...c.slice(1, c.length)], I(f.current);
385
- const t = new Q("", e.data.id, $.System);
386
- t.isWaiting = !0, f.current = [t, ...f.current], I(f.current), e.answerAgain();
407
+ h.current = [...p.slice(1, p.length)], I(h.current);
408
+ const t = new _("", e.data.id, W.System);
409
+ t.isWaiting = !0, h.current = [t, ...h.current], I(h.current), M(!0), H(!0), e.answerAgain();
387
410
  });
388
- b(() => {
389
- var t, i;
390
- xe.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !He && ((i = se.current) == null || i.clear());
391
- }, [(Ae = e == null ? void 0 : e.data) == null ? void 0 : Ae.id]);
392
- const Ht = () => {
393
- var a;
394
- if (!((a = e == null ? void 0 : e.data) != null && a.id))
411
+ F(() => {
412
+ var t, n;
413
+ Ne.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !He && ((n = pe.current) == null || n.clear());
414
+ }, [e]);
415
+ const Dt = () => {
416
+ var l;
417
+ if (!((l = e == null ? void 0 : e.data) != null && l.id))
395
418
  return;
396
- const i = c[c.length - 1].messageTime;
419
+ const n = p[p.length - 1].messageTime;
397
420
  e.fetchMessages({
398
- endTime: i,
421
+ endTime: n,
399
422
  pageSize: Je
400
- }).then((o) => {
401
- console.log(o, "loadMoreData");
402
- const r = o || [];
423
+ }).then((i) => {
424
+ const r = i || [];
403
425
  if (!r || !(r != null && r.length)) {
404
- V(!1);
426
+ Y(!1);
405
427
  return;
406
428
  }
407
- r.length < 10 ? V(!1) : V(!0), I([...c, ...r.reverse()]);
429
+ r.length < 10 ? Y(!1) : Y(!0), I([...p, ...r.reverse()]);
408
430
  });
409
- }, Mt = (t) => {
410
- var i;
411
- (i = e == null ? void 0 : e.data) != null && i.id ? m == null || m.updateSession(n.id, e.data.id, {
412
- netOpen: t ? 1 : 2
413
- }).then(() => {
414
- var a;
415
- (a = e.data) != null && a.id && k(t);
416
- }) : k(t);
417
- }, ce = () => j(void 0, null, function* () {
418
- var t;
419
- (t = e == null ? void 0 : e.data) != null && t.id && (m == null || m.getSession(n.id, e.data.id).then((i) => {
420
- var a;
421
- (a = e == null ? void 0 : e.data) != null && a.id && (k(i.netOpen), W(i.enableNetOpen));
422
- }));
431
+ }, Ht = (t) => j(void 0, null, function* () {
432
+ var n, l;
433
+ if (!((n = e == null ? void 0 : e.data) != null && n.id))
434
+ b(t);
435
+ else {
436
+ if (yield e.setNetOpen(t), !((l = e.data) != null && l.id))
437
+ return;
438
+ b(t);
439
+ }
440
+ }), me = () => j(void 0, null, function* () {
441
+ e ? e.fetchData().then((t) => {
442
+ var n;
443
+ (n = e == null ? void 0 : e.data) != null && n.id && (b(t.netOpen), $(t.enableNetOpen));
444
+ }) : (b(!1), $(s.arrange[0].enableNetOpen));
423
445
  });
424
- return b(() => {
425
- ce();
426
- }, [(Be = e == null ? void 0 : e.data) == null ? void 0 : Be.id]), b(() => {
427
- var t, i;
428
- if (C.current) {
429
- const a = document.getElementById("chat-main"), o = (t = C.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), r = (i = C.current) == null ? void 0 : i.querySelector(".infinite-scroll-component");
430
- if (!o || !r || !a)
446
+ return F(() => {
447
+ me();
448
+ }, [e]), F(() => {
449
+ var t, n;
450
+ if (T.current) {
451
+ const l = document.getElementById("chat-main"), i = (t = T.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), r = (n = T.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
452
+ if (!i || !r || !l)
431
453
  return;
432
- const l = a.offsetHeight;
433
- if (r.offsetHeight <= l) {
434
- if (o.style.height === "100%")
454
+ const o = l.offsetHeight;
455
+ if (r.offsetHeight <= o) {
456
+ if (i.style.height === "100%")
435
457
  return;
436
- o.style.height = "100%";
458
+ i.style.height = "100%";
437
459
  } else {
438
- if (o.style.height === "auto")
460
+ if (i.style.height === "auto")
439
461
  return;
440
- o.style.height = "auto";
462
+ i.style.height = "auto";
441
463
  }
442
464
  }
443
- }, [c]), /* @__PURE__ */ A("div", {
465
+ }, [p]), F(() => {
466
+ if (e)
467
+ return;
468
+ const t = () => {
469
+ const i = ((L == null ? void 0 : L.promptVariables) || []).filter(
470
+ (r) => r.key !== "query" && r.status === 1
471
+ // 只要求输入被引用的变量
472
+ ).map((r, o) => {
473
+ var k, g;
474
+ let a = "";
475
+ return typeof (c == null ? void 0 : c.promptVariables) == "object" && (a = ((g = (k = c.promptVariables.default) == null ? void 0 : k.find((m) => m.key === r.key)) == null ? void 0 : g.value) || ""), {
476
+ id: o + "",
477
+ key: r.key,
478
+ name: r.name,
479
+ value: a
480
+ };
481
+ });
482
+ ie([...i].sort((r, o) => r.key.localeCompare(o.key)));
483
+ };
484
+ return L != null && L.ready ? t() : L == null || L.addEventListener("ready", t), () => {
485
+ L == null || L.removeEventListener("ready", t);
486
+ };
487
+ }, [e, L, c == null ? void 0 : c.promptVariables]), /* @__PURE__ */ q("div", {
444
488
  className: "agent-chat",
445
- children: [/* @__PURE__ */ d(ai, {
446
- ref: Fe,
447
- appId: n.id,
489
+ children: [(f == null ? void 0 : f.promptVariables) && /* @__PURE__ */ d(dn, {
490
+ ref: Pe,
491
+ appId: s.id,
448
492
  currentSession: e,
449
493
  promptVariables: E,
450
- setPromptVariables: Pe
451
- }), /* @__PURE__ */ A("div", {
494
+ setPromptVariables: ie,
495
+ setCurrentSession: v
496
+ }), /* @__PURE__ */ q("div", {
452
497
  className: "chat-main",
453
498
  id: "chat-main",
454
- style: nt,
499
+ style: it,
455
500
  children: [/* @__PURE__ */ d("div", {
456
501
  className: "chat-main-wrapper",
457
502
  id: "scrollableDiv",
@@ -461,100 +506,100 @@ ${t}` : t;
461
506
  display: "flex",
462
507
  flexDirection: "column-reverse"
463
508
  },
464
- ref: C,
465
- onScroll: Nt,
466
- children: ($e = e == null ? void 0 : e.data) != null && $e.id && (c != null && c.length) ? /* @__PURE__ */ d(ri, {
467
- dataLength: c.length,
468
- next: Ht,
509
+ ref: T,
510
+ onScroll: Tt,
511
+ children: (Ae = e == null ? void 0 : e.data) != null && Ae.id && (p != null && p.length) ? /* @__PURE__ */ d(fn, {
512
+ dataLength: p.length,
513
+ next: Dt,
469
514
  style: {
470
515
  display: "flex",
471
516
  flexDirection: "column-reverse",
472
517
  overflowX: "hidden"
473
518
  },
474
519
  inverse: !0,
475
- endMessage: c.length > Je && // 少于一页不展示这个提示
476
- ((qe = C.current) != null && qe.scrollTop) && ((Ve = C.current) == null ? void 0 : Ve.scrollTop) < -10 ? /* @__PURE__ */ d(Bt, {
520
+ endMessage: p.length > Je && // 少于一页不展示这个提示
521
+ ((Be = T.current) != null && Be.scrollTop) && (($e = T.current) == null ? void 0 : $e.scrollTop) < -10 ? /* @__PURE__ */ d($t, {
477
522
  plain: !0,
478
523
  children: "没有更多数据了"
479
524
  }) : null,
480
- hasMore: vt,
525
+ hasMore: wt,
481
526
  loader: /* @__PURE__ */ d("div", {
482
527
  style: {
483
528
  height: "50px",
484
529
  textAlign: "center",
485
530
  overflow: "hidden"
486
531
  },
487
- children: /* @__PURE__ */ d($t, {})
532
+ children: /* @__PURE__ */ d(qt, {})
488
533
  }),
489
534
  scrollableTarget: "scrollableDiv",
490
- children: c.map((t, i) => /* @__PURE__ */ d(ci, {
491
- application: n,
535
+ children: p.map((t, n) => /* @__PURE__ */ d(hn, {
536
+ application: s,
492
537
  currentSession: e,
493
538
  history: t,
494
- docViewerUrl: u,
495
- isLastHistory: i === 0,
496
- onRelatedClick: Et,
497
- onAgainClick: Pt,
498
- onEditClick: Tt
499
- }, t.messageId + i))
539
+ docViewerUrl: y,
540
+ isLastHistory: n === 0,
541
+ onRelatedClick: Rt,
542
+ onAgainClick: Ot,
543
+ onEditClick: Pt
544
+ }, t.messageId + n))
500
545
  }) : /* @__PURE__ */ d("div", {
501
546
  className: "main-empty",
502
- children: /* @__PURE__ */ d(St, ue(he({}, fi), {
503
- children: !!we.length && /* @__PURE__ */ d(Jt, {
504
- ref: se,
505
- sid: (We = e == null ? void 0 : e.data) == null ? void 0 : We.id,
506
- isRecommendClearing: be,
507
- data: we,
547
+ children: /* @__PURE__ */ d(nn, ke(ve({}, gn), {
548
+ children: !!Fe.length && /* @__PURE__ */ d(tn, {
549
+ ref: pe,
550
+ sid: (qe = e == null ? void 0 : e.data) == null ? void 0 : qe.id,
551
+ isRecommendClearing: Ee,
552
+ data: Fe,
508
553
  onItemClick: (t) => {
509
- var a, o, r;
510
- if (Y(t == null ? void 0 : t.question), U(t == null ? void 0 : t.question), be)
554
+ var l, i, r;
555
+ if (G(t == null ? void 0 : t.question), B(t == null ? void 0 : t.question), Ee)
511
556
  return;
512
- t != null && t.id && re(!0);
513
- const i = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
514
- (r = (o = Z.current) == null ? void 0 : o.clear()) == null || r.then(() => {
515
- var l;
516
- t != null && t.id && (i ? (l = De(i, t)) == null || l.finally(() => {
517
- re(!1);
518
- }) : (re(!1), M(!0), y == null || y({
519
- netOpen: T ? 1 : 2
520
- }).then((s) => {
521
- var p, L, F;
522
- g == null || g(s), M(!1), k(!!((p = s.data) != null && p.netOpen)), W(!!((L = s.data) != null && L.enableNetOpen));
523
- const w = ((F = s.data) == null ? void 0 : F.id) || "";
524
- De(w, t);
557
+ t != null && t.id && fe(!0);
558
+ const n = (l = e == null ? void 0 : e.data) == null ? void 0 : l.id;
559
+ (r = (i = te.current) == null ? void 0 : i.clear()) == null || r.then(() => {
560
+ var o;
561
+ t != null && t.id && (n ? (o = Ve(n, t)) == null || o.finally(() => {
562
+ fe(!1);
563
+ }) : (fe(!1), z(!0), w == null || w({
564
+ netOpen: O ? 1 : 2
565
+ }).then((a) => {
566
+ var g, m, N;
567
+ v == null || v(a), z(!1), b(!!((g = a.data) != null && g.netOpen)), $(!!((m = a.data) != null && m.enableNetOpen));
568
+ const k = ((N = a.data) == null ? void 0 : N.id) || "";
569
+ Ve(k, t);
525
570
  })));
526
571
  });
527
572
  }
528
573
  })
529
574
  }))
530
575
  })
531
- }), Te && /* @__PURE__ */ d("div", {
576
+ }), Oe && /* @__PURE__ */ d("div", {
532
577
  className: "session-stop",
533
- children: /* @__PURE__ */ d(B, {
578
+ children: /* @__PURE__ */ d(K, {
534
579
  type: "primary",
535
580
  style: {
536
581
  background: "white"
537
582
  },
538
583
  ghost: !0,
539
584
  size: "small",
540
- icon: /* @__PURE__ */ d(pe, {
585
+ icon: /* @__PURE__ */ d(we, {
541
586
  type: "icon-zantinghuida",
542
587
  style: {
543
588
  fontSize: 16
544
589
  }
545
590
  }),
546
- onClick: () => Lt(),
591
+ onClick: () => Ft(),
547
592
  children: "停止回答"
548
593
  })
549
- }), Ee && (c == null ? void 0 : c.length) > 0 && /* @__PURE__ */ d("div", {
594
+ }), De && (p == null ? void 0 : p.length) > 0 && /* @__PURE__ */ d("div", {
550
595
  className: "back-bottom",
551
- children: /* @__PURE__ */ d(B, {
596
+ children: /* @__PURE__ */ d(K, {
552
597
  size: "small",
553
- onClick: () => Ft({
598
+ onClick: () => Et({
554
599
  behavior: "smooth"
555
600
  }),
556
601
  type: "link",
557
- icon: /* @__PURE__ */ d(pe, {
602
+ icon: /* @__PURE__ */ d(we, {
558
603
  type: "icon-yijianhuidaodibu",
559
604
  style: {
560
605
  fontSize: 24
@@ -564,32 +609,32 @@ ${t}` : t;
564
609
  })]
565
610
  }), /* @__PURE__ */ d("div", {
566
611
  className: "chat-footer",
567
- children: /* @__PURE__ */ A("div", {
612
+ children: /* @__PURE__ */ q("div", {
568
613
  className: "chat-footer-input",
569
- children: [q && /* @__PURE__ */ d("div", {
614
+ children: [Q && /* @__PURE__ */ d("div", {
570
615
  className: "input-files",
571
- children: /* @__PURE__ */ d(Gt, {
572
- file: q,
616
+ children: /* @__PURE__ */ d(Jt, {
617
+ file: Q,
573
618
  actions: {
574
619
  upload: Ct,
575
620
  remove: () => {
576
- z(void 0);
621
+ A(void 0);
577
622
  }
578
623
  },
579
- onUrlChange: (t) => G(t)
624
+ onUrlChange: (t) => S(t)
580
625
  })
581
- }), /* @__PURE__ */ A(ee, {
626
+ }), /* @__PURE__ */ q(oe, {
582
627
  className: "footer-upload-action",
583
628
  onClick: (t) => t.preventDefault(),
584
- children: [/* @__PURE__ */ A(ee, {
585
- children: [n.type === 2 && (v == null ? void 0 : v.imageUpload) && /* @__PURE__ */ d(qt, {
586
- disabled: !!q,
629
+ children: [/* @__PURE__ */ q(oe, {
630
+ children: [s.type === 2 && (f == null ? void 0 : f.imageUpload) && /* @__PURE__ */ d(Kt, {
631
+ disabled: !!Q || D,
587
632
  accept: ".jpg, .png, .jpeg,.bmp",
588
633
  listType: "picture-card",
589
- beforeUpload: bt,
634
+ beforeUpload: Nt,
590
635
  className: "footer-upload-picture",
591
636
  showUploadList: !1,
592
- children: q ? /* @__PURE__ */ d(B, {
637
+ children: Q ? /* @__PURE__ */ d(K, {
593
638
  type: "text",
594
639
  className: "camera-out-btn",
595
640
  style: {
@@ -597,20 +642,20 @@ ${t}` : t;
597
642
  position: "relative",
598
643
  bottom: "-2px"
599
644
  },
600
- disabled: !!q,
645
+ disabled: !!Q || D,
601
646
  icon: /* @__PURE__ */ d(Ze, {
602
647
  className: "icon-tianjia",
603
648
  style: {
604
649
  fontSize: "22px"
605
650
  }
606
651
  })
607
- }) : /* @__PURE__ */ d(Vt, {
652
+ }) : /* @__PURE__ */ d(Wt, {
608
653
  placement: "topLeft",
609
654
  overlayClassName: "footer-upload-tooltip",
610
655
  title: /* @__PURE__ */ d("div", {
611
656
  children: "支持上传.jpg .png .jpeg .bmp格式的图片数据,最大20M,单次仅可上传1个"
612
657
  }),
613
- children: /* @__PURE__ */ d(B, {
658
+ children: /* @__PURE__ */ d(K, {
614
659
  type: "text",
615
660
  className: "camera-out-btn",
616
661
  style: {
@@ -626,126 +671,130 @@ ${t}` : t;
626
671
  })
627
672
  })
628
673
  })
629
- }), te && (v != null && v.fileUpload) && (n != null && n.id) ? /* @__PURE__ */ d(ni, {
630
- appId: n == null ? void 0 : n.id,
631
- ref: Z,
674
+ }), se && (f != null && f.fileUpload) && (s != null && s.id) ? /* @__PURE__ */ d(rn, {
675
+ appId: s == null ? void 0 : s.id,
676
+ ref: te,
632
677
  isFirstSession: He,
633
- docViewerUrl: u,
678
+ docViewerUrl: y,
634
679
  onStatusChange: (t) => j(void 0, null, function* () {
635
- t !== "process" ? (J(!0), ce()) : J(!1);
680
+ t !== "process" ? (ne(!0), me()) : ne(!1);
636
681
  }),
637
682
  createSession: () => new Promise((t) => {
638
- M(!0), y == null || y({
639
- netOpen: T ? 1 : 2
640
- }).then((i) => {
641
- var o, r, l;
642
- g == null || g(i), M(!1), k(!!((o = i.data) != null && o.netOpen)), W(!!((r = i.data) != null && r.enableNetOpen));
643
- const a = ((l = i.data) == null ? void 0 : l.id) || "";
644
- t(a);
683
+ z(!0), w == null || w({
684
+ netOpen: O ? 1 : 2
685
+ }).then((n) => {
686
+ var i, r, o;
687
+ v == null || v(n), z(!1), b(!!((i = n.data) != null && i.netOpen)), $(!!((r = n.data) != null && r.enableNetOpen));
688
+ const l = ((o = n.data) == null ? void 0 : o.id) || "";
689
+ t(l);
645
690
  });
646
691
  }),
647
692
  sid: (Ke = e == null ? void 0 : e.data) == null ? void 0 : Ke.id,
648
- disabled: de,
649
- afterFileAdd: (t, i) => {
650
- i && X((a) => {
651
- const o = a[i] || [];
693
+ disabled: he || D,
694
+ afterFileAdd: (t, n) => {
695
+ n && ee((l) => {
696
+ const i = l[n] || [];
652
697
  return {
653
- [i]: [...o, t]
698
+ [n]: [...i, t]
654
699
  };
655
700
  });
656
701
  },
657
702
  afterFileDelete: (t) => {
658
- var a;
659
- const i = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
660
- i && X((o) => {
661
- const r = o[i] || [];
703
+ var l;
704
+ const n = (l = e == null ? void 0 : e.data) == null ? void 0 : l.id;
705
+ n && ee((i) => {
706
+ const r = i[n] || [];
662
707
  return {
663
- [i]: r.filter((l) => l.id !== t)
708
+ [n]: r.filter((o) => o.id !== t)
664
709
  };
665
710
  });
666
711
  },
667
712
  onFileListChange: (t) => {
668
- ut(t);
713
+ pt(t);
669
714
  },
670
715
  shouldContinue: gt,
671
716
  afterFilesClear: () => {
672
- var i;
673
- const t = (i = e == null ? void 0 : e.data) == null ? void 0 : i.id;
674
- t && (X({
717
+ var n;
718
+ const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
719
+ t && (ee({
675
720
  [t]: []
676
- }), ce());
721
+ }), me());
677
722
  }
678
- }) : null, (v == null ? void 0 : v.prompt) && (n == null ? void 0 : n.id) && /* @__PURE__ */ d(ei, {
679
- appId: n.id,
723
+ }) : null, (f == null ? void 0 : f.prompt) && (s == null ? void 0 : s.id) && /* @__PURE__ */ d(on, {
724
+ appId: s.id,
680
725
  list: [],
681
- search: Ce ? st : "",
726
+ search: Te ? at : "",
682
727
  onPromptSelect: (t) => {
683
- U(t.context), Y(t.context);
684
- }
728
+ B(t.context), G(t.context);
729
+ },
730
+ disabled: D
685
731
  })]
686
- }), /* @__PURE__ */ A(ee, {
687
- children: [(v == null ? void 0 : v.connectNetwork) && n.type === 0 && ((Qe = n.arrange) == null ? void 0 : Qe.length) && !!n.arrange[0].enableNetOpen && /* @__PURE__ */ d(si, {
688
- sessionId: (Ye = e == null ? void 0 : e.data) == null ? void 0 : Ye.id,
689
- netStatus: T,
690
- enable: xt,
732
+ }), /* @__PURE__ */ q(oe, {
733
+ children: [(f == null ? void 0 : f.connectNetwork) && s.type === 0 && ((We = s.arrange) == null ? void 0 : We.length) && !!s.arrange[0].enableNetOpen && /* @__PURE__ */ d(un, {
734
+ sessionId: (Qe = e == null ? void 0 : e.data) == null ? void 0 : Qe.id,
735
+ netStatus: O,
736
+ enable: typeof (c == null ? void 0 : c.connectNetwork) == "object" && typeof (c == null ? void 0 : c.connectNetwork.diabled) == "boolean" ? !(c != null && c.connectNetwork.diabled) : bt,
737
+ disabledTip: e ? void 0 : "网络访问已被禁用",
691
738
  onNetStatusChange: (t) => {
692
- Mt(t);
693
- }
694
- }), (v == null ? void 0 : v.sessionList) && /* @__PURE__ */ d(li, {
695
- currentSessionId: (_e = e == null ? void 0 : e.data) == null ? void 0 : _e.id,
696
- onSessionChange: (t, i) => {
697
- U(void 0), g == null || g(i);
739
+ Ht(t);
698
740
  }
699
- }), (v == null ? void 0 : v.sessionOpen) && /* @__PURE__ */ d(B, {
700
- icon: /* @__PURE__ */ d(ii, {}),
741
+ }), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ d(cn, {
742
+ currentSessionId: (Ye = e == null ? void 0 : e.data) == null ? void 0 : Ye.id,
743
+ onSessionChange: (t, n) => {
744
+ B(void 0), v == null || v(n);
745
+ },
746
+ disabled: D
747
+ }), (f == null ? void 0 : f.sessionOpen) && /* @__PURE__ */ d(K, {
748
+ icon: /* @__PURE__ */ d(ln, {}),
701
749
  className: "add-btn",
702
750
  type: "primary",
703
- disabled: Te || !e || !c.length,
751
+ disabled: Oe || !e || !p.length || D,
704
752
  onClick: () => {
705
- var t, i;
706
- g == null || g(void 0), k(!1), (t = Fe.current) == null || t.clear(), (i = se.current) == null || i.clear();
753
+ var t, n;
754
+ v == null || v(void 0), b(!1), (t = Pe.current) == null || t.clear(), (n = pe.current) == null || n.clear();
707
755
  },
708
756
  children: "新会话"
709
757
  })]
710
758
  })]
711
759
  }), /* @__PURE__ */ d("div", {
712
760
  className: "footer-textarea",
713
- children: /* @__PURE__ */ d(Zt, {
714
- ref: le,
761
+ children: /* @__PURE__ */ d(en, {
762
+ ref: ce,
715
763
  maxLength: ot,
716
764
  text: ct,
717
765
  networkStatus: !1,
718
- disabled: ye || Ie,
719
- onTextSend: Me,
720
- onChange: (t, i) => {
721
- U(t);
722
- const a = i.getText().replace(/[\n\s]+$/, "");
723
- Y(a), dt(a), Ce || rt(!0);
766
+ loading: Me,
767
+ disabled: Le || Ce || D || Me,
768
+ onTextSend: Ue,
769
+ onChange: (t, n) => {
770
+ B(t);
771
+ const l = n.getText().replace(/[\n\s]+$/, "");
772
+ G(l), dt(l), Te || rt(!0);
724
773
  },
725
- clearAction: /* @__PURE__ */ d(ee, {
774
+ clearAction: /* @__PURE__ */ d(oe, {
726
775
  size: 0,
727
- children: /* @__PURE__ */ d(B, {
776
+ children: /* @__PURE__ */ d(K, {
728
777
  type: "link",
729
- disabled: de,
778
+ disabled: he || D,
730
779
  ghost: !0,
731
- icon: /* @__PURE__ */ d(pe, {
780
+ icon: /* @__PURE__ */ d(we, {
732
781
  style: {
733
782
  fontSize: 22
734
783
  },
735
784
  type: "icon-qingchujiyi"
736
785
  }),
737
- onClick: () => kt()
786
+ onClick: () => xt()
738
787
  })
739
788
  })
740
789
  })
741
790
  })]
742
791
  })
743
- }), /* @__PURE__ */ d(ti, {
744
- tips: it
745
- }), Ne && /* @__PURE__ */ d(oi, {
746
- isvisible: Ne,
747
- files: ht,
748
- sessionId: (Ge = e == null ? void 0 : e.data) == null ? void 0 : Ge.id,
792
+ }), /* @__PURE__ */ d(sn, {
793
+ tips: nt
794
+ }), Re && /* @__PURE__ */ d(an, {
795
+ isvisible: Re,
796
+ files: ut,
797
+ sessionId: (_e = e == null ? void 0 : e.data) == null ? void 0 : _e.id,
749
798
  onClose: (t) => {
750
799
  ft(!1), mt(!1);
751
800
  }
@@ -753,5 +802,5 @@ ${t}` : t;
753
802
  });
754
803
  };
755
804
  export {
756
- Qi as default
805
+ Kn as default
757
806
  };