@glodon-aiot/agent-cli-ui 3.3.6 → 3.4.0-alpha.3

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 (54) hide show
  1. package/dist/es/AgentClientUI.mjs +59 -54
  2. package/dist/es/Dialog/AgentChat/Tools/SessionHistoryDrawer/index.mjs +74 -0
  3. package/dist/es/Dialog/AgentChat/index.mjs +589 -560
  4. package/dist/es/Dialog/SessionList/index.mjs +255 -173
  5. package/dist/es/Dialog/index.mjs +117 -103
  6. package/dist/es/QuillEditor/index.mjs +19 -17
  7. package/dist/es/components/Sider/index.mjs +24 -0
  8. package/dist/es/constant.mjs +2 -0
  9. package/dist/es/index.mjs +100 -99
  10. package/dist/es/packages/agent-cli-ui/package.json.mjs +3 -3
  11. package/dist/es/packages/react-components/dist/es/index.mjs +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/style28.css +1 -1
  30. package/dist/es/src/style29.css +1 -1
  31. package/dist/es/src/style30.css +1 -1
  32. package/dist/es/src/style31.css +1 -1
  33. package/dist/es/src/style32.css +1 -0
  34. package/dist/es/src/style33.css +1 -0
  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 +57 -57
  42. package/dist/src/AgentClientUI.d.ts +1 -0
  43. package/dist/src/Dialog/AgentChat/HistoryItem/FileItem/index.d.ts +1 -1
  44. package/dist/src/Dialog/AgentChat/HistoryItem/SessionAction/index.d.ts +1 -1
  45. package/dist/src/Dialog/AgentChat/HistoryItem/index.d.ts +1 -1
  46. package/dist/src/Dialog/AgentChat/PromptSetting/index.d.ts +2 -2
  47. package/dist/src/Dialog/AgentChat/Tools/SessionHistoryDrawer/index.d.ts +2 -2
  48. package/dist/src/Dialog/AgentChat/index.d.ts +8 -3
  49. package/dist/src/Dialog/SessionList/index.d.ts +9 -5
  50. package/dist/src/Dialog/index.d.ts +1 -0
  51. package/dist/src/QuillEditor/index.d.ts +1 -0
  52. package/dist/src/components/KnowledgeList/index.d.ts +1 -1
  53. package/dist/src/types.d.ts +1 -0
  54. package/package.json +3 -3
@@ -1,80 +1,81 @@
1
- var P = Object.defineProperty, U = Object.defineProperties;
2
- var V = Object.getOwnPropertyDescriptors;
3
- var E = Object.getOwnPropertySymbols;
4
- var q = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
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) => {
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
- f(n.next(e));
17
- } catch (u) {
18
- g(u);
16
+ f(s.next(e));
17
+ } catch (p) {
18
+ g(p);
19
19
  }
