@glodon-aiot/agent-cli-ui 3.3.2-beta.0 → 3.3.2-beta.2

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.
@@ -29,32 +29,33 @@ var z = (L, o, v) => new Promise((e, x) => {
29
29
  });
30
30
  import { jsx as c, jsxs as A } from "react/jsx-runtime";
31
31
  import { memo as Gt, useState as m, useRef as B, useContext as Xt, useEffect as T, useMemo as Zt } from "react";
32
- /* empty css */import { Divider as Jt, Spin as St, Button as _, Space as ae, Upload as en, Tooltip as tn, message as u, notification as nn } from "antd";
32
+ /* empty css */import { Divider as Jt, Spin as St, Button as _, Space as le, Upload as en, Tooltip as tn, message as u, notification as nn } from "antd";
33
33
  import de from "../../components/Iconfont/index.mjs";
34
34
  import { IHistoryRole as G, ChatMessageRole as it } from "@glodon-aiot/apis";
35
35
  import rt from "./HistoryItem/index.mjs";
36
- import lt from "dayjs";
37
- import { v4 as at } from "uuid";
36
+ import at from "dayjs";
37
+ import { v4 as lt } from "uuid";
38
38
  import on from "../../context.mjs";
39
- import { MB as sn } from "../../constant.mjs";
40
- import rn from "../../components/FilePreview/index.mjs";
39
+ import { configuration as sn } from "@glodon-aiot/bot-client-sdk";
40
+ import { MB as rn } from "../../constant.mjs";
41
+ import an from "../../components/FilePreview/index.mjs";
41
42
  import { getImageExtension as ln } from "../../utils/index.mjs";
42
- import an from "../../QuillEditor/index.mjs";
43
- import dn from "../../components/Recommend/index.mjs";
44
- import cn from "../../components/Greeting/index.mjs";
45
- import fn from "../../Footer/index.mjs";
46
- import { CameraOutlined as gn, PlusOutlined as un } from "@ant-design/icons";
47
- import hn from "./Tools/UploadKnowledgeFiles/index.mjs";
48
- import mn from "../UploadingPrompt/index.mjs";
43
+ import dn from "../../QuillEditor/index.mjs";
44
+ import cn from "../../components/Recommend/index.mjs";
45
+ import fn from "../../components/Greeting/index.mjs";
46
+ import gn from "../../Footer/index.mjs";
47
+ import { CameraOutlined as un, PlusOutlined as hn } from "@ant-design/icons";
48
+ import mn from "./Tools/UploadKnowledgeFiles/index.mjs";
49
+ import pn from "../UploadingPrompt/index.mjs";
49
50
  import yn from "./PromptSetting/index.mjs";
50
51
  import { useMemoizedFn as we } from "ahooks";
