@glodon-aiot/agent-cli-ui 3.0.10 → 3.0.11-alpha.1

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.
@@ -1,97 +1,97 @@
1
- import { jsxs as s, jsx as e } from "../../_virtual/jsx-runtime.mjs";
2
- import { memo as d, useContext as le, useState as se } from "react";
1
+ import { jsxs as r, jsx as e } from "../../_virtual/jsx-runtime.mjs";
2
+ import { memo as d, useContext as se, useState as re } from "react";
3
3
  import c from "../../InputProgress/index.mjs";
4
- import re from "../SessionRefer/index.mjs";
5
- import ae from "../SessionAction/index.mjs";
6
- import { IHistoryRole as P, IThinkingStatus as Q } from "@glodon-aiot/apis";
7
- import oe from "../../FileItem/index.mjs";
8
- import { Popover as de, Space as q, Button as D, Row as ce, Col as pe, Collapse as V, Divider as me, message as W } from "antd";
9
- import ue from "../SearchReference/index.mjs";
4
+ import ae from "../SessionRefer/index.mjs";
5
+ import oe from "../SessionAction/index.mjs";
6
+ import { IHistoryRole as Q, IThinkingStatus as q } from "@glodon-aiot/apis";
7
+ import de from "../../FileItem/index.mjs";
8
+ import { Popover as ce, Space as D, Button as V, Row as pe, Col as me, Collapse as W, Divider as ue, message as G } from "antd";
9
+ import he from "../SearchReference/index.mjs";
10
10
  import "./style.less.mjs";
11
- import he from "../HistoryContent/index.mjs";
12
- import ge from "../../components/Markdown/index.mjs";
13
- import Ne from "../../node_modules/classnames/index.mjs";
11
+ import ge from "../HistoryContent/index.mjs";
12
+ import Ne from "../../components/Markdown/index.mjs";
13
+ import fe from "../../node_modules/classnames/index.mjs";
14
14
  import p from "../../Iconfont/index.mjs";
15
- import { CheckOutlined as $, CloseOutlined as G, LoadingOutlined as fe } from "@ant-design/icons";
15
+ import { CheckOutlined as K, CloseOutlined as X, LoadingOutlined as ye } from "@ant-design/icons";
16
16
  import m from "../../components/JsonDisplay/index.mjs";
17
- import ye from "../../context.mjs";
17
+ import Le from "../../context.mjs";
18
18
  import Ce from "../SessionRelated/index.mjs";
