@glodon-aiot/agent-cli-ui 3.9.0-beta.10 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/es/Dialog/AgentChat/HistoryItem/FileItem/index.mjs +12 -12
  2. package/dist/es/Dialog/AgentChat/HistoryItem/SessionRefer/index.mjs +11 -11
  3. package/dist/es/Dialog/AgentChat/HistoryItem/SessionRelated/index.mjs +2 -2
  4. package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +118 -133
  5. package/dist/es/Dialog/AgentChat/Tools/UploadKnowledgeFiles/index.mjs +1 -1
  6. package/dist/es/Dialog/AgentChat/index.mjs +573 -604
  7. package/dist/es/Dialog/SessionList/index.mjs +218 -271
  8. package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +53 -53
  9. package/dist/es/components/FilePreview/index.mjs +6 -6
  10. package/dist/es/components/Iconfont/index.mjs +3 -3
  11. package/dist/es/constant.mjs +4 -4
  12. package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/components/Markdown/Code/index.mjs +1 -1
  13. package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/components/Markdown/Image/index.mjs +3 -3
  14. package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/components/Markdown/index.mjs +25 -24
  15. package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/index.mjs +1 -1
  16. package/dist/es/node_modules/hast-util-from-parse5/lib/index.mjs +162 -0
  17. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/index.mjs +12 -0
  18. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/aria.mjs +61 -0
  19. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/find.mjs +33 -0
  20. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/html.mjs +368 -0
  21. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/normalize.mjs +6 -0
  22. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/svg.mjs +566 -0
  23. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/case-insensitive-transform.mjs +7 -0
  24. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/case-sensitive-transform.mjs +6 -0
  25. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/create.mjs +14 -0
  26. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/defined-info.mjs +36 -0
  27. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/info.mjs +28 -0
  28. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/merge.mjs +10 -0
  29. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/schema.mjs +21 -0
  30. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/util/types.mjs +15 -0
  31. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/xlink.mjs +19 -0
  32. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/xml.mjs +15 -0
  33. package/dist/es/node_modules/hast-util-from-parse5/node_modules/property-information/lib/xmlns.mjs +16 -0
  34. package/dist/es/node_modules/hast-util-from-parse5/node_modules/vfile-location/lib/index.mjs +47 -0
  35. package/dist/es/node_modules/hast-util-from-parse5/node_modules/web-namespaces/index.mjs +11 -0
  36. package/dist/es/node_modules/rehype-raw/lib/index.mjs +26 -0
  37. package/dist/es/node_modules/rehype-raw/node_modules/entities/dist/esm/decode-codepoint.mjs +38 -0
  38. package/dist/es/node_modules/rehype-raw/node_modules/entities/dist/esm/decode.mjs +251 -0
  39. package/dist/es/node_modules/rehype-raw/node_modules/entities/dist/esm/generated/decode-data-html.mjs +7 -0
  40. package/dist/es/node_modules/rehype-raw/node_modules/hast-util-raw/lib/index.mjs +249 -0
  41. package/dist/es/node_modules/rehype-raw/node_modules/hast-util-to-parse5/lib/index.mjs +125 -0
  42. package/dist/es/node_modules/rehype-raw/node_modules/html-void-elements/index.mjs +4 -0
  43. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/doctype.mjs +34 -0
  44. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/error-codes.mjs +7 -0
  45. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/foreign-content.mjs +103 -0
  46. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/html.mjs +44 -0
  47. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/token.mjs +14 -0
  48. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/common/unicode.mjs +38 -0
  49. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/parser/formatting-element-list.mjs +91 -0
  50. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/parser/index.mjs +2308 -0
  51. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/parser/open-element-stack.mjs +220 -0
  52. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/serializer/index.mjs +2 -0
  53. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/tokenizer/index.mjs +1948 -0
  54. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/tokenizer/preprocessor.mjs +92 -0
  55. package/dist/es/node_modules/rehype-raw/node_modules/parse5/dist/tree-adapters/default.mjs +173 -0
  56. package/dist/es/node_modules/rehype-raw/node_modules/property-information/index.mjs +12 -0
  57. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/aria.mjs +61 -0
  58. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/find.mjs +33 -0
  59. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/html.mjs +368 -0
  60. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/normalize.mjs +6 -0
  61. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/svg.mjs +566 -0
  62. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/case-insensitive-transform.mjs +7 -0
  63. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/case-sensitive-transform.mjs +6 -0
  64. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/create.mjs +17 -0
  65. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/defined-info.mjs +27 -0
  66. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/info.mjs +23 -0
  67. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/merge.mjs +11 -0
  68. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/schema.mjs +17 -0
  69. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/util/types.mjs +15 -0
  70. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/xlink.mjs +19 -0
  71. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/xml.mjs +15 -0
  72. package/dist/es/node_modules/rehype-raw/node_modules/property-information/lib/xmlns.mjs +16 -0
  73. package/dist/es/node_modules/rehype-raw/node_modules/unist-util-visit/lib/index.mjs +16 -0
  74. package/dist/es/node_modules/rehype-raw/node_modules/web-namespaces/index.mjs +11 -0
  75. package/dist/es/node_modules/zwitch/index.mjs +18 -0
  76. package/dist/es/packages/agent-cli-ui/package.json.mjs +3 -3
  77. package/dist/es/src/style11.css +1 -1
  78. package/dist/es/src/style12.css +1 -1
  79. package/dist/es/src/style13.css +1 -1
  80. package/dist/es/src/style14.css +1 -1
  81. package/dist/es/src/style15.css +1 -1
  82. package/dist/es/src/style16.css +1 -1
  83. package/dist/es/src/style17.css +1 -1
  84. package/dist/es/src/style18.css +1 -1
  85. package/dist/es/src/style19.css +1 -1
  86. package/dist/es/src/style20.css +1 -1
  87. package/dist/es/src/style21.css +1 -1
  88. package/dist/es/src/style22.css +1 -1
  89. package/dist/es/src/style23.css +1 -1
  90. package/dist/es/src/style26.css +1 -1
  91. package/dist/es/src/style27.css +1 -1
  92. package/dist/es/src/style28.css +1 -1
  93. package/dist/es/src/style30.css +1 -1
  94. package/dist/es/src/style31.css +1 -1
  95. package/dist/es/src/style32.css +1 -1
  96. package/dist/es/src/style5.css +1 -1
  97. package/dist/es/src/style6.css +1 -1
  98. package/dist/es/src/style8.css +1 -1
  99. package/dist/es/src/style9.css +1 -1
  100. package/dist/lib/index.css +1 -1
  101. package/dist/lib/index.js +68 -69
  102. package/dist/src/constant.d.ts +2 -2
  103. package/package.json +3 -3
  104. /package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/Iconfont/index.mjs +0 -0
  105. /package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/components/Copy/index.mjs +0 -0
  106. /package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/components/Markdown/ATag/index.mjs +0 -0
  107. /package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/components/Markdown/Video/index.mjs +0 -0
  108. /package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/utils/clipboard.mjs +0 -0
  109. /package/dist/es/{packages → node_modules/@glodon-aiot}/react-components/dist/es/utils/markdown/index.mjs +0 -0
