@glodon-aiot/agent-cli-ui 3.3.7-beta.2 → 3.3.8-alpha.1

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 (52) hide show
  1. package/dist/es/AgentClientUI.mjs +107 -94
  2. package/dist/es/Dialog/AgentChat/HistoryItem/SessionRefer/index.mjs +46 -59
  3. package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +46 -47
  4. package/dist/es/Dialog/AgentChat/index.mjs +378 -376
  5. package/dist/es/Dialog/SessionList/index.mjs +115 -119
  6. package/dist/es/Dialog/index.mjs +26 -30
  7. package/dist/es/QuillEditor/index.mjs +59 -70
  8. package/dist/es/components/Recommend/index.mjs +34 -52
  9. package/dist/es/constant.mjs +3 -11
  10. package/dist/es/index.mjs +293 -285
  11. package/dist/es/packages/agent-cli-ui/package.json.mjs +23 -25
  12. package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
  13. package/dist/es/src/style.css +1 -1
  14. package/dist/es/src/style10.css +1 -1
  15. package/dist/es/src/style11.css +1 -1
  16. package/dist/es/src/style12.css +1 -1
  17. package/dist/es/src/style13.css +1 -1
  18. package/dist/es/src/style14.css +1 -1
  19. package/dist/es/src/style15.css +1 -1
  20. package/dist/es/src/style17.css +1 -1
  21. package/dist/es/src/style18.css +1 -1
  22. package/dist/es/src/style19.css +1 -1
  23. package/dist/es/src/style20.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/style4.css +1 -1
  32. package/dist/es/src/style5.css +1 -1
  33. package/dist/es/src/style6.css +1 -1
  34. package/dist/es/src/style7.css +1 -1
  35. package/dist/es/src/style8.css +1 -1
  36. package/dist/es/src/style9.css +1 -1
  37. package/dist/lib/index.css +1 -1
  38. package/dist/lib/index.js +54 -54
  39. package/dist/src/AgentClientUI.d.ts +1 -1
  40. package/dist/src/Dialog/AgentChat/HistoryItem/SessionRefer/index.d.ts +0 -2
  41. package/dist/src/Dialog/index.d.ts +1 -1
  42. package/dist/src/Footer/index.d.ts +1 -2
  43. package/dist/src/QuillEditor/index.d.ts +1 -1
  44. package/dist/src/components/Greeting/index.d.ts +1 -2
  45. package/dist/src/components/Header/index.d.ts +1 -2
  46. package/dist/src/components/Recommend/index.d.ts +0 -1
  47. package/dist/src/constant.d.ts +0 -4
  48. package/dist/src/index.d.ts +1 -5
  49. package/dist/src/types.d.ts +2 -3
  50. package/dist/src/utils/antdConfig.d.ts +7 -0
  51. package/dist/src/utils/testAntdPrefix.d.ts +3 -0
  52. package/package.json +11 -13
@@ -1,136 +1,149 @@
1
- var Q = Object.defineProperty, T = Object.defineProperties;
2
- var X = Object.getOwnPropertyDescriptors;
1
+ var z = Object.defineProperty, ee = Object.defineProperties;
2
+ var te = Object.getOwnPropertyDescriptors;
3
3
  var y = Object.getOwnPropertySymbols;