19
- import Le from "../ReferCollapse/index.mjs";
20
- import ve from "../../node_modules/copy-to-clipboard/index.mjs";
21
- import Re from "./think.svg.mjs";
22
- import { escapeSlash as Se } from "../../utils/index.mjs";
23
- const be = (o) => {
19
+ import ve from "../ReferCollapse/index.mjs";
20
+ import Re from "../../node_modules/copy-to-clipboard/index.mjs";
21
+ import be from "../../assets/think.svg.mjs";
22
+ import { escapeSlash as Ee } from "../../utils/index.mjs";
23
+ const Se = (o) => {
24
24
  if (!o)
25
25
  return o;
26
26
  try {
27
27
  return JSON.parse(o);
28
- } catch (r) {
28
+ } catch (a) {
29
29
  return o;
30
30
  }
31
- }, Ee = d(ue), K = d(re), C = d(ge);
32
- d(he);
33
- const ke = d(oe);
34
- d(Le);
31
+ }, ke = d(he), Y = d(ae), L = d(Ne);
32
+ d(ge);
33
+ const Te = d(de);
34
+ d(ve);
35
35
  const u = (o) => {
36
36
  if (!o)
37
37
  return !1;
38
38
  try {
39
- const r = JSON.parse(o);
40
- return !(r != null && r.code && (r.code < 200 || r.code > 300));
41
- } catch (r) {
39
+ const a = JSON.parse(o);
40
+ return !(a != null && a.code && (a.code < 200 || a.code > 300));
41
+ } catch (a) {
42
42
  return !0;
43
43
  }
44
- }, X = (o) => {
44
+ }, Z = (o) => {
45
45
  var t;
46
- const r = JSON.parse(JSON.stringify(o)) || [], a = (t = r == null ? void 0 : r.pop()) == null ? void 0 : t.pop();
47
- return a ? (a == null ? void 0 : a.type) === "BEFORE_CALL" || (a == null ? void 0 : a.type) === "FUNCTION_CALL" : !1;
48
- }, Ke = (o) => {
49
- var S, b, E, k, T, A, x, O, F;
46
+ const a = JSON.parse(JSON.stringify(o)) || [], l = (t = a == null ? void 0 : a.pop()) == null ? void 0 : t.pop();
47
+ return l ? (l == null ? void 0 : l.type) === "BEFORE_CALL" || (l == null ? void 0 : l.type) === "FUNCTION_CALL" : !1;
48
+ }, Ye = (o) => {
49
+ var b, E, S, k, T, A, O, x, F, _;
50
50
  const {
51
- application: r,
52
- currentSession: a,
51
+ application: a,
52
+ currentSession: l,
53
53
  history: t,
54
54
  isLastHistory: h,
55
- onRelatedClick: Y,
56
- onAgainClick: Z,
57
- isLoading: Te,
55
+ onRelatedClick: $,
56
+ onAgainClick: ee,
57
+ isLoading: Ae,
58
58
  docViewerUrl: g,
59
59
  onEditClick: N
60
60
  } = o, {
61
- debug: L,
61
+ debug: C,
62
62
  transform: i,
63
63
  popupContainer: f
64
- } = le(ye), v = t.role === P.User, R = t.role === P.Robot, {
65
- Panel: ee
66
- } = V, [y, te] = se(!0), ne = () => {
67
- W.config({
64
+ } = se(Le), v = t.role === Q.User, R = t.role === Q.Robot, {
65
+ Panel: te
66
+ } = W, [y, ne] = re(!0), ie = () => {
67
+ G.config({
68
68
  getContainer: () => (f == null ? void 0 : f.current) || document.body
69
- }), ve(t.content), W.success("复制成功");
69
+ }), Re(t.content), G.success("复制成功");
70
70
  };
71
- return /* @__PURE__ */ s("div", {
72
- className: Ne({
71
+ return /* @__PURE__ */ r("div", {
72
+ className: fe({
73
73
  "history-item": !0,
74
74
  "history-item__user": v,
75
75
  "history-item__bot": R
76
76
  }),
77
- children: [v && /* @__PURE__ */ s("div", {
77
+ children: [v && /* @__PURE__ */ r("div", {
78
78
  className: "history-item-user",
79
79
  children: [/* @__PURE__ */ e("div", {
80
80
  className: "item-user-panel",
81
- children: /* @__PURE__ */ e(de, {
81
+ children: /* @__PURE__ */ e(ce, {
82
82
  placement: "topLeft",
83
83
  overlayStyle: {
84
84
  padding: 4
85
85
  },
86
86
  overlayClassName: "session-item-overlay-popover",
87
87
  getPopupContainer: (n) => n.parentNode,
88
- content: i != null && i.userEdit || i != null && i.userCopy ? /* @__PURE__ */ s(q, {
88
+ content: i != null && i.userEdit || i != null && i.userCopy ? /* @__PURE__ */ r(D, {
89
89
  className: "item-user-popover",
90
90
  size: 4,
91
91
  children: [(i == null ? void 0 : i.userEdit) && /* @__PURE__ */ e("div", {
92
92
  className: "user-pannel-item",
93
93
  onClick: () => N == null ? void 0 : N(t.content),
94
- children: /* @__PURE__ */ e(D, {
94
+ children: /* @__PURE__ */ e(V, {
95
95
  type: "link",
96
96
  size: "small",
97
97
  icon: /* @__PURE__ */ e(p, {
@@ -100,8 +100,8 @@ const u = (o) => {
100
100
  })
101
101
  }), (i == null ? void 0 : i.userCopy) && /* @__PURE__ */ e("div", {
102
102
  className: "user-pannel-item",
103
- onClick: ne,
104
- children: /* @__PURE__ */ e(D, {
103
+ onClick: ie,
104
+ children: /* @__PURE__ */ e(V, {
105
105
  type: "link",
106
106
  size: "small",
107
107
  icon: /* @__PURE__ */ e(p, {
@@ -117,24 +117,24 @@ const u = (o) => {
117
117
  className: "user-panel-main",
118
118
  children: /* @__PURE__ */ e("span", {
119
119
  className: "item-user-content",
120
- children: /* @__PURE__ */ e(C, {
120
+ children: /* @__PURE__ */ e(L, {
121
121
  showLatex: !1,
122
- children: Se(t.content)
122
+ children: Ee(t.content)
123
123
  })
124
124
  })
125
125
  })
126
126
  })
127
127
  }), /* @__PURE__ */ e("div", {
128
128
  className: "item-user-file",
129
- children: /* @__PURE__ */ e(ce, {
129
+ children: /* @__PURE__ */ e(pe, {
130
130
  gutter: [12, 12],
131
131
  justify: "end",
132
132
  wrap: !0,
133
- children: (S = t.files) == null ? void 0 : S.map((n) => /* @__PURE__ */ e(pe, {
133
+ children: (b = t.files) == null ? void 0 : b.map((n) => /* @__PURE__ */ e(me, {
134
134
  className: "user-file-col",
135
- children: /* @__PURE__ */ e(ke, {
135
+ children: /* @__PURE__ */ e(Te, {
136
136
  docViewerUrl: g,
137
- currentSession: a,
137
+ currentSession: l,
138
138
  file: n
139
139
  })
140
140
  }, n.id))
@@ -142,51 +142,51 @@ const u = (o) => {
142
142
  })]
143
143
  }), R && /* @__PURE__ */ e("div", {
144
144
  className: "history-item-bot",
145
- children: /* @__PURE__ */ s("div", {
145
+ children: /* @__PURE__ */ r("div", {
146
146
  className: "bot-content-wrapper",
147
- children: [r.type === 2 && /* @__PURE__ */ s("div", {
147
+ children: [a.type === 2 && /* @__PURE__ */ r("div", {
148
148
  className: "item-bot-plugin",
149
- children: [/* @__PURE__ */ e(V, {
149
+ children: [/* @__PURE__ */ e(W, {
150
150
  ghost: !0,
151
151
  expandIconPosition: "right",
152
- children: (b = t.actions) == null ? void 0 : b.map((n, ie) => {
153
- var _, I, U, z, j, B, w, M, H, J;
154
- return /* @__PURE__ */ s(ee, {
155
- collapsible: L ? "header" : "icon",
156
- showArrow: L,
157
- header: /* @__PURE__ */ s(q, {
152
+ children: (E = t.actions) == null ? void 0 : E.map((n, le) => {
153
+ var I, U, z, j, B, w, M, J, P, H;
154
+ return /* @__PURE__ */ r(te, {
155
+ collapsible: C ? "header" : "icon",
156
+ showArrow: C,
157
+ header: /* @__PURE__ */ r(D, {
158
158
  size: 8,
159
159
  style: {
160
160
  width: "100%"
161
161
  },
162
- children: [/* @__PURE__ */ s("span", {
162
+ children: [/* @__PURE__ */ r("span", {
163
163
  className: "bot-plugin-status",
164
- children: [(n[n.length - 1].type === "RESULT" || n[n.length - 1].type === "AFTER_CALL") && u((_ = n.find((l) => l.type === "RESULT")) == null ? void 0 : _.data.result) && /* @__PURE__ */ e("span", {
164
+ children: [(n[n.length - 1].type === "RESULT" || n[n.length - 1].type === "AFTER_CALL") && u((I = n.find((s) => s.type === "RESULT")) == null ? void 0 : I.data.result) && /* @__PURE__ */ e("span", {
165
165
  className: "plugin-status-success",
166
- children: /* @__PURE__ */ e($, {})
166
+ children: /* @__PURE__ */ e(K, {})
167
167
  }), n[n.length - 1].type === "ABORT" && /* @__PURE__ */ e("span", {
168
168
  className: "plugin-status-error",
169
- children: /* @__PURE__ */ e(G, {})
170
- }), (n[n.length - 1].type === "RESULT" || n[n.length - 1].type === "AFTER_CALL") && !u((I = n.find((l) => l.type === "RESULT")) == null ? void 0 : I.data.result) && /* @__PURE__ */ e("span", {
169
+ children: /* @__PURE__ */ e(X, {})
170
+ }), (n[n.length - 1].type === "RESULT" || n[n.length - 1].type === "AFTER_CALL") && !u((U = n.find((s) => s.type === "RESULT")) == null ? void 0 : U.data.result) && /* @__PURE__ */ e("span", {
171
171
  className: "plugin-status-error",
172
- children: /* @__PURE__ */ e(G, {})
172
+ children: /* @__PURE__ */ e(X, {})
173
173
  }), (n[n.length - 1].type === "BEFORE_CALL" || n[n.length - 1].type === "FUNCTION_CALL") && /* @__PURE__ */ e("span", {
174
174
  className: "plugin-status-loading",
175
- children: /* @__PURE__ */ e(fe, {})
175
+ children: /* @__PURE__ */ e(ye, {})
176
176
  })]
177
177
  }), /* @__PURE__ */ e("span", {
178
178
  className: "bot-plugin-title",
179
- children: (U = n[n.length - 1].data) == null ? void 0 : U.pluginName
179
+ children: (z = n[n.length - 1].data) == null ? void 0 : z.pluginName
180
180
  }), /* @__PURE__ */ e("span", {
181
181
  className: "bot-plugin-action",
182
- children: (z = n[n.length - 1].data) == null ? void 0 : z.funcName
182
+ children: (j = n[n.length - 1].data) == null ? void 0 : j.funcName
183
183
  }), (n[n.length - 1].type === "BEFORE_CALL" || n[n.length - 1].type === "FUNCTION_CALL") && /* @__PURE__ */ e("span", {
184
184
  className: "bot-plugin-result",
185
185
  children: "执行中"
186
- }), (n[n.length - 1].type === "RESULT" || n[n.length - 1].type === "AFTER_CALL") && u((j = n.find((l) => l.type === "RESULT")) == null ? void 0 : j.data.result) && /* @__PURE__ */ e("span", {
186
+ }), (n[n.length - 1].type === "RESULT" || n[n.length - 1].type === "AFTER_CALL") && u((B = n.find((s) => s.type === "RESULT")) == null ? void 0 : B.data.result) && /* @__PURE__ */ e("span", {
187
187
  className: "bot-plugin-result",
188
188
  children: "执行成功"
189
- }), (n[n.length - 1].type === "RESULT" || n[n.length - 1].type === "AFTER_CALL") && !u((B = n.find((l) => l.type === "RESULT")) == null ? void 0 : B.data.result) && /* @__PURE__ */ e("span", {
189
+ }), (n[n.length - 1].type === "RESULT" || n[n.length - 1].type === "AFTER_CALL") && !u((w = n.find((s) => s.type === "RESULT")) == null ? void 0 : w.data.result) && /* @__PURE__ */ e("span", {
190
190
  className: "bot-plugin-result",
191
191
  children: "执行失败"
192
192
  }), n[n.length - 1].type === "ABORT" && /* @__PURE__ */ e("span", {
@@ -200,7 +200,7 @@ const u = (o) => {
200
200
  }), /* @__PURE__ */ e("div", {
201
201
  className: "bot-plugin-json",
202
202
  children: /* @__PURE__ */ e(m, {
203
- josn: (w = n.find((l) => l.type === "BEFORE_CALL")) == null ? void 0 : w.data.thought
203
+ josn: (M = n.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : M.data.thought
204
204
  })
205
205
  }), /* @__PURE__ */ e("div", {
206
206
  className: "bot-plugin-content",
@@ -208,7 +208,7 @@ const u = (o) => {
208
208
  }), /* @__PURE__ */ e("div", {
209
209
  className: "bot-plugin-json",
210
210
  children: /* @__PURE__ */ e(m, {
211
- josn: (M = n.find((l) => l.type === "BEFORE_CALL")) == null ? void 0 : M.data.parameters
211
+ josn: (J = n.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : J.data.parameters
212
212
  })
213
213
  }), /* @__PURE__ */ e("div", {
214
214
  className: "bot-plugin-content",
@@ -216,7 +216,7 @@ const u = (o) => {
216
216
  }), /* @__PURE__ */ e("div", {
217
217
  className: "bot-plugin-json",
218
218
  children: /* @__PURE__ */ e(m, {
219
- josn: (H = n.find((l) => l.type === "BEFORE_CALL")) == null ? void 0 : H.data.requestBody
219
+ josn: (P = n.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : P.data.requestBody
220
220
  })
221
221
  }), /* @__PURE__ */ e("div", {
222
222
  className: "bot-plugin-content",
@@ -224,44 +224,44 @@ const u = (o) => {
224
224
  }), /* @__PURE__ */ e("div", {
225
225
  className: "bot-plugin-json",
226
226
  children: /* @__PURE__ */ e(m, {
227
- josn: be((J = n.find((l) => l.type === "RESULT")) == null ? void 0 : J.data.result)
227
+ josn: Se((H = n.find((s) => s.type === "RESULT")) == null ? void 0 : H.data.result)
228
228
  })
229
229
  })]
230
- }, ie);
230
+ }, le);
231
231
  })
232
232
  }), t.isLoading && /* @__PURE__ */ e("div", {
233
233
  className: "history-input-progress",
234
234
  style: {
235
235
  padding: "4px 0"
236
236
  },
237
- children: X(t.actions) ? null : /* @__PURE__ */ e(c, {
237
+ children: Z(t.actions) ? null : /* @__PURE__ */ e(c, {
238
238
  size: 4,
239
239
  text: "思考中"
240
240
  })
241
241
  })]
242
- }), /* @__PURE__ */ e("div", {
242
+ }), ((S = l == null ? void 0 : l.data) == null ? void 0 : S.netOpen) && /* @__PURE__ */ e("div", {
243
243
  className: "item-bot-net",
244
- children: /* @__PURE__ */ e(Ee, {
244
+ children: /* @__PURE__ */ e(ke, {
245
245
  history: t
246
246
  })
247
- }), (E = t == null ? void 0 : t.reference) != null && E.length && ((k = i == null ? void 0 : i.reference) != null && k.referenceFirst) ? /* @__PURE__ */ e(K, {
247
+ }), (k = t == null ? void 0 : t.reference) != null && k.length && ((T = i == null ? void 0 : i.reference) != null && T.referenceFirst) ? /* @__PURE__ */ e(Y, {
248
248
  history: t,
249
249
  docViewerUrl: g
250
- }) : null, /* @__PURE__ */ s("div", {
250
+ }) : null, /* @__PURE__ */ r("div", {
251
251
  className: "item-bot-content",
252
- children: [/* @__PURE__ */ s("div", {
252
+ children: [/* @__PURE__ */ r("div", {
253
253
  className: "content-think",
254
- children: [(t == null ? void 0 : t.reasoningContent) && /* @__PURE__ */ s("div", {
254
+ children: [(t == null ? void 0 : t.reasoningContent) && /* @__PURE__ */ r("div", {
255
255
  className: "think-top",
256
256
  onClick: () => {
257
- te(!y);
257
+ ne(!y);
258
258
  },
259
259
  children: [/* @__PURE__ */ e("img", {
260
- src: Re,
260
+ src: be,
261
261
  alt: ""
262
262
  }), (t == null ? void 0 : t.reasoningContent) && !(t != null && t.content) && /* @__PURE__ */ e("span", {
263
263
  children: "我正在推理思考…"
264
- }), (t == null ? void 0 : t.reasoningContent) && t.content && /* @__PURE__ */ s("span", {
264
+ }), (t == null ? void 0 : t.reasoningContent) && t.content && /* @__PURE__ */ r("span", {
265
265
  children: ["已完成推理(用时 ", (t == null ? void 0 : t.thinkingSecs) || 0, " 秒)"]
266
266
  }), /* @__PURE__ */ e("span", {
267
267
  className: "think-action",
@@ -277,27 +277,27 @@ const u = (o) => {
277
277
  }
278
278
  })
279
279
  })]
280
- }), !!((T = t == null ? void 0 : t.reasoningContent) != null && T.trim()) && y && /* @__PURE__ */ s("div", {
280
+ }), !!((A = t == null ? void 0 : t.reasoningContent) != null && A.trim()) && y && /* @__PURE__ */ r("div", {
281
281
  className: "think-bottom",
282
- children: [/* @__PURE__ */ s("div", {
282
+ children: [/* @__PURE__ */ r("div", {
283
283
  className: "bottom-left",
284
- children: [(t == null ? void 0 : t.thinkingStatus) === Q.Start && /* @__PURE__ */ e("div", {
284
+ children: [(t == null ? void 0 : t.thinkingStatus) === q.Start && /* @__PURE__ */ e("div", {
285
285
  className: "thinking"
286
- }), (t == null ? void 0 : t.thinkingStatus) === Q.End && /* @__PURE__ */ e("div", {
286
+ }), (t == null ? void 0 : t.thinkingStatus) === q.End && /* @__PURE__ */ e("div", {
287
287
  className: "thinked",
288
- children: /* @__PURE__ */ e($, {})
288
+ children: /* @__PURE__ */ e(K, {})
289
289
  })]
290
290
  }), /* @__PURE__ */ e("div", {
291
291
  className: "bottom-right",
292
- children: /* @__PURE__ */ e(C, {
292
+ children: /* @__PURE__ */ e(L, {
293
293
  children: (t == null ? void 0 : t.reasoningContent) || ""
294
294
  })
295
295
  })]
296
296
  })]
297
- }), /* @__PURE__ */ e(C, {
297
+ }), /* @__PURE__ */ e(L, {
298
298
  children: t.content
299
299
  })]
300
- }), (A = t == null ? void 0 : t.reference) != null && A.length && !((x = i == null ? void 0 : i.reference) != null && x.referenceFirst) ? /* @__PURE__ */ e(K, {
300
+ }), (O = t == null ? void 0 : t.reference) != null && O.length && !((x = i == null ? void 0 : i.reference) != null && x.referenceFirst) ? /* @__PURE__ */ e(Y, {
301
301
  history: t,
302
302
  docViewerUrl: g
303
303
  }) : null, t.isRelatedQuestion && h ? /* @__PURE__ */ e("div", {
@@ -312,23 +312,23 @@ const u = (o) => {
312
312
  style: {
313
313
  padding: "4px 0"
314
314
  },
315
- children: X(t.actions) ? null : /* @__PURE__ */ e(c, {
315
+ children: Z(t.actions) ? null : /* @__PURE__ */ e(c, {
316
316
  size: 4,
317
317
  text: "思考中"
318
318
  })
319
- }), (i == null ? void 0 : i.relate) && h && !!((O = t.relatedQuesion) != null && O.length) && /* @__PURE__ */ e(Ce, {
319
+ }), (i == null ? void 0 : i.relate) && h && !!((F = t.relatedQuesion) != null && F.length) && /* @__PURE__ */ e(Ce, {
320
320
  relatedQuesion: t.relatedQuesion,
321
- onRelatedClick: Y
322
- }), !t.isSensitive && !!t.messageId && /* @__PURE__ */ e(ae, {
323
- appId: r.id,
321
+ onRelatedClick: $
322
+ }), !t.isSensitive && !!t.messageId && /* @__PURE__ */ e(oe, {
323
+ appId: a.id,
324
324
  history: t,
325
- sessionId: (F = a == null ? void 0 : a.data) == null ? void 0 : F.id,
326
- onAgainClick: Z,
325
+ sessionId: (_ = l == null ? void 0 : l.data) == null ? void 0 : _.id,
326
+ onAgainClick: ee,
327
327
  isLastHistory: h,
328
- currentSession: a
328
+ currentSession: l
329
329
  })]
330
330
  })
331
- }), t.isContext && /* @__PURE__ */ s(me, {
331
+ }), t.isContext && /* @__PURE__ */ r(ue, {
332
332
  children: [/* @__PURE__ */ e("div", {
333
333
  style: {
334
334
  color: "#84868C",
@@ -346,6 +346,6 @@ const u = (o) => {
346
346
  });
347
347
  };
348
348
  export {
349
- Ke as default,
349
+ Ye as default,
350
350
  u as isResultExec
351
351
  };
@@ -1,64 +1,75 @@
1
- import { jsxs as e, jsx as s } from "../../_virtual/jsx-runtime.mjs";
2
- import o from "../../Iconfont/index.mjs";
3
- import { useState as m } from "react";
1
+ import { jsx as e, jsxs as r, Fragment as d } from "../../_virtual/jsx-runtime.mjs";
2
+ import { useState as p } from "react";
3
+ import m from "../../assets/think.svg.mjs";
4
4
  import "./style.less.mjs";
5
- const v = (h) => {
6
- var a, c, i;
5
+ import { CheckOutlined as u, CloseOutlined as g } from "@ant-design/icons";
6
+ import { Collapse as l, Space as f } from "antd";
7
+ const {
8
+ Panel: N
9
+ } = l, C = (i) => {
10
+ var t;
7
11
  const {
8
12
  history: n
9
- } = h, [t, d] = m(!1);
10
- return /* @__PURE__ */ e("div", {
13
+ } = i, [h, o] = p(!1), s = n.searchingStatus ? n.searchingStatus : n.searchReference.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__ */ r("div", {
17
+ className: "item-bot-plugin",
14
18
  onClick: () => {
15
- d(!t);
19
+ o(!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__ */ r(d, {
22
+ children: [/* @__PURE__ */ e("img", {
23
+ src: m,
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(l, {
29
+ ghost: !0,
30
+ expandIconPosition: "right",
31
+ children: /* @__PURE__ */ e(N, {
32
+ collapsible: "icon",
33
+ showArrow: !!(s === "end" && n.searchReference.length),
34
+ header: /* @__PURE__ */ r(f, {
35
+ size: 8,
36
+ style: {
37
+ width: "100%"
38
+ },
39
+ children: [/* @__PURE__ */ r("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(u, {})
44
+ }), s === "end" && !n.searchReference.length && /* @__PURE__ */ e("span", {
45
+ className: "plugin-status-error",
46
+ children: /* @__PURE__ */ e(g, {})
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: (t = n.searchReference) == null ? void 0 : t.map((a, c) => /* @__PURE__ */ r("div", {
56
+ className: "text",
57
+ children: [/* @__PURE__ */ r("span", {
58
+ children: [c + 1, ". "]
59
+ }), /* @__PURE__ */ e("span", {
60
+ className: "link",
61
+ onClick: () => {
62
+ window.open(a.link);
63
+ },
64
+ children: a.title
65
+ })]
66
+ }, c))
67
+ })
68
+ }, "")
58
69
  })]
59
- })]
60
- });
70
+ })
71
+ }) : null;
61
72
  };
62
73
  export {
63
- v as default
74
+ C as default
64
75
  };