20
- }, r = (e) => {
20
+ }, a = (e) => {
21
21
  try {
22
- f(n.throw(e));
23
- } catch (u) {
24
- g(u);
22
+ f(s.throw(e));
23
+ } catch (p) {
24
+ g(p);
25
25
  }
26
- }, f = (e) => e.done ? l(e.value) : Promise.resolve(e.value).then(s, r);
27
- f((n = n.apply(i, o)).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 a, jsxs as A } from "react/jsx-runtime";
30
- import { forwardRef as B, useState as p, useContext as F, useRef as G, useEffect as y, 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) => {
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
- sessionId: n,
37
+ sessionId: s,
38
38
  appId: l,
39
39
  docViewerUrl: g
40
- } = i, [s, r] = p(), {
40
+ } = r, [t, a] = h(), {
41
41
  showHeader: f,
42
42
  agentClient: e,
43
- sider: u,
43
+ sider: p,
44
44
  onSessionLoad: m,
45
- features: c
46
- } = F(M), [h, H] = p(), I = G(null), [K, D] = p(""), [S, k] = p(), [b, N] = p(!1);
47
- y(() => {
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]), y(() => {
51
- const d = () => v(void 0, null, function* () {
52
- const t = e == null ? void 0 : e.application;
53
- if (!(t != null && t.id))
45
+ features: c,
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
+ const o = e == null ? void 0 : e.application;
54
+ if (!(o != null && o.id))
54
55
  return;
55
- const w = t == null ? void 0 : t.arrange;
56
- if (!(w != null && w.length))
56
+ const y = o == null ? void 0 : o.arrange;
57
+ if (!(y != null && y.length))
57
58
  return;
58
- const O = w[0].embeddingService;
59
- D(O), H(t);
59
+ const q = y[0].embeddingService;
60
+ V(q), P(o);
60
61
  });
61
62
  if (e != null && e.ready) {
62
- d();
63
+ n();
63
64
  return;
64
65
  }
65
- return e == null || e.addEventListener("ready", () => d()), () => {
66
- e == null || e.removeEventListener("ready", d);
66
+ return e == null || e.addEventListener("ready", () => n()), () => {
67
+ e == null || e.removeEventListener("ready", n);
67
68
  };
68
- }, [e]), y(() => {
69
- e && n && (e.ready ? e == null || e.getSessions().then((d) => v(void 0, null, function* () {
70
- r == null || r(d.find((t) => t.id === n));
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));
71
72
  })) : e.addEventListener("ready", () => v(void 0, null, function* () {
72
- e == null || e.getSessions().then((d) => v(void 0, null, function* () {
73
- r == null || r(d.find((t) => t.id === n));
73
+ e == null || e.getSessions().then((n) => v(void 0, null, function* () {
74
+ a == null || a(n.find((o) => o.id === s));
74
75
  }));
75
76
  }), !0));
76
- }, [e, n]), y(() => {
77
- if (!s) {
77
+ }, [e, s]), I(() => {
78
+ if (!t) {
78
79
  m && m({
79
80
  applicationId: l,
80
81
  sessionId: "",
@@ -83,72 +84,85 @@ import W from "./SessionList/index.mjs";
83
84
  });
84
85
  return;
85
86
  }
86
- s.data && m && m({
87
+ t.data && m && m({
87
88
  applicationId: l,
88
- sessionId: s.data.id,
89
- session: s.data,
90
- sessionInstance: s
91
- }), s.addEventListener("data:loaded", () => {
92
- s != null && s.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({
93
94
  applicationId: l,
94
- sessionId: s.data.id,
95
- session: s.data,
96
- sessionInstance: s
95
+ sessionId: t.data.id,
96
+ session: t.data,
97
+ sessionInstance: t
97
98
  });
98
99
  }, !0);
99
- }, [s]);
100
- const L = (d) => {
101
- var t;
102
- return (t = I.current) == null ? void 0 : t.create(j(R({}, d), {
103
- knowledges: S
100
+ }, [t]);
101
+ const R = (n) => {
102
+ var o;
103
+ return (o = w.current) == null ? void 0 : o.create(K(H({}, n), {
104
+ knowledges: N
104
105
  }));
105
106
  };
106
- return J(o, () => ({
107
- createSession: (d) => L(d),
107
+ return W(d, () => ({
108
+ createSession: (n) => R(n),
108
109
  getSessionList: () => {
109
- var t;
110
- const d = ((t = I.current) == null ? void 0 : t.list()) || [];
111
- return Promise.resolve(d);
110
+ var o;
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();
112
118
  }
113
- })), /* @__PURE__ */ a("div", {
119
+ })), /* @__PURE__ */ i("div", {
114
120
  className: "dialog",
115
- children: /* @__PURE__ */ A("div", {
121
+ children: /* @__PURE__ */ T("div", {
116
122
  className: "dialog-pannel",
117
- children: [/* @__PURE__ */ a("div", {
123
+ children: [/* @__PURE__ */ i("div", {
118
124
  className: "dialog-sider",
119
- children: /* @__PURE__ */ a(W, {
120
- ref: I,
121
- sider: u,
125
+ style: {
126
+ display: p && O === "inlay" ? "block" : "none"
127
+ },
128
+ children: /* @__PURE__ */ i(_, {
129
+ ref: w,
122
130
  appId: l,
123
- networkStatus: b,
124
- currentSession: s,
125
- application: h,
126
- setCurrentSession: r,
127
- checkKnowledges: S,
128
- setCheckKnowledges: f ? k : void 0
131
+ networkStatus: x,
132
+ currentSession: t,
133
+ application: u,
134
+ setCurrentSession: a,
135
+ checkKnowledges: N,
136
+ setCheckKnowledges: f ? k : void 0,
137
+ sessions: E,
138
+ setSessions: L,
139
+ sessionId: s
129
140
  })
130
- }), /* @__PURE__ */ a("div", {
141
+ }), /* @__PURE__ */ i("div", {
131
142
  className: "dialog-content",
132
- children: /* @__PURE__ */ A("div", {
143
+ children: /* @__PURE__ */ T("div", {
133
144
  className: "dialog-chat",
134
- children: [f && /* @__PURE__ */ a("div", {
145
+ children: [f && /* @__PURE__ */ i("div", {
135
146
  className: "dialog-chat-header",
136
- children: /* @__PURE__ */ a(T, {
147
+ children: /* @__PURE__ */ i(Z, {
137
148
  setCheckKnowledges: k,
138
- application: h,
139
- currentSession: s
149
+ application: u,
150
+ currentSession: t
140
151
  })
141
- }), /* @__PURE__ */ a("div", {
152
+ }), /* @__PURE__ */ i("div", {
142
153
  className: "dialog-chat-content",
143
- children: (h == null ? void 0 : h.id) && /* @__PURE__ */ a(Q, {
144
- setNetworkStatus: N,
145
- networkStatus: b,
146
- application: h,
147
- currentSession: s,
148
- onCreateSession: L,
154
+ children: (u == null ? void 0 : u.id) && /* @__PURE__ */ i(Y, {
155
+ setNetworkStatus: S,
156
+ networkStatus: x,
157
+ application: u,
158
+ currentSession: t,
159
+ onCreateSession: R,
149
160
  docViewerUrl: g,
150
- embeddingService: K,
151
- setCurrentSession: r
161
+ embeddingService: U,
162
+ setCurrentSession: a,
163
+ sessions: E,
164
+ setSessions: L,
165
+ ref: b
152
166
  })
153
167
  })]
154
168
  })
@@ -157,5 +171,5 @@ import W from "./SessionList/index.mjs";
157
171
  });
158
172
  });
159
173
  export {
160
- te as default
174
+ ae as default
161
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
  })]
@@ -0,0 +1,24 @@
1
+ var a = Object.defineProperty;
2
+ var o = Object.getOwnPropertySymbols;
3
+ var d = Object.prototype.hasOwnProperty, f = Object.prototype.propertyIsEnumerable;
4
+ var s = (e, r, i) => r in e ? a(e, r, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[r] = i, t = (e, r) => {
5
+ for (var i in r || (r = {}))
6
+ d.call(r, i) && s(e, i, r[i]);
7
+ if (o)
8
+ for (var i of o(r))
9
+ f.call(r, i) && s(e, i, r[i]);
10
+ return e;
11
+ };
12
+ import { jsx as m } from "react/jsx-runtime";
13
+ import { forwardRef as n } from "react";
14
+ import p from "../../Dialog/SessionList/index.mjs";
15
+ /* empty css */const c = n((e, r) => /* @__PURE__ */ m("div", {
16
+ className: "sider-container",
17
+ children: /* @__PURE__ */ m(p, t({
18
+ ref: r
19
+ }, e))
20
+ }));
21
+ c.displayName = "Sider";
22
+ export {
23
+ c as default
24
+ };
@@ -58,6 +58,8 @@ const u = {
58
58
  // 默认临界值
59
59
  },
60
60
  sessionList: !0,
61
+ siderTitle: !1,
62
+ //默认不展示应用名称
61
63
  newSession: !0,
62
64
  fileUpload: !0,
63
65
  //dialog only