@glodon-aiot/agent-cli-ui 3.19.0-alpha.20 → 3.19.0-alpha.21

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,130 +1,119 @@
1
- var b = (C, a, n) => new Promise((x, e) => {
2
- var r = (i) => {
1
+ var g = (L, d, s) => new Promise((y, e) => {
2
+ var a = (n) => {
3
3
  try {
4
- u(n.next(i));
5
- } catch (f) {
6
- e(f);
4
+ c(s.next(n));
5
+ } catch (m) {
6
+ e(m);
7
7
  }
8
- }, h = (i) => {
8
+ }, h = (n) => {
9
9
  try {
10
- u(n.throw(i));
11
- } catch (f) {
12
- e(f);
10
+ c(s.throw(n));
11
+ } catch (m) {
12
+ e(m);
13
13
  }
14
- }, u = (i) => i.done ? x(i.value) : Promise.resolve(i.value).then(r, h);
15
- u((n = n.apply(C, a)).next());
14
+ }, c = (n) => n.done ? y(n.value) : Promise.resolve(n.value).then(a, h);
15
+ c((s = s.apply(L, d)).next());
16
16
  });
17
- import { jsx as p } from "react/jsx-runtime";
18
- import { useContext as D, useState as I, useRef as N, useEffect as E } from "react";
19
- import { Drawer as O, Spin as R, message as d } from "antd";
20
- /* empty css */import { LoadingOutlined as j } from "@ant-design/icons";
17
+ import { jsx as I } from "react/jsx-runtime";
18
+ import { useContext as O, useState as E, useRef as R, useEffect as b } from "react";
19
+ import { Drawer as j, Spin as v, message as w } from "antd";
20
+ /* empty css */import { LoadingOutlined as A } from "@ant-design/icons";
21
21
  import B from "./SessionItem.mjs";
22
22
  import H from "../../../../../context.mjs";
23
- const K = (C) => {
23
+ import { withAgentCliMessage as x } from "../../../../../utils/scopedMessage.mjs";
24
+ const Q = (L) => {
24
25
  const {
25
- currentSessionId: a,
26
- onSessionChange: n,
27
- onClose: x
28
- } = C, {
26
+ currentSessionId: d,
27
+ onSessionChange: s,
28
+ onClose: y
29
+ } = L, {
29
30
  agentClient: e,
30
- popupContainer: r
31
- } = D(H), [h, u] = I(!1), [i, f] = I(!1), [L, v] = I(""), [g, l] = I([]), o = N(g);
32
- E(() => {
33
- o.current = [], l(o.current), u(!0), e == null || e.getSessions().then((t) => b(void 0, null, function* () {
34
- u(!1), o.current = [...t], l(o.current);
31
+ popupContainer: a
32
+ } = O(H), [h, c] = E(!1), [n, m] = E(!1), [C, T] = E(""), [f, l] = E([]), o = R(f);
33
+ b(() => {
34
+ o.current = [], l(o.current), c(!0), e == null || e.getSessions().then((t) => g(void 0, null, function* () {
35
+ c(!1), o.current = [...t], l(o.current);
35
36
  }));
36
- }, []), E(() => {
37
- g.length && a && setTimeout(() => {
37
+ }, []), b(() => {
38
+ f.length && d && setTimeout(() => {
38
39
  var t;
39
- (t = document.getElementById(a)) == null || t.scrollIntoView(!0);
40
+ (t = document.getElementById(d)) == null || t.scrollIntoView(!0);
40
41
  }, 100);
41
- }, [g]);
42
- const w = (t, s) => {
43
- e == null || e.removeSession(t, !0).then(() => b(void 0, null, function* () {
44
- const c = g.filter((m) => {
45
- var S, y;
46
- return ((S = m.data) == null ? void 0 : S.id) !== ((y = t.data) == null ? void 0 : y.id);
42
+ }, [f]);
43
+ const _ = (t, r) => {
44
+ e == null || e.removeSession(t, !0).then(() => g(void 0, null, function* () {
45
+ const i = f.filter((u) => {
46
+ var p, S;
47
+ return ((p = u.data) == null ? void 0 : p.id) !== ((S = t.data) == null ? void 0 : S.id);
47
48
  });
48
- t.data.id === a && n && n("", null), d.config({
49
- getContainer: () => (r == null ? void 0 : r.current) || document.body,
50
- prefixCls: "gbot-message"
51
- }), d.success("删除成功"), d.config({
52
- getContainer: void 0,
53
- prefixCls: "gbot-message"
54
- }), o.current = [...c], l(o.current);
55
- })), s == null || s.stopPropagation();
56
- }, T = (t) => {
57
- t && (n && n(t.sessionId, t), x());
58
- }, _ = (t, s) => b(void 0, null, function* () {
49
+ t.data.id === d && s && s("", null), x(a, () => {
50
+ w.success("删除成功");
51
+ }), o.current = [...i], l(o.current);
52
+ })), r == null || r.stopPropagation();
53
+ }, $ = (t) => {
54
+ t && (s && s(t.sessionId, t), y());
55
+ }, z = (t, r) => g(void 0, null, function* () {
59
56
  try {
60
- yield e == null ? void 0 : e.setTop(t.data.id, s), d.config({
61
- getContainer: () => (r == null ? void 0 : r.current) || document.body,
62
- prefixCls: "gbot-message"
63
- }), d.success(`${s ? "" : "取消"}置顶成功`), d.config({
64
- getContainer: void 0,
65
- prefixCls: "gbot-message"
57
+ yield e == null ? void 0 : e.setTop(t.data.id, r), x(a, () => {
58
+ w.success(`${r ? "" : "取消"}置顶成功`);
66
59
  });
67
- } catch (c) {
68
- d.config({
69
- getContainer: () => (r == null ? void 0 : r.current) || document.body,
70
- prefixCls: "gbot-message"
71
- }), d.error(`${s ? "" : "取消"}置顶失败`), d.config({
72
- getContainer: void 0,
73
- prefixCls: "gbot-message"
60
+ } catch (i) {
61
+ x(a, () => {
62
+ w.error(`${r ? "" : "取消"}置顶失败`);
74
63
  });
75
64
  }
76
65
  e == null || e.getSessions({
77
66
  order: "top_time desc, sort_status desc, updated_at desc"
78
- }).then((c) => b(void 0, null, function* () {
79
- o.current = [...c], l(o.current);
67
+ }).then((i) => g(void 0, null, function* () {
68
+ o.current = [...i], l(o.current);
80
69
  }));
81
- }), $ = (t, s) => {
82
- s && (t.rename(s), t == null || t.addEventListener("data:updated", () => {
83
- const c = o.current.map((m) => {
84
- var S, y;
85
- return ((S = m.data) == null ? void 0 : S.id) === ((y = m.data) == null ? void 0 : y.id), m;
70
+ }), D = (t, r) => {
71
+ r && (t.rename(r), t == null || t.addEventListener("data:updated", () => {
72
+ const i = o.current.map((u) => {
73
+ var p, S;
74
+ return ((p = u.data) == null ? void 0 : p.id) === ((S = u.data) == null ? void 0 : S.id), u;
86
75
  });
87
- o.current = [...c], l(o.current);
76
+ o.current = [...i], l(o.current);
88
77
  }));
89
- }, z = (t, s) => {
90
- f(s), v(t);
78
+ }, N = (t, r) => {
79
+ m(r), T(t);
91
80
  };
92
- return /* @__PURE__ */ p(O, {
81
+ return /* @__PURE__ */ I(j, {
93
82
  title: "会话历史记录",
94
83
  open: !0,
95
84
  placement: "bottom",
96
- onClose: x,
85
+ onClose: y,
97
86
  className: `session-list-drawer ${h ? "loading-panel" : ""}`,
98
87
  size: "large",
99
- getContainer: () => (r == null ? void 0 : r.current) || document.body,
88
+ getContainer: () => (a == null ? void 0 : a.current) || document.body,
100
89
  destroyOnClose: !0,
101
90
  style: {
102
91
  position: "absolute"
103
92
  },
104
- children: h ? /* @__PURE__ */ p(R, {
105
- indicator: /* @__PURE__ */ p(j, {
93
+ children: h ? /* @__PURE__ */ I(v, {
94
+ indicator: /* @__PURE__ */ I(A, {
106
95
  style: {
107
96
  fontSize: 24
108
97
  },
109
98
  spin: !0
110
99
  })
111
- }) : g.map((t, s) => {
112
- var c;
113
- return /* @__PURE__ */ p(B, {
100
+ }) : f.map((t, r) => {
101
+ var i;
102
+ return /* @__PURE__ */ I(B, {
114
103
  session: t,
115
- index: s,
116
- currentSessionId: a,
117
- onChangeSession: T,
118
- onDelSession: w,
119
- onTopSession: _,
120
- onEditNameConfirm: $,
121
- editSessionId: L,
122
- isEdit: i,
123
- onChangeEditStatus: z
124
- }, (c = t.data) == null ? void 0 : c.id);
104
+ index: r,
105
+ currentSessionId: d,
106
+ onChangeSession: $,
107
+ onDelSession: _,
108
+ onTopSession: z,
109
+ onEditNameConfirm: D,
110
+ editSessionId: C,
111
+ isEdit: n,
112
+ onChangeEditStatus: N
113
+ }, (i = t.data) == null ? void 0 : i.id);
125
114
  })
126
115
  });
127
116
  };
128
117
  export {
129
- K as default
118
+ Q as default
130
119
  };