@glodon-aiot/agent-cli-ui 3.2.10-beta.6 → 3.2.10-beta.8

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.
@@ -3,9 +3,9 @@ import { memo as d, useContext as re, useState as ae } from "react";
3
3
  import c from "../../InputProgress/index.mjs";
4
4
  import oe from "../SessionRefer/index.mjs";
5
5
  import de from "../SessionAction/index.mjs";
6
- import { IHistoryRole as H, IThinkingStatus as q } from "@glodon-aiot/apis";
6
+ import { IHistoryRole as q, IThinkingStatus as D } from "@glodon-aiot/apis";
7
7
  import ce from "../../FileItem/index.mjs";
8
- import { Popover as pe, Space as D, Button as V, Row as me, Col as ue, Collapse as W, Divider as he, message as G } from "antd";
8
+ import { Popover as pe, Space as V, Button as W, Row as me, Col as ue, Collapse as G, Divider as he, message as C } from "antd";
9
9
  import ge from "../SearchReference/index.mjs";
10
10
  /* empty css */import Ne from "../HistoryContent/index.mjs";
11
11
  import fe from "../../components/Markdown/index.mjs";
@@ -27,7 +27,7 @@ const ke = (o) => {
27
27
  } catch (l) {
28
28
  return o;
29
29
  }
30
- }, Te = d(ge), Y = d(oe), C = d(fe);
30
+ }, Te = d(ge), Y = d(oe), L = d(fe);
31
31
  d(Ne);
32
32
  const Ae = d(ce);
33
33
  d(Re);
