@glodon-aiot/agent-cli-ui 3.4.0-alpha.2 → 3.4.0-alpha.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.
Files changed (39) hide show
  1. package/dist/es/AgentClientUI.mjs +59 -54
  2. package/dist/es/Dialog/AgentChat/Tools/SessionHistoryDrawer/index.mjs +45 -66
  3. package/dist/es/Dialog/AgentChat/index.mjs +415 -382
  4. package/dist/es/Dialog/SessionList/index.mjs +144 -143
  5. package/dist/es/Dialog/index.mjs +99 -93
  6. package/dist/es/QuillEditor/index.mjs +19 -17
  7. package/dist/es/index.mjs +97 -97
  8. package/dist/es/packages/agent-cli-ui/package.json.mjs +3 -3
  9. package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
  10. package/dist/es/src/style10.css +1 -1
  11. package/dist/es/src/style11.css +1 -1
  12. package/dist/es/src/style12.css +1 -1
  13. package/dist/es/src/style13.css +1 -1
  14. package/dist/es/src/style14.css +1 -1
  15. package/dist/es/src/style15.css +1 -1
  16. package/dist/es/src/style16.css +1 -1
  17. package/dist/es/src/style17.css +1 -1
  18. package/dist/es/src/style18.css +1 -1
  19. package/dist/es/src/style19.css +1 -1
  20. package/dist/es/src/style20.css +1 -1
  21. package/dist/es/src/style21.css +1 -1
  22. package/dist/es/src/style22.css +1 -1
  23. package/dist/es/src/style27.css +1 -1
  24. package/dist/es/src/style28.css +1 -1
  25. package/dist/es/src/style29.css +1 -1
  26. package/dist/es/src/style30.css +1 -1
  27. package/dist/es/src/style31.css +1 -1
  28. package/dist/es/src/style5.css +1 -1
  29. package/dist/es/src/style6.css +1 -1
  30. package/dist/es/src/style7.css +1 -1
  31. package/dist/es/src/style8.css +1 -1
  32. package/dist/lib/index.css +1 -1
  33. package/dist/lib/index.js +56 -56
  34. package/dist/src/AgentClientUI.d.ts +1 -0
  35. package/dist/src/Dialog/AgentChat/Tools/SessionHistoryDrawer/index.d.ts +2 -0
  36. package/dist/src/Dialog/AgentChat/index.d.ts +4 -1
  37. package/dist/src/Dialog/index.d.ts +1 -0
  38. package/dist/src/QuillEditor/index.d.ts +1 -0
  39. package/package.json +3 -3