51
- import pn from "./Tools/SessionListDrawer/index.mjs";
52
- import vn from "react-infinite-scroll-component";
53
- import bn from "./Tools/ConnectToNetwork/index.mjs";
54
- import kn from "./Tools/PromptManager/index.mjs";
55
- import wn from "../../assets/icon.svg.mjs";
56
- const xn = Gt(rt), ot = {
57
- icon: wn,
52
+ import vn from "./Tools/SessionListDrawer/index.mjs";
53
+ import bn from "react-infinite-scroll-component";
54
+ import kn from "./Tools/ConnectToNetwork/index.mjs";
55
+ import wn from "./Tools/PromptManager/index.mjs";
56
+ import xn from "../../assets/icon.svg.mjs";
57
+ const In = Gt(rt), ot = {
58
+ icon: xn,
58
59
  text: "今天我能帮你什么?"
59
60
  };
60
61
  class J {
@@ -68,12 +69,12 @@ class J {
68
69
  D(this, "isSensitive");
69
70
  D(this, "isSuspend");
70
71
  D(this, "comment");
71
- this.content = o, this.sessionId = v, this.role = e, this.files = x, this.content = o, this.role = e, this.sessionId = v, this.files = x, this.messageTime = lt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = at(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
72
+ this.content = o, this.sessionId = v, this.role = e, this.files = x, this.content = o, this.role = e, this.sessionId = v, this.files = x, this.messageTime = at(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = lt(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
72
73
  isAgree: 0
73
74
  };
74
75
  }
75
76
  }
76
- const st = 10, Zn = (L) => {
77
+ const st = 10, Sn = (L) => {
77
78
  var Be, qe, Ye, Ke, We, Qe, _e, Ge, Xe, Ze, Je;
78
79
  const {
79
80
  application: o,
@@ -96,13 +97,13 @@ const st = 10, Zn = (L) => {
96
97
  beforeMessageSend: j,
97
98
  bodyStyle: gt,
98
99
  disabled: M,
99
- features: a,
100
+ features: l,
100
101
  popupContainer: g,
101
102
  icon: ut
102
- } = Xt(on), [Le, ue] = m(!1), y = B(h), Ce = B(), [ht, mt] = m(0), [X, q] = m(), [Y, te] = m(""), [Ne, he] = m(!1), me = B(null), [Fe, yt] = m([]), [Te, K] = m(!1), [Ee, pt] = m(!1), [vt, bt] = m(""), [kt, W] = m(), [ne, ie] = m({}), oe = B(null), Pe = B(null), ye = B(null), [Re, wt] = m(!1), [xt, It] = m([]), [Lt, se] = m(!0), [Ct, Nt] = m(!0), [De, O] = m(!1), [pe, V] = m(!1), [He, Ft] = m(!1), [E, re] = m(typeof (a == null ? void 0 : a.promptVariables) == "object" ? a.promptVariables.default || [] : []), [Tt, Et] = m(typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0), [Me, U] = m(!1), [Oe, Z] = m(!1), [Pt, Q] = m(typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.default) == "boolean" ? a.connectNetwork.default : !1), [Ue, le] = m(!1);
103
+ } = Xt(on), [Le, ue] = m(!1), p = B(h), Ce = B(), [ht, mt] = m(0), [X, q] = m(), [Y, te] = m(""), [Ne, he] = m(!1), me = B(null), [Fe, pt] = m([]), [Te, K] = m(!1), [Ee, yt] = m(!1), [vt, bt] = m(""), [kt, W] = m(), [ne, ie] = m({}), oe = B(null), Pe = B(null), pe = B(null), [Re, wt] = m(!1), [xt, It] = m([]), [Lt, se] = m(!0), [Ct, Nt] = m(!0), [De, O] = m(!1), [ye, V] = m(!1), [He, Ft] = m(!1), [E, re] = m(typeof (l == null ? void 0 : l.promptVariables) == "object" ? l.promptVariables.default || [] : []), [Tt, Et] = m(typeof (l == null ? void 0 : l.knowledges) == "object" && l.knowledges.default || void 0), [Me, U] = m(!1), [Oe, Z] = m(!1), [Pt, Q] = m(typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.default) == "boolean" ? l.connectNetwork.default : !1), [Ue, ae] = m(!1);
103
104
  T(() => {
104
105
  var r, i;
105
- e && (y.current = []), C([]);
106
+ e && (p.current = []), C([]);
106
107
  const t = P.current;
107
108
  if (t && t.scrollTo({
108
109
  top: 0
@@ -110,18 +111,18 @@ const st = 10, Zn = (L) => {
110
111
  return;
111
112
  if (V(!1), O(!1), (i = e.messages) != null && i.length) {
112
113
  const s = [...e.messages.filter((d) => d == null ? void 0 : d.messageId)].reverse();
113
- y.current = [...s], C([...s]);
114
+ p.current = [...s], C([...s]);
114
115
  }
115
- const n = (l) => {
116
+ const n = (a) => {
116
117
  var s;
117
- (s = e == null ? void 0 : e.data) != null && s.id && (y.current = [...l].reverse(), C([...l].reverse()), !l || l.length < 10 ? Z(!1) : Z(!0), Ie && Ie({
118
+ (s = e == null ? void 0 : e.data) != null && s.id && (p.current = [...a].reverse(), C([...a].reverse()), !a || a.length < 10 ? Z(!1) : Z(!0), Ie && Ie({
118
119
  applicationId: o.id,
119
120
  sessionId: e.data.id,
120
- histories: l
121
+ histories: a
121
122
  }));
122
123
  };
123
124
  return e.addEventListener("history:loaded", n), () => {
124
- y.current = [], C([]), e == null || e.removeEventListener("history:loaded", n);
125
+ p.current = [], C([]), e == null || e.removeEventListener("history:loaded", n);
125
126
  };
126
127
  }, [e]), T(() => {
127
128
  const t = () => {
@@ -162,11 +163,11 @@ const st = 10, Zn = (L) => {
162
163
  };
163
164
  T(() => {
164
165
  o != null && o.id && (F == null || F.getRecommendQues(o.id).then((t) => {
165
- yt(t);
166
+ pt(t);
166
167
  }));
167
168
  }, [ct, o]);
168
169
  const ze = (t) => z(void 0, null, function* () {
169
- var w, p;
170
+ var w, y;
170
171
  if (M) {
171
172
  u.config({
172
173
  getContainer: () => (g == null ? void 0 : g.current) || document.body
@@ -194,7 +195,7 @@ const st = 10, Zn = (L) => {
194
195
  return;
195
196
  } else
196
197
  console.error("变量值不能为空", E == null ? void 0 : E.map((b) => !!(b != null && b.value)));
197
- if (pe) {
198
+ if (ye) {
198
199
  u.config({
199
200
  getContainer: () => (g == null ? void 0 : g.current) || document.body
200
201
  }), u.error("正在回复中"), u.config({
@@ -239,8 +240,8 @@ const st = 10, Zn = (L) => {
239
240
  });
240
241
  return;
241
242
  }
242
- le(!0);
243
- const l = Y ? `![](${Y})
243
+ ae(!0);
244
+ const a = Y ? `![](${Y})
244
245
  ${n}` : n;
245
246
  let s;
246
247
  try {
@@ -248,7 +249,7 @@ ${n}` : n;
248
249
  applicationId: o.id,
249
250
  sessionId: i,
250
251
  message: {
251
- content: l,
252
+ content: a,
252
253
  sessionId: i,
253
254
  role: it.User,
254
255
  files: ne[i]
@@ -257,14 +258,14 @@ ${n}` : n;
257
258
  } catch (b) {
258
259
  s = !1;
259
260
  }
260
- if (le(!1), s === !1)
261
+ if (ae(!1), s === !1)
261
262
  return;
262
263
  let d = n;
263
- typeof s == "object" && (d = s.content || n), ((p = ne[i]) == null ? void 0 : p.length) > 0 ? Ht(d) : ve(d);
264
+ typeof s == "object" && (d = s.content || n), ((y = ne[i]) == null ? void 0 : y.length) > 0 ? Ht(d) : ve(d);
264
265
  }), Dt = (t) => new Promise((n, r) => z(void 0, null, function* () {
265
266
  const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.key !== "query").map((d) => {
266
- var p;
267
- const w = (p = E.find((b) => b.key === d.key)) == null ? void 0 : p.value;
267
+ var y;
268
+ const w = (y = E.find((b) => b.key === d.key)) == null ? void 0 : y.value;
268
269
  return d.value = w || "", d;
269
270
  });
270
271
  re(s.sort((d, w) => d.key.localeCompare(w.key))), yield t == null ? void 0 : t.setPromptVariables(s), n();
@@ -273,24 +274,24 @@ ${n}` : n;
273
274
  if (se(!1), !((s = e == null ? void 0 : e.data) != null && s.id) || !(o != null && o.id))
274
275
  return;
275
276
  const n = ((d = e.data) == null ? void 0 : d.id) || "", r = [];
276
- let i = [], l = /* @__PURE__ */ new Set();
277
- (w = ne[n]) == null || w.forEach((p) => {
278
- l.has(p.id) || (i.push(p), l.add(p.id));
279
- }), Promise.all(i.map((p) => F == null ? void 0 : F.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, p.id, {
277
+ let i = [], a = /* @__PURE__ */ new Set();
278
+ (w = ne[n]) == null || w.forEach((y) => {
279
+ a.has(y.id) || (i.push(y), a.add(y.id));
280
+ }), Promise.all(i.map((y) => F == null ? void 0 : F.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, y.id, {
280
281
  enabled: 1
281
282
  }).then((b) => {
282
- r.push(p);
283
- }))).then((p) => {
283
+ r.push(y);
284
+ }))).then((y) => {
284
285
  se(!0), ve(t, r);
285
- }).catch((p) => {
286
- throw Error(p);
286
+ }).catch((y) => {
287
+ throw Error(y);
287
288
  });
288
289
  };
289
290
  T(() => {
290
291
  if (!fe || !e)
291
292
  return;
292
293
  const t = fe, n = () => z(void 0, null, function* () {
293
- le(!0);
294
+ ae(!0);
294
295
  const r = Y ? `![](${Y})
295
296
  ${t}` : t;
296
297
  let i;
@@ -305,32 +306,32 @@ ${t}` : t;
305
306
  files: ne[e.id]
306
307
  }
307
308
  }) : i = !0;
308
- } catch (l) {
309
+ } catch (a) {
309
310
  i = !1;
310
311
  }
311
- le(!1), i !== !1 && (ve(t), xe(void 0));
312
+ ae(!1), i !== !1 && (ve(t), xe(void 0));
312
313
  });
313
314
  return e.ready ? n() : e.addEventListener("ready", n, !0), () => {
314
315
  e == null || e.removeEventListener("ready", n);
315
316
  };
316
317
  }, [fe, e]);
317
318
  const ve = (t, n) => z(void 0, null, function* () {
318
- var p, b;
319
- const r = (p = e == null ? void 0 : e.data) == null ? void 0 : p.id;
319
+ var y, b;
320
+ const r = (y = e == null ? void 0 : e.data) == null ? void 0 : y.id;
320
321
  if (!r)
321
322
  return;
322
323
  V(!0), O(!0);
323
324
  const i = Y ? `![](${Y})
324
- ${t}` : t, l = new J(i, r, G.User, n);
325
- S(void 0), W(void 0), y.current = [l, ...h], C(y.current), o.id && ee && ee({
325
+ ${t}` : t, a = new J(i, r, G.User, n);
326
+ S(void 0), W(void 0), p.current = [a, ...h], C(p.current), o.id && ee && ee({
326
327
  applicationId: o.id,
327
328
  sessionId: r,
328
- message: l
329
+ message: a
329
330
  });
330
331
  const s = new J("", r, G.System);
331
- s.isWaiting = !0, y.current = [s, ...y.current], C(y.current);
332
+ s.isWaiting = !0, p.current = [s, ...p.current], C(p.current);
332
333
  const d = (n == null ? void 0 : n.map((R) => R.id)) || [], w = {
333
- stream: !0,
334
+ stream: sn.stream,
334
335
  referenceFirst: !1
335
336
  };
336
337
  if (f != null && f.promptVariables) {
@@ -356,16 +357,16 @@ ${t}` : t, l = new J(i, r, G.User, n);
356
357
  const n = (i) => {
357
358
  if (!i.sessionId || i.sessionId && i.sessionId !== Ce.current || i.role === G.User)
358
359
  return;
359
- if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (O(!1), V(!1), y.current = y.current.filter((d) => !d.isWaiting), C([...y.current]), y.current = [...y.current], i.content))
360
+ if (i.index === -1 && i.code !== 200 && i.code !== 11915 && (O(!1), V(!1), p.current = p.current.filter((d) => !d.isWaiting), C([...p.current]), p.current = [...p.current], i.content))
360
361
  return nn.error({
361
362
  message: i.content
362
363
  });
363
- const l = i.actions || [], s = new J(i.content, t, G.Robot);
364
- s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions = l, s.isLoading = !0, s.searchingStatus = i.searchingStatus, y.current = y.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && C([s, ...y.current]), i.code === 11915 && (O(!1), V(!1), s.isLoading = !1, s.content = "请您换个问题问我吧~", s.isSensitive = !0, C([s, ...y.current])), i.index === -2 && (O(!1), V(!1), s.isLoading = !1, s.content = "回答已中止~", s.isSuspend = !0, C([s, ...y.current])), i.index === -1 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, C([s, ...y.current]), o.id && ee && ee({
364
+ const a = i.actions || [], s = new J(i.content, t, G.Robot);
365
+ s.messageId = i.messageId, s.reasoningContent = i.reasoningContent, s.searchReference = i.searchReference, s.thinkingSecs = i.thinkingSecs, s.thinkingStatus = i.thinkingStatus, s.actions = a, s.isLoading = !0, s.searchingStatus = i.searchingStatus, p.current = p.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), i.index === void 0 && C([s, ...p.current]), i.code === 11915 && (O(!1), V(!1), s.isLoading = !1, s.content = "请您换个问题问我吧~", s.isSensitive = !0, C([s, ...p.current])), i.index === -2 && (O(!1), V(!1), s.isLoading = !1, s.content = "回答已中止~", s.isSuspend = !0, C([s, ...p.current])), i.index === -1 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, C([s, ...p.current]), o.id && ee && ee({
365
366
  applicationId: o.id,
366
367
  sessionId: t,
367
368
  message: s
368
- })), i.index === -3 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, s.relatedQuesion = i.relatedQuesion, C([s, ...y.current]));
369
+ })), i.index === -3 && (O(!1), V(!1), s.isLoading = !1, s.reference = i.reference, s.relatedQuesion = i.relatedQuesion, C([s, ...p.current]));
369
370
  };
370
371
  return e.ready ? e.addEventListener("message:updated", n) : e.addEventListener("ready", () => {
371
372
  e.addEventListener("message:updated", n);
@@ -397,7 +398,7 @@ ${t}` : t, l = new J(i, r, G.User, n);
397
398
  getContainer: () => (g == null ? void 0 : g.current) || document.body
398
399
  }), u.error("该文件为空,请重新上传"), u.config({
399
400
  getContainer: void 0
400
- }), !1) : n > 20 * sn ? (u.config({
401
+ }), !1) : n > 20 * rn ? (u.config({
401
402
  getContainer: () => (g == null ? void 0 : g.current) || document.body
402
403
  }), u.error("图片须小于20M"), u.config({
403
404
  getContainer: void 0
@@ -408,25 +409,25 @@ ${t}` : t, l = new J(i, r, G.User, n);
408
409
  U(!0), x == null || x({
409
410
  netOpen: H ? 1 : 2
410
411
  }).then((i) => {
411
- var l, s;
412
- k == null || k(i), U(!1), I(!!((l = i.data) != null && l.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(je(i, t));
412
+ var a, s;
413
+ k == null || k(i), U(!1), I(!!((a = i.data) != null && a.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(je(i, t));
413
414
  });
414
415
  });
415
416
  }), je = (t, n) => {
416
417
  const r = ln(n.name);
417
418
  return new Promise((i) => {
418
419
  var s;
419
- const l = {
420
- files: [`${at()}.${r}`],
420
+ const a = {
421
+ files: [`${lt()}.${r}`],
421
422
  isv: "minio",
422
423
  knowledgeId: ((s = t.data) == null ? void 0 : s.id) || "",
423
424
  type: 1
424
425
  };
425
- he(!0), F == null || F.postTicket(l).then((d) => {
426
+ he(!0), F == null || F.postTicket(a).then((d) => {
426
427
  F.uploadMinioFile(d.minio, n).then(() => {
427
428
  var R, $;
428
- const w = (R = d.minio.endpoints) == null ? void 0 : R[0], p = d.minio.bucket, b = ($ = d.minio.fileKeys) == null ? void 0 : $[0];
429
- i(`${location.protocol}//${w}/${p}/${b}`);
429
+ const w = (R = d.minio.endpoints) == null ? void 0 : R[0], y = d.minio.bucket, b = ($ = d.minio.fileKeys) == null ? void 0 : $[0];
430
+ i(`${location.protocol}//${w}/${y}/${b}`);
430
431
  }).catch(() => {
431
432
  te(""), q(void 0);
432
433
  }).finally(() => {
@@ -450,8 +451,8 @@ ${t}` : t, l = new J(i, r, G.User, n);
450
451
  type: 1
451
452
  });
452
453
  F == null || F.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, i).finally(() => {
453
- var l;
454
- (l = oe.current) == null || l.update().finally(r);
454
+ var a;
455
+ (a = oe.current) == null || a.update().finally(r);
455
456
  });
456
457
  }), Ut = () => {
457
458
  var t;
@@ -478,13 +479,13 @@ ${t}` : t, l = new J(i, r, G.User, n);
478
479
  var n;
479
480
  if (!((n = e == null ? void 0 : e.data) != null && n.id))
480
481
  return;
481
- y.current = [...h.slice(1, h.length)], C(y.current);
482
+ p.current = [...h.slice(1, h.length)], C(p.current);
482
483
  const t = new J("", e.data.id, G.System);
483
- t.isWaiting = !0, y.current = [t, ...y.current], C(y.current), V(!0), O(!0), e.answerAgain();
484
+ t.isWaiting = !0, p.current = [t, ...p.current], C(p.current), V(!0), O(!0), e.answerAgain();
484
485
  });
485
486
  T(() => {
486
487
  var t, n;
487
- Ce.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Me && ((n = ye.current) == null || n.clear());
488
+ Ce.current = (t = e == null ? void 0 : e.data) == null ? void 0 : t.id, !Me && ((n = pe.current) == null || n.clear());
488
489
  }, [e]);
489
490
  const Bt = () => {
490
491
  var r;
@@ -495,12 +496,12 @@ ${t}` : t, l = new J(i, r, G.User, n);
495
496
  endTime: n,
496
497
  pageSize: st
497
498
  }).then((i) => {
498
- const l = i || [];
499
- if (!l || !(l != null && l.length)) {
499
+ const a = i || [];
500
+ if (!a || !(a != null && a.length)) {
500
501
  Z(!1);
501
502
  return;
502
503
  }
503
- l.length < 10 ? Z(!1) : Z(!0), C([...h, ...l.reverse()]);
504
+ a.length < 10 ? Z(!1) : Z(!0), C([...h, ...a.reverse()]);
504
505
  });
505
506
  }, qt = (t) => z(void 0, null, function* () {
506
507
  var n, r;
@@ -522,11 +523,11 @@ ${t}` : t, l = new J(i, r, G.User, n);
522
523
  }, [e]), T(() => {
523
524
  var t, n;
524
525
  if (P.current) {
525
- const r = document.getElementById("chat-main"), i = (t = P.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), l = (n = P.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
526
- if (!i || !l || !r)
526
+ const r = document.getElementById("chat-main"), i = (t = P.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), a = (n = P.current) == null ? void 0 : n.querySelector(".infinite-scroll-component");
527
+ if (!i || !a || !r)
527
528
  return;
528
529
  const s = r.offsetHeight;
529
- if (l.offsetHeight <= s) {
530
+ if (a.offsetHeight <= s) {
530
531
  if (i.style.height === "100%")
531
532
  return;
532
533
  i.style.height = "100%";
@@ -541,24 +542,24 @@ ${t}` : t, l = new J(i, r, G.User, n);
541
542
  return;
542
543
  const t = () => {
543
544
  const i = ((N == null ? void 0 : N.promptVariables) || []).filter(
544
- (l) => l.key !== "query" && l.status === 1
545
+ (a) => a.key !== "query" && a.status === 1
545
546
  // 只要求输入被引用的变量
546
- ).map((l, s) => {
547
- var w, p;
547
+ ).map((a, s) => {
548
+ var w, y;
548
549
  let d = "";
549
- return typeof (a == null ? void 0 : a.promptVariables) == "object" && (d = ((p = (w = a.promptVariables.default) == null ? void 0 : w.find((b) => b.key === l.key)) == null ? void 0 : p.value) || ""), {
550
+ return typeof (l == null ? void 0 : l.promptVariables) == "object" && (d = ((y = (w = l.promptVariables.default) == null ? void 0 : w.find((b) => b.key === a.key)) == null ? void 0 : y.value) || ""), {
550
551
  id: s + "",
551
- key: l.key,
552
- name: l.name,
552
+ key: a.key,
553
+ name: a.name,
553
554
  value: d
554
555
  };
555
556
  });
556
- re([...i].sort((l, s) => l.key.localeCompare(s.key)));
557
+ re([...i].sort((a, s) => a.key.localeCompare(s.key)));
557
558
  };
558
559
  return N != null && N.ready ? t() : N == null || N.addEventListener("ready", t), () => {
559
560
  N == null || N.removeEventListener("ready", t);
560
561
  };
561
- }, [e, N, a == null ? void 0 : a.promptVariables]);
562
+ }, [e, N, l == null ? void 0 : l.promptVariables]);
562
563
  const $e = () => x == null ? void 0 : x({
563
564
  netOpen: H ? 1 : 2
564
565
  }).then((t) => {
@@ -576,7 +577,7 @@ ${t}` : t, l = new J(i, r, G.User, n);
576
577
  sessionId: "",
577
578
  reference: [],
578
579
  searchReference: [],
579
- messageTime: lt(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
580
+ messageTime: at(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
580
581
  actions: [],
581
582
  isLoading: !1
582
583
  },
@@ -607,7 +608,7 @@ ${t}` : t, l = new J(i, r, G.User, n);
607
608
  },
608
609
  ref: P,
609
610
  onScroll: jt,
610
- children: (Be = e == null ? void 0 : e.data) != null && Be.id && (h != null && h.length) ? /* @__PURE__ */ A(vn, {
611
+ children: (Be = e == null ? void 0 : e.data) != null && Be.id && (h != null && h.length) ? /* @__PURE__ */ A(bn, {
611
612
  dataLength: h.length,
612
613
  next: Bt,
613
614
  style: {
@@ -631,7 +632,7 @@ ${t}` : t, l = new J(i, r, G.User, n);
631
632
  children: /* @__PURE__ */ c(St, {})
632
633
  }),
633
634
  scrollableTarget: "scrollableDiv",
634
- children: [h.map((t, n) => /* @__PURE__ */ c(xn, {
635
+ children: [h.map((t, n) => /* @__PURE__ */ c(In, {
635
636
  application: o,
636
637
  currentSession: e,
637
638
  history: t,
@@ -643,27 +644,27 @@ ${t}` : t, l = new J(i, r, G.User, n);
643
644
  }, t.messageId + n)), !Oe && Ae]
644
645
  }) : /* @__PURE__ */ A("div", {
645
646
  className: "main-empty",
646
- children: [(a == null ? void 0 : a.greeting) !== !1 && /* @__PURE__ */ c(cn, {
647
- text: a === void 0 || a.greeting === !0 || ((Ke = a.greeting) == null ? void 0 : Ke.text) === void 0 ? ot.text : a.greeting.text,
648
- icon: a === void 0 || a.greeting === !0 || ((We = a.greeting) == null ? void 0 : We.icon) === void 0 ? ut || ot.icon : a.greeting.icon,
649
- children: !!Fe.length && typeof (a == null ? void 0 : a.greeting) == "object" && a.greeting.questions !== !1 && /* @__PURE__ */ c(dn, {
650
- ref: ye,
647
+ children: [(l == null ? void 0 : l.greeting) !== !1 && /* @__PURE__ */ c(fn, {
648
+ text: l === void 0 || l.greeting === !0 || ((Ke = l.greeting) == null ? void 0 : Ke.text) === void 0 ? ot.text : l.greeting.text,
649
+ icon: l === void 0 || l.greeting === !0 || ((We = l.greeting) == null ? void 0 : We.icon) === void 0 ? ut || ot.icon : l.greeting.icon,
650
+ children: !!Fe.length && typeof (l == null ? void 0 : l.greeting) == "object" && l.greeting.questions !== !1 && /* @__PURE__ */ c(cn, {
651
+ ref: pe,
651
652
  sid: (Qe = e == null ? void 0 : e.data) == null ? void 0 : Qe.id,
652
653
  isRecommendClearing: Te,
653
654
  data: Fe,
654
655
  onItemClick: (t) => {
655
- var r, i, l;
656
+ var r, i, a;
656
657
  if (S(t == null ? void 0 : t.question), W(t == null ? void 0 : t.question), Te)
657
658
  return;
658
659
  t != null && t.id && K(!0);
659
660
  const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
660
- f != null && f.fileUpload ? (l = (i = oe.current) == null ? void 0 : i.clear()) == null || l.then(() => {
661
+ f != null && f.fileUpload ? (a = (i = oe.current) == null ? void 0 : i.clear()) == null || a.then(() => {
661
662
  var s, d;
662
663
  t != null && t.id && (n ? (s = Ve(n, t)) == null || s.finally(() => {
663
664
  K(!1);
664
665
  }) : (K(!1), U(!0), (d = $e()) == null || d.then((w) => {
665
- var p;
666
- (p = Ve(w.id, t)) == null || p.finally(() => {
666
+ var y;
667
+ (y = Ve(w.id, t)) == null || y.finally(() => {
667
668
  K(!1);
668
669
  });
669
670
  })));
@@ -712,7 +713,7 @@ ${t}` : t, l = new J(i, r, G.User, n);
712
713
  className: "chat-footer-input",
713
714
  children: [X && /* @__PURE__ */ c("div", {
714
715
  className: "input-files",
715
- children: /* @__PURE__ */ c(rn, {
716
+ children: /* @__PURE__ */ c(an, {
716
717
  file: X,
717
718
  actions: {
718
719
  upload: Ot,
@@ -722,10 +723,10 @@ ${t}` : t, l = new J(i, r, G.User, n);
722
723
  },
723
724
  onUrlChange: (t) => te(t)
724
725
  })
725
- }), /* @__PURE__ */ A(ae, {
726
+ }), /* @__PURE__ */ A(le, {
726
727
  className: "footer-upload-action",
727
728
  onClick: (t) => t.preventDefault(),
728
- children: [/* @__PURE__ */ A(ae, {
729
+ children: [/* @__PURE__ */ A(le, {
729
730
  children: [o.type === 2 && (f == null ? void 0 : f.imageUpload) && /* @__PURE__ */ c(en, {
730
731
  disabled: !!X || M,
731
732
  accept: ".jpg, .png, .jpeg,.bmp",
@@ -742,7 +743,7 @@ ${t}` : t, l = new J(i, r, G.User, n);
742
743
  bottom: "-2px"
743
744
  },
744
745
  disabled: !!X || M,
745
- icon: /* @__PURE__ */ c(gn, {
746
+ icon: /* @__PURE__ */ c(un, {
746
747
  className: "icon-tianjia",
747
748
  style: {
748
749
  fontSize: "22px"
@@ -771,7 +772,7 @@ ${t}` : t, l = new J(i, r, G.User, n);
771
772
  })
772
773
  })
773
774
  })
774
- }), ce && (f != null && f.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(hn, {
775
+ }), ce && (f != null && f.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ c(mn, {
775
776
  appId: o == null ? void 0 : o.id,
776
777
  ref: oe,
777
778
  isFirstSession: Me,
@@ -783,14 +784,14 @@ ${t}` : t, l = new J(i, r, G.User, n);
783
784
  U(!0), x == null || x({
784
785
  netOpen: H ? 1 : 2
785
786
  }).then((n) => {
786
- var i, l, s;
787
- k == null || k(n), U(!1), I(!!((i = n.data) != null && i.netOpen)), Q(!!((l = n.data) != null && l.enableNetOpen));
787
+ var i, a, s;
788
+ k == null || k(n), U(!1), I(!!((i = n.data) != null && i.netOpen)), Q(!!((a = n.data) != null && a.enableNetOpen));
788
789
  const r = ((s = n.data) == null ? void 0 : s.id) || "";
789
790
  t(r);
790
791
  });
791
792
  }),
792
793
  sid: (_e = e == null ? void 0 : e.data) == null ? void 0 : _e.id,
793
- disabled: pe || M,
794
+ disabled: ye || M,
794
795
  afterFileAdd: (t, n) => {
795
796
  n && ie((r) => {
796
797
  const i = r[n] || [];
@@ -803,9 +804,9 @@ ${t}` : t, l = new J(i, r, G.User, n);
803
804
  var r;
804
805
  const n = (r = e == null ? void 0 : e.data) == null ? void 0 : r.id;
805
806
  n && ie((i) => {
806
- const l = i[n] || [];
807
+ const a = i[n] || [];
807
808
  return {
808
- [n]: l.filter((s) => s.id !== t)
809
+ [n]: a.filter((s) => s.id !== t)
809
810
  };
810
811
  });
811
812
  },
@@ -820,7 +821,7 @@ ${t}` : t, l = new J(i, r, G.User, n);
820
821
  [t]: []
821
822
  }), be());
822
823
  }
823
- }) : null, (f == null ? void 0 : f.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(kn, {
824
+ }) : null, (f == null ? void 0 : f.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(wn, {
824
825
  appId: o.id,
825
826
  list: [],
826
827
  search: Ee ? vt : "",
@@ -829,36 +830,36 @@ ${t}` : t, l = new J(i, r, G.User, n);
829
830
  },
830
831
  disabled: M
831
832
  })]
832
- }), /* @__PURE__ */ A(ae, {
833
- children: [(f == null ? void 0 : f.connectNetwork) && o.type === 0 && ((Ge = o.arrange) == null ? void 0 : Ge.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(bn, {
833
+ }), /* @__PURE__ */ A(le, {
834
+ children: [(f == null ? void 0 : f.connectNetwork) && o.type === 0 && ((Ge = o.arrange) == null ? void 0 : Ge.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ c(kn, {
834
835
  sessionId: (Xe = e == null ? void 0 : e.data) == null ? void 0 : Xe.id,
835
836
  netStatus: H,
836
- enable: typeof (a == null ? void 0 : a.connectNetwork) == "object" && typeof (a == null ? void 0 : a.connectNetwork.diabled) == "boolean" ? !(a != null && a.connectNetwork.diabled) : Pt,
837
+ enable: typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.diabled) == "boolean" ? !(l != null && l.connectNetwork.diabled) : Pt,
837
838
  disabledTip: e ? void 0 : "网络访问已被禁用",
838
839
  onNetStatusChange: (t) => {
839
840
  qt(t);
840
841
  }
841
- }), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ c(pn, {
842
+ }), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ c(vn, {
842
843
  currentSessionId: (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id,
843
844
  onSessionChange: (t, n) => {
844
845
  W(void 0), k == null || k(n);
845
846
  },
846
847
  disabled: M
847
848
  }), (f == null ? void 0 : f.sessionOpen) && /* @__PURE__ */ c(_, {
848
- icon: /* @__PURE__ */ c(un, {}),
849
+ icon: /* @__PURE__ */ c(hn, {}),
849
850
  className: "add-btn",
850
851
  type: "primary",
851
852
  disabled: De || !e || !h.length || M,
852
853
  onClick: () => {
853
854
  var t, n;
854
- k == null || k(void 0), I(!1), (t = Pe.current) == null || t.clear(), (n = ye.current) == null || n.clear();
855
+ k == null || k(void 0), I(!1), (t = Pe.current) == null || t.clear(), (n = pe.current) == null || n.clear();
855
856
  },
856
857
  children: "新会话"
857
858
  })]
858
859
  })]
859
860
  }), /* @__PURE__ */ c("div", {
860
861
  className: "footer-textarea",
861
- children: /* @__PURE__ */ c(an, {
862
+ children: /* @__PURE__ */ c(dn, {
862
863
  ref: me,
863
864
  maxLength: ht,
864
865
  text: kt,
@@ -869,13 +870,13 @@ ${t}` : t, l = new J(i, r, G.User, n);
869
870
  onChange: (t, n) => {
870
871
  W(t);
871
872
  const r = n.getText().replace(/[\n\s]+$/, "");
872
- S(r), bt(r), Ee || pt(!0);
873
+ S(r), bt(r), Ee || yt(!0);
873
874
  },
874
- clearAction: /* @__PURE__ */ c(ae, {
875
+ clearAction: /* @__PURE__ */ c(le, {
875
876
  size: 0,
876
877
  children: /* @__PURE__ */ c(_, {
877
878
  type: "link",
878
- disabled: pe || M,
879
+ disabled: ye || M,
879
880
  ghost: !0,
880
881
  icon: /* @__PURE__ */ c(de, {
881
882
  style: {
@@ -889,9 +890,9 @@ ${t}` : t, l = new J(i, r, G.User, n);
889
890
  })
890
891
  })]
891
892
  })
892
- }), /* @__PURE__ */ c(fn, {
893
+ }), /* @__PURE__ */ c(gn, {
893
894
  tips: ft
894
- }), Re && /* @__PURE__ */ c(mn, {
895
+ }), Re && /* @__PURE__ */ c(pn, {
895
896
  isvisible: Re,
896
897
  files: xt,
897
898
  sessionId: (Je = e == null ? void 0 : e.data) == null ? void 0 : Je.id,
@@ -902,5 +903,5 @@ ${t}` : t, l = new J(i, r, G.User, n);
902
903
  });
903
904
  };
904
905
  export {
905
- Zn as default
906
+ Sn as default
906
907
  };