@glodon-aiot/agent-cli-ui 3.3.2-beta.1 → 3.3.2-beta.3

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.
@@ -2,15 +2,15 @@ var Yt = Object.defineProperty, Kt = Object.defineProperties;
2
2
  var Wt = Object.getOwnPropertyDescriptors;
3
3
  var et = Object.getOwnPropertySymbols;
4
4
  var Qt = Object.prototype.hasOwnProperty, _t = Object.prototype.propertyIsEnumerable;
5
- var ke = (L, o, v) => o in L ? Yt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v, tt = (L, o) => {
5
+ var be = (L, o, v) => o in L ? Yt(L, o, { enumerable: !0, configurable: !0, writable: !0, value: v }) : L[o] = v, tt = (L, o) => {
6
6
  for (var v in o || (o = {}))
7
- Qt.call(o, v) && ke(L, v, o[v]);
7
+ Qt.call(o, v) && be(L, v, o[v]);
8
8
  if (et)
9
9
  for (var v of et(o))
10
- _t.call(o, v) && ke(L, v, o[v]);
10
+ _t.call(o, v) && be(L, v, o[v]);
11
11
  return L;
12
12
  }, nt = (L, o) => Kt(L, Wt(o));
13
- var D = (L, o, v) => (ke(L, typeof o != "symbol" ? o + "" : o, v), v);
13
+ var D = (L, o, v) => (be(L, typeof o != "symbol" ? o + "" : o, v), v);
14
14
  var z = (L, o, v) => new Promise((e, x) => {
15
15
  var ce = (I) => {
16
16
  try {
@@ -18,13 +18,13 @@ var z = (L, o, v) => new Promise((e, x) => {
18
18
  } catch (h) {
19
19
  x(h);
20
20
  }
21
- }, k = (I) => {
21
+ }, b = (I) => {
22
22
  try {
23
23
  H(v.throw(I));
24
24
  } catch (h) {
25
25
  x(h);
26
26
  }
27
- }, H = (I) => I.done ? e(I.value) : Promise.resolve(I.value).then(ce, k);
27
+ }, H = (I) => I.done ? e(I.value) : Promise.resolve(I.value).then(ce, b);
28
28
  H((v = v.apply(L, o)).next());
29
29
  });
30
30
  import { jsx as c, jsxs as A } from "react/jsx-runtime";
@@ -50,8 +50,8 @@ import pn from "../UploadingPrompt/index.mjs";
50
50
  import yn from "./PromptSetting/index.mjs";
51
51
  import { useMemoizedFn as we } from "ahooks";
52
52
  import vn from "./Tools/SessionListDrawer/index.mjs";
53
- import bn from "react-infinite-scroll-component";
54
- import kn from "./Tools/ConnectToNetwork/index.mjs";
53
+ import kn from "react-infinite-scroll-component";
54
+ import bn from "./Tools/ConnectToNetwork/index.mjs";
55
55
  import wn from "./Tools/PromptManager/index.mjs";
56
56
  import xn from "../../assets/icon.svg.mjs";
57
57
  const In = Gt(rt), ot = {
@@ -82,7 +82,7 @@ const st = 10, Sn = (L) => {
82
82
  currentSession: e,
83
83
  onCreateSession: x,
84
84
  embeddingService: ce,
85
- setCurrentSession: k,
85
+ setCurrentSession: b,
86
86
  networkStatus: H,
87
87
  setNetworkStatus: I
88
88
  } = L, [h, C] = m([]), [dt, S] = m(), [fe, xe] = m(), P = B(null), {
@@ -100,7 +100,7 @@ const st = 10, Sn = (L) => {
100
100
  features: l,
101
101
  popupContainer: g,
102
102
  icon: ut
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
+ } = 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, kt] = m(""), [bt, 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);
104
104
  T(() => {
105
105
  var r, i;
106
106
  e && (p.current = []), C([]);
@@ -185,7 +185,7 @@ const st = 10, Sn = (L) => {
185
185
  });
186
186
  return;
187
187
  }
188
- if (!(E == null ? void 0 : E.every((b) => !!(b != null && b.value))))
188
+ if (!(E == null ? void 0 : E.every((k) => !!(k != null && k.value))))
189
189
  if (f != null && f.promptVariables) {
190
190
  u.config({
191
191
  getContainer: () => (g == null ? void 0 : g.current) || document.body
@@ -194,7 +194,7 @@ const st = 10, Sn = (L) => {
194
194
  });
195
195
  return;
196
196
  } else
197
- console.error("变量值不能为空", E == null ? void 0 : E.map((b) => !!(b != null && b.value)));
197
+ console.error("变量值不能为空", E == null ? void 0 : E.map((k) => !!(k != null && k.value)));
198
198
  if (ye) {
199
199
  u.config({
200
200
  getContainer: () => (g == null ? void 0 : g.current) || document.body
@@ -232,10 +232,10 @@ const st = 10, Sn = (L) => {
232
232
  if (!i) {
233
233
  x == null || x({
234
234
  netOpen: H ? 1 : 2
235
- }).then((b) => {
235
+ }).then((k) => {
236
236
  var R, $;
237
- U(!0), I(!!((R = b.data) != null && R.netOpen)), Q(!!(($ = b.data) != null && $.enableNetOpen)), Dt(b).then(() => {
238
- k == null || k(b), U(!1), xe(n);
237
+ U(!0), I(!!((R = k.data) != null && R.netOpen)), Q(!!(($ = k.data) != null && $.enableNetOpen)), Dt(k).then(() => {
238
+ b == null || b(k), U(!1), xe(n);
239
239
  });
240
240
  });
241
241
  return;
@@ -255,7 +255,7 @@ ${n}` : n;
255
255
  files: ne[i]
256
256
  }
257
257
  }) : s = !0;
258
- } catch (b) {
258
+ } catch (k) {
259
259
  s = !1;
260
260
  }
261
261
  if (ae(!1), s === !1)
@@ -265,7 +265,7 @@ ${n}` : n;
265
265
  }), Dt = (t) => new Promise((n, r) => z(void 0, null, function* () {
266
266
  const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.key !== "query").map((d) => {
267
267
  var y;
268
- const w = (y = E.find((b) => b.key === d.key)) == null ? void 0 : y.value;
268
+ const w = (y = E.find((k) => k.key === d.key)) == null ? void 0 : y.value;
269
269
  return d.value = w || "", d;
270
270
  });
271
271
  re(s.sort((d, w) => d.key.localeCompare(w.key))), yield t == null ? void 0 : t.setPromptVariables(s), n();
@@ -279,7 +279,7 @@ ${n}` : n;
279
279
  a.has(y.id) || (i.push(y), a.add(y.id));
280
280
  }), Promise.all(i.map((y) => F == null ? void 0 : F.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, n, y.id, {
281
281
  enabled: 1
282
- }).then((b) => {
282
+ }).then((k) => {
283
283
  r.push(y);
284
284
  }))).then((y) => {
285
285
  se(!0), ve(t, r);
@@ -316,7 +316,7 @@ ${t}` : t;
316
316
  };
317
317
  }, [fe, e]);
318
318
  const ve = (t, n) => z(void 0, null, function* () {
319
- var y, b;
319
+ var y, k;
320
320
  const r = (y = e == null ? void 0 : e.data) == null ? void 0 : y.id;
321
321
  if (!r)
322
322
  return;
@@ -347,7 +347,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
347
347
  fileIds: d
348
348
  }, w), ie({
349
349
  [r]: []
350
- }), (b = oe.current) == null || b.update();
350
+ }), (k = oe.current) == null || k.update();
351
351
  });
352
352
  T(() => {
353
353
  var r;
@@ -410,7 +410,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
410
410
  netOpen: H ? 1 : 2
411
411
  }).then((i) => {
412
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
+ b == null || b(i), U(!1), I(!!((a = i.data) != null && a.netOpen)), Q(!!((s = i.data) != null && s.enableNetOpen)), r(je(i, t));
414
414
  });
415
415
  });
416
416
  }), je = (t, n) => {
@@ -426,8 +426,8 @@ ${t}` : t, a = new J(i, r, G.User, n);
426
426
  he(!0), F == null || F.postTicket(a).then((d) => {
427
427
  F.uploadMinioFile(d.minio, n).then(() => {
428
428
  var R, $;
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}`);
429
+ const w = (R = d.minio.endpoints) == null ? void 0 : R[0], y = d.minio.bucket, k = ($ = d.minio.fileKeys) == null ? void 0 : $[0];
430
+ i(`${location.protocol}//${w}/${y}/${k}`);
431
431
  }).catch(() => {
432
432
  te(""), q(void 0);
433
433
  }).finally(() => {
@@ -512,14 +512,14 @@ ${t}` : t, a = new J(i, r, G.User, n);
512
512
  return;
513
513
  I(t);
514
514
  }
515
- }), be = () => z(void 0, null, function* () {
515
+ }), ke = () => z(void 0, null, function* () {
516
516
  e ? e.fetchData().then((t) => {
517
517
  var n;
518
518
  (n = e == null ? void 0 : e.data) != null && n.id && (I(t.netOpen), Q(t.enableNetOpen));
519
519
  }) : (I(!1), Q(o.arrange[0].enableNetOpen));
520
520
  });
521
521
  T(() => {
522
- be();
522
+ ke();
523
523
  }, [e]), T(() => {
524
524
  var t, n;
525
525
  if (P.current) {
@@ -547,7 +547,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
547
547
  ).map((a, s) => {
548
548
  var w, y;
549
549
  let d = "";
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
+ return typeof (l == null ? void 0 : l.promptVariables) == "object" && (d = ((y = (w = l.promptVariables.default) == null ? void 0 : w.find((k) => k.key === a.key)) == null ? void 0 : y.value) || ""), {
551
551
  id: s + "",
552
552
  key: a.key,
553
553
  name: a.name,
@@ -564,7 +564,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
564
564
  netOpen: H ? 1 : 2
565
565
  }).then((t) => {
566
566
  var n, r;
567
- return k == null || k(t), U(!1), I(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), t;
567
+ return b == null || b(t), U(!1), I(!!((n = t.data) != null && n.netOpen)), Q(!!((r = t.data) != null && r.enableNetOpen)), t;
568
568
  }), Ae = Zt(() => {
569
569
  var t;
570
570
  return o.arrange && ((t = o.arrange[0]) != null && t.openingContent) ? /* @__PURE__ */ c(rt, {
@@ -581,7 +581,8 @@ ${t}` : t, a = new J(i, r, G.User, n);
581
581
  actions: [],
582
582
  isLoading: !1
583
583
  },
584
- actions: !!h.length
584
+ actions: !!h.length,
585
+ markdown: l == null ? void 0 : l.markdown
585
586
  }) : null;
