@glodon-aiot/agent-cli-ui 3.2.10-beta.3 → 3.2.10-beta.4

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,46 +1,46 @@
1
1
  import { jsxs as x, jsx as A } from "react/jsx-runtime";
2
- import { useContext as H, useState as i, useEffect as y } from "react";
2
+ import { useContext as H, useState as i, useEffect as v } from "react";
3
3
  /* empty css */import K from "../../context.mjs";
4
4
  import { Space as q } from "antd";
5
5
  import z from "./KnowledgeSelect/index.mjs";
6
- const P = (v) => {
6
+ const P = (y) => {
7
7
  var j, u;
8
8
  const {
9
9
  currentSession: t,
10
- application: n,
10
+ application: o,
11
11
  setCurrentSession: B,
12
12
  reload: D,
13
13
  setCheckKnowledges: g
14
- } = v, {
14
+ } = y, {
15
15
  mode: C,
16
16
  transform: w,
17
- features: o
18
- } = H(K), [d, k] = i([]), [r, c] = i(typeof (o == null ? void 0 : o.knowledges) == "object" ? ((j = o.knowledges.default) == null ? void 0 : j.map((e) => e.id)) || [] : []), [E, p] = i(0), [h, b] = i(!1);
19
- y(() => {
20
- if (!(n != null && n.id))
17
+ features: n
18
+ } = H(K), [d, k] = i([]), [r, p] = i(typeof (n == null ? void 0 : n.knowledges) == "object" ? ((j = n.knowledges.default) == null ? void 0 : j.map((e) => e.id)) || [] : []), [E, c] = i(0), [h, b] = i(!1);
19
+ v(() => {
20
+ if (!(o != null && o.id))
21
21
  return;
22
- const e = n.arrange;
22
+ const e = o.arrange;
23
23
  if (!(e != null && e.length))
24
24
  return;
25
25
  const s = e[0].knowledges || [];
26
26
  k(s);
27
- const l = typeof (o == null ? void 0 : o.knowledges) == "object" && o.knowledges.default || s;
27
+ const l = typeof (n == null ? void 0 : n.knowledges) == "object" && n.knowledges.default || s;
28
28
  if (!t) {
29
- c(l.map((f) => f.id)), p(l.length), g == null || g(l);
29
+ p(l.map((f) => f.id)), c(l.length), g == null || g(l);
30
30
  return;
31
31
  }
32
32
  const a = () => {
33
33
  const f = t.knowledges || l;
34
- p(f.length);
34
+ c(f.length);
35
35
  const F = f.map((N) => N.id);
36
- c(F);
36
+ p(F);
37
37
  };
38
38
  return a(), t.addEventListener("data:updated", a), () => {
39
39
  t == null || t.removeEventListener("data:updated", a);
40
40
  };
41
- }, [n, t]), y(() => {
41
+ }, [o, t]), v(() => {
42
42
  var m;
43
- if (!h || (b(!1), !(n != null && n.id)))
43
+ if (!h || (b(!1), !(o != null && o.id)))
44
44
  return;
45
45
  const e = [];
46
46
  r == null || r.map((s) => {
@@ -49,20 +49,20 @@ const P = (v) => {
49
49
  }), (m = t == null ? void 0 : t.data) != null && m.id && t.setKnowledges(e);
50
50
  }, [h]);
51
51
  const S = (e) => {
52
- b(!0), c(e);
52
+ b(!0), p(e);
53
53
  const m = [];
54
54
  e == null || e.map((s) => {
55
55
  const l = d == null ? void 0 : d.find((a) => a.id === s);
56
56
  m.push(l);
57
- }), g == null || g(m), p(e.length);
57
+ }), g == null || g(m), c(e.length);
58
58
  };
59
59
  return /* @__PURE__ */ x("div", {
60
60
  className: "chat-header",
61
61
  children: [/* @__PURE__ */ x(q, {
62
62
  className: "header-title",
63
- children: [C === "inlay" && ((u = t == null ? void 0 : t.data) == null ? void 0 : u.name), C === "float" && (n == null ? void 0 : n.name)]
63
+ children: [C === "inlay" && ((u = t == null ? void 0 : t.data) == null ? void 0 : u.name), C === "float" && (o == null ? void 0 : o.name)]
64
64
  }), (w == null ? void 0 : w.knowledges) && d.length !== 0 && /* @__PURE__ */ A(z, {
65
- disabled: (n == null ? void 0 : n.type) === 2 || typeof (o == null ? void 0 : o.knowledges) == "object" && (o == null ? void 0 : o.knowledges.diabled) || !1,
65
+ disabled: typeof (n == null ? void 0 : n.knowledges) == "object" && (n == null ? void 0 : n.knowledges.diabled) || !1,
66
66
  checkedValues: r,
67
67
  currKnowledgeList: d,
68
68
  selectCount: E,
@@ -1,68 +1,95 @@
1
- import { jsx as e, jsxs as r, Fragment as f } from "react/jsx-runtime";
2
- import { useState as N } from "react";
3
- import R from "../../assets/think.svg.mjs";
4
- /* empty css */import { CheckOutlined as k, CloseOutlined as x } from "@ant-design/icons";
5
- import { Collapse as p, Space as S } from "antd";
1
+ import { jsx as e, jsxs as n, Fragment as k } from "react/jsx-runtime";
2
+ import { useState as S } from "react";
3
+ import w from "../../assets/think.svg.mjs";
4
+ /* empty css */import { CheckOutlined as x, CloseOutlined as C } from "@ant-design/icons";
5
+ import { Collapse as g, Space as i } from "antd";
6
+ import I from "dayjs";
6
7
  const {
7
- Panel: b
8
- } = p, E = (m) => {
9
- var t, a, c, l, i, h;
8
+ Panel: v
9
+ } = g, M = (u) => {
10
+ var r, h, o, d, m, p;
10
11
  const {
11
- history: n
12
- } = m, [u, g] = N(!1), s = n.searchingStatus ? n.searchingStatus : (t = n.searchReference) != null && t.length ? "end" : "";
13
- return s ? /* @__PURE__ */ e("div", {
12
+ history: a,
13
+ openTarget: N = "_blank",
14
+ container: l,
15
+ onShowList: c
16
+ } = u, [f, R] = S(!1), t = a.searchingStatus ? a.searchingStatus : (r = a.searchReference) != null && r.length ? "end" : "";
17
+ return t ? /* @__PURE__ */ e("div", {
14
18
  className: "search-reference",
15
- children: /* @__PURE__ */ r("div", {
19
+ children: /* @__PURE__ */ n("div", {
16
20
  className: "item-bot-plugin",
17
21
  onClick: () => {
18
- g(!u);
22
+ R(!f);
19
23
  },
20
- children: [s === "start" && /* @__PURE__ */ r(f, {
24
+ children: [t === "start" && /* @__PURE__ */ n(k, {
21
25
  children: [/* @__PURE__ */ e("img", {
22
- src: R,
26
+ src: w,
23
27
  alt: ""
24
28
  }), /* @__PURE__ */ e("span", {
25
29
  children: "正在搜索…"
26
30
  })]
27
- }), s === "end" && /* @__PURE__ */ e(p, {
31
+ }), t === "end" && /* @__PURE__ */ e(g, {
28
32
  ghost: !0,
29
33
  expandIconPosition: "right",
30
- children: /* @__PURE__ */ e(b, {
31
- collapsible: "icon",
32
- showArrow: !!(s === "end" && ((a = n.searchReference) != null && a.length)),
33
- header: /* @__PURE__ */ r(S, {
34
+ onChange: c && (() => {
35
+ t === "end" && c(a.searchReference, a.messageId);
36
+ }),
37
+ children: /* @__PURE__ */ e(v, {
38
+ collapsible: l ? "disabled" : "icon",
39
+ showArrow: !!(t === "end" && ((h = a.searchReference) != null && h.length)),
40
+ header: /* @__PURE__ */ n(i, {
34
41
  size: 8,
35
42
  style: {
36
43
  width: "100%"
37
44
  },
38
- children: [/* @__PURE__ */ r("span", {
45
+ children: [/* @__PURE__ */ n("span", {
39
46
  className: "bot-plugin-status",
40
- children: [s === "end" && ((c = n.searchReference) == null ? void 0 : c.length) > 0 && /* @__PURE__ */ e("span", {
47
+ children: [t === "end" && ((o = a.searchReference) == null ? void 0 : o.length) > 0 && /* @__PURE__ */ e("span", {
41
48
  className: "plugin-status-success",
42
- children: /* @__PURE__ */ e(k, {})
43
- }), s === "end" && !((l = n.searchReference) != null && l.length) && /* @__PURE__ */ e("span", {
44
- className: "plugin-status-error",
45
49
  children: /* @__PURE__ */ e(x, {})
50
+ }), t === "end" && !((d = a.searchReference) != null && d.length) && /* @__PURE__ */ e("span", {
51
+ className: "plugin-status-error",
52
+ children: /* @__PURE__ */ e(C, {})
46
53
  })]
47
- }), s === "end" && /* @__PURE__ */ e("span", {
54
+ }), t === "end" && /* @__PURE__ */ e("span", {
48
55
  className: "bot-plugin-title",
49
- children: (i = n.searchReference) != null && i.length ? `已搜索到${n.searchReference.length}个网页` : "未找到搜索内容,请检查搜索服务"
56
+ children: (m = a.searchReference) != null && m.length ? `已搜索到${a.searchReference.length}个网页` : "未找到搜索内容,请检查搜索服务"
50
57
  })]
51
58
  }),
52
- children: /* @__PURE__ */ e("div", {
53
- className: "bot-net-main",
54
- children: (h = n.searchReference) == null ? void 0 : h.map((o, d) => /* @__PURE__ */ r("div", {
55
- className: "text",
56
- children: [/* @__PURE__ */ r("span", {
57
- children: [d + 1, ". "]
58
- }), /* @__PURE__ */ e("span", {
59
- className: "link",
60
- onClick: () => {
61
- window.open(o.link);
62
- },
63
- children: o.title
59
+ children: !l && /* @__PURE__ */ e("div", {
60
+ className: "search-reference-list",
61
+ children: (p = a.searchReference) == null ? void 0 : p.map((s, b) => /* @__PURE__ */ n(i, {
62
+ direction: "vertical",
63
+ className: "search-reference-list-item",
64
+ onClick: () => {
65
+ window.open(s.link, N);
66
+ },
67
+ size: 12,
68
+ children: [/* @__PURE__ */ n("span", {
69
+ className: "search-reference-list-item-title",
70
+ children: [/* @__PURE__ */ n("span", {
71
+ className: "number",
72
+ children: [b + 1, "."]
73
+ }), s.title]
74
+ }), s.snippet && /* @__PURE__ */ e("span", {
75
+ className: "search-reference-list-item-content",
76
+ children: s.snippet
77
+ }), /* @__PURE__ */ n("div", {
78
+ className: "search-reference-list-item-footer",
79
+ children: [/* @__PURE__ */ n(i, {
80
+ children: [(s == null ? void 0 : s.siteIcon) && /* @__PURE__ */ e("img", {
81
+ className: "logo",
82
+ src: s == null ? void 0 : s.siteIcon
83
+ }), /* @__PURE__ */ e("span", {
84
+ className: "name",
85
+ children: s.siteName
86
+ })]
87
+ }), /* @__PURE__ */ e("span", {
88
+ className: "time",
89
+ children: I(s.ts || s.datePublished).format("YYYY-MM-DD")
90
+ })]
64
91
  })]
65
- }, d))
92
+ }, s.link))
66
93
  })
67
94
  }, "")
68
95
  })]
@@ -70,5 +97,5 @@ const {
70
97
  }) : null;
71
98
  };
72
99
  export {
73
- E as default
100
+ M as default
74
101
  };