@@ -1,81 +1,81 @@
1
- var q = Object.defineProperty, z = Object.defineProperties;
2
- var B = Object.getOwnPropertyDescriptors;
3
- var R = Object.getOwnPropertySymbols;
4
- var F = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
5
- var j = (i, t, s) => t in i ? q(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s, A = (i, t) => {
6
- for (var s in t || (t = {}))
7
- F.call(t, s) && j(i, s, t[s]);
8
- if (R)
9
- for (var s of R(t))
10
- G.call(t, s) && j(i, s, t[s]);
11
- return i;
12
- }, H = (i, t) => z(i, B(t));
13
- var p = (i, t, s) => new Promise((l, y) => {
14
- var n = (e) => {
1
+ var z = Object.defineProperty, B = Object.defineProperties;
2
+ var F = Object.getOwnPropertyDescriptors;
3
+ var j = Object.getOwnPropertySymbols;
4
+ var G = Object.prototype.hasOwnProperty, J = Object.prototype.propertyIsEnumerable;
5
+ var A = (r, d, s) => d in r ? z(r, d, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[d] = s, H = (r, d) => {
6
+ for (var s in d || (d = {}))
7
+ G.call(d, s) && A(r, s, d[s]);
8
+ if (j)
9
+ for (var s of j(d))
10
+ J.call(d, s) && A(r, s, d[s]);
11
+ return r;
12
+ }, K = (r, d) => B(r, F(d));
13
+ var v = (r, d, s) => new Promise((l, g) => {
14
+ var t = (e) => {
15
15
  try {
16
16
  f(s.next(e));
17
- } catch (v) {
18
- y(v);
17
+ } catch (p) {
18
+ g(p);
19
19
  }
20
20
  }, a = (e) => {
21
21
  try {
22
22
  f(s.throw(e));
23
- } catch (v) {
24
- y(v);
23
+ } catch (p) {
24
+ g(p);
25
25
  }
26
- }, f = (e) => e.done ? l(e.value) : Promise.resolve(e.value).then(n, a);
27
- f((s = s.apply(i, t)).next());
26
+ }, f = (e) => e.done ? l(e.value) : Promise.resolve(e.value).then(t, a);
27
+ f((s = s.apply(r, d)).next());
28
28
  });
29
- import { jsx as r, jsxs as K } from "react/jsx-runtime";
30
- import { forwardRef as J, useState as u, useContext as M, useRef as Q, useEffect as w, useImperativeHandle as T } from "react";
31
- import W from "../context.mjs";
32
- import X from "./AgentChat/index.mjs";
33
- import Y from "../components/KnowledgeList/index.mjs";
34
- import Z from "../components/Sider/index.mjs";
35
- /* empty css */const ie = J((i, t) => {
29
+ import { jsx as i, jsxs as T } from "react/jsx-runtime";
30
+ import { forwardRef as M, useState as h, useContext as Q, useRef as D, useEffect as I, useImperativeHandle as W } from "react";
31
+ import X from "../context.mjs";
32
+ import Y from "./AgentChat/index.mjs";
33
+ import Z from "../components/KnowledgeList/index.mjs";
34
+ import _ from "../components/Sider/index.mjs";
35
+ /* empty css */const ae = M((r, d) => {
36
36
  const {
37
37
  sessionId: s,
38
38
  appId: l,
39
- docViewerUrl: y
40
- } = i, [n, a] = u(), {
39
+ docViewerUrl: g
40
+ } = r, [t, a] = h(), {
41
41
  showHeader: f,
42
42
  agentClient: e,
43
- sider: v,
43
+ sider: p,
44
44
  onSessionLoad: m,
45
45
  features: c,
46
- mode: D
47
- } = M(W), [h, O] = u(), I = Q(null), [P, U] = u(""), [N, k] = u(), [b, S] = u(!1), [E, L] = u([]);
48
- w(() => {
49
- var d;
50
- S(n ? !!((d = n.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);
51
- }, [n]), w(() => {
52
- const d = () => p(void 0, null, function* () {
46
+ mode: O
47
+ } = Q(X), [u, P] = h(), w = D(null), [U, V] = h(""), [N, k] = h(), b = D(null), [x, S] = h(!1), [E, L] = h([]);
48
+ I(() => {
49
+ var n;
50
+ S(t ? !!((n = t.data) != null && n.netOpen) : typeof (c == null ? void 0 : c.connectNetwork) == "object" && typeof (c == null ? void 0 : c.connectNetwork.default) == "boolean" ? c.connectNetwork.default : !1);
51
+ }, [t]), I(() => {
52
+ const n = () => v(void 0, null, function* () {
53
53
  const o = e == null ? void 0 : e.application;
54
54
  if (!(o != null && o.id))
55
55
  return;
56
- const g = o == null ? void 0 : o.arrange;
57
- if (!(g != null && g.length))
56
+ const y = o == null ? void 0 : o.arrange;
57
+ if (!(y != null && y.length))
58
58
  return;
59
- const V = g[0].embeddingService;
60
- U(V), O(o);
59
+ const q = y[0].embeddingService;
60
+ V(q), P(o);
61
61
  });
62
62
  if (e != null && e.ready) {
63
- d();
63
+ n();
64
64
  return;
65
65
  }
66
- return e == null || e.addEventListener("ready", () => d()), () => {
67
- e == null || e.removeEventListener("ready", d);
66
+ return e == null || e.addEventListener("ready", () => n()), () => {
67
+ e == null || e.removeEventListener("ready", n);
68
68
  };
69
- }, [e]), w(() => {
70
- e && s && (e.ready ? e == null || e.getSessions().then((d) => p(void 0, null, function* () {
71
- a == null || a(d.find((o) => o.id === s));
72
- })) : e.addEventListener("ready", () => p(void 0, null, function* () {
73
- e == null || e.getSessions().then((d) => p(void 0, null, function* () {
74
- a == null || a(d.find((o) => o.id === s));
69
+ }, [e]), I(() => {
70
+ e && s && (e.ready ? e == null || e.getSessions().then((n) => v(void 0, null, function* () {
71
+ a == null || a(n.find((o) => o.id === s));
72
+ })) : e.addEventListener("ready", () => v(void 0, null, function* () {
73
+ e == null || e.getSessions().then((n) => v(void 0, null, function* () {
74
+ a == null || a(n.find((o) => o.id === s));
75
75
  }));
76
76
  }), !0));
77
- }, [e, s]), w(() => {
78
- if (!n) {
77
+ }, [e, s]), I(() => {
78
+ if (!t) {
79
79
  m && m({
80
80
  applicationId: l,
81
81
  sessionId: "",
@@ -84,48 +84,53 @@ import Z from "../components/Sider/index.mjs";
84
84
  });
85
85
  return;
86
86
  }
87
- n.data && m && m({
87
+ t.data && m && m({
88
88
  applicationId: l,
89
- sessionId: n.data.id,
90
- session: n.data,
91
- sessionInstance: n
92
- }), n.addEventListener("data:loaded", () => {
93
- n != null && n.data && m && m({
89
+ sessionId: t.data.id,
90
+ session: t.data,
91
+ sessionInstance: t
92
+ }), t.addEventListener("data:loaded", () => {
93
+ t != null && t.data && m && m({
94
94
  applicationId: l,
95
- sessionId: n.data.id,
96
- session: n.data,
97
- sessionInstance: n
95
+ sessionId: t.data.id,
96
+ session: t.data,
97
+ sessionInstance: t
98
98
  });
99
99
  }, !0);
100
- }, [n]);
101
- const x = (d) => {
100
+ }, [t]);
101
+ const R = (n) => {
102
102
  var o;
103
- return (o = I.current) == null ? void 0 : o.create(H(A({}, d), {
103
+ return (o = w.current) == null ? void 0 : o.create(K(H({}, n), {
104
104
  knowledges: N
105
105
  }));
106
106
  };
107
- return T(t, () => ({
108
- createSession: (d) => x(d),
107
+ return W(d, () => ({
108
+ createSession: (n) => R(n),
109
109
  getSessionList: () => {
110
110
  var o;
111
- const d = ((o = I.current) == null ? void 0 : o.list()) || [];
112
- return Promise.resolve(d);
111
+ const n = ((o = w.current) == null ? void 0 : o.list()) || [];
112
+ return Promise.resolve(n);
113
+ },
114
+ // 新增:获取当前输入框内容
115
+ getCurrentInputText: () => {
116
+ var n;
117
+ return (n = b.current) == null ? void 0 : n.getCurrentInputText();
113
118
  }
114
- })), /* @__PURE__ */ r("div", {
119
+ })), /* @__PURE__ */ i("div", {
115
120
  className: "dialog",
116
- children: /* @__PURE__ */ K("div", {
121
+ children: /* @__PURE__ */ T("div", {
117
122
  className: "dialog-pannel",
118
- children: [/* @__PURE__ */ r("div", {
123
+ children: [/* @__PURE__ */ i("div", {
119
124
  className: "dialog-sider",
120
125
  style: {
121
- display: v && D === "inlay" ? "block" : "none"
126
+ display: p && O === "inlay" ? "block" : "none"
122
127
  },
123
- children: /* @__PURE__ */ r(Z, {
124
- ref: I,
128
+ children: /* @__PURE__ */ i(_, {
129
+ ref: w,
125
130
  appId: l,
126
- networkStatus: b,
127
- currentSession: n,
128
- application: h,
131
+ networkStatus: x,
132
+ currentSession: t,
133
+ application: u,
129
134
  setCurrentSession: a,
130
135
  checkKnowledges: N,
131
136
  setCheckKnowledges: f ? k : void 0,
@@ -133,30 +138,31 @@ import Z from "../components/Sider/index.mjs";
133
138
  setSessions: L,
134
139
  sessionId: s
135
140
  })
136
- }), /* @__PURE__ */ r("div", {
141
+ }), /* @__PURE__ */ i("div", {
137
142
  className: "dialog-content",
138
- children: /* @__PURE__ */ K("div", {
143
+ children: /* @__PURE__ */ T("div", {
139
144
  className: "dialog-chat",
140
- children: [f && /* @__PURE__ */ r("div", {
145
+ children: [f && /* @__PURE__ */ i("div", {
141
146
  className: "dialog-chat-header",
142
- children: /* @__PURE__ */ r(Y, {
147
+ children: /* @__PURE__ */ i(Z, {
143
148
  setCheckKnowledges: k,
144
- application: h,
145
- currentSession: n
149
+ application: u,
150
+ currentSession: t
146
151
  })
147
- }), /* @__PURE__ */ r("div", {
152
+ }), /* @__PURE__ */ i("div", {
148
153
  className: "dialog-chat-content",
149
- children: (h == null ? void 0 : h.id) && /* @__PURE__ */ r(X, {
154
+ children: (u == null ? void 0 : u.id) && /* @__PURE__ */ i(Y, {
150
155
  setNetworkStatus: S,
151
- networkStatus: b,
152
- application: h,
153
- currentSession: n,
154
- onCreateSession: x,
155
- docViewerUrl: y,
156
- embeddingService: P,
156
+ networkStatus: x,
157
+ application: u,
158
+ currentSession: t,
159
+ onCreateSession: R,
160
+ docViewerUrl: g,
161
+ embeddingService: U,
157
162
  setCurrentSession: a,
158
163
  sessions: E,
159
- setSessions: L
164
+ setSessions: L,
165
+ ref: b
160
166
  })
161
167
  })]
162
168
  })
@@ -165,5 +171,5 @@ import Z from "../components/Sider/index.mjs";
165
171
  });
166
172
  });
167
173
  export {
168
- ie as default
174
+ ae as default
169
175
  };
@@ -1,11 +1,11 @@
1
1
  import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as X, useState as o, useRef as O, useImperativeHandle as Y, useEffect as g } from "react";
2
+ import { forwardRef as X, useState as o, useRef as O, useImperativeHandle as Y, useEffect as p } from "react";
3
3
  import { Popover as Z, Space as ee, Button as te } from "antd";
4
4
  import { useKeyPress as P } from "ahooks";
5
5
  import T from "classnames";
6
6
  import ne from "react-quill";
7
7
  import re from "../components/Iconfont/index.mjs";
8
- import { shortCutEnum as p } from "../utils/index.mjs";
8
+ import { shortCutEnum as m } from "../utils/index.mjs";
9
9
  import "react-quill/dist/quill.snow.css";
10
10
  /* empty css */const ie = X((z, F) => {
11
11
  var D, q, B;
@@ -17,14 +17,16 @@ import "react-quill/dist/quill.snow.css";
17
17
  onChange: y,
18
18
  networkStatus: a,
19
19
  clearAction: C,
20
- loading: m
21
- } = z, [b, L] = o(!0), [h, l] = o(), [v, w] = o(), [M, Q] = o(15), [S, U] = o(12), [k, A] = o(0), [I, E] = o(!1), V = O(null), n = O(null);
20
+ loading: v
21
+ } = z, [b, L] = o(!0), [h, l] = o(), [g, w] = o(), [M, Q] = o(15), [S, U] = o(12), [k, A] = o(0), [I, E] = o(!1), V = O(null), n = O(null);
22
22
  Y(F, () => ({
23
23
  clear: $,
24
24
  prevent: H,
25
25
  focus: x,
26
- update: W
27
- })), g(() => {
26
+ update: W,
27
+ // 新增:获取当前输入框内容
28
+ getCurrentText: () => g
29
+ })), p(() => {
28
30
  l(N), n.current && (f(), x());
29
31
  }, [N]);
30
32
  const W = (e) => {
@@ -40,7 +42,7 @@ import "react-quill/dist/quill.snow.css";
40
42
  e.getLength() > 0 && e.setSelection(e.getLength(), e.getLength());
41
43
  });
42
44
  };
43
- g(() => {
45
+ p(() => {
44
46
  if (!n.current)
45
47
  return;
46
48
  const e = n.current.getEditor();
@@ -73,20 +75,20 @@ import "react-quill/dist/quill.snow.css";
73
75
  if (!a)
74
76
  return;
75
77
  const e = (t = n.current) == null ? void 0 : t.getEditor();
76
- e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, p.NETWORK));
78
+ e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, m.NETWORK));
77
79
  }, _ = () => {
78
80
  var t;
79
81
  const e = (t = n.current) == null ? void 0 : t.getEditor();
80
- e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, p.DOCUMENT));
82
+ e == null || e.focus(), E(!1), setTimeout(() => e == null ? void 0 : e.insertText(k, m.DOCUMENT));
81
83
  }, G = () => {
82
84
  var t, i, u;
83
85
  const e = (t = n.current) == null ? void 0 : t.getEditor();
84
- return e && (e == null ? void 0 : e.getLength()) > 2 && !((i = e.getText()) != null && i.includes(p.NETWORK)) && !((u = e.getText()) != null && u.includes(p.DOCUMENT));
86
+ return e && (e == null ? void 0 : e.getLength()) > 2 && !((i = e.getText()) != null && i.includes(m.NETWORK)) && !((u = e.getText()) != null && u.includes(m.DOCUMENT));
85
87
  };
86
- return g(() => {
88
+ return p(() => {
87
89
  var e, t;
88
- m ? (e = n.current) == null || e.getEditor().disable() : (t = n.current) == null || t.getEditor().enable();
89
- }, [m]), g(() => (window.addEventListener("resize", f), () => {
90
+ v ? (e = n.current) == null || e.getEditor().disable() : (t = n.current) == null || t.getEditor().enable();
91
+ }, [v]), p(() => (window.addEventListener("resize", f), () => {
90
92
  window.removeEventListener("resize", f);
91
93
  }), []), /* @__PURE__ */ s("div", {
92
94
  className: T({
@@ -110,7 +112,7 @@ import "react-quill/dist/quill.snow.css";
110
112
  onKeyDown: (e) => {
111
113
  if (!e.shiftKey && e.keyCode == 13) {
112
114
  const t = h == null ? void 0 : h.replace(/[\n\s]+$/, "");
113
- l(t), d && d(v);
115
+ l(t), d && d(g);
114
116
  }
115
117
  },
116
118
  value: h,
@@ -199,8 +201,8 @@ import "react-quill/dist/quill.snow.css";
199
201
  }), /* @__PURE__ */ r(te, {
200
202
  type: "link",
201
203
  ghost: !0,
202
- disabled: j || !v,
203
- loading: m,
204
+ disabled: j || !g,
205
+ loading: v,
204
206
  icon: /* @__PURE__ */ r(re, {
205
207
  className: "icon-sendMsg",
206
208
  style: {
@@ -209,7 +211,7 @@ import "react-quill/dist/quill.snow.css";
209
211
  type: "icon-fasong"
210
212
  }),
211
213
  onClick: () => {
212
- d && d(v);
214
+ d && d(g);
213
215
  }
214
216
  })]
215
217
  })]