586
587
  }, [o == null ? void 0 : o.arrange, h]);
587
588
  return /* @__PURE__ */ A("div", {
@@ -592,7 +593,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
592
593
  currentSession: e,
593
594
  promptVariables: E,
594
595
  setPromptVariables: re,
595
- setCurrentSession: k
596
+ setCurrentSession: b
596
597
  }), /* @__PURE__ */ A("div", {
597
598
  className: "chat-main",
598
599
  id: "chat-main",
@@ -608,7 +609,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
608
609
  },
609
610
  ref: P,
610
611
  onScroll: jt,
611
- children: (Be = e == null ? void 0 : e.data) != null && Be.id && (h != null && h.length) ? /* @__PURE__ */ A(bn, {
612
+ children: (Be = e == null ? void 0 : e.data) != null && Be.id && (h != null && h.length) ? /* @__PURE__ */ A(kn, {
612
613
  dataLength: h.length,
613
614
  next: Bt,
614
615
  style: {
@@ -640,7 +641,8 @@ ${t}` : t, a = new J(i, r, G.User, n);
640
641
  isLastHistory: n === 0,
641
642
  onRelatedClick: $t,
642
643
  onAgainClick: At,
643
- onEditClick: Vt
644
+ onEditClick: Vt,
645
+ markdown: l == null ? void 0 : l.markdown
644
646
  }, t.messageId + n)), !Oe && Ae]
645
647
  }) : /* @__PURE__ */ A("div", {
646
648
  className: "main-empty",
@@ -778,14 +780,14 @@ ${t}` : t, a = new J(i, r, G.User, n);
778
780
  isFirstSession: Me,
779
781
  docViewerUrl: v,
780
782
  onStatusChange: (t) => z(void 0, null, function* () {
781
- t !== "process" ? (se(!0), be()) : se(!1);
783
+ t !== "process" ? (se(!0), ke()) : se(!1);
782
784
  }),
783
785
  createSession: () => new Promise((t) => {
784
786
  U(!0), x == null || x({
785
787
  netOpen: H ? 1 : 2
786
788
  }).then((n) => {
787
789
  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));
790
+ b == null || b(n), U(!1), I(!!((i = n.data) != null && i.netOpen)), Q(!!((a = n.data) != null && a.enableNetOpen));
789
791
  const r = ((s = n.data) == null ? void 0 : s.id) || "";
790
792
  t(r);
791
793
  });
@@ -819,7 +821,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
819
821
  const t = (n = e == null ? void 0 : e.data) == null ? void 0 : n.id;
820
822
  t && (ie({
821
823
  [t]: []
822
- }), be());
824
+ }), ke());
823
825
  }
824
826
  }) : null, (f == null ? void 0 : f.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ c(wn, {
825
827
  appId: o.id,
@@ -831,7 +833,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
831
833
  disabled: M
832
834
  })]
