@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,95 +1,88 @@
1
- import { jsxs as g, jsx as r } from "react/jsx-runtime";
2
- import { useContext as b, useState as x, useEffect as v } from "react";
3
- /* empty css */import { Typography as w, message as m } from "antd";
4
- import { getFileExtension as C, formatFileSize as y, isValidImageUrlWithAnyExtension as I } from "../../../../utils/index.mjs";
5
- import E from "../../../../context.mjs";
6
- import { FILE_ICONS as U } from "../../../../constant.mjs";
7
- const K = (u) => {
1
+ import { jsxs as l, jsx as i } from "react/jsx-runtime";
2
+ import { useContext as v, useState as u, useEffect as y } from "react";
3
+ /* empty css */import { Typography as E, message as d } from "antd";
4
+ import { getFileExtension as C, formatFileSize as U, isValidImageUrlWithAnyExtension as S } from "../../../../utils/index.mjs";
5
+ import f from "../../../../context.mjs";
6
+ import { withAgentCliMessage as x } from "../../../../utils/scopedMessage.mjs";
7
+ import { FILE_ICONS as j } from "../../../../constant.mjs";
8
+ const P = (F) => {
8
9
  const {
9
- currentSession: c,
10
- fileId: d,
11
- file: s,
12
- docViewerUrl: f
13
- } = u, {
14
- service: l,
15
- popupContainer: o
16
- } = b(E), [e, h] = x(), [t, p] = x("");
17
- v(() => {
18
- var n;
19
- if (s != null && s.id) {
20
- h(s);
21
- const i = C(s == null ? void 0 : s.name) || "";
22
- p(i);
10
+ currentSession: s,
11
+ fileId: p,
12
+ file: r,
13
+ docViewerUrl: w
14
+ } = F, {
15
+ service: c,
16
+ popupContainer: t
17
+ } = v(f), [n, h] = u(), [m, g] = u("");
18
+ y(() => {
19
+ var e;
20
+ if (r != null && r.id) {
21
+ h(r);
22
+ const o = C(r == null ? void 0 : r.name) || "";
23
+ g(o);
23
24
  } else {
24
- if (!d || !((n = c == null ? void 0 : c.data) != null && n.id))
25
+ if (!p || !((e = s == null ? void 0 : s.data) != null && e.id))
25
26
  return;
26
- l == null || l.getSessionKnowledgeFile(c.data.id, d).then((i) => {
27
- h(i);
28
- const N = C(i == null ? void 0 : i.name) || "";
29
- p(N);
27
+ c == null || c.getSessionKnowledgeFile(s.data.id, p).then((o) => {
28
+ h(o);
29
+ const I = C(o == null ? void 0 : o.name) || "";
30
+ g(I);
30
31
  });
31
32
  }
32
33
  }, []);
33
- const F = (n) => {
34
- if (!(n != null && n.url)) {
35
- m.config({
36
- getContainer: () => (o == null ? void 0 : o.current) || document.body,
37
- prefixCls: "gbot-message"
38
- }), m.error("链接不存在"), m.config({
39
- getContainer: void 0,
40
- prefixCls: "gbot-message"
34
+ const N = (e) => {
35
+ if (!(e != null && e.url)) {
36
+ x(t, () => {
37
+ d.error("链接不存在");
41
38
  });
42
39
  return;
43
40
  }
44
- if (!I(n.url)) {
45
- m.config({
46
- getContainer: () => (o == null ? void 0 : o.current) || document.body,
47
- prefixCls: "gbot-message"
48
- }), m.error("链接格式不正确"), m.config({
49
- getContainer: void 0,
50
- prefixCls: "gbot-message"
41
+ if (!S(e.url)) {
42
+ x(t, () => {
43
+ d.error("链接格式不正确");
51
44
  });
52
45
  return;
53
46
  }
54
- window.open(`${f}?url=${encodeURIComponent(n == null ? void 0 : n.url)}`);
47
+ window.open(`${w}?url=${encodeURIComponent(e == null ? void 0 : e.url)}`);
55
48
  };
56
- return /* @__PURE__ */ g("div", {
49
+ return /* @__PURE__ */ l("div", {
57
50
  className: "file-item",
58
- onClick: () => F(e),
59
- children: [/* @__PURE__ */ r("div", {
51
+ onClick: () => N(n),
52
+ children: [/* @__PURE__ */ i("div", {
60
53
  className: "item-left",
61
- children: /* @__PURE__ */ r("img", {
54
+ children: /* @__PURE__ */ i("img", {
62
55
  className: "file-icon",
63
- src: U[t]
56
+ src: j[m]
64
57
  })
65
- }), /* @__PURE__ */ g("div", {
58
+ }), /* @__PURE__ */ l("div", {
66
59
  className: "item-main",
67
- children: [/* @__PURE__ */ r("div", {
60
+ children: [/* @__PURE__ */ i("div", {
68
61
  className: "file-name",
69
- children: /* @__PURE__ */ r(w.Paragraph, {
62
+ children: /* @__PURE__ */ i(E.Paragraph, {
70
63
  style: {
71
64
  margin: 0,
72
65
  width: "100%"
73
66
  },
74
67
  ellipsis: {
75
68
  rows: 1,
76
- tooltip: e == null ? void 0 : e.name
69
+ tooltip: n == null ? void 0 : n.name
77
70
  },
78
- children: e == null ? void 0 : e.name
71
+ children: n == null ? void 0 : n.name
79
72
  })
80
- }), /* @__PURE__ */ g("div", {
73
+ }), /* @__PURE__ */ l("div", {
81
74
  className: "file-desc",
82
- children: [/* @__PURE__ */ r("span", {
83
- children: t == null ? void 0 : t.toUpperCase()
84
- }), /* @__PURE__ */ r("span", {
75
+ children: [/* @__PURE__ */ i("span", {
76
+ children: m == null ? void 0 : m.toUpperCase()
77
+ }), /* @__PURE__ */ i("span", {
85
78
  children: ","
86
- }), /* @__PURE__ */ r("span", {
87
- children: y((e == null ? void 0 : e.size) || 0)
79
+ }), /* @__PURE__ */ i("span", {
80
+ children: U((n == null ? void 0 : n.size) || 0)
88
81
  })]
89
82
  })]
90
83
  })]
91
84
  });
92
85
  };
93
86
  export {
94
- K as default
87
+ P as default
95
88
  };
@@ -1,11 +1,12 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import { useState as m, useContext as F, useEffect as w } from "react";
3
- import { Space as P, Popover as L, Popconfirm as $, Input as q, message as k, notification as g, Button as Q } from "antd";
4
- import r from "../../../../components/Iconfont/index.mjs";
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { useState as o, useContext as D, useEffect as w } from "react";
3
+ import { Space as z, Popover as F, Popconfirm as L, Input as $, message as q, notification as u, Button as Q } from "antd";
4
+ import m from "../../../../components/Iconfont/index.mjs";
5
5
  import G from "copy-to-clipboard";
6
6
  import J from "classnames";
7
7
  /* empty css */import K from "../../../../context.mjs";
8
- const U = [{
8
+ import { withAgentCliMessage as U } from "../../../../utils/scopedMessage.mjs";
9
+ const V = [{
9
10
  id: 1,
10
11
  name: "展示信息不正确"
11
12
  }, {
@@ -17,65 +18,61 @@ const U = [{
17
18
  }, {
18
19
  id: 4,
19
20
  name: "其他原因"
20
- }], ie = (y) => {
21
- var z;
21
+ }], ce = (P) => {
22
+ var b;
22
23
  const {
23
- appId: v,
24
+ appId: x,
24
25
  history: n,
25
26
  isLastHistory: H = !1,
26
- sessionId: d,
27
+ sessionId: l,
27
28
  currentSession: c,
28
- onAgainClick: u
29
- } = y, [i, h] = m([]), [C, I] = m(), [T, b] = m(!1), [M, A] = m(!1), {
30
- service: V,
31
- popupContainer: o,
29
+ onAgainClick: g
30
+ } = P, [i, h] = o([]), [C, v] = o(), [y, I] = o(!1), [M, A] = o(!1), {
31
+ service: W,
32
+ popupContainer: d,
32
33
  transform: N,
33
34
  onComment: p
34
- } = F(K), [f, x] = m(() => {
35
+ } = D(K), [f, k] = o(() => {
35
36
  var e;
36
37
  return (e = n == null ? void 0 : n.comment) == null ? void 0 : e.isAgree;
37
- }), [S, _] = m(400);
38
+ }), [T, S] = o(400);
38
39
  w(() => {
39
40
  var e;
40
- x((e = n == null ? void 0 : n.comment) == null ? void 0 : e.isAgree);
41
- }, [(z = n == null ? void 0 : n.comment) == null ? void 0 : z.isAgree]);
42
- const E = () => {
43
- k.config({
44
- getContainer: () => (o == null ? void 0 : o.current) || document.body,
45
- prefixCls: "gbot-message"
46
- }), G(n.content), k.success("复制成功"), k.config({
47
- getContainer: void 0,
48
- prefixCls: "gbot-message"
41
+ k((e = n == null ? void 0 : n.comment) == null ? void 0 : e.isAgree);
42
+ }, [(b = n == null ? void 0 : n.comment) == null ? void 0 : b.isAgree]);
43
+ const _ = () => {
44
+ U(d, () => {
45
+ G(n.content), q.success("复制成功");
49
46
  });
50
- }, R = (e) => {
51
- if (!d || !(n != null && n.messageId))
47
+ }, E = (e) => {
48
+ if (!l || !(n != null && n.messageId))
52
49
  return;
53
50
  const a = {
54
51
  messageId: n.messageId,
55
52
  isAgree: e
56
53
  };
57
54
  c == null || c.postMessageComment(a).then(() => {
58
- x(e), n != null && n.comment && (n.comment.isAgree = e), !(e <= 0) && (A(!0), setTimeout(() => {
55
+ k(e), n != null && n.comment && (n.comment.isAgree = e), !(e <= 0) && (A(!0), setTimeout(() => {
59
56
  A(!1);
60
57
  }, 2e3));
61
58
  }), p && p({
62
- applicationId: v,
63
- sessionId: d,
59
+ applicationId: x,
60
+ sessionId: l,
64
61
  comment: a
65
62
  });
66
- }, B = (e) => {
63
+ }, R = (e) => {
67
64
  if (i.some((a) => a.id === e.id)) {
68
65
  const a = i.filter((s) => s.id !== e.id);
69
66
  h([...a]);
70
67
  } else
71
68
  h([...i, e]);
72
- }, j = (e) => {
73
- I(e.target.value);
74
- }, O = () => {
75
- if (!d)
69
+ }, B = (e) => {
70
+ v(e.target.value);
71
+ }, j = () => {
72
+ if (!l)
76
73
  return;
77
74
  if (!(i != null && i.length))
78
- return b(!0), Promise.reject();
75
+ return I(!0), Promise.reject();
79
76
  let e = [];
80
77
  i != null && i.length && (e = [...e, ...i.map((s) => s.name)]), C && (e = [...e, C]);
81
78
  const a = {
@@ -83,27 +80,27 @@ const U = [{
83
80
  isAgree: -1,
84
81
  againstReason: e
85
82
  };
86
- g.config({
87
- getContainer: () => (o == null ? void 0 : o.current) || document.body,
83
+ u.config({
84
+ getContainer: () => (d == null ? void 0 : d.current) || document.body,
88
85
  prefixCls: "gbot-notification"
89
86
  }), c == null || c.postMessageComment(a).then(() => {
90
- x(-1), n != null && n.comment && (n.comment.isAgree = -1);
87
+ k(-1), n != null && n.comment && (n.comment.isAgree = -1);
91
88
  const s = `open${Date.now()}`;
92
- g.success({
89
+ u.success({
93
90
  message: "提交反馈成功",
94
91
  description: "感谢您的参与,我们会认真评估每一条建议!",
95
92
  duration: 2,
96
93
  btn: /* @__PURE__ */ t(Q, {
97
94
  type: "primary",
98
- onClick: () => g.close(s),
95
+ onClick: () => u.close(s),
99
96
  children: "我知道了"
100
97
  }),
101
98
  key: s,
102
- onClose: () => g.close(s)
99
+ onClose: () => u.close(s)
103
100
  });
104
101
  }), p && p({
105
- applicationId: v,
106
- sessionId: d,
102
+ applicationId: x,
103
+ sessionId: l,
107
104
  comment: a
108
105
  });
109
106
  };
@@ -112,18 +109,18 @@ const U = [{
112
109
  return e = requestAnimationFrame(() => {
113
110
  const s = document.getElementById("chat-main");
114
111
  if (s) {
115
- const D = s.offsetHeight;
116
- _(D * 0.8);
112
+ const O = s.offsetHeight;
113
+ S(O * 0.8);
117
114
  }
118
115
  }), () => {
119
116
  e && cancelAnimationFrame(e);
120
117
  };
121
- }, [n]), /* @__PURE__ */ l("div", {
118
+ }, [n]), /* @__PURE__ */ r("div", {
122
119
  className: "session-action",
123
- children: [N != null && N.again && H ? /* @__PURE__ */ l(P, {
120
+ children: [N != null && N.again && H ? /* @__PURE__ */ r(z, {
124
121
  className: "session-action-again",
125
- onClick: () => u == null ? void 0 : u(),
126
- children: [/* @__PURE__ */ t(r, {
122
+ onClick: () => g == null ? void 0 : g(),
123
+ children: [/* @__PURE__ */ t(m, {
127
124
  type: "icon-zaicihuida"
128
125
  }), /* @__PURE__ */ t("span", {
129
126
  style: {
@@ -133,22 +130,22 @@ const U = [{
133
130
  })]
134
131
  }) : /* @__PURE__ */ t("span", {}), /* @__PURE__ */ t("div", {
135
132
  className: "session-action-comment",
136
- children: /* @__PURE__ */ l(P, {
133
+ children: /* @__PURE__ */ r(z, {
137
134
  size: 8,
138
135
  className: "action-comment-feedback",
139
136
  children: [!n.isSuspend && /* @__PURE__ */ t("span", {
140
137
  className: "comment-feedback-item comment-feedback-copy",
141
- onClick: E,
142
- children: /* @__PURE__ */ t(r, {
138
+ onClick: _,
139
+ children: /* @__PURE__ */ t(m, {
143
140
  type: "icon-fuzhi"
144
141
  })
145
142
  }), f === 0 && !n.isSuspend && /* @__PURE__ */ t("span", {
146
143
  className: "comment-feedback-item",
147
- children: /* @__PURE__ */ t(r, {
144
+ children: /* @__PURE__ */ t(m, {
148
145
  type: "icon-zan",
149
- onClick: () => R(1)
146
+ onClick: () => E(1)
150
147
  })
151
- }), f === 1 && /* @__PURE__ */ t(L, {
148
+ }), f === 1 && /* @__PURE__ */ t(F, {
152
149
  open: M,
153
150
  getPopupContainer: (e) => e.parentNode,
154
151
  content: /* @__PURE__ */ t("div", {
@@ -158,23 +155,23 @@ const U = [{
158
155
  trigger: "click",
159
156
  children: /* @__PURE__ */ t("span", {
160
157
  className: "comment-feedback-item comment-feedback-item__active",
161
- children: /* @__PURE__ */ t(r, {
158
+ children: /* @__PURE__ */ t(m, {
162
159
  type: "icon-zan"
163
160
  })
164
161
  })
165
- }), f === 0 && !n.isSuspend && /* @__PURE__ */ t($, {
162
+ }), f === 0 && !n.isSuspend && /* @__PURE__ */ t(L, {
166
163
  showArrow: !1,
167
164
  arrowPointAtCenter: !0,
168
165
  okText: "确定",
169
166
  cancelText: "取消",
170
167
  getPopupContainer: (e) => e.parentNode,
171
168
  onOpenChange: (e) => {
172
- e && (h([]), I(""), b(!1));
169
+ e && (h([]), v(""), I(!1));
173
170
  },
174
171
  icon: !1,
175
- title: /* @__PURE__ */ l("div", {
172
+ title: /* @__PURE__ */ r("div", {
176
173
  className: "cai-pannel",
177
- children: [/* @__PURE__ */ l("div", {
174
+ children: [/* @__PURE__ */ r("div", {
178
175
  className: "cai-title",
179
176
  children: [/* @__PURE__ */ t("span", {
180
177
  className: "cai-require",
@@ -185,15 +182,15 @@ const U = [{
185
182
  })]
186
183
  }), /* @__PURE__ */ t("div", {
187
184
  className: "cai-list",
188
- children: U.map((e) => /* @__PURE__ */ t("span", {
185
+ children: V.map((e) => /* @__PURE__ */ t("span", {
189
186
  className: J({
190
187
  "cai-item": !0,
191
188
  "cai-item__active": i.some((a) => a.id === e.id)
192
189
  }),
193
- onClick: () => B(e),
190
+ onClick: () => R(e),
194
191
  children: e.name
195
192
  }, e.id))
196
- }), T && /* @__PURE__ */ t("div", {
193
+ }), y && /* @__PURE__ */ t("div", {
197
194
  className: "cai-error",
198
195
  children: /* @__PURE__ */ t("span", {
199
196
  className: "cai-error-text",
@@ -205,8 +202,8 @@ const U = [{
205
202
  className: "cai-question",
206
203
  children: "您还有哪些建议?"
207
204
  })
208
- }), /* @__PURE__ */ t(q.TextArea, {
209
- onChange: j,
205
+ }), /* @__PURE__ */ t($.TextArea, {
206
+ onChange: B,
210
207
  value: C,
211
208
  autoSize: {
212
209
  minRows: 3,
@@ -219,7 +216,7 @@ const U = [{
219
216
  maxLength: 300
220
217
  })]
221
218
  }),
222
- onConfirm: () => O(),
219
+ onConfirm: () => j(),
223
220
  cancelButtonProps: {
224
221
  size: "middle"
225
222
  },
@@ -227,18 +224,18 @@ const U = [{
227
224
  size: "middle"
228
225
  },
229
226
  overlayStyle: {
230
- maxHeight: `${S}px`,
227
+ maxHeight: `${T}px`,
231
228
  overflow: "auto"
232
229
  },
233
230
  children: /* @__PURE__ */ t("span", {
234
231
  className: "comment-feedback-item",
235
- children: /* @__PURE__ */ t(r, {
232
+ children: /* @__PURE__ */ t(m, {
236
233
  type: "icon-cai"
237
234
  })
238
235
  })
239
236
  }), f === -1 && /* @__PURE__ */ t("span", {
240
237
  className: "comment-feedback-item comment-feedback-item__active",
241
- children: /* @__PURE__ */ t(r, {
238
+ children: /* @__PURE__ */ t(m, {
242
239
  type: "icon-cai"
243
240
  })
244
241
  })]
@@ -247,5 +244,5 @@ const U = [{
247
244
  });
248
245
  };
249
246
  export {
250
- ie as default
247
+ ce as default
251
248
  };