4
- var Y = Object.prototype.hasOwnProperty, Z = Object.prototype.propertyIsEnumerable;
5
- var R = (o, t, e) => t in o ? Q(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, f = (o, t) => {
4
+ var oe = Object.prototype.hasOwnProperty, ne = Object.prototype.propertyIsEnumerable;
5
+ var I = (n, t, e) => t in n ? z(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, f = (n, t) => {
6
6
  for (var e in t || (t = {}))
7
- Y.call(t, e) && R(o, e, t[e]);
7
+ oe.call(t, e) && I(n, e, t[e]);
8
8
  if (y)
9
9
  for (var e of y(t))
10
- Z.call(t, e) && R(o, e, t[e]);
11
- return o;
12
- }, g = (o, t) => T(o, X(t));
10
+ ne.call(t, e) && I(n, e, t[e]);
11
+ return n;
12
+ }, h = (n, t) => ee(n, te(t));
13
13
  import { jsx as s, jsxs as x } from "react/jsx-runtime";
14
- import { forwardRef as _, useRef as U, useState as r, useEffect as k, useImperativeHandle as B } from "react";
15
- /* empty css */import { AgentClientProvider as z } from "./context.mjs";
16
- import { Resizable as ee } from "react-resizable";
17
- import te from "./Dialog/index.mjs";
18
- import { ConfigProvider as A, Spin as ne, Button as L } from "antd";
19
- import oe from "antd/es/locale/zh_CN";
20
- const Ne = _((o, t) => {
14
+ import { forwardRef as ie, useRef as k, useState as d, useEffect as A, useImperativeHandle as se } from "react";
15
+ /* empty css */import { AgentClientProvider as le } from "./context.mjs";
16
+ import { Resizable as ae } from "react-resizable";
17
+ import re from "./Dialog/index.mjs";
18
+ import { configure as de, BotClient as me } from "@glodon-aiot/bot-client-sdk";
19
+ import { JWT as ce } from "./utils/index.mjs";
20
+ import { ConfigProvider as L, Spin as fe, Button as U } from "antd";
21
+ import he from "antd/es/locale/zh_CN";
22
+ const ke = ie((n, t) => {
21
23
  const {
22
24
  className: e,
23
25
  triggerButton: l,
24
- size: n,
25
- theme: S,
26
- icon: p,
27
- docViewerUrl: $,
28
- token: ie,
29
- debug: se,
30
- env: le,
31
- plugins: ae,
32
- mcp: de,
33
- footer: H,
34
- defaultInput: j,
35
- onComment: M,
36
- onSessionLoad: P,
37
- onSessionUnload: W,
38
- onMessage: D,
39
- beforeMessageSend: E,
40
- bodyStyle: u,
41
- apiUrl: re,
42
- sessionId: O,
43
- disabled: V,
44
- transform: q,
45
- features: F,
46
- stream: me,
47
- agentClient: m,
48
- application: d
49
- } = o, b = U(null), [G, ce] = r(!1), [C, J] = r(), [i, v] = r(n), [w, N] = r(o.open), c = U(null);
50
- k(() => {
51
- d && (console.log("[AgentClientUI] token", m, d), J(d.id));
52
- }, [d]), A.config({
53
- theme: S
54
- }), k(() => {
55
- n && v(n);
56
- }, [n]);
57
- const K = (a, {
58
- element: h,
59
- size: I
26
+ size: o,
27
+ theme: $,
28
+ icon: g,
29
+ docViewerUrl: H,
30
+ token: m,
31
+ debug: W,
32
+ env: j,
33
+ plugins: M,
34
+ mcp: P,
35
+ footer: S,
36
+ defaultInput: T,
37
+ onComment: D,
38
+ onSessionLoad: E,
39
+ onSessionUnload: J,
40
+ onMessage: O,
41
+ beforeMessageSend: V,
42
+ bodyStyle: p,
43
+ apiUrl: q,
44
+ sessionId: F,
45
+ disabled: G,
46
+ transform: K,
47
+ features: Q,
48
+ stream: X
49
+ } = n, u = k(null), [Y, ge] = d(!1), [C, Z] = d(), [b, _] = d(), [i, w] = d(o), [v, N] = d(n.open), c = k(null);
50
+ A(() => {
51
+ if (!m)
52
+ return;
53
+ const a = ce(m);
54
+ Z(a.rid), de({
55
+ debug: W,
56
+ env: j,
57
+ apiRoot: q
58
+ });
59
+ const r = new me(m, {
60
+ plugins: M,
61
+ mcp: P,
62
+ stream: X
63
+ });
64
+ _(r);
65
+ }, [m]), L.config({
66
+ theme: $
67
+ }), A(() => {
68
+ o && w(o);
69
+ }, [o]);
70
+ const B = (a, {
71
+ element: r,
72
+ size: R
60
73
  }) => {
61
- v({
62
- width: Number(I.width),
63
- height: I.height
74
+ w({
75
+ width: Number(R.width),
76
+ height: R.height
64
77
  });
65
78
  };
66
- return B(t, () => ({
67
- createSession: (a) => {
68
- var h;
69
- return (h = c.current) == null ? void 0 : h.createSession(a);
79
+ return se(t, () => ({
80
+ sessionCreate: (a) => {
81
+ var r;
82
+ return (r = c.current) == null ? void 0 : r.sessionCreate(a);
70
83
  },
71
84
  getSessionList: () => {
72
85
  var a;
73
86
  return (a = c.current) == null ? void 0 : a.getSessionList();
74
87
  }
75
- })), /* @__PURE__ */ s(A, {
76
- locale: oe,
77
- children: /* @__PURE__ */ x(z, {
78
- value: g(f({}, o), {
79
- popupContainer: b,
80
- agentClient: m,
81
- footer: H,
82
- defaultInput: j,
83
- onComment: M,
84
- onSessionLoad: P,
85
- onSessionUnload: W,
86
- onMessage: D,
87
- beforeMessageSend: E,
88
- bodyStyle: u,
89
- disabled: V,
90
- transform: q,
91
- features: F
88
+ })), /* @__PURE__ */ s(L, {
89
+ locale: he,
90
+ children: /* @__PURE__ */ x(le, {
91
+ value: h(f({}, n), {
92
+ popupContainer: u,
93
+ agentClient: b,
94
+ footer: S,
95
+ defaultInput: T,
96
+ onComment: D,
97
+ onSessionLoad: E,
98
+ onSessionUnload: J,
99
+ onMessage: O,
100
+ beforeMessageSend: V,
101
+ bodyStyle: p,
102
+ disabled: G,
103
+ transform: K,
104
+ features: Q
92
105
  }),
93
- children: [/* @__PURE__ */ s(ee, {
106
+ children: [/* @__PURE__ */ s(ae, {
94
107
  height: (i == null ? void 0 : i.height) || "100%",
95
108
  width: (i == null ? void 0 : i.width) || "100%",
96
109
  maxConstraints: [document.body.clientWidth - 45],
97
- minConstraints: [Number(n == null ? void 0 : n.minWidth)],
98
- onResize: K,
110
+ minConstraints: [Number(o == null ? void 0 : o.minWidth)],
111
+ onResize: B,
99
112
  handle: /* @__PURE__ */ s("span", {
100
113
  className: "resize-handle-ew"
101
114
  }),
102
115
  resizeHandles: e == "float" ? ["w"] : [],
103
116
  children: /* @__PURE__ */ x("div", {
104
117
  id: "dialog-modal",
105
- className: `gbot-dialog-modal ${e} ${w ? "opened" : "closed"}`,
106
- style: g(f({}, n), {
107
- width: e == "float" ? i == null ? void 0 : i.width : n == null ? void 0 : n.width,
108
- height: e === "float" ? i == null ? void 0 : i.height : n == null ? void 0 : n.height,
118
+ className: `gbot-dialog-modal ${e} ${v ? "opened" : "closed"}`,
119
+ style: h(f({}, o), {
120
+ width: e == "float" ? i == null ? void 0 : i.width : o == null ? void 0 : o.width,
121
+ height: e === "float" ? i == null ? void 0 : i.height : o == null ? void 0 : o.height,
109
122
  maxHeight: "100vh"
110
123
  }),
111
- ref: b,
112
- children: [G ? /* @__PURE__ */ s("div", {
124
+ ref: u,
125
+ children: [Y ? /* @__PURE__ */ s("div", {
113
126
  className: "loading",
114
- children: /* @__PURE__ */ s(ne, {})
115
- }) : C && m ? /* @__PURE__ */ s(te, {
127
+ children: /* @__PURE__ */ s(fe, {})
128
+ }) : C && b ? /* @__PURE__ */ s(re, {
116
129
  ref: c,
117
130
  appId: C,
118
- docViewerUrl: $,
119
- bodyStyle: u,
120
- sessionId: O
121
- }) : null, (l == null ? void 0 : l.visible) && /* @__PURE__ */ s(L, {
131
+ docViewerUrl: H,
132
+ bodyStyle: p,
133
+ sessionId: F
134
+ }) : null, (l == null ? void 0 : l.visible) && /* @__PURE__ */ s(U, {
122
135
  className: "trigger-btn close-btn",
123
136
  icon: /* @__PURE__ */ s("img", {
124
- src: p
137
+ src: g
125
138
  }),
126
139
  onClick: () => N(!1)
127
140
  })]
128
141
  })
129
- }), (l == null ? void 0 : l.visible) && !w && /* @__PURE__ */ s(L, {
142
+ }), (l == null ? void 0 : l.visible) && !v && /* @__PURE__ */ s(U, {
130
143
  className: `${e}-trigger-btn open-btn`,
131
144
  style: l.style,
132
145
  icon: /* @__PURE__ */ s("img", {
133
- src: p
146
+ src: g
134
147
  }),
135
148
  onClick: () => N(!0)
136
149
  })]
@@ -138,5 +151,5 @@ const Ne = _((o, t) => {
138
151
  });
139
152
  });
140
153
  export {
141
- Ne as default
154
+ ke as default
142
155
  };
@@ -1,92 +1,79 @@
1
- var R = Object.defineProperty, T = Object.defineProperties;
2
- var U = Object.getOwnPropertyDescriptors;
3
- var f = Object.getOwnPropertySymbols;
4
- var $ = Object.prototype.hasOwnProperty, b = Object.prototype.propertyIsEnumerable;
5
- var h = (a, e, n) => e in a ? R(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, w = (a, e) => {
6
- for (var n in e || (e = {}))
7
- $.call(e, n) && h(a, n, e[n]);
8
- if (f)
9
- for (var n of f(e))
10
- b.call(e, n) && h(a, n, e[n]);
11
- return a;
12
- }, k = (a, e) => T(a, U(e));
13
- import { jsxs as t, jsx as s } from "react/jsx-runtime";
14
- import { useContext as j } from "react";
15
- import { Space as I, Collapse as C } from "antd";
16
- import z from "../../../../components/Iconfont/index.mjs";
17
- /* empty css */import { ISourceType as g } from "@glodon-aiot/apis";
1
+ import { jsxs as s, jsx as n } from "react/jsx-runtime";
2
+ import { useContext as x } from "react";
3
+ import { Space as p, Collapse as f } from "antd";
4
+ import S from "../../../../components/Iconfont/index.mjs";
5
+ /* empty css */import { ISourceType as u } from "@glodon-aiot/apis";
18
6
  import "../../../../packages/react-components/dist/es/index.mjs";
19
- import A from "./ReferItem/index.mjs";
20
- import K from "../../../../context.mjs";
21
- import { Markdown as L } from "../../../../packages/react-components/dist/es/components/Markdown/index.mjs";
7
+ import D from "./ReferItem/index.mjs";
8
+ import y from "../../../../context.mjs";
9
+ import { Markdown as F } from "../../../../packages/react-components/dist/es/components/Markdown/index.mjs";
22
10
  const {
23
- Panel: P
24
- } = C, X = (a) => {
25
- var c, m, p, u;
11
+ Panel: R
12
+ } = f, M = (h) => {
13
+ var r, d, c, m;
26
14
  const {
27
- history: e,
28
- docViewerUrl: n,
29
- markdown: N
30
- } = a, {
31
- transform: r,
32
- service: d
33
- } = j(K), v = (o, i) => {
34
- if (!(!(o != null && o.knowledgeId) || !(o != null && o.docId))) {
35
- if (o.sourceType === g.WebLink) {
36
- window.open(o.webLink);
15
+ history: o,
16
+ docViewerUrl: w
17
+ } = h, {
18
+ transform: i,
19
+ service: l
20
+ } = x(y), I = (e, a) => {
21
+ if (!(!(e != null && e.knowledgeId) || !(e != null && e.docId))) {
22
+ if (e.sourceType === u.WebLink) {
23
+ window.open(e.webLink);
37
24
  return;
38
25
  }
39
- o.sourceType === g.SourceFile && window.open(`${n}#/doc?url=${encodeURIComponent(o.sourceFileUrl)}&page=${i || 0}`);
26
+ e.sourceType === u.SourceFile && window.open(`${w}#/doc?url=${encodeURIComponent(e.sourceFileUrl)}&page=${a || 0}`);
40
27
  }
41
28
  };
42
- return /* @__PURE__ */ t("div", {
29
+ return /* @__PURE__ */ s("div", {
43
30
  className: "session-refer",
44
- children: [/* @__PURE__ */ t(I, {
31
+ children: [/* @__PURE__ */ s(p, {
45
32
  className: "session-refer-header",
46
33
  size: 8,
47
- children: [/* @__PURE__ */ s(z, {
34
+ children: [/* @__PURE__ */ n(S, {
48
35
  type: "icon-cankaolaiyuan",
49
36
  style: {
50
37
  color: "#0A51D1",
51
38
  fontSize: 16
52
39
  }
53
- }), /* @__PURE__ */ s("span", {
40
+ }), /* @__PURE__ */ n("span", {
54
41
  className: "refer-header-title",
55
42
  children: "参考来源"
56
- }), /* @__PURE__ */ t("span", {
57
- children: ["(共 ", ((c = e == null ? void 0 : e.reference) == null ? void 0 : c.length) || 0, " 项)"]
43
+ }), /* @__PURE__ */ s("span", {
44
+ children: ["(共 ", ((r = o == null ? void 0 : o.reference) == null ? void 0 : r.length) || 0, " 项)"]
58
45
  })]
59
- }), /* @__PURE__ */ s("div", {
46
+ }), /* @__PURE__ */ n("div", {
60
47
  className: "session-refer-content",
61
- children: /* @__PURE__ */ s(C, {
48
+ children: /* @__PURE__ */ n(f, {
62
49
  ghost: !0,
63
- defaultActiveKey: (m = r == null ? void 0 : r.reference) != null && m.isExpand ? (p = e == null ? void 0 : e.reference) == null ? void 0 : p.map((o, i) => o.docId + i) : [],
64
- children: (u = e == null ? void 0 : e.reference) == null ? void 0 : u.map((o, i) => /* @__PURE__ */ s(P, {
65
- header: /* @__PURE__ */ t(I, {
50
+ defaultActiveKey: (d = i == null ? void 0 : i.reference) != null && d.isExpand ? (c = o == null ? void 0 : o.reference) == null ? void 0 : c.map((e, a) => e.docId + a) : [],
51
+ children: (m = o == null ? void 0 : o.reference) == null ? void 0 : m.map((e, a) => /* @__PURE__ */ n(R, {
52
+ header: /* @__PURE__ */ s(p, {
66
53
  className: "session-refer-panel",
67
- children: [/* @__PURE__ */ t("span", {
54
+ children: [/* @__PURE__ */ s("span", {
68
55
  className: "refer-panel-item",
69
- children: [i + 1, "."]
70
- }), d && /* @__PURE__ */ s(A, {
71
- data: o,
72
- loadPage: (x, S, D) => d.getKnowledgeIdFileIdData(x, S, D).then((y) => {
73
- const l = (y || []).find((F) => F.key === "pages_from");
74
- return (l == null ? void 0 : l.value) || 0;
56
+ children: [a + 1, "."]
57
+ }), l && /* @__PURE__ */ n(D, {
58
+ data: e,
59
+ loadPage: (g, k, C) => l.getKnowledgeIdFileIdData(g, k, C).then((N) => {
60
+ const t = (N || []).find((v) => v.key === "pages_from");
61
+ return (t == null ? void 0 : t.value) || 0;
75
62
  }),
76
- onClick: v
63
+ onClick: I
77
64
  })]
78
65
  }),
79
- children: /* @__PURE__ */ s("div", {
66
+ children: /* @__PURE__ */ n("div", {
80
67
  className: "refer-markdown",
81
- children: /* @__PURE__ */ s(L, k(w({}, N), {
82
- children: o.text || "-"
83
- }))
68
+ children: /* @__PURE__ */ n(F, {
69
+ children: e.text || "-"
70
+ })
84
71
  })
85
- }, o.docId + i))
72
+ }, e.docId + a))
86
73
  })
87
74
  })]
88
75
  });
89
76
  };
90
77
  export {
91
- X as default
78
+ M as default
92
79
  };