@glodon-aiot/agent-cli-ui 3.3.2-beta.15 → 3.3.2-beta.17

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.
Files changed (47) hide show
  1. package/dist/es/AgentClientUI.mjs +119 -109
  2. package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +1 -1
  3. package/dist/es/Dialog/AgentChat/index.mjs +282 -269
  4. package/dist/es/Dialog/SessionList/index.mjs +35 -34
  5. package/dist/es/Dialog/index.mjs +101 -94
  6. package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +124 -120
  7. package/dist/es/components/FilePreview/index.mjs +26 -25
  8. package/dist/es/index.mjs +238 -211
  9. package/dist/es/packages/agent-cli-ui/package.json.mjs +3 -3
  10. package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
  11. package/dist/es/src/style.css +1 -1
  12. package/dist/es/src/style10.css +1 -1
  13. package/dist/es/src/style11.css +1 -1
  14. package/dist/es/src/style12.css +1 -1
  15. package/dist/es/src/style13.css +1 -1
  16. package/dist/es/src/style14.css +1 -1
  17. package/dist/es/src/style15.css +1 -1
  18. package/dist/es/src/style16.css +1 -1
  19. package/dist/es/src/style17.css +1 -1
  20. package/dist/es/src/style18.css +1 -1
  21. package/dist/es/src/style19.css +1 -1
  22. package/dist/es/src/style20.css +1 -1
  23. package/dist/es/src/style21.css +1 -1
  24. package/dist/es/src/style22.css +1 -1
  25. package/dist/es/src/style23.css +1 -1
  26. package/dist/es/src/style24.css +1 -1
  27. package/dist/es/src/style25.css +1 -1
  28. package/dist/es/src/style26.css +1 -1
  29. package/dist/es/src/style27.css +1 -1
  30. package/dist/es/src/style28.css +1 -1
  31. package/dist/es/src/style29.css +1 -1
  32. package/dist/es/src/style3.css +1 -1
  33. package/dist/es/src/style30.css +1 -1
  34. package/dist/es/src/style31.css +1 -1
  35. package/dist/es/src/style5.css +1 -1
  36. package/dist/es/src/style6.css +1 -1
  37. package/dist/es/src/style7.css +1 -1
  38. package/dist/es/src/style8.css +1 -1
  39. package/dist/es/src/style9.css +1 -1
  40. package/dist/lib/index.css +1 -1
  41. package/dist/lib/index.js +30 -30
  42. package/dist/src/AgentClientUI.d.ts +10 -2
  43. package/dist/src/Dialog/SessionList/index.d.ts +1 -0
  44. package/dist/src/Dialog/index.d.ts +9 -1
  45. package/dist/src/index.d.ts +7 -2
  46. package/dist/src/types.d.ts +2 -1
  47. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- var N = (V, E, f) => new Promise((a, i) => {
1
+ var N = (V, E, f) => new Promise((t, i) => {
2
2
  var v = (p) => {
3
3
  try {
4
4
  k(f.next(p));
@@ -11,21 +11,21 @@ var N = (V, E, f) => new Promise((a, i) => {
11
11
  } catch (s) {
12
12
  i(s);
13
13
  }
14
- }, k = (p) => p.done ? a(p.value) : Promise.resolve(p.value).then(v, g);
14
+ }, k = (p) => p.done ? t(p.value) : Promise.resolve(p.value).then(v, g);
15
15
  k((f = f.apply(V, E)).next());
16
16
  });
17
17
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
18
- import { forwardRef as U, useState as L, useContext as q, useEffect as x, useImperativeHandle as G } from "react";
19
- import { Button as J, Popconfirm as H, Input as Q, Space as T } from "antd";
20
- import W from "dayjs";
21
- import X from "classnames";
18
+ import { forwardRef as U, useState as L, useContext as q, useEffect as x, useImperativeHandle as u } from "react";
19
+ import { Button as G, Popconfirm as H, Input as J, Space as Q } from "antd";
20
+ import T from "dayjs";
21
+ import W from "classnames";
22
22
  import O from "../../components/Iconfont/index.mjs";
23
- import Y from "../../context.mjs";
24
- /* empty css */import { useMemoizedFn as Z } from "ahooks";
25
- const $ = U((V, E) => {
23
+ import X from "../../context.mjs";
24
+ /* empty css */import { useMemoizedFn as Y } from "ahooks";
25
+ const Z = U((V, E) => {
26
26
  const {
27
27
  sider: f,
28
- currentSession: a,
28
+ currentSession: t,
29
29
  setCurrentSession: i,
30
30
  checkKnowledges: v,
31
31
  application: g,
@@ -33,48 +33,49 @@ const $ = U((V, E) => {
33
33
  } = V, [p, s] = L(), {
34
34
  agentClient: m,
35
35
  mode: P,
36
- features: t
37
- } = q(Y), [h, j] = L([]), [D, K] = L(v), M = Z(() => {
36
+ features: a
37
+ } = q(X), [h, j] = L([]), [D, K] = L(v), M = Y(() => {
38
38
  var e;
39
- if (!((e = a == null ? void 0 : a.data) != null && e.id))
39
+ if (!((e = t == null ? void 0 : t.data) != null && e.id))
40
40
  return;
41
41
  const d = h.map((l) => {
42
42
  var o, c;
43
- return ((o = l.data) == null ? void 0 : o.id) === ((c = a.data) == null ? void 0 : c.id) ? a : l;
43
+ return ((o = l.data) == null ? void 0 : o.id) === ((c = t.data) == null ? void 0 : c.id) ? t : l;
44
44
  });
45
45
  j([...d]);
46
46
  });
47
47
  x(() => {
48
48
  m == null || m.getSessions().then((d) => N(void 0, null, function* () {
49
49
  var e;
50
- if (j([...d]), !((e = a == null ? void 0 : a.data) != null && e.id) && (d != null && d.length) && P === "inlay") {
50
+ if (j([...d]), !((e = t == null ? void 0 : t.data) != null && e.id) && (d != null && d.length) && P === "inlay") {
51
51
  const l = d[0];
52
52
  i == null || i(l);
53
53
  }
54
54
  }));
55
55
  }, []), x(() => {
56
56
  var d;
57
- if (!((d = a == null ? void 0 : a.data) != null && d.id) && v === void 0) {
58
- const e = typeof (t == null ? void 0 : t.knowledges) == "object" && t.knowledges.default || void 0;
57
+ if (!((d = t == null ? void 0 : t.data) != null && d.id) && v === void 0) {
58
+ const e = typeof (a == null ? void 0 : a.knowledges) == "object" && a.knowledges.default || void 0;
59
59
  K(e);
60
60
  return;
61
61
  }
62
62
  K(v);
63
63
  }, [v]), x(() => {
64
- a == null || a.addEventListener("data:updated", M);
65
- }, [a]), G(E, () => ({
64
+ t == null || t.addEventListener("data:updated", M);
65
+ }, [t]), u(E, () => ({
66
66
  create(d) {
67
67
  return C(d);
68
- }
68
+ },
69
+ list: () => Promise.resolve(h)
69
70
  }));
70
71
  const C = (d) => new Promise((e) => N(void 0, null, function* () {
71
72
  var c;
72
- const l = typeof (t == null ? void 0 : t.promptVariables) == "object" ? (t == null ? void 0 : t.promptVariables.default) || [] : void 0, o = yield m == null ? void 0 : m.loadSession("", {
73
+ const l = typeof (a == null ? void 0 : a.promptVariables) == "object" ? (a == null ? void 0 : a.promptVariables.default) || [] : void 0, o = yield m == null ? void 0 : m.loadSession("", {
73
74
  name: d == null ? void 0 : d.name,
74
75
  // @ts-ignore netOpen入参是number 响应是boolen
75
76
  // 只有对话有联网 其它没有
76
77
  netOpen: (g == null ? void 0 : g.type) === 0 ? d == null ? void 0 : d.netOpen : void 0,
77
- knowledges: (c = a == null ? void 0 : a.data) != null && c.id ? d == null ? void 0 : d.knowledges : D,
78
+ knowledges: (c = t == null ? void 0 : t.data) != null && c.id ? d == null ? void 0 : d.knowledges : D,
78
79
  promptVariables: l
79
80
  });
80
81
  o == null || o.addEventListener("data:created", () => N(void 0, null, function* () {
@@ -94,7 +95,7 @@ const $ = U((V, E) => {
94
95
  var w, y;
95
96
  return ((w = c.data) == null ? void 0 : w.id) !== ((y = d.data) == null ? void 0 : y.id);
96
97
  });
97
- ((l = d.data) == null ? void 0 : l.id) === ((o = a == null ? void 0 : a.data) == null ? void 0 : o.id) && (e != null && e.length ? i == null || i(e[0]) : i == null || i(void 0)), j([...e]);
98
+ ((l = d.data) == null ? void 0 : l.id) === ((o = t == null ? void 0 : t.data) == null ? void 0 : o.id) && (e != null && e.length ? i == null || i(e[0]) : i == null || i(void 0)), j([...e]);
98
99
  }));
99
100
  }, F = (d) => {
100
101
  var e;
@@ -108,11 +109,11 @@ const $ = U((V, E) => {
108
109
  };
109
110
  return x(() => {
110
111
  var e, l, o, c;
111
- if (!(a != null && a.id))
112
+ if (!(t != null && t.id))
112
113
  return;
113
114
  const d = {};
114
- typeof (t == null ? void 0 : t.knowledges) == "object" && ((e = t == null ? void 0 : t.knowledges) != null && e.default) && (d.knowledges = (l = t == null ? void 0 : t.knowledges) == null ? void 0 : l.default), typeof (t == null ? void 0 : t.promptVariables) == "object" && ((o = t == null ? void 0 : t.promptVariables) != null && o.default) && (d.promptVariables = (c = t == null ? void 0 : t.promptVariables) == null ? void 0 : c.default), m == null || m.loadSession(a.id, d);
115
- }, [a]), /* @__PURE__ */ n("div", {
115
+ typeof (a == null ? void 0 : a.knowledges) == "object" && ((e = a == null ? void 0 : a.knowledges) != null && e.default) && (d.knowledges = (l = a == null ? void 0 : a.knowledges) == null ? void 0 : l.default), typeof (a == null ? void 0 : a.promptVariables) == "object" && ((o = a == null ? void 0 : a.promptVariables) != null && o.default) && (d.promptVariables = (c = a == null ? void 0 : a.promptVariables) == null ? void 0 : c.default), m == null || m.loadSession(t.id, d);
116
+ }, [t]), /* @__PURE__ */ n("div", {
116
117
  className: "bot-session-container",
117
118
  children: f && P === "inlay" && /* @__PURE__ */ r("div", {
118
119
  className: "agent-sessions",
@@ -121,7 +122,7 @@ const $ = U((V, E) => {
121
122
  children: [/* @__PURE__ */ n("span", {
122
123
  className: "session-header-title",
123
124
  children: "会话列表"
124
- }), /* @__PURE__ */ n(J, {
125
+ }), /* @__PURE__ */ n(G, {
125
126
  className: "session-header-btn",
126
127
  onClick: z,
127
128
  children: "+ 新建会话"
@@ -131,9 +132,9 @@ const $ = U((V, E) => {
131
132
  children: h == null ? void 0 : h.map((d) => {
132
133
  var e, l, o, c, w, y;
133
134
  return /* @__PURE__ */ n("div", {
134
- className: X({
135
+ className: W({
135
136
  "session-item": !0,
136
- "session-item__active": ((e = d.data) == null ? void 0 : e.id) === ((l = a == null ? void 0 : a.data) == null ? void 0 : l.id)
137
+ "session-item__active": ((e = d.data) == null ? void 0 : e.id) === ((l = t == null ? void 0 : t.data) == null ? void 0 : l.id)
137
138
  }),
138
139
  onClick: () => _(d),
139
140
  children: /* @__PURE__ */ r("div", {
@@ -149,7 +150,7 @@ const $ = U((V, E) => {
149
150
  children: [/* @__PURE__ */ n(H, {
150
151
  getPopupContainer: (b) => b.parentNode,
151
152
  icon: !1,
152
- title: /* @__PURE__ */ n(Q, {
153
+ title: /* @__PURE__ */ n(J, {
153
154
  placeholder: "请输入内容",
154
155
  autoComplete: "off",
155
156
  showCount: !0,
@@ -169,7 +170,7 @@ const $ = U((V, E) => {
169
170
  }), /* @__PURE__ */ n(H, {
170
171
  getPopupContainer: (b) => b.parentNode,
171
172
  icon: !1,
172
- title: /* @__PURE__ */ r(T, {
173
+ title: /* @__PURE__ */ r(Q, {
173
174
  direction: "vertical",
174
175
  children: [/* @__PURE__ */ n("div", {
175
176
  children: "删除确认?"
@@ -194,7 +195,7 @@ const $ = U((V, E) => {
194
195
  children: ((c = d.data) == null ? void 0 : c.finialMessage) || "-"
195
196
  }), /* @__PURE__ */ n("span", {
196
197
  className: "item-bottom-time",
197
- children: W((w = d.data) == null ? void 0 : w.createdAt).format("MM/DD HH:mm:ss")
198
+ children: T((w = d.data) == null ? void 0 : w.createdAt).format("MM/DD HH:mm:ss")
198
199
  })]
199
200
  })]
200
201
  })
@@ -204,7 +205,7 @@ const $ = U((V, E) => {
204
205
  })
205
206
  });
206
207
  });
207
- $.displayName = "SessionList";
208
+ Z.displayName = "SessionList";
208
209
  export {
209
- $ as default
210
+ Z as default
210
211
  };
@@ -1,150 +1,157 @@
1
- var O = Object.defineProperty, U = Object.defineProperties;
1
+ var P = Object.defineProperty, U = Object.defineProperties;
2
2
  var V = Object.getOwnPropertyDescriptors;
3
- var b = Object.getOwnPropertySymbols;
3
+ var E = Object.getOwnPropertySymbols;
4
4
  var q = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
5
- var E = (t, d, n) => d in t ? O(t, d, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[d] = n, L = (t, d) => {
6
- for (var n in d || (d = {}))
7
- q.call(d, n) && E(t, n, d[n]);
8
- if (b)
9
- for (var n of b(d))
10
- z.call(d, n) && E(t, n, d[n]);
11
- return t;
12
- }, x = (t, d) => U(t, V(d));
13
- var h = (t, d, n) => new Promise((w, s) => {
14
- var i = (c) => {
5
+ var x = (i, o, n) => o in i ? P(i, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[o] = n, R = (i, o) => {
6
+ for (var n in o || (o = {}))
7
+ q.call(o, n) && x(i, n, o[n]);
8
+ if (E)
9
+ for (var n of E(o))
10
+ z.call(o, n) && x(i, n, o[n]);
11
+ return i;
12
+ }, j = (i, o) => U(i, V(o));
13
+ var v = (i, o, n) => new Promise((l, g) => {
14
+ var s = (e) => {
15
15
  try {
16
- e(n.next(c));
17
- } catch (r) {
18
- s(r);
16
+ f(n.next(e));
17
+ } catch (u) {
18
+ g(u);
19
19
  }
20
- }, p = (c) => {
20
+ }, a = (e) => {
21
21
  try {
22
- e(n.throw(c));
23
- } catch (r) {
24
- s(r);
22
+ f(n.throw(e));
23
+ } catch (u) {
24
+ g(u);
25
25
  }
26
- }, e = (c) => c.done ? w(c.value) : Promise.resolve(c.value).then(i, p);
27
- e((n = n.apply(t, d)).next());
26
+ }, f = (e) => e.done ? l(e.value) : Promise.resolve(e.value).then(s, a);
27
+ f((n = n.apply(i, o)).next());
28
28
  });
29
- import { jsx as l, jsxs as j } from "react/jsx-runtime";
30
- import { useState as v, useContext as B, useRef as F, useEffect as u } from "react";
31
- import G from "../context.mjs";
32
- import J from "./AgentChat/index.mjs";
33
- import M from "../components/KnowledgeList/index.mjs";
34
- import P from "./SessionList/index.mjs";
35
- /* empty css */const ee = (t) => {
29
+ import { jsx as r, jsxs as A } from "react/jsx-runtime";
30
+ import { forwardRef as B, useState as p, useContext as F, useRef as G, useEffect as I, useImperativeHandle as J } from "react";
31
+ import M from "../context.mjs";
32
+ import Q from "./AgentChat/index.mjs";
33
+ import T from "../components/KnowledgeList/index.mjs";
34
+ import W from "./SessionList/index.mjs";
35
+ /* empty css */const te = B((i, o) => {
36
36
  const {
37
- sessionId: d,
38
- appId: n,
39
- docViewerUrl: w
40
- } = t, [s, i] = v(), {
41
- showHeader: p,
37
+ sessionId: n,
38
+ appId: l,
39
+ docViewerUrl: g
40
+ } = i, [s, a] = p(), {
41
+ showHeader: f,
42
42
  agentClient: e,
43
- sider: c,
44
- onSessionLoad: r,
45
- features: f
46
- } = B(G), [m, A] = v(), I = F(null), [K, R] = v(""), [N, k] = v(), [S, y] = v(!1);
47
- u(() => {
48
- var a;
49
- y(s ? !!((a = s.data) != null && a.netOpen) : typeof (f == null ? void 0 : f.connectNetwork) == "object" && typeof (f == null ? void 0 : f.connectNetwork.default) == "boolean" ? f.connectNetwork.default : !1);
50
- }, [s]), u(() => {
51
- const a = () => h(void 0, null, function* () {
52
- const o = e == null ? void 0 : e.application;
53
- if (!(o != null && o.id))
43
+ sider: u,
44
+ onSessionLoad: m,
45
+ features: c
46
+ } = F(M), [h, H] = p(), y = G(null), [K, D] = p(""), [S, k] = p(), [b, N] = p(!1);
47
+ I(() => {
48
+ var d;
49
+ N(s ? !!((d = s.data) != null && d.netOpen) : typeof (c == null ? void 0 : c.connectNetwork) == "object" && typeof (c == null ? void 0 : c.connectNetwork.default) == "boolean" ? c.connectNetwork.default : !1);
50
+ }, [s]), I(() => {
51
+ const d = () => v(void 0, null, function* () {
52
+ const t = e == null ? void 0 : e.application;
53
+ if (!(t != null && t.id))
54
54
  return;
55
- const g = o == null ? void 0 : o.arrange;
56
- if (!(g != null && g.length))
55
+ const w = t == null ? void 0 : t.arrange;
56
+ if (!(w != null && w.length))
57
57
  return;
58
- const D = g[0].embeddingService;
59
- R(D), A(o);
58
+ const O = w[0].embeddingService;
59
+ D(O), H(t);
60
60
  });
61
- return e == null || e.addEventListener("ready", () => a()), () => {
62
- e == null || e.removeEventListener("ready", a);
61
+ return e == null || e.addEventListener("ready", () => d()), () => {
62
+ e == null || e.removeEventListener("ready", d);
63
63
  };
64
- }, []), u(() => {
65
- e && d && (e.ready ? e == null || e.getSessions().then((a) => h(void 0, null, function* () {
66
- i == null || i(a.find((o) => o.id === d));
67
- })) : e.addEventListener("ready", () => h(void 0, null, function* () {
68
- e == null || e.getSessions().then((a) => h(void 0, null, function* () {
69
- i == null || i(a.find((o) => o.id === d));
64
+ }, []), I(() => {
65
+ e && n && (e.ready ? e == null || e.getSessions().then((d) => v(void 0, null, function* () {
66
+ a == null || a(d.find((t) => t.id === n));
67
+ })) : e.addEventListener("ready", () => v(void 0, null, function* () {
68
+ e == null || e.getSessions().then((d) => v(void 0, null, function* () {
69
+ a == null || a(d.find((t) => t.id === n));
70
70
  }));
71
71
  }), !0));
72
- }, [e, d]), u(() => {
72
+ }, [e, n]), I(() => {
73
73
  if (!s) {
74
- r && r({
75
- applicationId: n,
74
+ m && m({
75
+ applicationId: l,
76
76
  sessionId: "",
77
77
  session: null,
78
78
  sessionInstance: null
79
79
  });
80
80
  return;
81
81
  }
82
- s.data && r && r({
83
- applicationId: n,
82
+ s.data && m && m({
83
+ applicationId: l,
84
84
  sessionId: s.data.id,
85
85
  session: s.data,
86
86
  sessionInstance: s
87
87
  }), s.addEventListener("data:loaded", () => {
88
- s != null && s.data && r && r({
89
- applicationId: n,
88
+ s != null && s.data && m && m({
89
+ applicationId: l,
90
90
  sessionId: s.data.id,
91
91
  session: s.data,
92
92
  sessionInstance: s
93
93
  });
94
94
  }, !0);
95
95
  }, [s]);
96
- const H = (a) => {
97
- var o;
98
- return (o = I.current) == null ? void 0 : o.create(x(L({}, a), {
99
- knowledges: N
96
+ const L = (d) => {
97
+ var t;
98
+ return (t = y.current) == null ? void 0 : t.create(j(R({}, d), {
99
+ knowledges: S
100
100
  }));
101
101
  };
102
- return /* @__PURE__ */ l("div", {
102
+ return J(o, () => ({
103
+ sessionCreate: (d) => L(d),
104
+ getSessionList: () => {
105
+ var t;
106
+ const d = ((t = y.current) == null ? void 0 : t.list()) || [];
107
+ return Promise.resolve(d);
108
+ }
109
+ })), /* @__PURE__ */ r("div", {
103
110
  className: "dialog",
104
- children: /* @__PURE__ */ j("div", {
111
+ children: /* @__PURE__ */ A("div", {
105
112
  className: "dialog-pannel",
106
- children: [/* @__PURE__ */ l("div", {
113
+ children: [/* @__PURE__ */ r("div", {
107
114
  className: "dialog-sider",
108
- children: /* @__PURE__ */ l(P, {
109
- ref: I,
110
- sider: c,
111
- appId: n,
112
- networkStatus: S,
115
+ children: /* @__PURE__ */ r(W, {
116
+ ref: y,
117
+ sider: u,
118
+ appId: l,
119
+ networkStatus: b,
113
120
  currentSession: s,
114
- application: m,
115
- setCurrentSession: i,
116
- checkKnowledges: N,
117
- setCheckKnowledges: p ? k : void 0
121
+ application: h,
122
+ setCurrentSession: a,
123
+ checkKnowledges: S,
124
+ setCheckKnowledges: f ? k : void 0
118
125
  })
119
- }), /* @__PURE__ */ l("div", {
126
+ }), /* @__PURE__ */ r("div", {
120
127
  className: "dialog-content",
121
- children: /* @__PURE__ */ j("div", {
128
+ children: /* @__PURE__ */ A("div", {
122
129
  className: "dialog-chat",
123
- children: [p && /* @__PURE__ */ l("div", {
130
+ children: [f && /* @__PURE__ */ r("div", {
124
131
  className: "dialog-chat-header",
125
- children: /* @__PURE__ */ l(M, {
132
+ children: /* @__PURE__ */ r(T, {
126
133
  setCheckKnowledges: k,
127
- application: m,
134
+ application: h,
128
135
  currentSession: s
129
136
  })
130
- }), /* @__PURE__ */ l("div", {
137
+ }), /* @__PURE__ */ r("div", {
131
138
  className: "dialog-chat-content",
132
- children: (m == null ? void 0 : m.id) && /* @__PURE__ */ l(J, {
133
- setNetworkStatus: y,
134
- networkStatus: S,
135
- application: m,
139
+ children: (h == null ? void 0 : h.id) && /* @__PURE__ */ r(Q, {
140
+ setNetworkStatus: N,
141
+ networkStatus: b,
142
+ application: h,
136
143
  currentSession: s,
137
- onCreateSession: H,
138
- docViewerUrl: w,
144
+ onCreateSession: L,
145
+ docViewerUrl: g,
139
146
  embeddingService: K,
140
- setCurrentSession: i
147
+ setCurrentSession: a
141
148
  })
142
149
  })]
143
150
  })
144
151
  })]
145
152
  })
146
153
  });
147
- };
154
+ });
148
155
  export {
149
- ee as default
156
+ te as default
150
157
  };