@glodon-aiot/agent-cli-ui 3.0.9 → 3.0.11-alpha.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.
@@ -2,16 +2,16 @@ var Mt = Object.defineProperty, jt = Object.defineProperties;
2
2
  var Vt = Object.getOwnPropertyDescriptors;
3
3
  var Xe = Object.getOwnPropertySymbols;
4
4
  var $t = Object.prototype.hasOwnProperty, At = Object.prototype.propertyIsEnumerable;
5
- var ve = (x, o, g) => o in x ? Mt(x, o, { enumerable: !0, configurable: !0, writable: !0, value: g }) : x[o] = g, ke = (x, o) => {
6
- for (var g in o || (o = {}))
7
- $t.call(o, g) && ve(x, g, o[g]);
5
+ var ve = (x, s, g) => s in x ? Mt(x, s, { enumerable: !0, configurable: !0, writable: !0, value: g }) : x[s] = g, ke = (x, s) => {
6
+ for (var g in s || (s = {}))
7
+ $t.call(s, g) && ve(x, g, s[g]);
8
8
  if (Xe)
9
- for (var g of Xe(o))
10
- At.call(o, g) && ve(x, g, o[g]);
9
+ for (var g of Xe(s))
10
+ At.call(s, g) && ve(x, g, s[g]);
11
11
  return x;
12
- }, we = (x, o) => jt(x, Vt(o));
13
- var P = (x, o, g) => (ve(x, typeof o != "symbol" ? o + "" : o, g), g);
14
- var z = (x, o, g) => new Promise((e, k) => {
12
+ }, we = (x, s) => jt(x, Vt(s));
13
+ var P = (x, s, g) => (ve(x, typeof s != "symbol" ? s + "" : s, g), g);
14
+ var z = (x, s, g) => new Promise((e, k) => {
15
15
  var ae = (w) => {
16
16
  try {
17
17
  O(g.next(w));
@@ -25,7 +25,7 @@ var z = (x, o, g) => new Promise((e, k) => {
25
25
  k(p);
26
26
  }
27
27
  }, O = (w) => w.done ? e(w.value) : Promise.resolve(w.value).then(ae, v);
28
- O((g = g.apply(x, o)).next());
28
+ O((g = g.apply(x, s)).next());
29
29
  });
30
30
  import { jsxs as W, jsx as a } from "../../_virtual/jsx-runtime.mjs";
31
31
  import { memo as Bt, useState as u, useRef as $, useContext as qt, useEffect as C } from "react";
@@ -59,7 +59,7 @@ const hi = Bt(Gt), gi = {
59
59
  text: "今天我能帮你什么?"
60
60
  };
61
61
  class Z {
62
- constructor(o, g, e, k) {
62
+ constructor(s, g, e, k) {
63
63
  P(this, "messageTime");
64
64
  P(this, "isWaiting");
65
65
  P(this, "messageId");
@@ -69,7 +69,7 @@ class Z {
69
69
  P(this, "isSensitive");
70
70
  P(this, "isSuspend");
71
71
  P(this, "comment");
72
- this.content = o, this.sessionId = g, this.role = e, this.files = k, this.content = o, this.role = e, this.sessionId = g, this.files = k, this.messageTime = Xt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = et(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
72
+ this.content = s, this.sessionId = g, this.role = e, this.files = k, this.content = s, this.role = e, this.sessionId = g, this.files = k, this.messageTime = Xt(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"), this.isWaiting = !1, this.messageId = et(), this.isContext = !1, this.actions = [], this.reference = [], this.isSensitive = !1, this.isSuspend = !1, this.comment = {
73
73
  isAgree: 0
74
74
  };
75
75
  }
@@ -77,7 +77,7 @@ class Z {
77
77
  const Se = 10, Ki = (x) => {
78
78
  var $e, Ae, Be, qe, Ke, We, Qe, Ye, _e;
79
79
  const {
80
- application: o,
80
+ application: s,
81
81
  docViewerUrl: g = "",
82
82
  currentSession: e,
83
83
  onCreateSession: k,
@@ -108,13 +108,13 @@ const Se = 10, Ki = (x) => {
108
108
  }), !((l = e == null ? void 0 : e.data) != null && l.id))
109
109
  return;
110
110
  if (j(!1), H(!1), (n = e.messages) != null && n.length) {
111
- const s = [...e.messages.filter((d) => d == null ? void 0 : d.messageId)].reverse();
112
- h.current = [...s], I([...s]);
111
+ const o = [...e.messages.filter((d) => d == null ? void 0 : d.messageId)].reverse();
112
+ h.current = [...o], I([...o]);
113
113
  }
114
114
  const i = (r) => {
115
- var s;
116
- (s = e == null ? void 0 : e.data) != null && s.id && (h.current = [...r].reverse(), I([...r].reverse()), !r || r.length < 10 ? X(!1) : X(!0), Le && Le({
117
- applicationId: o.id,
115
+ var o;
116
+ (o = e == null ? void 0 : e.data) != null && o.id && (h.current = [...r].reverse(), I([...r].reverse()), !r || r.length < 10 ? X(!1) : X(!0), Le && Le({
117
+ applicationId: s.id,
118
118
  sessionId: e.data.id,
119
119
  histories: r
120
120
  }));
@@ -143,7 +143,7 @@ const Se = 10, Ki = (x) => {
143
143
  }, [e]);
144
144
  const It = () => {
145
145
  var l;
146
- if (!((l = e == null ? void 0 : e.data) != null && l.id) || !(o != null && o.id))
146
+ if (!((l = e == null ? void 0 : e.data) != null && l.id) || !(s != null && s.id))
147
147
  return;
148
148
  const t = e.data.id, i = p[p.length - 1];
149
149
  if (i && i.isContext)
@@ -154,10 +154,10 @@ const Se = 10, Ki = (x) => {
154
154
  });
155
155
  };
156
156
  C(() => {
157
- o != null && o.id && (N == null || N.getRecommendQues(o.id).then((t) => {
157
+ s != null && s.id && (N == null || N.getRecommendQues(s.id).then((t) => {
158
158
  rt(t);
159
159
  }));
160
- }, [it, o]);
160
+ }, [it, s]);
161
161
  const Me = (t) => z(void 0, null, function* () {
162
162
  var b, m;
163
163
  if (D)
@@ -194,10 +194,10 @@ const Se = 10, Ki = (x) => {
194
194
  le(!0);
195
195
  const r = B ? `![](${B})
196
196
  ${i}` : i;
197
- let s;
197
+ let o;
198
198
  try {
199
- M ? s = yield M == null ? void 0 : M({
200
- applicationId: o.id,
199
+ M ? o = yield M == null ? void 0 : M({
200
+ applicationId: s.id,
201
201
  sessionId: n,
202
202
  message: {
203
203
  content: r,
@@ -205,30 +205,30 @@ ${i}` : i;
205
205
  role: Ze.User,
206
206
  files: te[n]
207
207
  }
208
- }) : s = !0;
208
+ }) : o = !0;
209
209
  } catch (y) {
210
- s = !1;
210
+ o = !1;
211
211
  }
212
- if (le(!1), s === !1)
212
+ if (le(!1), o === !1)
213
213
  return;
214
214
  let d = i;
215
- typeof s == "object" && (d = s.content || i), ((m = te[n]) == null ? void 0 : m.length) > 0 ? Nt(d) : me(d);
215
+ typeof o == "object" && (d = o.content || i), ((m = te[n]) == null ? void 0 : m.length) > 0 ? Nt(d) : me(d);
216
216
  }), Lt = (t) => new Promise((i, l) => z(void 0, null, function* () {
217
- const s = (t == null ? void 0 : t.promptVariables).filter((d) => d.key !== "query").map((d) => {
217
+ const o = (t == null ? void 0 : t.promptVariables).filter((d) => d.key !== "query").map((d) => {
218
218
  var m;
219
219
  const b = (m = F.find((y) => y.key === d.key)) == null ? void 0 : m.value;
220
220
  return d.value = b || "", d;
221
221
  });
222
- se(s.sort((d, b) => d.key.localeCompare(b.key))), yield t == null ? void 0 : t.setPromptVariables(s), i();
222
+ se(o.sort((d, b) => d.key.localeCompare(b.key))), yield t == null ? void 0 : t.setPromptVariables(o), i();
223
223
  })), Nt = (t) => {
224
- var s, d, b;
225
- if (oe(!1), !((s = e == null ? void 0 : e.data) != null && s.id) || !(o != null && o.id))
224
+ var o, d, b;
225
+ if (oe(!1), !((o = e == null ? void 0 : e.data) != null && o.id) || !(s != null && s.id))
226
226
  return;
227
227
  const i = ((d = e.data) == null ? void 0 : d.id) || "", l = [];
228
228
  let n = [], r = /* @__PURE__ */ new Set();
229
229
  (b = te[i]) == null || b.forEach((m) => {
230
230
  r.has(m.id) || (n.push(m), r.add(m.id));
231
- }), Promise.all(n.map((m) => N == null ? void 0 : N.patchApplicationIdKnowledgeIdFileId(o == null ? void 0 : o.id, i, m.id, {
231
+ }), Promise.all(n.map((m) => N == null ? void 0 : N.patchApplicationIdKnowledgeIdFileId(s == null ? void 0 : s.id, i, m.id, {
232
232
  enabled: 1
233
233
  }).then((y) => {
234
234
  l.push(m);
@@ -248,7 +248,7 @@ ${t}` : t;
248
248
  let n;
249
249
  try {
250
250
  M ? n = yield M == null ? void 0 : M({
251
- applicationId: o.id,
251
+ applicationId: s.id,
252
252
  sessionId: e.id,
253
253
  message: {
254
254
  content: l,
@@ -274,13 +274,13 @@ ${t}` : t;
274
274
  j(!0), H(!0);
275
275
  const n = B ? `![](${B})
276
276
  ${t}` : t, r = new Z(n, l, Y.User, i);
277
- J(void 0), q(void 0), h.current = [r, ...p], I(h.current), o.id && S && S({
278
- applicationId: o.id,
277
+ J(void 0), q(void 0), h.current = [r, ...p], I(h.current), s.id && S && S({
278
+ applicationId: s.id,
279
279
  sessionId: l,
280
280
  message: r
281
281
  });
282
- const s = new Z("", l, Y.System);
283
- s.isWaiting = !0, h.current = [s, ...h.current], I(h.current);
282
+ const o = new Z("", l, Y.System);
283
+ o.isWaiting = !0, h.current = [o, ...h.current], I(h.current);
284
284
  const d = (i == null ? void 0 : i.map((E) => E.id)) || [], b = {
285
285
  stream: !0,
286
286
  referenceFirst: !1
@@ -312,12 +312,12 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
312
312
  return _t.error({
313
313
  message: n.content
314
314
  });
315
- const r = n.actions || [], s = new Z(n.content, t, Y.Robot);
316
- s.messageId = n.messageId, s.reasoningContent = n.reasoningContent, s.searchReference = n.searchReference, s.thinkingSecs = n.thinkingSecs, s.thinkingStatus = n.thinkingStatus, s.actions = r, s.isLoading = !0, h.current = h.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), n.index === void 0 && I([s, ...h.current]), n.code === 11915 && (H(!1), j(!1), s.isLoading = !1, s.content = "请您换个问题问我吧~", s.isSensitive = !0, I([s, ...h.current])), n.index === -2 && (H(!1), j(!1), s.isLoading = !1, s.content = "回答已中止~", s.isSuspend = !0, I([s, ...h.current])), n.index === -1 && (H(!1), j(!1), s.isLoading = !1, s.reference = n.reference, I([s, ...h.current]), o.id && S && S({
317
- applicationId: o.id,
315
+ const r = n.actions || [], o = new Z(n.content, t, Y.Robot);
316
+ o.messageId = n.messageId, o.reasoningContent = n.reasoningContent, o.searchReference = n.searchReference, o.thinkingSecs = n.thinkingSecs, o.thinkingStatus = n.thinkingStatus, o.actions = r, o.isLoading = !0, o.searchingStatus = n.searchingStatus, h.current = h.current.filter((d) => !d.isWaiting).filter((d) => !d.isReplying), n.index === void 0 && I([o, ...h.current]), n.code === 11915 && (H(!1), j(!1), o.isLoading = !1, o.content = "请您换个问题问我吧~", o.isSensitive = !0, I([o, ...h.current])), n.index === -2 && (H(!1), j(!1), o.isLoading = !1, o.content = "回答已中止~", o.isSuspend = !0, I([o, ...h.current])), n.index === -1 && (H(!1), j(!1), o.isLoading = !1, o.reference = n.reference, I([o, ...h.current]), s.id && S && S({
317
+ applicationId: s.id,
318
318
  sessionId: t,
319
- message: s
320
- })), n.index === -3 && (H(!1), j(!1), s.isLoading = !1, s.reference = n.reference, s.relatedQuesion = n.relatedQuesion, I([s, ...h.current]));
319
+ message: o
320
+ })), n.index === -3 && (H(!1), j(!1), o.isLoading = !1, o.reference = n.reference, o.relatedQuesion = n.relatedQuesion, I([o, ...h.current]));
321
321
  };
322
322
  return e.ready ? e.addEventListener("message:updated", i) : e.addEventListener("ready", () => {
323
323
  e.addEventListener("message:updated", i);
@@ -352,18 +352,18 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
352
352
  U(!0), k == null || k({
353
353
  netOpen: O ? 1 : 2
354
354
  }).then((n) => {
355
- var r, s;
356
- v == null || v(n), U(!1), w(!!((r = n.data) != null && r.netOpen)), K(!!((s = n.data) != null && s.enableNetOpen)), l(je(n, t));
355
+ var r, o;
356
+ v == null || v(n), U(!1), w(!!((r = n.data) != null && r.netOpen)), K(!!((o = n.data) != null && o.enableNetOpen)), l(je(n, t));
357
357
  });
358
358
  });
359
359
  }), je = (t, i) => {
360
360
  const l = ei(i.name);
361
361
  return new Promise((n) => {
362
- var s;
362
+ var o;
363
363
  const r = {
364
364
  files: [`${et()}.${l}`],
365
365
  isv: "minio",
366
- knowledgeId: ((s = t.data) == null ? void 0 : s.id) || "",
366
+ knowledgeId: ((o = t.data) == null ? void 0 : o.id) || "",
367
367
  type: 1
368
368
  };
369
369
  ue(!0), N == null || N.postTicket(r).then((d) => {
@@ -388,12 +388,12 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
388
388
  });
389
389
  }, [p]);
390
390
  const Et = (t, i) => new Promise((l) => {
391
- if (!i.file.url || !(o != null && o.id))
391
+ if (!i.file.url || !(s != null && s.id))
392
392
  return l();
393
393
  const n = we(ke({}, i.file), {
394
394
  type: 1
395
395
  });
396
- N == null || N.postApplicationIdSessionKnowledgeSessionFile(o == null ? void 0 : o.id, t, n).finally(() => {
396
+ N == null || N.postApplicationIdSessionKnowledgeSessionFile(s == null ? void 0 : s.id, t, n).finally(() => {
397
397
  var r;
398
398
  (r = ne.current) == null || r.update().finally(l);
399
399
  });
@@ -459,7 +459,7 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
459
459
  e ? e.fetchData().then((t) => {
460
460
  var i;
461
461
  (i = e == null ? void 0 : e.data) != null && i.id && (w(t.netOpen), K(t.enableNetOpen));
462
- }) : (w(!1), K(o.arrange[0].enableNetOpen));
462
+ }) : (w(!1), K(s.arrange[0].enableNetOpen));
463
463
  });
464
464
  C(() => {
465
465
  ye();
@@ -469,8 +469,8 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
469
469
  const l = document.getElementById("chat-main"), n = (t = T.current) == null ? void 0 : t.querySelector(".infinite-scroll-component__outerdiv"), r = (i = T.current) == null ? void 0 : i.querySelector(".infinite-scroll-component");
470
470
  if (!n || !r || !l)
471
471
  return;
472
- const s = l.offsetHeight;
473
- if (r.offsetHeight <= s) {
472
+ const o = l.offsetHeight;
473
+ if (r.offsetHeight <= o) {
474
474
  if (n.style.height === "100%")
475
475
  return;
476
476
  n.style.height = "100%";
@@ -487,17 +487,17 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
487
487
  const n = ((L == null ? void 0 : L.promptVariables) || []).filter(
488
488
  (r) => r.key !== "query" && r.status === 1
489
489
  // 只要求输入被引用的变量
490
- ).map((r, s) => {
490
+ ).map((r, o) => {
491
491
  var b, m;
492
492
  let d = "";
493
493
  return typeof (f == null ? void 0 : f.promptVariables) == "object" && (d = ((m = (b = f.promptVariables.default) == null ? void 0 : b.find((y) => y.key === r.key)) == null ? void 0 : m.value) || ""), {
494
- id: s + "",
494
+ id: o + "",
495
495
  key: r.key,
496
496
  name: r.name,
497
497
  value: d
498
498
  };
499
499
  });
500
- se([...n].sort((r, s) => r.key.localeCompare(s.key)));
500
+ se([...n].sort((r, o) => r.key.localeCompare(o.key)));
501
501
  };
502
502
  return L != null && L.ready ? t() : L == null || L.addEventListener("ready", t), () => {
503
503
  L == null || L.removeEventListener("ready", t);
@@ -515,7 +515,7 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
515
515
  className: "agent-chat",
516
516
  children: [(c == null ? void 0 : c.promptVariables) && /* @__PURE__ */ a(di, {
517
517
  ref: Re,
518
- appId: o.id,
518
+ appId: s.id,
519
519
  currentSession: e,
520
520
  promptVariables: F,
521
521
  setPromptVariables: se,
@@ -560,7 +560,7 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
560
560
  }),
561
561
  scrollableTarget: "scrollableDiv",
562
562
  children: p.map((t, i) => /* @__PURE__ */ a(hi, {
563
- application: o,
563
+ application: s,
564
564
  currentSession: e,
565
565
  history: t,
566
566
  docViewerUrl: g,
@@ -584,8 +584,8 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
584
584
  t != null && t.id && G(!0);
585
585
  const i = (l = e == null ? void 0 : e.data) == null ? void 0 : l.id;
586
586
  c != null && c.fileUpload ? (r = (n = ne.current) == null ? void 0 : n.clear()) == null || r.then(() => {
587
- var s;
588
- t != null && t.id && (i ? (s = Et(i, t)) == null || s.finally(() => {
587
+ var o;
588
+ t != null && t.id && (i ? (o = Et(i, t)) == null || o.finally(() => {
589
589
  G(!1);
590
590
  }) : (G(!1), U(!0), Ve()));
591
591
  }) : i ? G(!1) : (G(!1), U(!0), Ve());
@@ -647,7 +647,7 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
647
647
  className: "footer-upload-action",
648
648
  onClick: (t) => t.preventDefault(),
649
649
  children: [/* @__PURE__ */ W(re, {
650
- children: [o.type === 2 && (c == null ? void 0 : c.imageUpload) && /* @__PURE__ */ a(Qt, {
650
+ children: [s.type === 2 && (c == null ? void 0 : c.imageUpload) && /* @__PURE__ */ a(Qt, {
651
651
  disabled: !!_ || D,
652
652
  accept: ".jpg, .png, .jpeg,.bmp",
653
653
  listType: "picture-card",
@@ -691,8 +691,8 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
691
691
  })
692
692
  })
693
693
  })
694
- }), ae && (c != null && c.fileUpload) && (o != null && o.id) ? /* @__PURE__ */ a(ri, {
695
- appId: o == null ? void 0 : o.id,
694
+ }), ae && (c != null && c.fileUpload) && (s != null && s.id) ? /* @__PURE__ */ a(ri, {
695
+ appId: s == null ? void 0 : s.id,
696
696
  ref: ne,
697
697
  isFirstSession: Ue,
698
698
  docViewerUrl: g,
@@ -703,9 +703,9 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
703
703
  U(!0), k == null || k({
704
704
  netOpen: O ? 1 : 2
705
705
  }).then((i) => {
706
- var n, r, s;
706
+ var n, r, o;
707
707
  v == null || v(i), U(!1), w(!!((n = i.data) != null && n.netOpen)), K(!!((r = i.data) != null && r.enableNetOpen));
708
- const l = ((s = i.data) == null ? void 0 : s.id) || "";
708
+ const l = ((o = i.data) == null ? void 0 : o.id) || "";
709
709
  t(l);
710
710
  });
711
711
  }),
@@ -725,7 +725,7 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
725
725
  i && ie((n) => {
726
726
  const r = n[i] || [];
727
727
  return {
728
- [i]: r.filter((s) => s.id !== t)
728
+ [i]: r.filter((o) => o.id !== t)
729
729
  };
730
730
  });
731
731
  },
@@ -740,8 +740,8 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
740
740
  [t]: []
741
741
  }), ye());
742
742
  }
743
- }) : null, (c == null ? void 0 : c.prompt) && (o == null ? void 0 : o.id) && /* @__PURE__ */ a(oi, {
744
- appId: o.id,
743
+ }) : null, (c == null ? void 0 : c.prompt) && (s == null ? void 0 : s.id) && /* @__PURE__ */ a(oi, {
744
+ appId: s.id,
745
745
  list: [],
746
746
  search: Pe ? dt : "",
747
747
  onPromptSelect: (t) => {
@@ -750,7 +750,7 @@ ${t}` : t, r = new Z(n, l, Y.User, i);
750
750
  disabled: D
751
751
  })]
752
752
  }), /* @__PURE__ */ W(re, {
753
- children: [(c == null ? void 0 : c.connectNetwork) && o.type === 0 && ((We = o.arrange) == null ? void 0 : We.length) && !!o.arrange[0].enableNetOpen && /* @__PURE__ */ a(ui, {
753
+ children: [(c == null ? void 0 : c.connectNetwork) && s.type === 0 && ((We = s.arrange) == null ? void 0 : We.length) && !!s.arrange[0].enableNetOpen && /* @__PURE__ */ a(ui, {
754
754
  sessionId: (Qe = e == null ? void 0 : e.data) == null ? void 0 : Qe.id,
755
755
  netStatus: O,
756
756
  enable: typeof (f == null ? void 0 : f.connectNetwork) == "object" && typeof (f == null ? void 0 : f.connectNetwork.diabled) == "boolean" ? !(f != null && f.connectNetwork.diabled) : xt,
@@ -18,7 +18,7 @@ import ye from "../../context.mjs";
18
18
  import Ce from "../SessionRelated/index.mjs";
19
19
  import Le from "../ReferCollapse/index.mjs";
20
20
  import ve from "../../node_modules/copy-to-clipboard/index.mjs";
21
- import Re from "./think.svg.mjs";
21
+ import Re from "../../assets/think.svg.mjs";
22
22
  import { escapeSlash as Se } from "../../utils/index.mjs";
23
23
  const be = (o) => {
24
24
  if (!o)
@@ -1,64 +1,75 @@
1
- import { jsxs as e, jsx as s } from "../../_virtual/jsx-runtime.mjs";
2
- import o from "../../Iconfont/index.mjs";
1
+ import { jsx as e, jsxs as t, Fragment as p } from "../../_virtual/jsx-runtime.mjs";
3
2
  import { useState as m } from "react";
3
+ import u from "../../assets/think.svg.mjs";
4
4
  import "./style.less.mjs";
5
- const v = (h) => {
6
- var a, c, i;
5
+ import { CheckOutlined as g, CloseOutlined as f } from "@ant-design/icons";
6
+ import { Collapse as i, Space as N } from "antd";
7
+ const {
8
+ Panel: R
9
+ } = i, S = (o) => {
10
+ var r, a;
7
11
  const {
8
12
  history: n
9
- } = h, [t, d] = m(!1);
10
- return /* @__PURE__ */ e("div", {
13
+ } = o, [h, d] = m(!1), s = n.searchingStatus || ((r = n.searchReference) != null && r.length ? "end" : "");
14
+ return s ? /* @__PURE__ */ e("div", {
11
15
  className: "search-reference",
12
- children: [((a = n.searchReference) == null ? void 0 : a.length) > 0 ? /* @__PURE__ */ e("div", {
13
- className: "bot-net-panel",
16
+ children: /* @__PURE__ */ t("div", {
17
+ className: "item-bot-plugin",
14
18
  onClick: () => {
15
- d(!t);
19
+ d(!h);
16
20
  },
17
- children: [/* @__PURE__ */ e("span", {
18
- children: ["找到", n.searchReference.length, "篇资料参考"]
19
- }), /* @__PURE__ */ s("span", {
20
- className: "net-pannel-action",
21
- children: t ? /* @__PURE__ */ s(o, {
22
- type: "icon-zhankai",
23
- style: {
24
- fontSize: 16
25
- }
26
- }) : /* @__PURE__ */ s(o, {
27
- type: "icon-shouqi",
28
- style: {
29
- fontSize: 16
30
- }
31
- })
32
- })]
33
- }) : null, t && ((c = n.searchReference) == null ? void 0 : c.length) > 0 && /* @__PURE__ */ e("div", {
34
- className: "bot-net-main",
35
- children: [/* @__PURE__ */ s("div", {
36
- className: "text",
37
- children: "正在尝试为您在互联网搜索相关资料..."
38
- }), /* @__PURE__ */ s("div", {
39
- className: "text",
40
- children: "开始获取资料..."
41
- }), (i = n.searchReference) == null ? void 0 : i.map((l, r) => /* @__PURE__ */ e("div", {
42
- className: "text",
43
- children: [/* @__PURE__ */ e("span", {
44
- children: ["找到了第 ", r + 1, " 篇资料:"]
45
- }), /* @__PURE__ */ s("span", {
46
- className: "link",
47
- onClick: () => {
48
- window.open(l.link);
49
- },
50
- children: l.title
21
+ children: [s === "start" && /* @__PURE__ */ t(p, {
22
+ children: [/* @__PURE__ */ e("img", {
23
+ src: u,
24
+ alt: ""
25
+ }), /* @__PURE__ */ e("span", {
26
+ children: "正在搜索…"
51
27
  })]
52
- }, r)), /* @__PURE__ */ e("div", {
53
- className: "text",
54
- children: ["一共找到 ", n.searchReference.length, " 篇资料,正在阅读..."]
55
- }), /* @__PURE__ */ e("div", {
56
- className: "text",
57
- children: ["找到了 ", n.searchReference.length, " 篇资料作为参考:"]
28
+ }), s === "end" && /* @__PURE__ */ e(i, {
29
+ ghost: !0,
30
+ expandIconPosition: "right",
31
+ children: /* @__PURE__ */ e(R, {
32
+ collapsible: "icon",
33
+ showArrow: !!(s === "end" && n.searchReference.length),
34
+ header: /* @__PURE__ */ t(N, {
35
+ size: 8,
36
+ style: {
37
+ width: "100%"
38
+ },
39
+ children: [/* @__PURE__ */ t("span", {
40
+ className: "bot-plugin-status",
41
+ children: [s === "end" && n.searchReference.length > 0 && /* @__PURE__ */ e("span", {
42
+ className: "plugin-status-success",
43
+ children: /* @__PURE__ */ e(g, {})
44
+ }), s === "end" && !n.searchReference.length && /* @__PURE__ */ e("span", {
45
+ className: "plugin-status-error",
46
+ children: /* @__PURE__ */ e(f, {})
47
+ })]
48
+ }), s === "end" && /* @__PURE__ */ e("span", {
49
+ className: "bot-plugin-title",
50
+ children: n.searchReference.length ? `已搜索到${n.searchReference.length}个网页` : "未找到搜索内容,请检查搜索服务"
51
+ })]
52
+ }),
53
+ children: /* @__PURE__ */ e("div", {
54
+ className: "bot-net-main",
55
+ children: (a = n.searchReference) == null ? void 0 : a.map((c, l) => /* @__PURE__ */ t("div", {
56
+ className: "text",
57
+ children: [/* @__PURE__ */ t("span", {
58
+ children: [l + 1, ". "]
59
+ }), /* @__PURE__ */ e("span", {
60
+ className: "link",
61
+ onClick: () => {
62
+ window.open(c.link);
63
+ },
64
+ children: c.title
65
+ })]
66
+ }, l))
67
+ })
68
+ }, "")
58
69
  })]
59
- })]
60
- });
70
+ })
71
+ }) : null;
61
72
  };
62
73
  export {
63
- v as default
74
+ S as default
64
75
  };