@@ -1,67 +1,67 @@
1
- var wn = Object.defineProperty, kn = Object.defineProperties;
2
- var In = Object.getOwnPropertyDescriptors;
3
- var Nt = Object.getOwnPropertySymbols;
4
- var Nn = Object.prototype.hasOwnProperty, En = Object.prototype.propertyIsEnumerable;
5
- var Ue = (w, h, o) => h in w ? wn(w, h, { enumerable: !0, configurable: !0, writable: !0, value: o }) : w[h] = o, Ae = (w, h) => {
6
- for (var o in h || (h = {}))
7
- Nn.call(h, o) && Ue(w, o, h[o]);
8
- if (Nt)
9
- for (var o of Nt(h))
10
- En.call(h, o) && Ue(w, o, h[o]);
1
+ var pn = Object.defineProperty, vn = Object.defineProperties;
2
+ var bn = Object.getOwnPropertyDescriptors;
3
+ var Ct = Object.getOwnPropertySymbols;
4
+ var xn = Object.prototype.hasOwnProperty, kn = Object.prototype.propertyIsEnumerable;
5
+ var Re = (w, h, i) => h in w ? pn(w, h, { enumerable: !0, configurable: !0, writable: !0, value: i }) : w[h] = i, Fe = (w, h) => {
6
+ for (var i in h || (h = {}))
7
+ xn.call(h, i) && Re(w, i, h[i]);
8
+ if (Ct)
9
+ for (var i of Ct(h))
10
+ kn.call(h, i) && Re(w, i, h[i]);
11
11
  return w;
12
- }, Fe = (w, h) => kn(w, In(h));
13
- var U = (w, h, o) => (Ue(w, typeof h != "symbol" ? h + "" : h, o), o);
14
- var A = (w, h, o) => new Promise((M, e) => {
15
- var x = (L) => {
12
+ }, Ue = (w, h) => vn(w, bn(h));
13
+ var U = (w, h, i) => (Re(w, typeof h != "symbol" ? h + "" : h, i), i);
14
+ var V = (w, h, i) => new Promise((j, e) => {
15
+ var x = (E) => {
16
16
  try {
17
- p(o.next(L));
17
+ p(i.next(E));
18
18
  } catch (P) {
19
19
  e(P);
20
20
  }
21
- }, $ = (L) => {
21
+ }, X = (E) => {
22
22
  try {
23
- p(o.throw(L));
23
+ p(i.throw(E));
24
24
  } catch (P) {
25
25
  e(P);
26
26
  }
27
- }, p = (L) => L.done ? M(L.value) : Promise.resolve(L.value).then(x, $);
28
- p((o = o.apply(w, h)).next());
27
+ }, p = (E) => E.done ? j(E.value) : Promise.resolve(E.value).then(x, X);
28
+ p((i = i.apply(w, h)).next());
29
29
  });
30
- import { jsx as d, jsxs as V, Fragment as Ln } from "react/jsx-runtime";
31
- import { memo as Pn, forwardRef as Tn, useState as m, useRef as Y, useContext as On, useEffect as k, useMemo as Rn, useImperativeHandle as Dn } from "react";
32
- /* empty css */import { Spin as Et, Divider as Hn, Button as X, Space as Ie, Upload as Un, Tooltip as An, Popover as Fn, notification as ie, message as u } from "antd";
33
- import oe from "../../components/Iconfont/index.mjs";
34
- import { IHistoryRole as se, ApplicationTypes as re, ChatMessageRole as Lt, PromptVariableType as Ne } from "@glodon-aiot/apis";
35
- import Rt from "./HistoryItem/index.mjs";
36
- import Dt from "dayjs";
37
- import { v4 as ze } from "uuid";
38
- import Mn from "../../context.mjs";
39
- import { configuration as jn } from "@glodon-aiot/bot-client-sdk";
40
- import { MAX_KNOWLEDGES_AND_FILES_COUNT as Pt, NET_OPEN_STATUS as Q, MB as zn } from "../../constant.mjs";
41
- import Vn from "../../components/FilePreview/index.mjs";
42
- import { calcKnowledgesLeafCount as $n, getImageExtension as Bn } from "../../utils/index.mjs";
43
- import _n from "../../QuillEditor/index.mjs";
44
- import qn from "../../components/Recommend/index.mjs";
45
- import Wn from "../../components/Greeting/index.mjs";
46
- import Kn from "../../Footer/index.mjs";
47
- import { PlusOutlined as Yn } from "@ant-design/icons";
48
- import Qn from "./Tools/UploadKnowledgeFiles/index.mjs";
49
- import Gn from "../UploadingPrompt/index.mjs";
50
- import Xn from "./PromptSetting/index.mjs";
51
- import { useMemoizedFn as Me } from "ahooks";
52
- import Zn from "./Tools/SessionListDrawer/index.mjs";
53
- import Jn from "./Tools/SessionHistoryDrawer/index.mjs";
54
- import Sn from "react-infinite-scroll-component";
55
- import ei from "./Tools/ConnectToNetwork/index.mjs";
56
- import ti from "./Tools/PromptManager/index.mjs";
57
- import { useSessionState as ni } from "../../hooks/useSessionState.mjs";
58
- import ii from "../../assets/icon.svg.mjs";
59
- const oi = Pn(Rt), Tt = {
60
- icon: ii,
30
+ import { jsx as d, jsxs as z, Fragment as wn } from "react/jsx-runtime";
31
+ import { memo as Cn, forwardRef as In, useState as u, useRef as Q, useContext as Nn, useEffect as L, useMemo as Ln, useImperativeHandle as En } from "react";
32
+ /* empty css */import { Spin as It, Divider as Pn, Button as G, Space as Ce, Upload as Tn, Tooltip as On, Popover as Dn, notification as ne, message as m } from "antd";
33
+ import ge from "../../components/Iconfont/index.mjs";
34
+ import { IHistoryRole as ie, ApplicationTypes as oe, ChatMessageRole as Nt, PromptVariableType as Ie } from "@glodon-aiot/apis";
35
+ import Tt from "./HistoryItem/index.mjs";
36
+ import Ot from "dayjs";
37
+ import { v4 as Me } from "uuid";
38
+ import Hn from "../../context.mjs";
39
+ import { configuration as Rn } from "@glodon-aiot/bot-client-sdk";
40
+ import { MAX_KNOWLEDGES_AND_FILES_COUNT as Lt, NET_OPEN_STATUS as K, MB as Fn } from "../../constant.mjs";
41
+ import Un from "../../components/FilePreview/index.mjs";
42
+ import { calcKnowledgesLeafCount as jn, getImageExtension as An } from "../../utils/index.mjs";
43
+ import Mn from "../../QuillEditor/index.mjs";
44
+ import Vn from "../../components/Recommend/index.mjs";
45
+ import zn from "../../components/Greeting/index.mjs";
46
+ import $n from "../../Footer/index.mjs";
47
+ import { CameraOutlined as qn, PlusOutlined as Bn } from "@ant-design/icons";
48
+ import Wn from "./Tools/UploadKnowledgeFiles/index.mjs";
49
+ import _n from "../UploadingPrompt/index.mjs";
50
+ import Kn from "./PromptSetting/index.mjs";
51
+ import { useMemoizedFn as je } from "ahooks";
52
+ import Yn from "./Tools/SessionListDrawer/index.mjs";
53
+ import Qn from "./Tools/SessionHistoryDrawer/index.mjs";
54
+ import Gn from "react-infinite-scroll-component";
55
+ import Xn from "./Tools/ConnectToNetwork/index.mjs";
56
+ import Zn from "./Tools/PromptManager/index.mjs";
57
+ import { useSessionState as Jn } from "../../hooks/useSessionState.mjs";
58
+ import Sn from "../../assets/icon.svg.mjs";
59
+ const ei = Cn(Tt), Et = {
60
+ icon: Sn,
61
61
  text: "今天我能帮你什么?"
62
62
  };
63
- class ge {
64
- constructor(h, o, M, e, x) {
63
+ class me {
64
+ constructor(h, i, j, e, x) {
65
65
  U(this, "messageTime");
66
66
  U(this, "isWaiting");
67
67
  U(this, "messageId");
@@ -73,132 +73,124 @@ class ge {
73
73
  U(this, "imageContent");
74
74
  // 新增:支持对话型应用的图片内容
75
75
  U(this, "comment");
76
- this.content = h, this.sessionId = o, this.role = M, this.files = e, this.content = h, this.role = M, this.sessionId = o, this.files = e, this.imageContent = x, this.messageTime = Dt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = ze(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
76
+ this.content = h, this.sessionId = i, this.role = j, this.files = e, this.content = h, this.role = j, this.sessionId = i, this.files = e, this.imageContent = x, this.messageTime = Ot(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = Me(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
77
77
  isAgree: 0
78
78
  };
79
79
  }
80
80
  }
81
- const Ot = 10, Ee = 5, je = (w, h, o, M) => {
81
+ const Pt = 10, Ae = (w, h, i, j) => {
82
82
  let e = w;
83
- if (M === re.Agent) {
84
- if (o && o.length > 0) {
85
- const x = o.map(($) => `[${$.name.replace(/\.[^/.]+$/, "")}](${$.url})`).join(`
86
- `);
87
- e = x ? `${x}
88
- ${e}` : e;
89
- }
90
- if (h && h.length > 0) {
91
- const x = h.filter(Boolean).map(($) => `![](${$})`).join(`
83
+ if (j === oe.Agent) {
84
+ if (i && i.length > 0) {
85
+ const x = i.map((X) => `[${X.name.replace(/\.[^/.]+$/, "")}](${X.url})`).join(`
92
86
  `);
93
87
  e = x ? `${x}
94
88
  ${e}` : e;
95
89
  }
90
+ h && (e = `![](${h})
91
+ ${e}`);
96
92
  }
97
93
  return e;
98
- }, Fi = Tn((w, h) => {
99
- var ct, gt, ft, ut, mt, ht, yt, pt, vt, bt, xt, Ct, wt, kt;
94
+ }, Hi = In((w, h) => {
95
+ var lt, dt, ct, ft, gt, mt, ut, ht, yt, pt, vt, bt, xt, kt;
100
96
  const {
101
- application: o,
102
- docViewerUrl: M = "",
97
+ application: i,
98
+ docViewerUrl: j = "",
103
99
  currentSession: e,
104
100
  onCreateSession: x,
105
- embeddingService: $,
101
+ embeddingService: X,
106
102
  setCurrentSession: p,
107
- networkStatus: L,
103
+ networkStatus: E,
108
104
  setNetworkStatus: P
109
- } = w, [v, I] = m([]), [Ht, fe] = m(), [Le, Ve] = m(), O = Y(null), {
110
- service: R,
111
- agentClient: N,
112
- depId: Ut,
113
- footer: At,
114
- transform: f,
115
- defaultInput: Pe,
116
- onMessage: ue,
117
- onHistoryLoad: $e,
118
- beforeMessageSend: B,
105
+ } = w, [v, C] = u([]), [Dt, ue] = u(), [Ne, Ve] = u(), T = Q(null), {
106
+ service: O,
107
+ agentClient: I,
108
+ depId: Ht,
109
+ footer: Rt,
110
+ transform: g,
111
+ defaultInput: Le,
112
+ onMessage: he,
113
+ onHistoryLoad: ze,
114
+ beforeMessageSend: $,
119
115
  bodyStyle: Ft,
120
- disabled: F,
121
- features: a,
122
- popupContainer: g,
123
- icon: Mt,
116
+ disabled: D,
117
+ features: s,
118
+ popupContainer: f,
119
+ icon: Ut,
124
120
  sider: jt,
125
- mode: zt
126
- } = On(Mn), [Be, Te] = m(!1), y = Y(v), _e = Y(void 0), [Vt, $t] = m(0), [me, he] = m([]), [Z, ye] = m([]), [qe, We] = m(0), [Ke, Bt] = m(!1);
127
- k(() => {
128
- Bt(qe > 0);
129
- }, [qe]);
130
- const pe = Y(null), [Ye, _t] = m([]), [Qe, J] = m(!1), [Ge, qt] = m(!1), [Wt, Kt] = m(""), [Yt, S] = m(), [ee, ae] = m({}), ve = Y(null), Xe = Y(null), Oe = Y(null), [Ze, Qt] = m(!1), [Gt, Xt] = m([]), [Zt, be] = m(!0), [Jt, St] = m(!0), [Je, j] = m(!1), [Re, _] = m(!1), [Se, en] = m(!1), [D, le] = m(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [tn, nn] = m(() => {
131
- const t = typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0;
121
+ mode: At
122
+ } = Nn(Hn), [$e, Ee] = u(!1), y = Q(v), qe = Q(void 0), [Mt, Vt] = u(0), [se, Z] = u(), [re, ae] = u(""), [Be, Pe] = u(!1), ye = Q(null), [We, zt] = u([]), [_e, J] = u(!1), [Ke, $t] = u(!1), [qt, Bt] = u(""), [Wt, S] = u(), [ee, le] = u({}), pe = Q(null), Ye = Q(null), Te = Q(null), [Qe, _t] = u(!1), [Kt, Yt] = u([]), [Qt, ve] = u(!0), [Gt, Xt] = u(!0), [Ge, A] = u(!1), [Oe, q] = u(!1), [Xe, Zt] = u(!1), [H, de] = u(typeof (s == null ? void 0 : s.promptVariables) == "object" ? s.promptVariables.default || [] : []), [Jt, St] = u(() => {
123
+ const t = typeof (s == null ? void 0 : s.knowledges) == "object" && s.knowledges.default || void 0;
132
124
  if (t) {
133
- if (Array.isArray(t) && t.some((r) => Array.isArray(r.fileIds) && r.fileIds.length === 0))
125
+ if (Array.isArray(t) && t.some((l) => Array.isArray(l.fileIds) && l.fileIds.length === 0))
134
126
  throw Error("fileIds cannot be an empty array");
135
- if ($n(t) > Pt)
136
- throw Error(`knowledges and fileIds total count cannot exceed ${Pt}`);
127
+ if (jn(t) > Lt)
128
+ throw Error(`knowledges and fileIds total count cannot exceed ${Lt}`);
137
129
  }
138
130
  return t;
139
- }), [et, z] = m(!1), [tt, de] = m(!1), [on, te] = m(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), [nt, xe] = m(!1), [sn, q] = m(!1), [rn, an] = m(null), [Ce, G] = m(!1), [it, ot] = m(!1), {
140
- isSwitchingToExistingSession: st,
141
- setIsSwitchingToExistingSession: we
142
- } = ni(), ne = Y(null);
143
- k(() => {
144
- if (an(e), e === null)
145
- q(!1);
131
+ }), [Ze, M] = u(!1), [Je, ce] = u(!1), [en, te] = u(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), [Se, be] = u(!1), [tn, B] = u(!1), [nn, on] = u(null), [xe, Y] = u(!1), [et, tt] = u(!1), {
132
+ isSwitchingToExistingSession: nt,
133
+ setIsSwitchingToExistingSession: ke
134
+ } = Jn();
135
+ L(() => {
136
+ if (on(e), e === null)
137
+ B(!1);
146
138
  else if (e === void 0)
147
- q(!0);
139
+ B(!0);
148
140
  else {
149
- if (rn === null) {
150
- if (st) {
151
- q(!0), we(!1);
141
+ if (nn === null) {
142
+ if (nt) {
143
+ B(!0), ke(!1);
152
144
  return;
153
145
  }
154
- q(!1);
146
+ B(!1);
155
147
  return;
156
148
  }
157
- e.ready ? q(!1) : q(!0);
149
+ e.ready ? B(!1) : B(!0);
158
150
  }
159
- }, [e, e == null ? void 0 : e.ready, st]), k(() => {
160
- var s, r;
161
- e && (y.current = []), I([]);
162
- const t = O.current;
151
+ }, [e, e == null ? void 0 : e.ready, nt]), L(() => {
152
+ var a, l;
153
+ e && (y.current = []), C([]);
154
+ const t = T.current;
163
155
  if (t && t.scrollTo({
164
156
  top: 0
165
- }), !((s = e == null ? void 0 : e.data) != null && s.id))
157
+ }), !((a = e == null ? void 0 : e.data) != null && a.id))
166
158
  return;
167
- if (_(!1), j(!1), (r = e.messages) != null && r.length) {
168
- const c = [...e.messages.filter((l) => l == null ? void 0 : l.messageId)].reverse();
169
- y.current = [...c], I([...c]), q(!1);
159
+ if (q(!1), A(!1), (l = e.messages) != null && l.length) {
160
+ const c = [...e.messages.filter((r) => r == null ? void 0 : r.messageId)].reverse();
161
+ y.current = [...c], C([...c]), B(!1);
170
162
  }
171
- const n = (i) => {
163
+ const n = (o) => {
172
164
  var c;
173
- (c = e == null ? void 0 : e.data) != null && c.id && (y.current = [...i].reverse(), I([...i].reverse()), !i || i.length < 10 ? de(!1) : de(!0), q(!1), $e && $e({
174
- applicationId: o.id,
165
+ (c = e == null ? void 0 : e.data) != null && c.id && (y.current = [...o].reverse(), C([...o].reverse()), !o || o.length < 10 ? ce(!1) : ce(!0), B(!1), ze && ze({
166
+ applicationId: i.id,
175
167
  sessionId: e.data.id,
176
- histories: i
168
+ histories: o
177
169
  }));
178
170
  };
179
171
  return e.addEventListener("history:loaded", n), () => {
180
- y.current = [], I([]), e == null || e.removeEventListener("history:loaded", n);
172
+ y.current = [], C([]), e == null || e.removeEventListener("history:loaded", n);
181
173
  };
182
- }, [e]), k(() => {
174
+ }, [e]), L(() => {
183
175
  const t = () => {
184
176
  var n;
185
- (n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && le(e.promptVariables.sort((s, r) => s.key.localeCompare(r.key))), e.knowledges && nn(e.knowledges), P(e.netOpen));
177
+ (n = e == null ? void 0 : e.data) != null && n.id && (e.promptVariables && de(e.promptVariables.sort((a, l) => a.key.localeCompare(l.key))), e.knowledges && St(e.knowledges), P(e.netOpen));
186
178
  };
187
179
  return e == null || e.addEventListener("data:updated", t), () => {
188
180
  e == null || e.removeEventListener("data:updated", t);
189
181
  };
190
- }, [e]), k(() => {
182
+ }, [e]), L(() => {
191
183
  var n;
192
184
  if (!((n = e == null ? void 0 : e.data) != null && n.id))
193
185
  return;
194
- const t = (s) => {
195
- var r;
196
- console.error(s.message, s.cause, "e.case"), ie.config({
197
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
186
+ const t = (a) => {
187
+ var l;
188
+ console.error(a.message, a.cause, "e.case"), ne.config({
189
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
198
190
  prefixCls: "gbot-notification"
199
- }), ie.error({
200
- message: ((r = s.cause) == null ? void 0 : r.message) || s.message
201
- }), ie.config({
191
+ }), ne.error({
192
+ message: ((l = a.cause) == null ? void 0 : l.message) || a.message
193
+ }), ne.config({
202
194
  getContainer: void 0,
203
195
  prefixCls: "gbot-notification"
204
196
  });
@@ -207,204 +199,204 @@ ${e}` : e;
207
199
  e == null || e.removeEventListener("error", t);
208
200
  };
209
201
  }, [e]);
210
- const ln = () => {
211
- var s;
212
- if (!((s = e == null ? void 0 : e.data) != null && s.id) || !(o != null && o.id))
202
+ const sn = () => {
203
+ var a;
204
+ if (!((a = e == null ? void 0 : e.data) != null && a.id) || !(i != null && i.id))
213
205
  return;
214
206
  const t = e.data.id, n = v[v.length - 1];
215
207
  if (n && n.isContext) {
216
- u.config({
217
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
208
+ m.config({
209
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
218
210
  prefixCls: "gbot-message"
219
- }), u.success("已开启新话题"), u.config({
211
+ }), m.success("已开启新话题"), m.config({
220
212
  getContainer: void 0,
221
213
  prefixCls: "gbot-message"
222
214
  });
223
215
  return;
224
216
  } else
225
217
  e.clear().then(() => {
226
- const r = new ge("", t, se.System);
227
- r.isContext = !0, I([r, ...v]);
218
+ const l = new me("", t, ie.System);
219
+ l.isContext = !0, C([l, ...v]);
228
220
  });
229
221
  };
230
- k(() => {
231
- o != null && o.id && (R == null || R.getRecommendQues(o.id).then((t) => {
232
- _t(t);
222
+ L(() => {
223
+ i != null && i.id && (O == null || O.getRecommendQues(i.id).then((t) => {
224
+ zt(t);
233
225
  }));
234
- }, [Ut, o]);
235
- const rt = (t) => A(void 0, null, function* () {
236
- var W, K;
237
- if (F) {
238
- u.config({
239
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
226
+ }, [Ht, i]);
227
+ const it = (t) => V(void 0, null, function* () {
228
+ var W, _;
229
+ if (D) {
230
+ m.config({
231
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
240
232
  prefixCls: "gbot-message"
241
- }), u.error("发送功能被禁用"), u.config({
233
+ }), m.error("发送功能被禁用"), m.config({
242
234
  getContainer: void 0,
243
235
  prefixCls: "gbot-message"
244
236
  });
245
237
  return;
246
238
  }
247
- const n = t || Ht;
239
+ const n = t || Dt;
248
240
  if (!(n != null && n.trim())) {
249
- u.config({
250
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
241
+ m.config({
242
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
251
243
  prefixCls: "gbot-message"
252
- }), u.error("请输入你想问的"), u.config({
244
+ }), m.error("请输入你想问的"), m.config({
253
245
  getContainer: void 0,
254
246
  prefixCls: "gbot-message"
255
247
  });
256
248
  return;
257
249
  }
258
- if (!(D == null ? void 0 : D.every((C) => !!(C != null && C.value))))
259
- if (f != null && f.promptVariables) {
260
- u.config({
261
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
250
+ if (!(H == null ? void 0 : H.every((k) => !!(k != null && k.value))))
251
+ if (g != null && g.promptVariables) {
252
+ m.config({
253
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
262
254
  prefixCls: "gbot-message"
263
- }), u.error("变量值不能为空"), u.config({
255
+ }), m.error("变量值不能为空"), m.config({
264
256
  getContainer: void 0,
265
257
  prefixCls: "gbot-message"
266
258
  });
267
259
  return;
268
260
  } else
269
- console.error("变量值不能为空", D == null ? void 0 : D.map((C) => !!(C != null && C.value)));
270
- if (Re) {
271
- u.config({
272
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
261
+ console.error("变量值不能为空", H == null ? void 0 : H.map((k) => !!(k != null && k.value)));
262
+ if (Oe) {
263
+ m.config({
264
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
273
265
  prefixCls: "gbot-message"
274
- }), u.error("正在回复中"), u.config({
266
+ }), m.error("正在回复中"), m.config({
275
267
  getContainer: void 0,
276
268
  prefixCls: "gbot-message"
277
269
  });
278
270
  return;
279
271
  }
280
- if (Be) {
281
- u.config({
282
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
272
+ if ($e) {
273
+ m.config({
274
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
283
275
  prefixCls: "gbot-message"
284
- }), u.error("等待初始化"), u.config({
276
+ }), m.error("等待初始化"), m.config({
285
277
  getContainer: void 0,
286
278
  prefixCls: "gbot-message"
287
279
  });
288
280
  return;
289
281
  }
290
- if (!Zt) {
291
- u.config({
292
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
282
+ if (!Qt) {
283
+ m.config({
284
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
293
285
  prefixCls: "gbot-message"
294
- }), u.error("正在解析文件"), u.config({
286
+ }), m.error("正在解析文件"), m.config({
295
287
  getContainer: void 0,
296
288
  prefixCls: "gbot-message"
297
289
  });
298
290
  return;
299
291
  }
300
- if (Ke) {
301
- u.config({
302
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
292
+ if (Be) {
293
+ m.config({
294
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
303
295
  prefixCls: "gbot-message"
304
- }), u.error("正在上传图片"), u.config({
296
+ }), m.error("正在上传图片"), m.config({
305
297
  getContainer: void 0,
306
298
  prefixCls: "gbot-message"
307
299
  });
308
300
  return;
309
301
  }
310
- he([]), ye([]);
311
- const r = (W = e == null ? void 0 : e.data) == null ? void 0 : W.id;
312
- if (!r) {
313
- if (Ce)
302
+ Z(void 0), ae("");
303
+ const l = (W = e == null ? void 0 : e.data) == null ? void 0 : W.id;
304
+ if (!l) {
305
+ if (xe)
314
306
  return;
315
- G(!0), x == null || x({
316
- netOpen: L ? Q.OPEN : Q.CLOSE
317
- }).then((C) => {
318
- var T, ce;
319
- z(!0), P(!!((T = C.data) != null && T.netOpen)), te(!!((ce = C.data) != null && ce.enableNetOpen)), ke(C).then(() => {
320
- p == null || p(C), z(!1), Ve(n);
307
+ Y(!0), x == null || x({
308
+ netOpen: E ? K.OPEN : K.CLOSE
309
+ }).then((k) => {
310
+ var F, fe;
311
+ M(!0), P(!!((F = k.data) != null && F.netOpen)), te(!!((fe = k.data) != null && fe.enableNetOpen)), we(k).then(() => {
312
+ p == null || p(k), M(!1), Ve(n);
321
313
  });
322
- }).catch((C) => {
323
- G(!1);
314
+ }).catch((k) => {
315
+ Y(!1);
324
316
  });
325
317
  return;
326
318
  }
327
- if (Ce)
319
+ if (xe)
328
320
  return;
329
- G(!0), xe(!0);
330
- const i = je(n, Z, ee[r], (o == null ? void 0 : o.type) || 0);
321
+ Y(!0), be(!0);
322
+ const o = Ae(n, re, ee[l], (i == null ? void 0 : i.type) || 0);
331
323
  let c;
332
324
  try {
333
- B ? c = yield B == null ? void 0 : B({
334
- applicationId: o.id,
335
- sessionId: r,
325
+ $ ? c = yield $ == null ? void 0 : $({
326
+ applicationId: i.id,
327
+ sessionId: l,
336
328
  message: {
337
- content: i,
338
- sessionId: r,
339
- role: Lt.User,
340
- files: ee[r]
329
+ content: o,
330
+ sessionId: l,
331
+ role: Nt.User,
332
+ files: ee[l]
341
333
  }
342
334
  }) : c = !0;
343
- } catch (C) {
335
+ } catch (k) {
344
336
  c = !1;
345
337
  }
346
- if (xe(!1), c === !1) {
347
- G(!1);
338
+ if (be(!1), c === !1) {
339
+ Y(!1);
348
340
  return;
349
341
  }
350
- let l = n;
351
- typeof c == "object" && (l = c.content || n);
352
- const E = yield (() => new Promise((C) => {
353
- le((T) => (C(T), T));
342
+ let r = n;
343
+ typeof c == "object" && (r = c.content || n);
344
+ const N = yield (() => new Promise((k) => {
345
+ de((F) => (k(F), F));
354
346
  }))();
355
- if (!(yield e.setPromptVariables(E))) {
356
- G(!1);
347
+ if (!(yield e.setPromptVariables(N))) {
348
+ Y(!1);
357
349
  return;
358
350
  }
359
- ((K = ee[r]) == null ? void 0 : K.length) > 0 ? dn(l) : De(l);
360
- }), ke = (t) => new Promise((n, s) => A(void 0, null, function* () {
361
- const c = (t == null ? void 0 : t.promptVariables).filter((l) => l.type ? !((l.type === Ne.User || l.type === void 0) && l.key === "query") && !((l.type === Ne.System || l.type === void 0) && l.key === "datetime") : l.key !== "query").map((l) => {
362
- var E;
363
- const b = (E = D.find((H) => H.key === l.key && H.type === l.type)) == null ? void 0 : E.value;
364
- return l.value = b || "", l;
351
+ ((_ = ee[l]) == null ? void 0 : _.length) > 0 ? rn(r) : De(r);
352
+ }), we = (t) => new Promise((n, a) => V(void 0, null, function* () {
353
+ const c = (t == null ? void 0 : t.promptVariables).filter((r) => r.type ? !((r.type === Ie.User || r.type === void 0) && r.key === "query") && !((r.type === Ie.System || r.type === void 0) && r.key === "datetime") : r.key !== "query").map((r) => {
354
+ var N;
355
+ const b = (N = H.find((R) => R.key === r.key && R.type === r.type)) == null ? void 0 : N.value;
356
+ return r.value = b || "", r;
365
357
  });
366
- le(c.sort((l, b) => l.key.localeCompare(b.key))), yield t == null ? void 0 : t.setPromptVariables(c).catch((l) => {
367
- console.error(l), u.config({
368
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
358
+ de(c.sort((r, b) => r.key.localeCompare(b.key))), yield t == null ? void 0 : t.setPromptVariables(c).catch((r) => {
359
+ console.error(r), m.config({
360
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
369
361
  prefixCls: "gbot-message"
370
- }), u.error(l.message), u.config({
362
+ }), m.error(r.message), m.config({
371
363
  getContainer: void 0,
372
364
  prefixCls: "gbot-message"
373
365
  });
374
366
  }), n();
375
- })), dn = (t) => {
376
- var i, c, l;
377
- if (be(!1), !((i = e == null ? void 0 : e.data) != null && i.id) || !(o != null && o.id))
367
+ })), rn = (t) => {
368
+ var o, c, r;
369
+ if (ve(!1), !((o = e == null ? void 0 : e.data) != null && o.id) || !(i != null && i.id))
378
370
  return;
379
371
  const n = ((c = e.data) == null ? void 0 : c.id) || "";
380
- let s = [], r = /* @__PURE__ */ new Set();
381
- (l = ee[n]) == null || l.forEach((b) => {
382
- r.has(b.id) || (s.push(b), r.add(b.id));
383
- }), be(!0), De(t, s);
372
+ let a = [], l = /* @__PURE__ */ new Set();
373
+ (r = ee[n]) == null || r.forEach((b) => {
374
+ l.has(b.id) || (a.push(b), l.add(b.id));
375
+ }), ve(!0), De(t, a);
384
376
  };
385
- k(() => {
386
- if (!Le || !e)
377
+ L(() => {
378
+ if (!Ne || !e)
387
379
  return;
388
- const t = Le, n = () => A(void 0, null, function* () {
389
- xe(!0);
390
- const s = je(t, Z, ee[e.id], (o == null ? void 0 : o.type) || 0);
391
- let r;
380
+ const t = Ne, n = () => V(void 0, null, function* () {
381
+ be(!0);
382
+ const a = Ae(t, re, ee[e.id], (i == null ? void 0 : i.type) || 0);
383
+ let l;
392
384
  try {
393
- B ? r = yield B == null ? void 0 : B({
394
- applicationId: o.id,
385
+ $ ? l = yield $ == null ? void 0 : $({
386
+ applicationId: i.id,
395
387
  sessionId: e.id,
396
388
  message: {
397
- content: s,
389
+ content: a,
398
390
  sessionId: e.id,
399
- role: Lt.User,
391
+ role: Nt.User,
400
392
  files: ee[e.id]
401
393
  }
402
- }) : r = !0;
403
- } catch (i) {
404
- r = !1;
394
+ }) : l = !0;
395
+ } catch (o) {
396
+ l = !1;
405
397
  }
406
- if (xe(!1), r === !1) {
407
- G(!1);
398
+ if (be(!1), l === !1) {
399
+ Y(!1);
408
400
  return;
409
401
  }
410
402
  De(t), Ve(void 0);
@@ -412,332 +404,325 @@ ${e}` : e;
412
404
  return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
413
405
  e == null || e.removeEventListener("ready", n);
414
406
  };
415
- }, [Le, e]);
416
- const De = (t, n) => A(void 0, null, function* () {
417
- var W, K, C;
418
- const s = (W = e == null ? void 0 : e.data) == null ? void 0 : W.id;
419
- if (!s)
407
+ }, [Ne, e]);
408
+ const De = (t, n) => V(void 0, null, function* () {
409
+ var W, _, k;
410
+ const a = (W = e == null ? void 0 : e.data) == null ? void 0 : W.id;
411
+ if (!a)
420
412
  return;
421
- _(!0), j(!0);
422
- const r = je(t, Z, n, (o == null ? void 0 : o.type) || 0);
423
- let i;
424
- if (o.type === re.Agent)
425
- i = void 0;
426
- else if (o.type === re.Dialog && ((K = o.arrange) != null && K.length) && o.arrange[0].visionOpen) {
427
- const T = Z && Z.length ? Z.filter(Boolean) : [];
428
- i = T.length ? T : void 0;
429
- } else
430
- i = void 0;
431
- const c = new ge(
432
- r,
433
- s,
434
- se.User,
413
+ q(!0), A(!0);
414
+ const l = Ae(t, re, n, (i == null ? void 0 : i.type) || 0);
415
+ let o;
416
+ i.type === oe.Agent ? o = void 0 : i.type === oe.Dialog && ((_ = i.arrange) != null && _.length) && i.arrange[0].visionOpen ? o = re ? [re] : void 0 : o = void 0;
417
+ const c = new me(
418
+ l,
419
+ a,
420
+ ie.User,
435
421
  n,
436
- i
422
+ o
437
423
  // 新增:传入图片内容
438
424
  );
439
- fe(void 0), S(void 0), y.current = [c, ...v], I(y.current), o.id && ue && ue({
440
- applicationId: o.id,
441
- sessionId: s,
425
+ ue(void 0), S(void 0), y.current = [c, ...v], C(y.current), i.id && he && he({
426
+ applicationId: i.id,
427
+ sessionId: a,
442
428
  message: c
443
429
  });
444
- const l = new ge("", s, se.System);
445
- l.isWaiting = !0, y.current = [l, ...y.current], I(y.current);
446
- const b = (n == null ? void 0 : n.map((T) => T.id)) || [], E = {
447
- stream: jn.stream,
430
+ const r = new me("", a, ie.System);
431
+ r.isWaiting = !0, y.current = [r, ...y.current], C(y.current);
432
+ const b = (n == null ? void 0 : n.map((F) => F.id)) || [], N = {
433
+ stream: Rn.stream,
448
434
  referenceFirst: !1
449
435
  };
450
- if (f != null && f.promptVariables) {
451
- const T = D == null ? void 0 : D.reduce((ce, It) => (ce[It.key] = It.value, ce), {});
452
- E.formatValues = T;
436
+ if (g != null && g.promptVariables) {
437
+ const F = H == null ? void 0 : H.reduce((fe, wt) => (fe[wt.key] = wt.value, fe), {});
438
+ N.formatValues = F;
453
439
  }
454
- if (f != null && f.knowledges) {
455
- const T = tn;
456
- E.knowledges = T;
440
+ if (g != null && g.knowledges) {
441
+ const F = Jt;
442
+ N.knowledges = F;
457
443
  }
458
- const H = {
459
- text: r,
444
+ const R = {
445
+ text: l,
460
446
  fileIds: b,
461
447
  files: n
462
448
  };
463
- i && i.length > 0 && (H.imageContent = i), yield e.send(H, E), ae({
464
- [s]: []
465
- }), (C = ve.current) == null || C.update(), he([]), ye([]), G(!1);
449
+ o && o.length > 0 && (R.imageContent = o), yield e.send(R, N), le({
450
+ [a]: []
451
+ }), (k = pe.current) == null || k.update(), Y(!1);
466
452
  });
467
- k(() => {
468
- var r;
469
- const t = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
453
+ L(() => {
454
+ var l;
455
+ const t = (l = e == null ? void 0 : e.data) == null ? void 0 : l.id;
470
456
  if (!t)
471
457
  return;
472
- const n = (i) => {
473
- if (!i.sessionId || i.sessionId && i.sessionId !== _e.current || i.role === se.User)
458
+ const n = (o) => {
459
+ if (!o.sessionId || o.sessionId && o.sessionId !== qe.current || o.role === ie.User)
474
460
  return;
475
- if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (j(!1), _(!1), y.current = y.current.filter((b) => !b.isWaiting), I([...y.current]), y.current = [...y.current], i.content)) {
476
- ie.config({
477
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
461
+ if (o.index === -1 && o.code !== 200 && o.code !== 11915 && (A(!1), q(!1), y.current = y.current.filter((b) => !b.isWaiting), C([...y.current]), y.current = [...y.current], o.content)) {
462
+ ne.config({
463
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
478
464
  prefixCls: "gbot-notification"
479
- }), ie.error({
480
- message: i.content
481
- }), ie.config({
465
+ }), ne.error({
466
+ message: o.content
467
+ }), ne.config({
482
468
  getContainer: void 0,
483
469
  prefixCls: "gbot-notification"
484
470
  });
485
471
  return;
486
472
  }
487
- const c = i.actions || [], l = new ge(i.content, t, se.Robot);
488
- l.messageId = i.messageId || ze(), l.reasoningContent = i.reasoningContent, l.searchReference = i.searchReference, l.thinkingSecs = i.thinkingSecs, l.thinkingStatus = i.thinkingStatus, l.actions = c, l.isLoading = !0, l.searchingStatus = i.searchingStatus, y.current = y.current.filter((b) => !b.isWaiting).filter((b) => !b.isReplying), i.index === void 0 && I([l, ...y.current]), i.code === 11915 && (j(!1), _(!1), l.isLoading = !1, l.content = "请您换个问题问我吧~", l.isSensitive = !0, I([l, ...y.current])), i.index === -2 && (j(!1), _(!1), l.isLoading = !1, l.content = "回答已中止~", l.isSuspend = !0, I([l, ...y.current])), i.index === -1 && (j(!1), _(!1), l.isLoading = !1, l.reference = i.reference, I([l, ...y.current]), o.id && ue && ue({
489
- applicationId: o.id,
473
+ const c = o.actions || [], r = new me(o.content, t, ie.Robot);
474
+ r.messageId = o.messageId || Me(), r.reasoningContent = o.reasoningContent, r.searchReference = o.searchReference, r.thinkingSecs = o.thinkingSecs, r.thinkingStatus = o.thinkingStatus, r.actions = c, r.isLoading = !0, r.searchingStatus = o.searchingStatus, y.current = y.current.filter((b) => !b.isWaiting).filter((b) => !b.isReplying), o.index === void 0 && C([r, ...y.current]), o.code === 11915 && (A(!1), q(!1), r.isLoading = !1, r.content = "请您换个问题问我吧~", r.isSensitive = !0, C([r, ...y.current])), o.index === -2 && (A(!1), q(!1), r.isLoading = !1, r.content = "回答已中止~", r.isSuspend = !0, C([r, ...y.current])), o.index === -1 && (A(!1), q(!1), r.isLoading = !1, r.reference = o.reference, C([r, ...y.current]), i.id && he && he({
475
+ applicationId: i.id,
490
476
  sessionId: t,
491
- message: l
492
- })), i.index === -3 && (j(!1), _(!1), l.isLoading = !1, l.reference = i.reference, l.relatedQuesion = i.relatedQuesion, I([l, ...y.current]));
493
- }, s = () => {
477
+ message: r
478
+ })), o.index === -3 && (A(!1), q(!1), r.isLoading = !1, r.reference = o.reference, r.relatedQuesion = o.relatedQuesion, C([r, ...y.current]));
479
+ }, a = () => {
494
480
  e.addEventListener("message:updated", n);
495
481
  };
496
- return e.ready ? e.addEventListener("message:updated", n) : e.addEventListener("ready", s), () => {
497
- e == null || e.removeEventListener("message:updated", n), e == null || e.removeEventListener("ready", s);
482
+ return e.ready ? e.addEventListener("message:updated", n) : e.addEventListener("ready", a), () => {
483
+ e == null || e.removeEventListener("message:updated", n), e == null || e.removeEventListener("ready", a);
498
484
  };
499
- }, [e]), k(() => {
485
+ }, [e]), L(() => {
500
486
  if (!e) {
501
- Te(!1);
487
+ Ee(!1);
502
488
  return;
503
489
  }
504
490
  const t = (n) => {
505
- Te(n);
491
+ Ee(n);
506
492
  };
507
- return Te(e.frozen), e.addEventListener("frozen", t), () => {
493
+ return Ee(e.frozen), e.addEventListener("frozen", t), () => {
508
494
  e == null || e.removeEventListener("frozen", t);
509
495
  };
510
- }, [e]), k(() => {
511
- if (!N)
496
+ }, [e]), L(() => {
497
+ if (!I)
512
498
  return;
513
- const t = N.questionContextMaxLength || 4e3;
514
- $t(t);
515
- }, [N, R]), k(() => {
516
- Pe && S(Pe.text);
517
- }, [Pe]);
518
- const cn = (t) => {
499
+ const t = I.questionContextMaxLength || 4e3;
500
+ Vt(t);
501
+ }, [I, O]), L(() => {
502
+ Le && S(Le.text);
503
+ }, [Le]);
504
+ const an = (t) => {
519
505
  const n = t.size;
520
- return n <= 0 ? (u.config({
521
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
506
+ return n <= 0 ? (m.config({
507
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
522
508
  prefixCls: "gbot-message"
523
- }), u.error("该文件为空,请重新上传"), u.config({
509
+ }), m.error("该文件为空,请重新上传"), m.config({
524
510
  getContainer: void 0,
525
511
  prefixCls: "gbot-message"
526
- }), !1) : n > 20 * zn ? (u.config({
527
- getContainer: () => (g == null ? void 0 : g.current) || document.body,
512
+ }), !1) : n > 20 * Fn ? (m.config({
513
+ getContainer: () => (f == null ? void 0 : f.current) || document.body,
528
514
  prefixCls: "gbot-message"
529
- }), u.error("图片须小于20M"), u.config({
515
+ }), m.error("图片须小于20M"), m.config({
530
516
  getContainer: void 0,
531
517
  prefixCls: "gbot-message"
532
- }), !1) : (he((s) => s.length >= Ee ? s : [...s, t]), !1);
533
- }, gn = () => A(void 0, null, function* () {
534
- var t;
535
- return (t = e == null ? void 0 : e.data) != null && t.id ? e : (ne.current || (ne.current = new Promise((n, s) => {
536
- z(!0), x == null || x({
537
- netOpen: L ? Q.OPEN : Q.CLOSE
538
- }).then((r) => {
539
- var i, c;
540
- p == null || p(r), z(!1), P(!!((i = r.data) != null && i.netOpen)), te(!!((c = r.data) != null && c.enableNetOpen)), ke(r), n(r);
541
- }).catch((r) => {
542
- ne.current = null, s(r);
518
+ }), !1) : (Z(t), !1);
519
+ }, ln = (t) => V(void 0, null, function* () {
520
+ var n;
521
+ return Z(t), (n = e == null ? void 0 : e.data) != null && n.id ? ot(e, t) : new Promise((a) => {
522
+ M(!0), x == null || x({
523
+ netOpen: E ? K.OPEN : K.CLOSE
524
+ }).then((l) => {
525
+ var o, c;
526
+ p == null || p(l), M(!1), P(!!((o = l.data) != null && o.netOpen)), te(!!((c = l.data) != null && c.enableNetOpen)), we(l), a(ot(l, t));
543
527
  });
544
- })), ne.current);
545
- }), fn = (t) => A(void 0, null, function* () {
546
- const n = yield gn();
547
- return un(n, t);
548
- }), un = (t, n) => {
549
- const s = Bn(n.name);
550
- return new Promise((r) => {
528
+ });
529
+ }), ot = (t, n) => {
530
+ const a = An(n.name);
531
+ return new Promise((l) => {
551
532
  var c;
552
- const i = {
553
- files: [`${ze()}.${s}`],
533
+ const o = {
534
+ files: [`${Me()}.${a}`],
554
535
  isv: "minio",
555
536
  knowledgeId: ((c = t.data) == null ? void 0 : c.id) || "",
556
537
  type: 1
557
538
  };
558
- R == null || R.postTicket(i).then((l) => {
559
- R.uploadMinioFile(l.minio, n).then(() => {
560
- var W, K;
561
- const b = (W = l.minio.endpoints) == null ? void 0 : W[0], E = l.minio.bucket, H = (K = l.minio.fileKeys) == null ? void 0 : K[0];
562
- r(`${location.protocol}//${b}/${E}/${H}`);
539
+ Pe(!0), O == null || O.postTicket(o).then((r) => {
540
+ O.uploadMinioFile(r.minio, n).then(() => {
541
+ var W, _;
542
+ const b = (W = r.minio.endpoints) == null ? void 0 : W[0], N = r.minio.bucket, R = (_ = r.minio.fileKeys) == null ? void 0 : _[0];
543
+ l(`${location.protocol}//${b}/${N}/${R}`);
563
544
  }).catch(() => {
545
+ ae(""), Z(void 0);
546
+ }).finally(() => {
547
+ Pe(!1);
564
548
  });
565
549
  }).catch(() => {
550
+ ae(""), Z(void 0), Pe(!1);
566
551
  });
567
552
  });
568
553
  };
569
- k(() => {
570
- const t = O.current;
571
- t && !Se && t.scrollTo({
554
+ L(() => {
555
+ const t = T.current;
556
+ t && !Xe && t.scrollTo({
572
557
  top: t.scrollHeight
573
558
  });
574
559
  }, [v]);
575
- const at = (t, n) => new Promise((s) => {
576
- if (!n.file.url || !(o != null && o.id))
577
- return s();
578
- const r = Fe(Ae({}, n.file), {
560
+ const st = (t, n) => new Promise((a) => {
561
+ if (!n.file.url || !(i != null && i.id))
562
+ return a();
563
+ const l = Ue(Fe({}, n.file), {
579
564
  type: 1
580
565
  });
581
- R == null || R.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, r).finally(() => {
582
- var i;
583
- (i = ve.current) == null || i.update().finally(s);
566
+ O == null || O.postApplicationIdSessionKnowledgeSessionFile(i == null ? void 0 : i.id, t, l).finally(() => {
567
+ var o;
568
+ (o = pe.current) == null || o.update().finally(a);
584
569
  });
585
- }), mn = () => {
570
+ }), dn = () => {
586
571
  var t;
587
- (t = e == null ? void 0 : e.data) != null && t.id && (j(!1), e.suspend());
588
- }, hn = (t) => {
589
- const n = O.current;
572
+ (t = e == null ? void 0 : e.data) != null && t.id && (A(!1), e.suspend());
573
+ }, cn = (t) => {
574
+ const n = T.current;
590
575
  n && setTimeout(() => {
591
576
  n.scrollTo({
592
577
  top: n.scrollHeight,
593
578
  behavior: t == null ? void 0 : t.behavior
594
579
  });
595
580
  }, t == null ? void 0 : t.ms);
596
- }, yn = () => {
597
- if (!O.current)
581
+ }, fn = () => {
582
+ if (!T.current)
598
583
  return;
599
- const t = O.current.scrollTop <= -80;
600
- en(t);
601
- }, pn = Me((t) => {
602
- var n, s;
603
- (n = pe.current) == null || n.update(t), (s = pe.current) == null || s.focus();
604
- }), vn = Me((t) => {
605
- rt(t);
606
- }), bn = Me(() => {
584
+ const t = T.current.scrollTop <= -80;
585
+ Zt(t);
586
+ }, gn = je((t) => {
587
+ var n, a;
588
+ (n = ye.current) == null || n.update(t), (a = ye.current) == null || a.focus();
589
+ }), mn = je((t) => {
590
+ it(t);
591
+ }), un = je(() => {
607
592
  var n;
608
593
  if (!((n = e == null ? void 0 : e.data) != null && n.id))
609
594
  return;
610
- y.current = [...v.slice(1, v.length)], I(y.current);
611
- const t = new ge("", e.data.id, se.System);
612
- t.isWaiting = !0, y.current = [t, ...y.current], I(y.current), _(!0), j(!0), e.answerAgain();
595
+ y.current = [...v.slice(1, v.length)], C(y.current);
596
+ const t = new me("", e.data.id, ie.System);
597
+ t.isWaiting = !0, y.current = [t, ...y.current], C(y.current), q(!0), A(!0), e.answerAgain();
613
598
  });
614
- k(() => {
599
+ L(() => {
615
600
  var t, n;
616
- _e.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !et && ((n = Oe.current) == null || n.clear());
601
+ qe.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Ze && ((n = Te.current) == null || n.clear());
617
602
  }, [e]);
618
- const xn = () => {
619
- var s;
620
- if (!((s = e == null ? void 0 : e.data) != null && s.id))
603
+ const hn = () => {
604
+ var a;
605
+ if (!((a = e == null ? void 0 : e.data) != null && a.id))
621
606
  return;
622
607
  const n = v[v.length - 1].messageTime;
623
608
  e.fetchMessages({
624
609
  endTime: n,
625
- pageSize: Ot
626
- }).then((r) => {
627
- const i = r || [];
628
- if (!i || !(i != null && i.length)) {
629
- de(!1);
610
+ pageSize: Pt
611
+ }).then((l) => {
612
+ const o = l || [];
613
+ if (!o || !(o != null && o.length)) {
614
+ ce(!1);
630
615
  return;
631
616
  }
632
- i.length < 10 ? de(!1) : de(!0), I([...v, ...i.reverse()]);
617
+ o.length < 10 ? ce(!1) : ce(!0), C([...v, ...o.reverse()]);
633
618
  });
634
- }, Cn = (t) => A(void 0, null, function* () {
635
- var n, s;
619
+ }, yn = (t) => V(void 0, null, function* () {
620
+ var n, a;
636
621
  if (!((n = e == null ? void 0 : e.data) != null && n.id))
637
622
  P(t);
638
623
  else {
639
- if (yield e.setNetOpen(t), !((s = e.data) != null && s.id))
624
+ if (yield e.setNetOpen(t), !((a = e.data) != null && a.id))
640
625
  return;
641
626
  P(t);
642
627
  }
643
- }), He = () => A(void 0, null, function* () {
628
+ }), He = () => V(void 0, null, function* () {
644
629
  e ? e.fetchData().then((t) => {
645
630
  var n;
646
631
  (n = e == null ? void 0 : e.data) != null && n.id && (P(t.netOpen), te(t.enableNetOpen));
647
- }) : (P(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), te(o.arrange[0].enableNetOpen));
632
+ }) : (P(typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.default) == "boolean" ? s.connectNetwork.default : !1), te(i.arrange[0].enableNetOpen));
648
633
  });
649
- k(() => {
634
+ L(() => {
650
635
  He();
651
- }, [e]), k(() => {
636
+ }, [e]), L(() => {
652
637
  requestAnimationFrame(() => {
653
- var n, s;
654
- if (O.current) {
655
- const r = document.getElementById("chat-main"), i = (n = O.current) == null ? void 0 : n.querySelector(".infinite-scroll-component__outerdiv"), c = (s = O.current) == null ? void 0 : s.querySelector(".infinite-scroll-component");
656
- if (!i || !c || !r)
638
+ var n, a;
639
+ if (T.current) {
640
+ const l = document.getElementById("chat-main"), o = (n = T.current) == null ? void 0 : n.querySelector(".infinite-scroll-component__outerdiv"), c = (a = T.current) == null ? void 0 : a.querySelector(".infinite-scroll-component");
641
+ if (!o || !c || !l)
657
642
  return;
658
- const l = r.offsetHeight;
659
- if (c.offsetHeight <= l) {
660
- if (i.style.height === "100%")
643
+ const r = l.offsetHeight;
644
+ if (c.offsetHeight <= r) {
645
+ if (o.style.height === "100%")
661
646
  return;
662
- i.style.height = "100%";
647
+ o.style.height = "100%";
663
648
  } else {
664
- if (i.style.height === "auto")
649
+ if (o.style.height === "auto")
665
650
  return;
666
- i.style.height = "auto";
651
+ o.style.height = "auto";
667
652
  }
668
653
  }
669
654
  });
670
- }, [v]), k(() => {
655
+ }, [v]), L(() => {
671
656
  if (e)
672
657
  return;
673
658
  const t = () => {
674
- const r = ((N == null ? void 0 : N.promptVariables) || []).filter((i) => i.type ? !(i.type === Ne.User && i.key === "query") && !(i.type === Ne.System && i.key === "datetime") && i.status === 1 : i.key !== "query" && i.status === 1).map((i, c) => {
675
- var b, E;
676
- let l = "";
677
- return typeof (a == null ? void 0 : a.promptVariables) == "object" && (l = ((E = (b = a.promptVariables.default) == null ? void 0 : b.find((H) => H.key === i.key && H.type === i.type)) == null ? void 0 : E.value) || ""), {
659
+ const l = ((I == null ? void 0 : I.promptVariables) || []).filter((o) => o.type ? !(o.type === Ie.User && o.key === "query") && !(o.type === Ie.System && o.key === "datetime") && o.status === 1 : o.key !== "query" && o.status === 1).map((o, c) => {
660
+ var b, N;
661
+ let r = "";
662
+ return typeof (s == null ? void 0 : s.promptVariables) == "object" && (r = ((N = (b = s.promptVariables.default) == null ? void 0 : b.find((R) => R.key === o.key && R.type === o.type)) == null ? void 0 : N.value) || ""), {
678
663
  id: c + "",
679
- key: i.key,
680
- name: i.name,
681
- value: l,
682
- type: i.type
664
+ key: o.key,
665
+ name: o.name,
666
+ value: r,
667
+ type: o.type
683
668
  };
684
669
  });
685
- le([...r].sort((i, c) => i.key.localeCompare(c.key)));
670
+ de([...l].sort((o, c) => o.key.localeCompare(c.key)));
686
671
  };
687
- return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
688
- N == null || N.removeEventListener("ready", t);
672
+ return I != null && I.ready ? t() : I == null || I.addEventListener("ready", t), () => {
673
+ I == null || I.removeEventListener("ready", t);
689
674
  };
690
- }, [e, N, a == null ? void 0 : a.promptVariables]);
691
- const lt = () => x == null ? void 0 : x({
692
- netOpen: L ? Q.OPEN : Q.CLOSE
675
+ }, [e, I, s == null ? void 0 : s.promptVariables]);
676
+ const rt = () => x == null ? void 0 : x({
677
+ netOpen: E ? K.OPEN : K.CLOSE
693
678
  }).then((t) => {
694
- var n, s;
695
- return p == null || p(t), z(!1), P(!!((n = t.data) != null && n.netOpen)), te(!!((s = t.data) != null && s.enableNetOpen)), ke(t), t;
696
- }), dt = Rn(() => {
679
+ var n, a;
680
+ return p == null || p(t), M(!1), P(!!((n = t.data) != null && n.netOpen)), te(!!((a = t.data) != null && a.enableNetOpen)), we(t), t;
681
+ }), at = Ln(() => {
697
682
  var t;
698
- return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ d(Rt, {
699
- application: o,
683
+ return i.arrange && ((t = i.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ d(Tt, {
684
+ application: i,
700
685
  history: {
701
686
  role: 1,
702
- content: o.arrange[0].openingContent,
687
+ content: i.arrange[0].openingContent,
703
688
  code: 200,
704
689
  messageId: "opening-message",
705
690
  sessionId: "",
706
691
  reference: [],
707
692
  searchReference: [],
708
- messageTime: Dt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
693
+ messageTime: Ot(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
709
694
  actions: [],
710
695
  isLoading: !1
711
696
  },
712
697
  actions: !!v.length,
713
- markdown: a == null ? void 0 : a.markdown
698
+ markdown: s == null ? void 0 : s.markdown
714
699
  }) : null;
715
- }, [o == null ? void 0 : o.arrange, v]);
716
- return Dn(h, () => ({
700
+ }, [i == null ? void 0 : i.arrange, v]);
701
+ return En(h, () => ({
717
702
  getCurrentInputText: () => {
718
703
  var t;
719
- return (t = pe.current) == null ? void 0 : t.getCurrentText();
704
+ return (t = ye.current) == null ? void 0 : t.getCurrentText();
720
705
  }
721
- })), k(() => {
706
+ })), L(() => {
722
707
  var n;
723
708
  const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
724
- t && ae((s) => Fe(Ae({}, s), {
709
+ t && le((a) => Ue(Fe({}, a), {
725
710
  [t]: []
726
711
  }));
727
- }, [(ct = e == null ? void 0 : e.data) == null ? void 0 : ct.id]), /* @__PURE__ */ V("div", {
712
+ }, [(lt = e == null ? void 0 : e.data) == null ? void 0 : lt.id]), /* @__PURE__ */ z("div", {
728
713
  className: "agent-chat",
729
- children: [sn ? /* @__PURE__ */ d("div", {
714
+ children: [tn ? /* @__PURE__ */ d("div", {
730
715
  className: "session-loading",
731
- children: /* @__PURE__ */ d(Et, {})
732
- }) : /* @__PURE__ */ V(Ln, {
733
- children: [(f == null ? void 0 : f.promptVariables) && /* @__PURE__ */ d(Xn, {
734
- ref: Xe,
735
- appId: o.id,
716
+ children: /* @__PURE__ */ d(It, {})
717
+ }) : /* @__PURE__ */ z(wn, {
718
+ children: [(g == null ? void 0 : g.promptVariables) && /* @__PURE__ */ d(Kn, {
719
+ ref: Ye,
720
+ appId: i.id,
736
721
  currentSession: e,
737
- promptVariables: D,
738
- setPromptVariables: le,
722
+ promptVariables: H,
723
+ setPromptVariables: de,
739
724
  setCurrentSession: p
740
- }), /* @__PURE__ */ V("div", {
725
+ }), /* @__PURE__ */ z("div", {
741
726
  className: "chat-main",
742
727
  id: "chat-main",
743
728
  style: Ft,
@@ -750,111 +735,111 @@ ${e}` : e;
750
735
  display: "flex",
751
736
  flexDirection: "column-reverse"
752
737
  },
753
- ref: O,
754
- onScroll: yn,
755
- children: (gt = e == null ? void 0 : e.data) != null && gt.id && (v != null && v.length) ? /* @__PURE__ */ V(Sn, {
738
+ ref: T,
739
+ onScroll: fn,
740
+ children: (dt = e == null ? void 0 : e.data) != null && dt.id && (v != null && v.length) ? /* @__PURE__ */ z(Gn, {
756
741
  dataLength: v.length,
757
- next: xn,
742
+ next: hn,
758
743
  style: {
759
744
  display: "flex",
760
745
  flexDirection: "column-reverse",
761
746
  overflowX: "hidden"
762
747
  },
763
748
  inverse: !0,
764
- endMessage: v.length > Ot && // 少于一页不展示这个提示
765
- ((ft = O.current) != null && ft.scrollTop) && ((ut = O.current) == null ? void 0 : ut.scrollTop) < -10 ? /* @__PURE__ */ d(Hn, {
749
+ endMessage: v.length > Pt && // 少于一页不展示这个提示
750
+ ((ct = T.current) != null && ct.scrollTop) && ((ft = T.current) == null ? void 0 : ft.scrollTop) < -10 ? /* @__PURE__ */ d(Pn, {
766
751
  plain: !0,
767
752
  children: "没有更多数据了"
768
753
  }) : null,
769
- hasMore: tt,
754
+ hasMore: Je,
770
755
  loader: /* @__PURE__ */ d("div", {
771
756
  style: {
772
757
  height: "50px",
773
758
  textAlign: "center",
774
759
  overflow: "hidden"
775
760
  },
776
- children: /* @__PURE__ */ d(Et, {})
761
+ children: /* @__PURE__ */ d(It, {})
777
762
  }),
778
763
  scrollableTarget: "scrollableDiv",
779
- children: [v.map((t, n) => /* @__PURE__ */ d(oi, {
780
- application: o,
764
+ children: [v.map((t, n) => /* @__PURE__ */ d(ei, {
765
+ application: i,
781
766
  currentSession: e,
782
767
  history: t,
783
- docViewerUrl: M,
768
+ docViewerUrl: j,
784
769
  isLastHistory: n === 0,
785
- onRelatedClick: vn,
786
- onAgainClick: bn,
787
- onEditClick: pn,
788
- markdown: a == null ? void 0 : a.markdown
789
- }, t.messageId + n)), !tt && dt]
790
- }) : /* @__PURE__ */ V("div", {
770
+ onRelatedClick: mn,
771
+ onAgainClick: un,
772
+ onEditClick: gn,
773
+ markdown: s == null ? void 0 : s.markdown
774
+ }, t.messageId + n)), !Je && at]
775
+ }) : /* @__PURE__ */ z("div", {
791
776
  className: "main-empty",
792
- children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ d(Wn, {
777
+ children: [(s == null ? void 0 : s.greeting) !== !1 && /* @__PURE__ */ d(zn, {
793
778
  text: (
794
779
  // 第一优先级:features配置
795
- a != null && a.greeting && typeof a.greeting == "object" && a.greeting.text !== void 0 ? a.greeting.text : (
780
+ s != null && s.greeting && typeof s.greeting == "object" && s.greeting.text !== void 0 ? s.greeting.text : (
796
781
  // 第二优先级:application.arrange[0].greetings
797
- (mt = o.arrange) != null && mt.length && ((ht = o.arrange[0]) != null && ht.greetings) ? o.arrange[0].greetings : (
782
+ (gt = i.arrange) != null && gt.length && ((mt = i.arrange[0]) != null && mt.greetings) ? i.arrange[0].greetings : (
798
783
  // 第三优先级:默认文本
799
- Tt.text
784
+ Et.text
800
785
  )
801
786
  )
802
787
  ),
803
- icon: a === void 0 || a.greeting === !0 || ((yt = a.greeting) == null ? void 0 : yt.icon) === void 0 ? Mt || Tt.icon : a.greeting.icon,
804
- children: !!Ye.length && (((a == null ? void 0 : a.greeting) === void 0 || (a == null ? void 0 : a.greeting)) === !0 || typeof (a == null ? void 0 : a.greeting) == "object" && a.greeting.questions !== !1) && /* @__PURE__ */ d(qn, {
805
- ref: Oe,
806
- sid: (pt = e == null ? void 0 : e.data) == null ? void 0 : pt.id,
807
- isRecommendClearing: Qe,
808
- data: Ye,
809
- layoutBreakpoints: typeof (a == null ? void 0 : a.greeting) == "object" ? a.greeting.layoutBreakpoints : void 0,
788
+ icon: s === void 0 || s.greeting === !0 || ((ut = s.greeting) == null ? void 0 : ut.icon) === void 0 ? Ut || Et.icon : s.greeting.icon,
789
+ children: !!We.length && (((s == null ? void 0 : s.greeting) === void 0 || (s == null ? void 0 : s.greeting)) === !0 || typeof (s == null ? void 0 : s.greeting) == "object" && s.greeting.questions !== !1) && /* @__PURE__ */ d(Vn, {
790
+ ref: Te,
791
+ sid: (ht = e == null ? void 0 : e.data) == null ? void 0 : ht.id,
792
+ isRecommendClearing: _e,
793
+ data: We,
794
+ layoutBreakpoints: typeof (s == null ? void 0 : s.greeting) == "object" ? s.greeting.layoutBreakpoints : void 0,
810
795
  onItemClick: (t) => {
811
- var s, r, i;
812
- if (fe(t == null ? void 0 : t.question), S(t == null ? void 0 : t.question), Qe)
796
+ var a, l, o;
797
+ if (ue(t == null ? void 0 : t.question), S(t == null ? void 0 : t.question), _e)
813
798
  return;
814
799
  t != null && t.id && J(!0);
815
- const n = (s = e == null ? void 0 : e.data) == null ? void 0 : s.id;
816
- f != null && f.fileUpload ? (i = (r = ve.current) == null ? void 0 : r.clear()) == null || i.then(() => {
817
- var c, l;
818
- t != null && t.id && (n ? (c = at(n, t)) == null || c.finally(() => {
800
+ const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
801
+ g != null && g.fileUpload ? (o = (l = pe.current) == null ? void 0 : l.clear()) == null || o.then(() => {
802
+ var c, r;
803
+ t != null && t.id && (n ? (c = st(n, t)) == null || c.finally(() => {
819
804
  J(!1);
820
- }) : (J(!1), z(!0), (l = lt()) == null || l.then((b) => {
821
- var E;
822
- (E = at(b.id, t)) == null || E.finally(() => {
805
+ }) : (J(!1), M(!0), (r = rt()) == null || r.then((b) => {
806
+ var N;
807
+ (N = st(b.id, t)) == null || N.finally(() => {
823
808
  J(!1);
824
809
  });
825
810
  })));
826
- }) : n ? J(!1) : (J(!1), z(!0), lt());
811
+ }) : n ? J(!1) : (J(!1), M(!0), rt());
827
812
  }
828
813
  })
829
- }), dt]
814
+ }), at]
830
815
  })
831
- }), Je && /* @__PURE__ */ d("div", {
816
+ }), Ge && /* @__PURE__ */ d("div", {
832
817
  className: "session-stop",
833
- children: /* @__PURE__ */ d(X, {
818
+ children: /* @__PURE__ */ d(G, {
834
819
  type: "primary",
835
820
  style: {
836
821
  background: "white"
837
822
  },
838
823
  ghost: !0,
839
824
  size: "small",
840
- icon: /* @__PURE__ */ d(oe, {
825
+ icon: /* @__PURE__ */ d(ge, {
841
826
  type: "icon-zantinghuida",
842
827
  style: {
843
828
  fontSize: 16
844
829
  }
845
830
  }),
846
- onClick: () => mn(),
831
+ onClick: () => dn(),
847
832
  children: "停止回答"
848
833
  })
849
- }), Se && (v == null ? void 0 : v.length) > 0 && /* @__PURE__ */ d("div", {
834
+ }), Xe && (v == null ? void 0 : v.length) > 0 && /* @__PURE__ */ d("div", {
850
835
  className: "back-bottom",
851
- children: /* @__PURE__ */ d(X, {
836
+ children: /* @__PURE__ */ d(G, {
852
837
  size: "small",
853
- onClick: () => hn({
838
+ onClick: () => cn({
854
839
  behavior: "smooth"
855
840
  }),
856
841
  type: "link",
857
- icon: /* @__PURE__ */ d(oe, {
842
+ icon: /* @__PURE__ */ d(ge, {
858
843
  type: "icon-yijianhuidaodibu",
859
844
  style: {
860
845
  fontSize: 24
@@ -864,53 +849,53 @@ ${e}` : e;
864
849
  })]
865
850
  }), /* @__PURE__ */ d("div", {
866
851
  className: "chat-footer",
867
- children: /* @__PURE__ */ V("div", {
852
+ children: /* @__PURE__ */ z("div", {
868
853
  className: "chat-footer-input",
869
- children: [me.length > 0 && /* @__PURE__ */ d("div", {
854
+ children: [se && /* @__PURE__ */ d("div", {
870
855
  className: "input-files",
871
- children: me.map((t, n) => /* @__PURE__ */ d(Vn, {
872
- className: "thumb-40",
873
- file: t,
856
+ children: /* @__PURE__ */ d(Un, {
857
+ file: se,
874
858
  actions: {
875
- upload: (s) => A(void 0, null, function* () {
876
- We((r) => r + 1);
877
- try {
878
- return yield fn(s);
879
- } finally {
880
- We((r) => Math.max(0, r - 1));
881
- }
882
- }),
859
+ upload: ln,
883
860
  remove: () => {
884
- he((s) => s.filter((r, i) => i !== n)), ye((s) => s.filter((r, i) => i !== n));
861
+ ae(""), Z(void 0);
885
862
  }
886
863
  },
887
- onUrlChange: (s) => {
888
- ye((r) => {
889
- const i = [...r];
890
- return i[n] = s, i;
891
- });
892
- }
893
- }, n))
894
- }), /* @__PURE__ */ V(Ie, {
864
+ onUrlChange: (t) => ae(t)
865
+ })
866
+ }), /* @__PURE__ */ z(Ce, {
895
867
  className: "footer-upload-action",
896
868
  onClick: (t) => t.preventDefault(),
897
- children: [/* @__PURE__ */ V(Ie, {
898
- children: [(o.type === re.Agent && (f == null ? void 0 : f.imageUpload) || o.type === re.Dialog && ((vt = o.arrange) == null ? void 0 : vt.length) && !!o.arrange[0].visionOpen && (f == null ? void 0 : f.imageUpload)) && /* @__PURE__ */ d(Un, {
899
- multiple: !0,
900
- disabled: me.length >= Ee || F,
869
+ children: [/* @__PURE__ */ z(Ce, {
870
+ children: [(i.type === oe.Agent && (g == null ? void 0 : g.imageUpload) || i.type === oe.Dialog && ((yt = i.arrange) == null ? void 0 : yt.length) && !!i.arrange[0].visionOpen && (g == null ? void 0 : g.imageUpload)) && /* @__PURE__ */ d(Tn, {
871
+ disabled: !!se || D,
901
872
  accept: ".jpg, .png, .jpeg,.bmp",
902
873
  listType: "picture-card",
903
- beforeUpload: cn,
874
+ beforeUpload: an,
904
875
  className: "footer-upload-picture",
905
876
  showUploadList: !1,
906
- children: me.length < Ee ? /* @__PURE__ */ d(An, {
877
+ children: se ? /* @__PURE__ */ d(G, {
878
+ type: "text",
879
+ className: "camera-out-btn",
880
+ style: {
881
+ width: "22px",
882
+ position: "relative",
883
+ bottom: "-2px"
884
+ },
885
+ disabled: !!se || D,
886
+ icon: /* @__PURE__ */ d(qn, {
887
+ className: "icon-tianjia",
888
+ style: {
889
+ fontSize: "22px"
890
+ }
891
+ })
892
+ }) : /* @__PURE__ */ d(On, {
907
893
  placement: "topLeft",
908
894
  overlayClassName: "footer-upload-tooltip",
909
895
  title: /* @__PURE__ */ d("div", {
910
- children: `支持上传.jpg .png .jpeg
911
- .bmp格式的图片数据,单文件最大20M,最多${Ee}张`
896
+ children: "支持上传.jpg .png .jpeg .bmp格式的图片数据,最大20M,单次仅可上传1个"
912
897
  }),
913
- children: /* @__PURE__ */ d(X, {
898
+ children: /* @__PURE__ */ d(G, {
914
899
  type: "text",
915
900
  className: "camera-out-btn",
916
901
  style: {
@@ -918,107 +903,91 @@ ${e}` : e;
918
903
  position: "relative",
919
904
  bottom: "-2px"
920
905
  },
921
- icon: /* @__PURE__ */ d(oe, {
922
- type: "icon-shangchuantupian",
906
+ icon: /* @__PURE__ */ d(ge, {
907
+ type: "icon-Vector",
923
908
  className: "icon-tianjia",
924
909
  style: {
925
910
  fontSize: "22px"
926
911
  }
927
912
  })
928
913
  })
929
- }) : /* @__PURE__ */ d(X, {
930
- type: "text",
931
- className: "camera-out-btn",
932
- style: {
933
- width: "22px",
934
- position: "relative",
935
- bottom: "-2px"
936
- },
937
- disabled: !0,
938
- icon: /* @__PURE__ */ d(oe, {
939
- type: "icon-shangchuantupian",
940
- className: "icon-tianjia",
941
- style: {
942
- fontSize: "22px"
943
- }
944
- })
945
914
  })
946
- }), $ && (f != null && f.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ d(Qn, {
947
- appId: o == null ? void 0 : o.id,
948
- ref: ve,
949
- isFirstSession: et,
950
- docViewerUrl: M,
951
- onStatusChange: (t) => A(void 0, null, function* () {
952
- t !== "process" ? (be(!0), He()) : be(!1);
915
+ }), X && (g != null && g.fileUpload) && (i != null && i.id) ? /* @__PURE__ */ d(Wn, {
916
+ appId: i == null ? void 0 : i.id,
917
+ ref: pe,
918
+ isFirstSession: Ze,
919
+ docViewerUrl: j,
920
+ onStatusChange: (t) => V(void 0, null, function* () {
921
+ t !== "process" ? (ve(!0), He()) : ve(!1);
953
922
  }),
954
923
  createSession: () => new Promise((t) => {
955
- z(!0), x == null || x({
956
- netOpen: L ? Q.OPEN : Q.CLOSE
924
+ M(!0), x == null || x({
925
+ netOpen: E ? K.OPEN : K.CLOSE
957
926
  }).then((n) => {
958
- var r, i, c;
959
- p == null || p(n), z(!1), P(!!((r = n.data) != null && r.netOpen)), te(!!((i = n.data) != null && i.enableNetOpen)), ke(n);
960
- const s = ((c = n.data) == null ? void 0 : c.id) || "";
961
- t(s);
927
+ var l, o, c;
928
+ p == null || p(n), M(!1), P(!!((l = n.data) != null && l.netOpen)), te(!!((o = n.data) != null && o.enableNetOpen)), we(n);
929
+ const a = ((c = n.data) == null ? void 0 : c.id) || "";
930
+ t(a);
962
931
  });
963
932
  }),
964
- sid: (bt = e == null ? void 0 : e.data) == null ? void 0 : bt.id,
965
- disabled: Re || F,
933
+ sid: (pt = e == null ? void 0 : e.data) == null ? void 0 : pt.id,
934
+ disabled: Oe || D,
966
935
  afterFileAdd: (t, n) => {
967
- n && ae((s) => {
968
- const r = s[n] || [];
936
+ n && le((a) => {
937
+ const l = a[n] || [];
969
938
  return {
970
- [n]: [...r, t]
939
+ [n]: [...l, t]
971
940
  };
972
941
  });
973
942
  },
974
943
  afterFileDelete: (t) => {
975
- var s;
976
- const n = (s = e == null ? void 0 : e.data) == null ? void 0 : s.id;
977
- n && ae((r) => {
978
- const i = r[n] || [];
944
+ var a;
945
+ const n = (a = e == null ? void 0 : e.data) == null ? void 0 : a.id;
946
+ n && le((l) => {
947
+ const o = l[n] || [];
979
948
  return {
980
- [n]: i.filter((c) => c.id !== t)
949
+ [n]: o.filter((c) => c.id !== t)
981
950
  };
982
951
  });
983
952
  },
984
953
  onFileListChange: (t) => {
985
- Xt(t);
954
+ Yt(t);
986
955
  },
987
- shouldContinue: Jt,
956
+ shouldContinue: Gt,
988
957
  afterFilesClear: () => {
989
958
  var n;
990
959
  const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
991
- t && (ae({
960
+ t && (le({
992
961
  [t]: []
993
962
  }), He());
994
963
  }
995
- }) : null, (f == null ? void 0 : f.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ d(ti, {
996
- appId: o.id,
964
+ }) : null, (g == null ? void 0 : g.prompt) && (i == null ? void 0 : i.id) && /* @__PURE__ */ d(Zn, {
965
+ appId: i.id,
997
966
  list: [],
998
- search: Ge ? Wt : "",
967
+ search: Ke ? qt : "",
999
968
  onPromptSelect: (t) => {
1000
- S(t.context), fe(t.context);
969
+ S(t.context), ue(t.context);
1001
970
  },
1002
- disabled: F
971
+ disabled: D
1003
972
  })]
1004
- }), /* @__PURE__ */ V(Ie, {
1005
- children: [(f == null ? void 0 : f.connectNetwork) && o.type === re.Dialog && ((xt = o.arrange) == null ? void 0 : xt.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ d(ei, {
1006
- sessionId: (Ct = e == null ? void 0 : e.data) == null ? void 0 : Ct.id,
1007
- netStatus: L,
1008
- enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : on,
973
+ }), /* @__PURE__ */ z(Ce, {
974
+ children: [(g == null ? void 0 : g.connectNetwork) && i.type === oe.Dialog && ((vt = i.arrange) == null ? void 0 : vt.length) && !!i.arrange[0].enableNetOpen && /* @__PURE__ */ d(Xn, {
975
+ sessionId: (bt = e == null ? void 0 : e.data) == null ? void 0 : bt.id,
976
+ netStatus: E,
977
+ enable: typeof (s == null ? void 0 : s.connectNetwork) == "object" && typeof (s == null ? void 0 : s.connectNetwork.diabled) == "boolean" ? !(s != null && s.connectNetwork.diabled) : en,
1009
978
  disabledTip: e ? void 0 : "网络访问已被禁用",
1010
979
  onNetStatusChange: (t) => {
1011
- Cn(t);
980
+ yn(t);
1012
981
  }
1013
- }), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ d(Zn, {
1014
- currentSessionId: (wt = e == null ? void 0 : e.data) == null ? void 0 : wt.id,
982
+ }), (g == null ? void 0 : g.sessionList) && /* @__PURE__ */ d(Yn, {
983
+ currentSessionId: (xt = e == null ? void 0 : e.data) == null ? void 0 : xt.id,
1015
984
  onSessionChange: (t, n) => {
1016
- S(void 0), we(!0), p == null || p(n);
985
+ S(void 0), ke(!0), p == null || p(n);
1017
986
  },
1018
- disabled: F
1019
- }), jt && zt === "float" && /* @__PURE__ */ d("div", {
987
+ disabled: D
988
+ }), jt && At === "float" && /* @__PURE__ */ d("div", {
1020
989
  className: "session-history-drawer-component",
1021
- children: /* @__PURE__ */ d(Fn, {
990
+ children: /* @__PURE__ */ d(Dn, {
1022
991
  placement: "topRight",
1023
992
  showArrow: !1,
1024
993
  overlayClassName: "session-history-overlay",
@@ -1027,88 +996,88 @@ ${e}` : e;
1027
996
  },
1028
997
  getPopupContainer: (t) => t.parentNode,
1029
998
  content: "会话历史记录",
1030
- children: /* @__PURE__ */ d(X, {
999
+ children: /* @__PURE__ */ d(G, {
1031
1000
  className: "history-overlay-action",
1032
- disabled: F,
1001
+ disabled: D,
1033
1002
  type: "text",
1034
- icon: /* @__PURE__ */ d(oe, {
1003
+ icon: /* @__PURE__ */ d(ge, {
1035
1004
  type: "icon-lishijilu",
1036
1005
  style: {
1037
1006
  fontSize: 24
1038
1007
  }
1039
1008
  }),
1040
- onClick: () => ot(!0)
1009
+ onClick: () => tt(!0)
1041
1010
  })
1042
1011
  })
1043
- }), (f == null ? void 0 : f.sessionOpen) && /* @__PURE__ */ d(X, {
1044
- icon: /* @__PURE__ */ d(Yn, {}),
1012
+ }), (g == null ? void 0 : g.sessionOpen) && /* @__PURE__ */ d(G, {
1013
+ icon: /* @__PURE__ */ d(Bn, {}),
1045
1014
  className: "add-btn",
1046
1015
  type: "primary",
1047
- disabled: Je || !e || !v.length || F,
1016
+ disabled: Ge || !e || !v.length || D,
1048
1017
  onClick: () => {
1049
1018
  var t, n;
1050
- we(!1), p == null || p(null), ne.current = null, P(!1), (t = Xe.current) == null || t.clear(), (n = Oe.current) == null || n.clear();
1019
+ ke(!1), p == null || p(null), P(!1), (t = Ye.current) == null || t.clear(), (n = Te.current) == null || n.clear();
1051
1020
  },
1052
1021
  children: "新会话"
1053
1022
  })]
1054
1023
  })]
1055
1024
  }), /* @__PURE__ */ d("div", {
1056
1025
  className: "footer-textarea",
1057
- children: /* @__PURE__ */ d(_n, {
1058
- ref: pe,
1059
- maxLength: Vt,
1060
- text: Yt,
1026
+ children: /* @__PURE__ */ d(Mn, {
1027
+ ref: ye,
1028
+ maxLength: Mt,
1029
+ text: Wt,
1061
1030
  networkStatus: !1,
1062
- loading: nt || Ce,
1063
- disabled: Be || Ke || F || nt || Ce,
1064
- onTextSend: rt,
1031
+ loading: Se || xe,
1032
+ disabled: $e || Be || D || Se || xe,
1033
+ onTextSend: it,
1065
1034
  onChange: (t, n) => {
1066
1035
  S(t);
1067
- const s = n.getText().replace(/[\n\s]+$/, "");
1068
- fe(s), Kt(s), Ge || qt(!0);
1036
+ const a = n.getText().replace(/[\n\s]+$/, "");
1037
+ ue(a), Bt(a), Ke || $t(!0);
1069
1038
  },
1070
- clearAction: /* @__PURE__ */ d(Ie, {
1039
+ clearAction: /* @__PURE__ */ d(Ce, {
1071
1040
  size: 0,
1072
- children: /* @__PURE__ */ d(X, {
1041
+ children: /* @__PURE__ */ d(G, {
1073
1042
  type: "link",
1074
- disabled: Re || F,
1043
+ disabled: Oe || D,
1075
1044
  ghost: !0,
1076
- icon: /* @__PURE__ */ d(oe, {
1045
+ icon: /* @__PURE__ */ d(ge, {
1077
1046
  style: {
1078
1047
  fontSize: 22
1079
1048
  },
1080
1049
  type: "icon-qingchujiyi"
1081
1050
  }),
1082
- onClick: () => ln()
1051
+ onClick: () => sn()
1083
1052
  })
1084
1053
  })
1085
1054
  })
1086
1055
  })]
1087
1056
  })
1088
- }), /* @__PURE__ */ d(Kn, {
1089
- tips: At
1090
- }), Ze && /* @__PURE__ */ d(Gn, {
1091
- isvisible: Ze,
1092
- files: Gt,
1057
+ }), /* @__PURE__ */ d($n, {
1058
+ tips: Rt
1059
+ }), Qe && /* @__PURE__ */ d(_n, {
1060
+ isvisible: Qe,
1061
+ files: Kt,
1093
1062
  sessionId: (kt = e == null ? void 0 : e.data) == null ? void 0 : kt.id,
1094
1063
  onClose: (t) => {
1095
- Qt(!1), St(!1);
1064
+ _t(!1), Xt(!1);
1096
1065
  }
1097
1066
  })]
1098
- }), it && /* @__PURE__ */ d(Jn, {
1067
+ }), et && /* @__PURE__ */ d(Qn, {
1099
1068
  currentSession: e,
1100
- application: o,
1101
- networkStatus: L,
1069
+ application: i,
1070
+ networkStatus: E,
1102
1071
  setCurrentSession: p,
1103
- disabled: F,
1104
- isSessionHistoryVisible: it,
1105
- setIsSessionHistoryVisible: ot,
1072
+ disabled: D,
1073
+ isSessionHistoryVisible: et,
1074
+ setIsSessionHistoryVisible: tt,
1106
1075
  onSessionChange: (t) => {
1107
- we(!0);
1076
+ ke(!0);
1108
1077
  }
1109
1078
  })]
1110
1079
  });
1111
1080
  });
1112
1081
  export {
1113
- Fi as default
1082
+ Hi as default
1114
1083
  };