@@ -45,7 +45,7 @@ const u = (o) => {
45
45
  const l = JSON.parse(JSON.stringify(o)) || [], a = (n = l == null ? void 0 : l.pop()) == null ? void 0 : n.pop();
46
46
  return a ? (a == null ? void 0 : a.type) === "BEFORE_CALL" || (a == null ? void 0 : a.type) === "FUNCTION_CALL" : !1;
47
47
  }, Ze = (o) => {
48
- var S, b, E, k, T, A, O, x, F, _;
48
+ var b, E, k, T, A, O, x, F, _, I;
49
49
  const {
50
50
  application: l,
51
51
  currentSession: a,
@@ -58,23 +58,25 @@ const u = (o) => {
58
58
  onEditClick: N,
59
59
  actions: ne = !0
60
60
  } = o, {
61
- debug: L,
61
+ debug: v,
62
62
  transform: i,
63
63
  popupContainer: f
64
- } = re(Le), v = n.role === H.User, R = n.role === H.Robot, {
64
+ } = re(Le), R = n.role === q.User, S = n.role === q.Robot, {
65
65
  Panel: te
66
- } = W, [y, ie] = ae(!0), le = () => {
67
- G.config({
66
+ } = G, [y, ie] = ae(!0), le = () => {
67
+ C.config({
68
68
  getContainer: () => (f == null ? void 0 : f.current) || document.body
69
- }), Se(n.content), G.success("复制成功");
69
+ }), Se(n.content), C.success("复制成功"), C.config({
70
+ getContainer: () => document.body
71
+ });
70
72
  };
71
73
  return /* @__PURE__ */ r("div", {
72
74
  className: ye({
73
75
  "history-item": !0,
74
- "history-item__user": v,
75
- "history-item__bot": R
76
+ "history-item__user": R,
77
+ "history-item__bot": S
76
78
  }),
77
- children: [v && /* @__PURE__ */ r("div", {
79
+ children: [R && /* @__PURE__ */ r("div", {
78
80
  className: "history-item-user",
79
81
  children: [/* @__PURE__ */ e("div", {
80
82
  className: "item-user-panel",
@@ -85,13 +87,13 @@ const u = (o) => {
85
87
  },
86
88
  overlayClassName: "session-item-overlay-popover",
87
89
  getPopupContainer: (t) => t.parentNode,
88
- content: i != null && i.userEdit || i != null && i.userCopy ? /* @__PURE__ */ r(D, {
90
+ content: i != null && i.userEdit || i != null && i.userCopy ? /* @__PURE__ */ r(V, {
89
91
  className: "item-user-popover",
90
92
  size: 4,
91
93
  children: [(i == null ? void 0 : i.userEdit) && /* @__PURE__ */ e("div", {
92
94
  className: "user-pannel-item",
93
95
  onClick: () => N == null ? void 0 : N(n.content),
94
- children: /* @__PURE__ */ e(V, {
96
+ children: /* @__PURE__ */ e(W, {
95
97
  type: "link",
96
98
  size: "small",
97
99
  icon: /* @__PURE__ */ e(p, {
@@ -101,7 +103,7 @@ const u = (o) => {
101
103
  }), (i == null ? void 0 : i.userCopy) && /* @__PURE__ */ e("div", {
102
104
  className: "user-pannel-item",
103
105
  onClick: le,
104
- children: /* @__PURE__ */ e(V, {
106
+ children: /* @__PURE__ */ e(W, {
105
107
  type: "link",
106
108
  size: "small",
107
109
  icon: /* @__PURE__ */ e(p, {
@@ -117,7 +119,7 @@ const u = (o) => {
117
119
  className: "user-panel-main",
118
120
  children: /* @__PURE__ */ e("span", {
119
121
  className: "item-user-content",
120
- children: /* @__PURE__ */ e(C, {
122
+ children: /* @__PURE__ */ e(L, {
121
123
  showLatex: !1,
122
124
  children: Ee(n.content)
123
125
  })
@@ -130,7 +132,7 @@ const u = (o) => {
130
132
  gutter: [12, 12],
131
133
  justify: "end",
132
134
  wrap: !0,
133
- children: (S = n.files) == null ? void 0 : S.map((t) => /* @__PURE__ */ e(ue, {
135
+ children: (b = n.files) == null ? void 0 : b.map((t) => /* @__PURE__ */ e(ue, {
134
136
  className: "user-file-col",
135
137
  children: /* @__PURE__ */ e(Ae, {
136
138
  docViewerUrl: g,
@@ -140,34 +142,34 @@ const u = (o) => {
140
142
  }, t.id))
141
143
  })
142
144
  })]
143
- }), R && /* @__PURE__ */ e("div", {
145
+ }), S && /* @__PURE__ */ e("div", {
144
146
  className: "history-item-bot",
145
147
  children: /* @__PURE__ */ r("div", {
146
148
  className: "bot-content-wrapper",
147
149
  children: [l.type === 2 && /* @__PURE__ */ r("div", {
148
150
  className: "item-bot-plugin",
149
- children: [/* @__PURE__ */ e(W, {
151
+ children: [/* @__PURE__ */ e(G, {
150
152
  ghost: !0,
151
153
  expandIconPosition: "right",
152
- children: (b = n.actions) == null ? void 0 : b.map((t, se) => {
153
- var I, U, z, j, B, w, M, J, P, Q;
154
+ children: (E = n.actions) == null ? void 0 : E.map((t, se) => {
155
+ var U, z, j, B, w, M, J, P, Q, H;
154
156
  return /* @__PURE__ */ r(te, {
155
- collapsible: L ? "header" : "icon",
156
- showArrow: L,
157
- header: /* @__PURE__ */ r(D, {
157
+ collapsible: v ? "header" : "icon",
158
+ showArrow: v,
159
+ header: /* @__PURE__ */ r(V, {
158
160
  size: 8,
159
161
  style: {
160
162
  width: "100%"
161
163
  },
162
164
  children: [/* @__PURE__ */ r("span", {
163
165
  className: "bot-plugin-status",
164
- children: [(t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && u((I = t.find((s) => s.type === "RESULT")) == null ? void 0 : I.data.result) && /* @__PURE__ */ e("span", {
166
+ children: [(t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && u((U = t.find((s) => s.type === "RESULT")) == null ? void 0 : U.data.result) && /* @__PURE__ */ e("span", {
165
167
  className: "plugin-status-success",
166
168
  children: /* @__PURE__ */ e(K, {})
167
169
  }), t[t.length - 1].type === "ABORT" && /* @__PURE__ */ e("span", {
168
170
  className: "plugin-status-error",
169
171
  children: /* @__PURE__ */ e(X, {})
170
- }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && !u((U = t.find((s) => s.type === "RESULT")) == null ? void 0 : U.data.result) && /* @__PURE__ */ e("span", {
172
+ }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && !u((z = t.find((s) => s.type === "RESULT")) == null ? void 0 : z.data.result) && /* @__PURE__ */ e("span", {
171
173
  className: "plugin-status-error",
172
174
  children: /* @__PURE__ */ e(X, {})
173
175
  }), (t[t.length - 1].type === "BEFORE_CALL" || t[t.length - 1].type === "FUNCTION_CALL") && /* @__PURE__ */ e("span", {
@@ -176,17 +178,17 @@ const u = (o) => {
176
178
  })]
177
179
  }), /* @__PURE__ */ e("span", {
178
180
  className: "bot-plugin-title",
179
- children: (z = t[t.length - 1].data) == null ? void 0 : z.pluginName
181
+ children: (j = t[t.length - 1].data) == null ? void 0 : j.pluginName
180
182
  }), /* @__PURE__ */ e("span", {
181
183
  className: "bot-plugin-action",
182
- children: (j = t[t.length - 1].data) == null ? void 0 : j.funcName
184
+ children: (B = t[t.length - 1].data) == null ? void 0 : B.funcName
183
185
  }), (t[t.length - 1].type === "BEFORE_CALL" || t[t.length - 1].type === "FUNCTION_CALL") && /* @__PURE__ */ e("span", {
184
186
  className: "bot-plugin-result",
185
187
  children: "执行中"
186
- }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && u((B = t.find((s) => s.type === "RESULT")) == null ? void 0 : B.data.result) && /* @__PURE__ */ e("span", {
188
+ }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && u((w = t.find((s) => s.type === "RESULT")) == null ? void 0 : w.data.result) && /* @__PURE__ */ e("span", {
187
189
  className: "bot-plugin-result",
188
190
  children: "执行成功"
189
- }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && !u((w = t.find((s) => s.type === "RESULT")) == null ? void 0 : w.data.result) && /* @__PURE__ */ e("span", {
191
+ }), (t[t.length - 1].type === "RESULT" || t[t.length - 1].type === "AFTER_CALL") && !u((M = t.find((s) => s.type === "RESULT")) == null ? void 0 : M.data.result) && /* @__PURE__ */ e("span", {
190
192
  className: "bot-plugin-result",
191
193
  children: "执行失败"
192
194
  }), t[t.length - 1].type === "ABORT" && /* @__PURE__ */ e("span", {
@@ -200,7 +202,7 @@ const u = (o) => {
200
202
  }), /* @__PURE__ */ e("div", {
201
203
  className: "bot-plugin-json",
202
204
  children: /* @__PURE__ */ e(m, {
203
- josn: (M = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : M.data.thought
205
+ josn: (J = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : J.data.thought
204
206
  })
205
207
  }), /* @__PURE__ */ e("div", {
206
208
  className: "bot-plugin-content",
@@ -208,7 +210,7 @@ const u = (o) => {
208
210
  }), /* @__PURE__ */ e("div", {
209
211
  className: "bot-plugin-json",
210
212
  children: /* @__PURE__ */ e(m, {
211
- josn: (J = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : J.data.parameters
213
+ josn: (P = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : P.data.parameters
212
214
  })
213
215
  }), /* @__PURE__ */ e("div", {
214
216
  className: "bot-plugin-content",
@@ -216,7 +218,7 @@ const u = (o) => {
216
218
  }), /* @__PURE__ */ e("div", {
217
219
  className: "bot-plugin-json",
218
220
  children: /* @__PURE__ */ e(m, {
219
- josn: (P = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : P.data.requestBody
221
+ josn: (Q = t.find((s) => s.type === "BEFORE_CALL")) == null ? void 0 : Q.data.requestBody
220
222
  })
221
223
  }), /* @__PURE__ */ e("div", {
222
224
  className: "bot-plugin-content",
@@ -224,7 +226,7 @@ const u = (o) => {
224
226
  }), /* @__PURE__ */ e("div", {
225
227
  className: "bot-plugin-json",
226
228
  children: /* @__PURE__ */ e(m, {
227
- josn: ke((Q = t.find((s) => s.type === "RESULT")) == null ? void 0 : Q.data.result)
229
+ josn: ke((H = t.find((s) => s.type === "RESULT")) == null ? void 0 : H.data.result)
228
230
  })
229
231
  })]
230
232
  }, se);
@@ -239,12 +241,12 @@ const u = (o) => {
239
241
  text: "思考中"
240
242
  })
241
243
  })]
242
- }), !!((E = n.searchReference) != null && E.length) && /* @__PURE__ */ e("div", {
244
+ }), !!((k = n.searchReference) != null && k.length) && /* @__PURE__ */ e("div", {
243
245
  className: "item-bot-net",
244
246
  children: /* @__PURE__ */ e(Te, {
245
247
  history: n
246
248
  })
247
- }), (k = n == null ? void 0 : n.reference) != null && k.length && ((T = i == null ? void 0 : i.reference) != null && T.referenceFirst) ? /* @__PURE__ */ e(Y, {
249
+ }), (T = n == null ? void 0 : n.reference) != null && T.length && ((A = i == null ? void 0 : i.reference) != null && A.referenceFirst) ? /* @__PURE__ */ e(Y, {
248
250
  history: n,
249
251
  docViewerUrl: g
250
252
  }) : null, /* @__PURE__ */ r("div", {
@@ -277,27 +279,27 @@ const u = (o) => {
277
279
  }
278
280
  })
279
281
  })]
280
- }), !!((A = n == null ? void 0 : n.reasoningContent) != null && A.trim()) && y && /* @__PURE__ */ r("div", {
282
+ }), !!((O = n == null ? void 0 : n.reasoningContent) != null && O.trim()) && y && /* @__PURE__ */ r("div", {
281
283
  className: "think-bottom",
282
284
  children: [/* @__PURE__ */ r("div", {
283
285
  className: "bottom-left",
284
- children: [(n == null ? void 0 : n.thinkingStatus) === q.Start && /* @__PURE__ */ e("div", {
286
+ children: [(n == null ? void 0 : n.thinkingStatus) === D.Start && /* @__PURE__ */ e("div", {
285
287
  className: "thinking"
286
- }), (n == null ? void 0 : n.thinkingStatus) === q.End && /* @__PURE__ */ e("div", {
288
+ }), (n == null ? void 0 : n.thinkingStatus) === D.End && /* @__PURE__ */ e("div", {
287
289
  className: "thinked",
288
290
  children: /* @__PURE__ */ e(K, {})
289
291
  })]
290
292
  }), /* @__PURE__ */ e("div", {
291
293
  className: "bottom-right",
292
- children: /* @__PURE__ */ e(C, {
294
+ children: /* @__PURE__ */ e(L, {
293
295
  children: (n == null ? void 0 : n.reasoningContent) || ""
294
296
  })
295
297
  })]
296
298
  })]
297
- }), /* @__PURE__ */ e(C, {
299
+ }), /* @__PURE__ */ e(L, {
298
300
  children: n.content
299
301
  })]
300
- }), (O = n == null ? void 0 : n.reference) != null && O.length && !((x = i == null ? void 0 : i.reference) != null && x.referenceFirst) ? /* @__PURE__ */ e(Y, {
302
+ }), (x = n == null ? void 0 : n.reference) != null && x.length && !((F = i == null ? void 0 : i.reference) != null && F.referenceFirst) ? /* @__PURE__ */ e(Y, {
301
303
  history: n,
302
304
  docViewerUrl: g
303
305
  }) : null, n.isRelatedQuestion && h ? /* @__PURE__ */ e("div", {
@@ -316,13 +318,13 @@ const u = (o) => {
316
318
  size: 4,
317
319
  text: "思考中"
318
320
  })
319
- }), l.arrange[0].recommendQuestionOpen && (i == null ? void 0 : i.relate) && h && !!((F = n.relatedQuesion) != null && F.length) && /* @__PURE__ */ e(ve, {
321
+ }), l.arrange[0].recommendQuestionOpen && (i == null ? void 0 : i.relate) && h && !!((_ = n.relatedQuesion) != null && _.length) && /* @__PURE__ */ e(ve, {
320
322
  relatedQuesion: n.relatedQuesion,
321
323
  onRelatedClick: $
322
324
  }), ne && !n.isSensitive && !!n.messageId && /* @__PURE__ */ e(de, {
323
325
  appId: l.id,
324
326
  history: n,
325
- sessionId: (_ = a == null ? void 0 : a.data) == null ? void 0 : _.id,
327
+ sessionId: (I = a == null ? void 0 : a.data) == null ? void 0 : I.id,
326
328
  onAgainClick: ee,
327
329
  isLastHistory: h,
328
330
  currentSession: a
@@ -1,6 +1,6 @@
1
1
  import { jsxs as r, jsx as n } from "react/jsx-runtime";
2
2
  import { useState as l, useContext as O, useEffect as D } from "react";
3
- import { Space as z, Popover as L, Popconfirm as M, Input as H, message as w, notification as u, Button as Q } from "antd";
3
+ import { Space as w, Popover as L, Popconfirm as M, Input as H, message as v, notification as u, Button as Q } from "antd";
4
4
  import m from "../../Iconfont/index.mjs";
5
5
  import $ from "copy-to-clipboard";
6
6
  import F from "classnames";
@@ -18,15 +18,15 @@ const J = [{
18
18
  id: 4,
19
19
  name: "其他原因"
20
20
  }], te = (P) => {
21
- var A;
21
+ var z;
22
22
  const {
23
- appId: v,
23
+ appId: x,
24
24
  history: t,
25
25
  isLastHistory: T = !1,
26
26
  sessionId: d,
27
27
  currentSession: i,
28
28
  onAgainClick: g
29
- } = P, [a, h] = l([]), [C, x] = l(), [_, I] = l(!1), [y, b] = l(!1), {
29
+ } = P, [a, h] = l([]), [C, I] = l(), [y, b] = l(!1), [_, A] = l(!1), {
30
30
  service: K,
31
31
  popupContainer: o,
32
32
  transform: N,
@@ -39,73 +39,75 @@ const J = [{
39
39
  D(() => {
40
40
  var e;
41
41
  k((e = t == null ? void 0 : t.comment) == null ? void 0 : e.isAgree);
42
- }, [(A = t == null ? void 0 : t.comment) == null ? void 0 : A.isAgree]);
42
+ }, [(z = t == null ? void 0 : t.comment) == null ? void 0 : z.isAgree]);
43
43
  const R = () => {
44
- w.config({
44
+ v.config({
45
45
  getContainer: () => (o == null ? void 0 : o.current) || document.body
46
- }), $(t.content), w.success("复制成功");
46
+ }), $(t.content), v.success("复制成功"), v.config({
47
+ getContainer: () => document.body
48
+ });
47
49
  }, S = (e) => {
48
50
  if (!d || !(t != null && t.messageId))
49
51
  return;
50
- const s = {
52
+ const c = {
51
53
  messageId: t.messageId,
52
54
  isAgree: e
53
55
  };
54
- i == null || i.postMessageComment(s).then(() => {
55
- k(e), t != null && t.comment && (t.comment.isAgree = e), !(e <= 0) && (b(!0), setTimeout(() => {
56
- b(!1);
56
+ i == null || i.postMessageComment(c).then(() => {
57
+ k(e), t != null && t.comment && (t.comment.isAgree = e), !(e <= 0) && (A(!0), setTimeout(() => {
58
+ A(!1);
57
59
  }, 2e3));
58
60
  }), p && p({
59
- applicationId: v,
61
+ applicationId: x,
60
62
  sessionId: d,
61
- comment: s
63
+ comment: c
62
64
  });
63
65
  }, j = (e) => {
64
- if (a.some((s) => s.id === e.id)) {
65
- const s = a.filter((c) => c.id !== e.id);
66
- h([...s]);
66
+ if (a.some((c) => c.id === e.id)) {
67
+ const c = a.filter((s) => s.id !== e.id);
68
+ h([...c]);
67
69
  } else
68
70
  h([...a, e]);
69
71
  }, B = (e) => {
70
- x(e.target.value);
72
+ I(e.target.value);
71
73
  }, E = () => {
72
74
  if (!d)
73
75
  return;
74
76
  if (!(a != null && a.length))
75
- return I(!0), Promise.reject();
77
+ return b(!0), Promise.reject();
76
78
  let e = [];
77
- a != null && a.length && (e = [...e, ...a.map((c) => c.name)]), C && (e = [...e, C]);
78
- const s = {
79
+ a != null && a.length && (e = [...e, ...a.map((s) => s.name)]), C && (e = [...e, C]);
80
+ const c = {
79
81
  messageId: t.messageId,
80
82
  isAgree: -1,
81
83
  againstReason: e
82
84
  };
83
85
  u.config({
84
86
  getContainer: () => (o == null ? void 0 : o.current) || document.body
85
- }), i == null || i.postMessageComment(s).then(() => {
87
+ }), i == null || i.postMessageComment(c).then(() => {
86
88
  k(-1), t != null && t.comment && (t.comment.isAgree = -1);
87
- const c = `open${Date.now()}`;
89
+ const s = `open${Date.now()}`;
88
90
  u.success({
89
91
  message: "提交反馈成功",
90
92
  description: "感谢您的参与,我们会认真评估每一条建议!",
91
93
  duration: 2,
92
94
  btn: /* @__PURE__ */ n(Q, {
93
95
  type: "primary",
94
- onClick: () => u.close(c),
96
+ onClick: () => u.close(s),
95
97
  children: "我知道了"
96
98
  }),
97
- key: c,
98
- onClose: () => u.close(c)
99
+ key: s,
100
+ onClose: () => u.close(s)
99
101
  });
100
102
  }), p && p({
101
- applicationId: v,
103
+ applicationId: x,
102
104
  sessionId: d,
103
- comment: s
105
+ comment: c
104
106
  });
105
107
  };
106
108
  return /* @__PURE__ */ r("div", {
107
109
  className: "session-action",
108
- children: [N != null && N.again && T ? /* @__PURE__ */ r(z, {
110
+ children: [N != null && N.again && T ? /* @__PURE__ */ r(w, {
109
111
  className: "session-action-again",
110
112
  onClick: () => g == null ? void 0 : g(),
111
113
  children: [/* @__PURE__ */ n(m, {
@@ -118,7 +120,7 @@ const J = [{
118
120
  })]
119
121
  }) : /* @__PURE__ */ n("span", {}), /* @__PURE__ */ n("div", {
120
122
  className: "session-action-comment",
121
- children: /* @__PURE__ */ r(z, {
123
+ children: /* @__PURE__ */ r(w, {
122
124
  size: 8,
123
125
  className: "action-comment-feedback",
124
126
  children: [!t.isSuspend && /* @__PURE__ */ n("span", {
@@ -134,7 +136,7 @@ const J = [{
134
136
  onClick: () => S(1)
135
137
  })
136
138
  }), f === 1 && /* @__PURE__ */ n(L, {
137
- open: y,
139
+ open: _,
138
140
  getPopupContainer: (e) => e.parentNode,
139
141
  content: /* @__PURE__ */ n("div", {
140
142
  className: "zan-text",
@@ -154,7 +156,7 @@ const J = [{
154
156
  cancelText: "取消",
155
157
  getPopupContainer: (e) => e.parentNode,
156
158
  onOpenChange: (e) => {
157
- e && (h([]), x(""), I(!1));
159
+ e && (h([]), I(""), b(!1));
158
160
  },
159
161
  icon: !1,
160
162
  title: /* @__PURE__ */ r("div", {
@@ -173,12 +175,12 @@ const J = [{
173
175
  children: J.map((e) => /* @__PURE__ */ n("span", {
174
176
  className: F({
175
177
  "cai-item": !0,
176
- "cai-item__active": a.some((s) => s.id === e.id)
178
+ "cai-item__active": a.some((c) => c.id === e.id)
177
179
  }),
178
180
  onClick: () => j(e),
179
181
  children: e.name
180
182
  }, e.id))
181
- }), _ && /* @__PURE__ */ n("div", {
183
+ }), y && /* @__PURE__ */ n("div", {
182
184
  className: "cai-error",
183
185
  children: /* @__PURE__ */ n("span", {
184
186
  className: "cai-error-text",
@@ -1,119 +1,123 @@
1
- var h = (w, i, n) => new Promise((I, e) => {
2
- var r = (c) => {
1
+ var h = (L, a, s) => new Promise((p, e) => {
2
+ var o = (c) => {
3
3
  try {
4
- a(n.next(c));
4
+ u(s.next(c));
5
5
  } catch (f) {
6
6
  e(f);
7
7
  }
8
- }, E = (c) => {
8
+ }, I = (c) => {
9
9
  try {
10
- a(n.throw(c));
10
+ u(s.throw(c));
11
11
  } catch (f) {
12
12
  e(f);
13
13
  }
14
- }, a = (c) => c.done ? I(c.value) : Promise.resolve(c.value).then(r, E);
15
- a((n = n.apply(w, i)).next());
14
+ }, u = (c) => c.done ? p(c.value) : Promise.resolve(c.value).then(o, I);
15
+ u((s = s.apply(L, a)).next());
16
16
  });
17
- import { jsx as L } from "react/jsx-runtime";
18
- import { useContext as O, useState as b, useRef as R, useEffect as x } from "react";
19
- import { Drawer as j, Spin as v, message as m } from "antd";
20
- /* empty css */import { LoadingOutlined as B } from "@ant-design/icons";
21
- import H from "./SessionItem.mjs";
22
- import P from "../../../context.mjs";
23
- const M = (w) => {
17
+ import { jsx as b } from "react/jsx-runtime";
18
+ import { useContext as N, useState as E, useRef as O, useEffect as w } from "react";
19
+ import { Drawer as R, Spin as j, message as d } from "antd";
20
+ /* empty css */import { LoadingOutlined as v } from "@ant-design/icons";
21
+ import B from "./SessionItem.mjs";
22
+ import H from "../../../context.mjs";
23
+ const K = (L) => {
24
24
  const {
25
- currentSessionId: i,
26
- onSessionChange: n,
27
- onClose: I
28
- } = w, {
25
+ currentSessionId: a,
26
+ onSessionChange: s,
27
+ onClose: p
28
+ } = L, {
29
29
  agentClient: e,
30
- popupContainer: r
31
- } = O(P), [E, a] = b(!1), [c, f] = b(!1), [p, T] = b(""), [l, S] = b([]), s = R(l);
32
- x(() => {
33
- s.current = [], S(s.current), a(!0), e == null || e.getSessions().then((t) => h(void 0, null, function* () {
34
- a(!1), s.current = [...t], S(s.current);
30
+ popupContainer: o
31
+ } = N(H), [I, u] = E(!1), [c, f] = E(!1), [x, C] = E(""), [g, l] = E([]), n = O(g);
32
+ w(() => {
33
+ n.current = [], l(n.current), u(!0), e == null || e.getSessions().then((t) => h(void 0, null, function* () {
34
+ u(!1), n.current = [...t], l(n.current);
35
35
  }));
36
- }, []), x(() => {
37
- l.length && i && setTimeout(() => {
36
+ }, []), w(() => {
37
+ g.length && a && setTimeout(() => {
38
38
  var t;
39
- (t = document.getElementById(i)) == null || t.scrollIntoView(!0);
39
+ (t = document.getElementById(a)) == null || t.scrollIntoView(!0);
40
40
  }, 100);
41
- }, [l]);
42
- const _ = (t, o) => {
43
- m.config({
44
- getContainer: () => (r == null ? void 0 : r.current) || document.body
41
+ }, [g]);
42
+ const T = (t, r) => {
43
+ d.config({
44
+ getContainer: () => (o == null ? void 0 : o.current) || document.body
45
45
  }), e == null || e.removeSession(t, !0).then(() => h(void 0, null, function* () {
46
- const d = l.filter((u) => {
47
- var g, y;
48
- return ((g = u.data) == null ? void 0 : g.id) !== ((y = t.data) == null ? void 0 : y.id);
46
+ const i = g.filter((m) => {
47
+ var S, y;
48
+ return ((S = m.data) == null ? void 0 : S.id) !== ((y = t.data) == null ? void 0 : y.id);
49
49
  });
50
- t.data.id === i && n && n(""), m.success("删除成功"), s.current = [...d], S(s.current);
51
- })), o == null || o.stopPropagation();
52
- }, $ = (t) => {
53
- t && (n && n(t.sessionId, t), I());
54
- }, z = (t, o) => h(void 0, null, function* () {
55
- m.config({
56
- getContainer: () => (r == null ? void 0 : r.current) || document.body
50
+ t.data.id === a && s && s(""), d.success("删除成功"), d.config({
51
+ getContainer: () => document.body
52
+ }), n.current = [...i], l(n.current);
53
+ })), r == null || r.stopPropagation();
54
+ }, _ = (t) => {
55
+ t && (s && s(t.sessionId, t), p());
56
+ }, $ = (t, r) => h(void 0, null, function* () {
57
+ d.config({
58
+ getContainer: () => (o == null ? void 0 : o.current) || document.body
57
59
  });
58
60
  try {
59
- yield e == null ? void 0 : e.setTop(t.data.id, o), m.success(`${o ? "" : "取消"}置顶成功`);
60
- } catch (d) {
61
- m.error(`${o ? "" : "取消"}置顶失败`);
61
+ yield e == null ? void 0 : e.setTop(t.data.id, r), d.success(`${r ? "" : "取消"}置顶成功`), d.config({
62
+ getContainer: () => document.body
63
+ });
64
+ } catch (i) {
65
+ d.error(`${r ? "" : "取消"}置顶失败`), d.config({
66
+ getContainer: () => document.body
67
+ });
62
68
  }
63
69
  e == null || e.getSessions({
64
70
  order: "top_time desc, sort_status desc, updated_at desc"
65
- }).then((d) => h(void 0, null, function* () {
66
- s.current = [...d], S(s.current);
71
+ }).then((i) => h(void 0, null, function* () {
72
+ n.current = [...i], l(n.current);
67
73
  }));
68
- }), D = (t, o) => {
69
- m.config({
70
- getContainer: () => (r == null ? void 0 : r.current) || document.body
71
- }), o && (t.rename(o), t == null || t.addEventListener("data:updated", () => {
72
- const d = s.current.map((u) => {
73
- var g, y;
74
- return ((g = u.data) == null ? void 0 : g.id) === ((y = u.data) == null ? void 0 : y.id), u;
74
+ }), z = (t, r) => {
75
+ r && (t.rename(r), t == null || t.addEventListener("data:updated", () => {
76
+ const i = n.current.map((m) => {
77
+ var S, y;
78
+ return ((S = m.data) == null ? void 0 : S.id) === ((y = m.data) == null ? void 0 : y.id), m;
75
79
  });
76
- s.current = [...d], S(s.current);
80
+ n.current = [...i], l(n.current);
77
81
  }));
78
- }, N = (t, o) => {
79
- f(o), T(t);
82
+ }, D = (t, r) => {
83
+ f(r), C(t);
80
84
  };
81
- return /* @__PURE__ */ L(j, {
85
+ return /* @__PURE__ */ b(R, {
82
86
  title: "会话历史记录",
83
87
  open: !0,
84
88
  placement: "bottom",
85
- onClose: I,
86
- className: `session-list-drawer ${E ? "loading-panel" : ""}`,
89
+ onClose: p,
90
+ className: `session-list-drawer ${I ? "loading-panel" : ""}`,
87
91
  size: "large",
88
- getContainer: () => (r == null ? void 0 : r.current) || document.body,
92
+ getContainer: () => (o == null ? void 0 : o.current) || document.body,
89
93
  destroyOnClose: !0,
90
94
  style: {
91
95
  position: "absolute"
92
96
  },
93
- children: E ? /* @__PURE__ */ L(v, {
94
- indicator: /* @__PURE__ */ L(B, {
97
+ children: I ? /* @__PURE__ */ b(j, {
98
+ indicator: /* @__PURE__ */ b(v, {
95
99
  style: {
96
100
  fontSize: 24
97
101
  },
98
102
  spin: !0
99
103
  })
100
- }) : l.map((t, o) => {
101
- var d;
102
- return /* @__PURE__ */ L(H, {
104
+ }) : g.map((t, r) => {
105
+ var i;
106
+ return /* @__PURE__ */ b(B, {
103
107
  session: t,
104
- index: o,
105
- currentSessionId: i,
106
- onChangeSession: $,
107
- onDelSession: _,
108
- onTopSession: z,
109
- onEditNameConfirm: D,
110
- editSessionId: p,
108
+ index: r,
109
+ currentSessionId: a,
110
+ onChangeSession: _,
111
+ onDelSession: T,
112
+ onTopSession: $,
113
+ onEditNameConfirm: z,
114
+ editSessionId: x,
111
115
  isEdit: c,
112
- onChangeEditStatus: N
113
- }, (d = t.data) == null ? void 0 : d.id);
116
+ onChangeEditStatus: D
117
+ }, (i = t.data) == null ? void 0 : i.id);
114
118
  })
115
119
  });
116
120
  };
117
121
  export {
118
- M as default
122
+ K as default
119
123
  };