833
835
  }), /* @__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, {
836
+ 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, {
835
837
  sessionId: (Xe = e == null ? void 0 : e.data) == null ? void 0 : Xe.id,
836
838
  netStatus: H,
837
839
  enable: typeof (l == null ? void 0 : l.connectNetwork) == "object" && typeof (l == null ? void 0 : l.connectNetwork.diabled) == "boolean" ? !(l != null && l.connectNetwork.diabled) : Pt,
@@ -842,7 +844,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
842
844
  }), (f == null ? void 0 : f.sessionList) && /* @__PURE__ */ c(vn, {
843
845
  currentSessionId: (Ze = e == null ? void 0 : e.data) == null ? void 0 : Ze.id,
844
846
  onSessionChange: (t, n) => {
845
- W(void 0), k == null || k(n);
847
+ W(void 0), b == null || b(n);
846
848
  },
847
849
  disabled: M
848
850
  }), (f == null ? void 0 : f.sessionOpen) && /* @__PURE__ */ c(_, {
@@ -852,7 +854,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
852
854
  disabled: De || !e || !h.length || M,
853
855
  onClick: () => {
854
856
  var t, n;
855
- k == null || k(void 0), I(!1), (t = Pe.current) == null || t.clear(), (n = pe.current) == null || n.clear();
857
+ b == null || b(void 0), I(!1), (t = Pe.current) == null || t.clear(), (n = pe.current) == null || n.clear();
856
858
  },
857
859
  children: "新会话"
858
860
  })]
@@ -862,7 +864,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
862
864
  children: /* @__PURE__ */ c(dn, {
863
865
  ref: me,
864
866
  maxLength: ht,
865
- text: kt,
867
+ text: bt,
866
868
  networkStatus: !1,
867
869
  loading: Ue,
868
870
  disabled: Le || Ne || M || Ue,
@@ -870,7 +872,7 @@ ${t}` : t, a = new J(i, r, G.User, n);
870
872
  onChange: (t, n) => {
871
873
  W(t);
872
874
  const r = n.getText().replace(/[\n\s]+$/, "");
873
- S(r), bt(r), Ee || yt(!0);
875
+ S(r), kt(r), Ee || yt(!0);
874
876
  },
875
877
  clearAction: /* @__PURE__ */ c(le, {
876
878
  size: 0,
package/dist/es/index.mjs CHANGED
@@ -1,28 +1,28 @@
1
- var Z = Object.defineProperty, q = Object.defineProperties;
2
- var ee = Object.getOwnPropertyDescriptors;
3
- var J = Object.getOwnPropertySymbols;
4
- var ie = Object.prototype.hasOwnProperty, te = Object.prototype.propertyIsEnumerable;
5
- var w = (g, i, s) => i in g ? Z(g, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : g[i] = s, o = (g, i) => {
1
+ var Y = Object.defineProperty, Z = Object.defineProperties;
2
+ var q = Object.getOwnPropertyDescriptors;
3
+ var P = Object.getOwnPropertySymbols;
4
+ var ee = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
5
+ var w = (g, i, s) => i in g ? Y(g, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : g[i] = s, o = (g, i) => {
6
6
  for (var s in i || (i = {}))
7
- ie.call(i, s) && w(g, s, i[s]);
8
- if (J)
9
- for (var s of J(i))
10
- te.call(i, s) && w(g, s, i[s]);
7
+ ee.call(i, s) && w(g, s, i[s]);
8
+ if (P)
9
+ for (var s of P(i))
10
+ ie.call(i, s) && w(g, s, i[s]);
11
11
  return g;
12
- }, m = (g, i) => q(g, ee(i));
12
+ }, m = (g, i) => Z(g, q(i));
13
13
  var a = (g, i, s) => (w(g, typeof i != "symbol" ? i + "" : i, s), s);
14
- import { jsx as Q, Fragment as oe } from "react/jsx-runtime";
14
+ import { jsx as J, Fragment as te } from "react/jsx-runtime";
15
15
  import l from "lodash/merge";
16
- import G from "react-dom";
17
- import se from "./AgentClientUI.mjs";
18
- import { notification as K } from "antd";
19
- import ne from "axios";
20
- import { defaultUIConfig as re, defaultApiUrl as he, defaultDovViewerUrl as ae } from "./constant.mjs";
21
- import { ApiUrl as ge } from "./types.mjs";
22
- /* empty css */import { BotClientApi as le } from "@glodon-aiot/apis";
23
- import { JWT as de, isExpired as fe } from "./utils/index.mjs";
16
+ import Q from "react-dom";
17
+ import oe from "./AgentClientUI.mjs";
18
+ import { notification as G } from "antd";
19
+ import se from "axios";
20
+ import { defaultUIConfig as ne, defaultApiUrl as re, defaultDovViewerUrl as he } from "./constant.mjs";
21
+ import { ApiUrl as ae } from "./types.mjs";
22
+ /* empty css */import { BotClientApi as ge } from "@glodon-aiot/apis";
23
+ import { JWT as le, isExpired as de } from "./utils/index.mjs";
24
24
  const b = {};
25
- class xe {
25
+ class ye {
26
26
  constructor(i) {
27
27
  a(this, "_token");
28
28
  a(this, "_activeSession", null);
@@ -36,10 +36,10 @@ class xe {
36
36
  a(this, "service");
37
37
  a(this, "rId", 0);
38
38
  a(this, "_mode", "float");
39
- a(this, "uiConfig", re);
39
+ a(this, "uiConfig", ne);
40
40
  a(this, "errorHandlers", {});
41
41
  a(this, "wrapper", document.createElement("div"));
42
- var _, y, x, U, S, B, H, z, L, M, V, A, N, E, F, D, j, T, R, W, $, O, P;
42
+ var _, y, x, U, S, B, H, z, L, M, V, A, N, E, F, D, j, T, R, W, $, O;
43
43
  const {
44
44
  env: s,
45
45
  token: d,
@@ -51,42 +51,42 @@ class xe {
51
51
  errorHandlers: r,
52
52
  features: e,
53
53
  sessionId: u,
54
- icon: X,
55
- logo: Y
54
+ icon: K,
55
+ logo: X
56
56
  // greeting,
57
57
  } = i;
58
- this.uiConfig.icon = X || this.uiConfig.icon, this.uiConfig.logo = Y || this.uiConfig.logo, (e == null ? void 0 : e.greeting) !== void 0 && (typeof e.greeting == "object" ? this.uiConfig.features = m(o({}, this.uiConfig.features), {
58
+ this.uiConfig.icon = K || this.uiConfig.icon, this.uiConfig.logo = X || this.uiConfig.logo, (e == null ? void 0 : e.greeting) !== void 0 && (typeof e.greeting == "object" ? this.uiConfig.features = m(o({}, this.uiConfig.features), {
59
59
  greeting: o(o({}, typeof ((_ = this.uiConfig.features) == null ? void 0 : _.greeting) != "object" ? {} : (y = this.uiConfig.features) == null ? void 0 : y.greeting), e.greeting)
60
60
  }) : this.uiConfig.features = m(o({}, this.uiConfig.features), {
61
61
  greeting: e.greeting
62
- })), console.log("this.uiConfig.features?.greeting", (x = this.uiConfig.features) == null ? void 0 : x.greeting), this._token = d, this.rId = 0, this._defatulSessionId = u, this.errorHandlers = o(o({}, this.errorHandlers), r);
62
+ })), this._token = d, this.rId = 0, this._defatulSessionId = u, this.errorHandlers = o(o({}, this.errorHandlers), r);
63
63
  const k = {
64
64
  sessionOpen: f === "float",
65
65
  sessionList: f === "float"
66
- }, I = (B = (S = (U = e == null ? void 0 : e.botMessageBox) == null ? void 0 : U.footer) == null ? void 0 : S.items) == null ? void 0 : B.find((c) => c.componentName === "AnswerAgain");
67
- (L = (z = (H = e == null ? void 0 : e.botMessageBox) == null ? void 0 : H.footer) == null ? void 0 : z.items) == null || L.find((c) => c.componentName === "Copy");
66
+ }, I = (S = (U = (x = e == null ? void 0 : e.botMessageBox) == null ? void 0 : x.footer) == null ? void 0 : U.items) == null ? void 0 : S.find((c) => c.componentName === "AnswerAgain");
67
+ (z = (H = (B = e == null ? void 0 : e.botMessageBox) == null ? void 0 : B.footer) == null ? void 0 : H.items) == null || z.find((c) => c.componentName === "Copy");
68
68
  const C = {
69
69
  sessionList: e == null ? void 0 : e.sessionList,
70
70
  sessionOpen: e == null ? void 0 : e.newSession,
71
71
  fileUpload: e == null ? void 0 : e.fileUpload,
72
- userCopy: (M = e == null ? void 0 : e.userMessageBox) == null ? void 0 : M.copy,
73
- userEdit: (V = e == null ? void 0 : e.userMessageBox) == null ? void 0 : V.editAgain,
72
+ userCopy: (L = e == null ? void 0 : e.userMessageBox) == null ? void 0 : L.copy,
73
+ userEdit: (M = e == null ? void 0 : e.userMessageBox) == null ? void 0 : M.editAgain,
74
74
  userPrompt: e == null ? void 0 : e.fileUpload,
75
75
  prompt: e == null ? void 0 : e.prompts,
76
- relate: (A = e == null ? void 0 : e.botMessageBox) == null ? void 0 : A.relatedQuesions,
76
+ relate: (V = e == null ? void 0 : e.botMessageBox) == null ? void 0 : V.relatedQuesions,
77
77
  again: !(I && I.visible === !1),
78
78
  reference: {
79
- iconVisible: (E = (N = e == null ? void 0 : e.botMessageBox) == null ? void 0 : N.reference) == null ? void 0 : E.file,
80
- referenceFirst: (F = e == null ? void 0 : e.botMessageBox) == null ? void 0 : F.referenceFirst,
81
- isExpand: (j = (D = e == null ? void 0 : e.botMessageBox) == null ? void 0 : D.reference) == null ? void 0 : j.itemExpanded
79
+ iconVisible: (N = (A = e == null ? void 0 : e.botMessageBox) == null ? void 0 : A.reference) == null ? void 0 : N.file,
80
+ referenceFirst: (E = e == null ? void 0 : e.botMessageBox) == null ? void 0 : E.referenceFirst,
81
+ isExpand: (D = (F = e == null ? void 0 : e.botMessageBox) == null ? void 0 : F.reference) == null ? void 0 : D.itemExpanded
82
82
  },
83
- searchReference: (T = e == null ? void 0 : e.botMessageBox) == null ? void 0 : T.searchReference,
83
+ searchReference: (j = e == null ? void 0 : e.botMessageBox) == null ? void 0 : j.searchReference,
84
84
  knowledges: !!(e != null && e.knowledges),
85
85
  metadata: e == null ? void 0 : e.metadata,
86
86
  greet: (e == null ? void 0 : e.greeting) !== !1,
87
87
  imageUpload: e == null ? void 0 : e.imageUpload,
88
- promptVariables: (e == null ? void 0 : e.promptVariables) === void 0 ? (R = this.uiConfig.transform) == null ? void 0 : R.promptVariables : (e == null ? void 0 : e.promptVariables) === !0 || typeof (e == null ? void 0 : e.promptVariables) == "object" && ((W = e == null ? void 0 : e.promptVariables) == null ? void 0 : W.visible) !== !1 ? ($ = this.uiConfig.transform) == null ? void 0 : $.promptVariables : !1,
89
- connectNetwork: (e == null ? void 0 : e.connectNetwork) === void 0 ? (O = this.uiConfig.transform) == null ? void 0 : O.connectNetwork : (e == null ? void 0 : e.connectNetwork) === !0 || (typeof (e == null ? void 0 : e.connectNetwork) == "object" && typeof (e == null ? void 0 : e.connectNetwork.visible) == "boolean" ? e == null ? void 0 : e.connectNetwork.visible : (P = this.uiConfig.transform) == null ? void 0 : P.connectNetwork)
88
+ promptVariables: (e == null ? void 0 : e.promptVariables) === void 0 ? (T = this.uiConfig.transform) == null ? void 0 : T.promptVariables : (e == null ? void 0 : e.promptVariables) === !0 || typeof (e == null ? void 0 : e.promptVariables) == "object" && ((R = e == null ? void 0 : e.promptVariables) == null ? void 0 : R.visible) !== !1 ? (W = this.uiConfig.transform) == null ? void 0 : W.promptVariables : !1,
89
+ connectNetwork: (e == null ? void 0 : e.connectNetwork) === void 0 ? ($ = this.uiConfig.transform) == null ? void 0 : $.connectNetwork : (e == null ? void 0 : e.connectNetwork) === !0 || (typeof (e == null ? void 0 : e.connectNetwork) == "object" && typeof (e == null ? void 0 : e.connectNetwork.visible) == "boolean" ? e == null ? void 0 : e.connectNetwork.visible : (O = this.uiConfig.transform) == null ? void 0 : O.connectNetwork)
90
90
  }, v = {
91
91
  sider: f === "inlay"
92
92
  };
@@ -122,7 +122,7 @@ class xe {
122
122
  transform: o(o(o(o({}, this.uiConfig.transform), k), i.transform), C)
123
123
  }), this.uiConfig.getContainer().append(this.wrapper);
124
124
  }
125
- this._mode = f, this.env = s || "prod", this._applicationId = de(d).rid, this.apiUrl = n || ge[this.env] || he, this.docViewerUrl = t || ae, this.service = this.setService(), this.render();
125
+ this._mode = f, this.env = s || "prod", this._applicationId = le(d).rid, this.apiUrl = n || ae[this.env] || re, this.docViewerUrl = t || he, this.service = this.setService(), this.render();
126
126
  }
127
127
  get token() {
128
128
  return this._token;
@@ -174,7 +174,7 @@ class xe {
174
174
  const r = this.token;
175
175
  if (!r)
176
176
  return t;
177
- if (fe(r)) {
177
+ if (de(r)) {
178
178
  const u = "token is timeout";
179
179
  this.errorHandlers.token ? typeof this.errorHandlers.token == "function" ? this.errorHandlers.token(
180
180
  // @ts-ignore
@@ -191,7 +191,7 @@ class xe {
191
191
  }), t;
192
192
  };
193
193
  function d(t, r = !0) {
194
- const e = `${i}${t}`, u = ne.create({
194
+ const e = `${i}${t}`, u = se.create({
195
195
  baseURL: e
196
196
  });
197
197
  return r && u.interceptors.request.use(s), u;
@@ -210,13 +210,13 @@ class xe {
210
210
  ) : console.error("errorHandlers.token is not a function") : console.error(e);
211
211
  }
212
212
  }, p = (t, r, e) => {
213
- t !== 10001 && t !== 10215 && (e || (K.config({
213
+ t !== 10001 && t !== 10215 && (e || (G.config({
214
214
  getContainer: this.uiConfig.getContainer
215
- }), K.error({
215
+ }), G.error({
216
216
  message: r
217
217
  })));
218
218
  }, h = d("");
219
- return new le(h, () => this.token, {
219
+ return new ge(h, () => this.token, {
220
220
  onHttpStatusError: f,
221
221
  onAppStatusError: p
222
222
  });
@@ -243,7 +243,7 @@ class xe {
243
243
  render() {
244
244
  var s, d, f, p;
245
245
  let i = this.wrapper.getBoundingClientRect().height;
246
- this.wrapper.style.height = `${i}px`, G.render(/* @__PURE__ */ Q(se, {
246
+ this.wrapper.style.height = `${i}px`, Q.render(/* @__PURE__ */ J(oe, {
247
247
  rId: this.rId,
248
248
  sessionId: this._defatulSessionId,
249
249
  showHeader: this.uiConfig.showHeader,
@@ -339,9 +339,9 @@ class xe {
339
339
  }), this.wrapper), this._defaultInputText = "";
340
340
  }
341
341
  destroy(i) {
342
- G.render(/* @__PURE__ */ Q(oe, {}), this.wrapper, i);
342
+ Q.render(/* @__PURE__ */ J(te, {}), this.wrapper, i);
343
343
  }
344
344
  }
345
345
  export {
346
- xe as default
346
+ ye as default
347
347
  };
@@ -1,42 +1,44 @@
1
1
  import { jsx as f, jsxs as h, Fragment as O } from "react/jsx-runtime";
2
- var m = Object.defineProperty, g = Object.defineProperties, j = Object.getOwnPropertyDescriptors, l = Object.getOwnPropertySymbols, u = Object.prototype.hasOwnProperty, d = Object.prototype.propertyIsEnumerable, s = (r, e, a) => e in r ? m(r, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[e] = a, p = (r, e) => {
3
- for (var a in e || (e = {}))
4
- u.call(e, a) && s(r, a, e[a]);
2
+ var g = Object.defineProperty, m = Object.defineProperties, j = Object.getOwnPropertyDescriptors, l = Object.getOwnPropertySymbols, u = Object.prototype.hasOwnProperty, d = Object.prototype.propertyIsEnumerable, v = (r, e, n) => e in r ? g(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n, w = (r, e) => {
3
+ for (var n in e || (e = {}))
4
+ u.call(e, n) && v(r, n, e[n]);
5
5
  if (l)
6
- for (var a of l(e))
7
- d.call(e, a) && s(r, a, e[a]);
6
+ for (var n of l(e))
7
+ d.call(e, n) && v(r, n, e[n]);
8
8
  return r;
9
- }, y = (r, e) => g(r, j(e)), x = (r, e) => {
10
- var a = {};
11
- for (var t in r)
12
- u.call(r, t) && e.indexOf(t) < 0 && (a[t] = r[t]);
9
+ }, y = (r, e) => m(r, j(e)), x = (r, e) => {
10
+ var n = {};
11
+ for (var a in r)
12
+ u.call(r, a) && e.indexOf(a) < 0 && (n[a] = r[a]);
13
13
  if (r != null && l)
14
- for (var t of l(r))
15
- e.indexOf(t) < 0 && d.call(r, t) && (a[t] = r[t]);
16
- return a;
14
+ for (var a of l(r))
15
+ e.indexOf(a) < 0 && d.call(r, a) && (n[a] = r[a]);
16
+ return n;
17
17
  };
18
18
  const P = (r) => {
19
- var e, a;
20
- const t = r, {
19
+ var e, n;
20
+ const a = r, {
21
21
  node: o
22
- } = t, i = x(t, [
22
+ } = a, i = x(a, [
23
23
  "node"
24
24
  ]);
25
25
  if (o.tagName === "a" && ((e = o.children) == null ? void 0 : e.length) > 0) {
26
- const v = ((a = o.children[0]) == null ? void 0 : a.value) || "";
27
- let w = /(^https?:\/\/|^www\.)(?:www\.)?[\w\-]+(\.[\w\-]+)+(\/[\w\- .\/?%&=]*)?/g, c = v.match(w), b = v.replace(w, "").trim();
26
+ const p = ((n = o.children[0]) == null ? void 0 : n.value) || "";
27
+ let s = /(^https?:\/\/|^www\.)(?:www\.)?[\w\-]+(\.[\w\-]+)+(\/[\w\- .\/?%&=]*)?/g, c = p.match(s), b = p.replace(s, "").trim();
28
28
  if (!(c != null && c.length))
29
- return /* @__PURE__ */ f("a", p({}, i));
30
- const n = c[0];
29
+ return /* @__PURE__ */ f("a", w({}, i));
30
+ const t = c[0];
31
31
  return /* @__PURE__ */ h(O, {
32
- children: [/* @__PURE__ */ f("a", y(p({}, i), {
33
- href: /^www\./.test(n) ? "//" + n : n,
34
- children: n
32
+ children: [/* @__PURE__ */ f("a", y(w({
33
+ href: /^www\./.test(t) ? "//" + t : t,
34
+ onClick: () => window.open(r.href, r.target || "_blank")
35
+ }, i), {
36
+ children: t
35
37
  })), b]
36
38
  });
37
39
  }
38
- return /* @__PURE__ */ f("a", p({}, i));
39
- }, k = P;
40
+ return /* @__PURE__ */ f("a", w({}, i));
41
+ }, A = P;
40
42
  export {
41
- k as default
43
+ A as default
42
44
  };
@@ -1,28 +1,28 @@
1
- import { jsx as e, jsxs as p, Fragment as f } from "react/jsx-runtime";
2
- import { Image as b } from "antd";
1
+ import { jsx as e, jsxs as v, Fragment as d } from "react/jsx-runtime";
2
+ import { Image as g } from "antd";
3
3
  import "../../../../../../../node_modules/antd-mobile/es/global/index.mjs";
4
- import u from "../../../../../../../node_modules/antd-mobile/es/components/image-viewer/index.mjs";
5
- import { useState as c, useEffect as v } from "react";
6
- import { isMobile as y } from "../../../../../../../node_modules/react-device-detect/dist/lib.mjs";
7
- import d from "../Video/index.mjs";
8
- import { checkMediaType as g } from "../../../utils/markdown/index.mjs";
9
- var j = Object.defineProperty, O = Object.defineProperties, w = Object.getOwnPropertyDescriptors, l = Object.getOwnPropertySymbols, h = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable, a = (r, o, t) => o in r ? j(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t, x = (r, o) => {
4
+ import y from "../../../../../../../node_modules/antd-mobile/es/components/image-viewer/index.mjs";
5
+ import { useState as i, useEffect as O } from "react";
6
+ import { isMobile as j } from "../../../../../../../node_modules/react-device-detect/dist/lib.mjs";
7
+ import h from "../Video/index.mjs";
8
+ import { checkMediaType as w } from "../../../utils/markdown/index.mjs";
9
+ var P = Object.defineProperty, k = Object.defineProperties, x = Object.getOwnPropertyDescriptors, m = Object.getOwnPropertySymbols, C = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable, p = (r, o, t) => o in r ? P(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t, l = (r, o) => {
10
10
  for (var t in o || (o = {}))
11
- h.call(o, t) && a(r, t, o[t]);
12
- if (l)
13
- for (var t of l(o))
14
- k.call(o, t) && a(r, t, o[t]);
11
+ C.call(o, t) && p(r, t, o[t]);
12
+ if (m)
13
+ for (var t of m(o))
14
+ E.call(o, t) && p(r, t, o[t]);
15
15
  return r;
16
- }, P = (r, o) => O(r, w(o));
17
- const C = (r) => {
18
- const [o, t] = c(!1), [n, i] = c();
19
- return v(() => {
20
- r.src && i(g(r.src));
21
- }, [r.src]), n == "video" ? /* @__PURE__ */ e(d, {
16
+ }, f = (r, o) => k(r, x(o));
17
+ const M = (r) => {
18
+ const [o, t] = i(!1), [b, u] = i();
19
+ return O(() => {
20
+ r.src && u(w(r.src));
21
+ }, [r.src]), b == "video" ? /* @__PURE__ */ e(h, {
22
22
  src: r.src,
23
23
  controls: !0
24
- }) : y ? /* @__PURE__ */ p(f, {
25
- children: [/* @__PURE__ */ e("img", {
24
+ }) : j ? /* @__PURE__ */ v(d, {
25
+ children: [/* @__PURE__ */ e("img", l({
26
26
  style: {
27
27
  maxWidth: "100%"
28
28
  },
@@ -30,27 +30,29 @@ const C = (r) => {
30
30
  onClick: () => {
31
31
  t(!0);
32
32
  }
33
- }), /* @__PURE__ */ e(u, {
33
+ }, r)), /* @__PURE__ */ e(y, {
34
34
  image: (r == null ? void 0 : r.src) || "",
35
35
  visible: o,
36
36
  onClose: () => {
37
37
  t(!1);
38
38
  }
39
39
  })]
40
- }) : /* @__PURE__ */ e(b, P(x({
40
+ }) : /* @__PURE__ */ e(g, f(l({
41
41
  style: {
42
42
  maxWidth: "100%"
43
43
  }
44
44
  }, r), {
45
- onClick: (m) => {
46
- var s;
47
- return (s = r.onClick) == null ? void 0 : s.call(r, m);
45
+ onClick: (s) => {
46
+ var a, n, c;
47
+ (c = r.onClick) == null || c.call(r, f(l({}, s), {
48
+ target: (n = (a = s.target) == null ? void 0 : a.offsetParent) == null ? void 0 : n.children[0]
49
+ }));
48
50
  },
49
51
  onError: () => {
50
52
  console.log(r), console.warn("图片加载失败");
51
53
  }
52
54
  }));
53
- }, T = C;
55
+ }, _ = M;
54
56
  export {
55
- T as default
57
+ _ as default
56
58
  };