@glodon-aiot/agent-cli-ui 3.3.2-beta.1 → 3.3.2-beta.11

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 (57) hide show
  1. package/dist/es/AgentClientUI.mjs +34 -32
  2. package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +161 -147
  3. package/dist/es/Dialog/AgentChat/index.mjs +41 -39
  4. package/dist/es/ReactTextGenerationUI/components/TextSiders/index.mjs +354 -0
  5. package/dist/es/ReactTextGenerationUI/components/fetchEventSource/fetch.mjs +112 -0
  6. package/dist/es/ReactTextGenerationUI/components/fetchEventSource/parse.mjs +97 -0
  7. package/dist/es/ReactTextGenerationUI/index.mjs +90 -0
  8. package/dist/es/index.mjs +522 -251
  9. package/dist/es/node_modules/moment/dist/moment.mjs +2301 -0
  10. package/dist/es/packages/agent-cli-ui/package.json.mjs +162 -0
  11. package/dist/es/packages/react-components/dist/es/components/Markdown/ATag/index.mjs +27 -25
  12. package/dist/es/packages/react-components/dist/es/components/Markdown/Image/index.mjs +29 -27
  13. package/dist/es/packages/react-components/dist/es/components/Markdown/index.mjs +58 -48
  14. package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
  15. package/dist/es/src/style10.css +1 -1
  16. package/dist/es/src/style11.css +1 -1
  17. package/dist/es/src/style12.css +1 -1
  18. package/dist/es/src/style13.css +1 -1
  19. package/dist/es/src/style14.css +1 -1
  20. package/dist/es/src/style15.css +1 -1
  21. package/dist/es/src/style16.css +1 -1
  22. package/dist/es/src/style17.css +1 -1
  23. package/dist/es/src/style18.css +1 -1
  24. package/dist/es/src/style19.css +1 -1
  25. package/dist/es/src/style2.css +1 -1
  26. package/dist/es/src/style20.css +1 -1
  27. package/dist/es/src/style21.css +1 -1
  28. package/dist/es/src/style22.css +1 -1
  29. package/dist/es/src/style24.css +1 -1
  30. package/dist/es/src/style25.css +1 -1
  31. package/dist/es/src/style26.css +1 -1
  32. package/dist/es/src/style27.css +1 -1
  33. package/dist/es/src/style28.css +1 -1
  34. package/dist/es/src/style29.css +1 -1
  35. package/dist/es/src/style3.css +1 -1
  36. package/dist/es/src/style30.css +1 -0
  37. package/dist/es/src/style31.css +1 -0
  38. package/dist/es/src/style4.css +1 -1
  39. package/dist/es/src/style5.css +1 -1
  40. package/dist/es/src/style6.css +1 -1
  41. package/dist/es/src/style7.css +1 -1
  42. package/dist/es/src/style8.css +1 -1
  43. package/dist/es/src/style9.css +1 -1
  44. package/dist/lib/index.css +1 -1
  45. package/dist/lib/index.js +69 -58
  46. package/dist/src/Dialog/AgentChat/HistoryItem/index.d.ts +2 -0
  47. package/dist/src/ReactTextGenerationUI/components/TextSiders/index.d.ts +21 -0
  48. package/dist/src/ReactTextGenerationUI/components/fetchEventSource/fetch.d.ts +44 -0
  49. package/dist/src/ReactTextGenerationUI/components/fetchEventSource/index.d.ts +1 -0
  50. package/dist/src/ReactTextGenerationUI/components/fetchEventSource/parse.d.ts +36 -0
  51. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/fetch.d.ts +44 -0
  52. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/index.d.ts +1 -0
  53. package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/parse.d.ts +36 -0
  54. package/dist/src/ReactTextGenerationUI/index.d.ts +4 -0
  55. package/dist/src/index.d.ts +5 -1
  56. package/dist/src/types.d.ts +6 -2
  57. package/package.json +3 -3
@@ -0,0 +1,112 @@
1
+ var W = Object.defineProperty, j = Object.defineProperties;
2
+ var k = Object.getOwnPropertyDescriptors;
3
+ var v = Object.getOwnPropertySymbols;
4
+ var A = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
5
+ var I = (t, e, a) => e in t ? W(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a, E = (t, e) => {
6
+ for (var a in e || (e = {}))
7
+ A.call(e, a) && I(t, a, e[a]);
8
+ if (v)
9
+ for (var a of v(e))
10
+ R.call(e, a) && I(t, a, e[a]);
11
+ return t;
12
+ }, $ = (t, e) => j(t, k(e));
13
+ var q = (t, e) => {
14
+ var a = {};
15
+ for (var n in t)
16
+ A.call(t, n) && e.indexOf(n) < 0 && (a[n] = t[n]);
17
+ if (t != null && v)
18
+ for (var n of v(t))
19
+ e.indexOf(n) < 0 && R.call(t, n) && (a[n] = t[n]);
20
+ return a;
21
+ };
22
+ var B = (t, e, a) => new Promise((n, w) => {
23
+ var o = (r) => {
24
+ try {
25
+ c(a.next(r));
26
+ } catch (d) {
27
+ w(d);
28
+ }
29
+ }, i = (r) => {
30
+ try {
31
+ c(a.throw(r));
32
+ } catch (d) {
33
+ w(d);
34
+ }
35
+ }, c = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(o, i);
36
+ c((a = a.apply(t, e)).next());
37
+ });
38
+ import { getBytes as z, getLines as G, getMessages as H } from "./parse.mjs";
39
+ const g = "text/event-stream", J = 1e3, D = "last-event-id";
40
+ function X(t, N) {
41
+ var u = N, {
42
+ signal: e,
43
+ headers: a,
44
+ onopen: n,
45
+ onmessage: w,
46
+ onclose: o,
47
+ onerror: i,
48
+ openWhenHidden: c,
49
+ fetch: r
50
+ } = u, d = q(u, [
51
+ "signal",
52
+ "headers",
53
+ "onopen",
54
+ "onmessage",
55
+ "onclose",
56
+ "onerror",
57
+ "openWhenHidden",
58
+ "fetch"
59
+ ]);
60
+ return new Promise((L, M) => {
61
+ const f = E({}, a);
62
+ f.accept || (f.accept = g);
63
+ let l;
64
+ function C() {
65
+ l.abort(), document.hidden || b();
66
+ }
67
+ c || document.addEventListener("visibilitychange", C);
68
+ let T = J, y = 0;
69
+ function h() {
70
+ document.removeEventListener("visibilitychange", C), window.clearTimeout(y), l.abort();
71
+ }
72
+ e == null || e.addEventListener("abort", () => {
73
+ h(), L();
74
+ });
75
+ const P = r != null ? r : window.fetch, V = n != null ? n : K;
76
+ function b() {
77
+ return B(this, null, function* () {
78
+ var x;
79
+ l = new AbortController();
80
+ try {
81
+ const m = yield P(t, $(E({}, d), {
82
+ headers: f,
83
+ signal: l.signal
84
+ }));
85
+ yield V(m), yield z(m.body, G(H((s) => {
86
+ s ? f[D] = s : delete f[D];
87
+ }, (s) => {
88
+ T = s;
89
+ }, w))), o == null || o(), h(), L();
90
+ } catch (m) {
91
+ if (!l.signal.aborted)
92
+ try {
93
+ const s = (x = i == null ? void 0 : i(m)) != null ? x : T;
94
+ window.clearTimeout(y), y = window.setTimeout(b, s);
95
+ } catch (s) {
96
+ h(), M(s);
97
+ }
98
+ }
99
+ });
100
+ }
101
+ b();
102
+ });
103
+ }
104
+ function K(t) {
105
+ const e = t.headers.get("content-type");
106
+ if (!(e != null && e.startsWith(g)))
107
+ throw new Error(`Expected content-type to be ${g}, Actual: ${e}`);
108
+ }
109
+ export {
110
+ g as EventStreamContentType,
111
+ X as fetchEventSource
112
+ };
@@ -0,0 +1,97 @@
1
+ var b = (s, t, e) => new Promise((a, c) => {
2
+ var f = (r) => {
3
+ try {
4
+ i(e.next(r));
5
+ } catch (n) {
6
+ c(n);
7
+ }
8
+ }, l = (r) => {
9
+ try {
10
+ i(e.throw(r));
11
+ } catch (n) {
12
+ c(n);
13
+ }
14
+ }, i = (r) => r.done ? a(r.value) : Promise.resolve(r.value).then(f, l);
15
+ i((e = e.apply(s, t)).next());
16
+ });
17
+ function w(s, t) {
18
+ return b(this, null, function* () {
19
+ const e = s.getReader();
20
+ let a;
21
+ for (; !(a = yield e.read()).done; )
22
+ t(a.value);
23
+ });
24
+ }
25
+ function g(s) {
26
+ let t, e, a, c = !1, f;
27
+ return function(i) {
28
+ t === void 0 ? (t = i, e = 0, a = -1, f = !1) : t = h(t, i);
29
+ const r = t.length;
30
+ let n = 0;
31
+ for (; e < r; ) {
32
+ c && (t[e] === 10 && (n = ++e), c = !1);
33
+ let o = -1;
34
+ for (; e < r && o === -1; ++e)
35
+ switch (t[e]) {
36
+ case 58:
37
+ a === -1 && (a = e - n);
38
+ break;
39
+ case 13:
40
+ c = !1, e + 4 < r && t[e + 1] === 10 && t[e + 2] !== 13 && t[e - 1] !== 10 && t[e - 2] !== 13 && (f = !0);
41
+ case 10:
42
+ o = e;
43
+ break;
44
+ }
45
+ if (o === -1)
46
+ break;
47
+ s(t.subarray(n, o), a, f), n = e, a = -1, f = !1;
48
+ }
49
+ n === r ? t = void 0 : n !== 0 && (t = t.subarray(n), e -= n);
50
+ };
51
+ }
52
+ function k(s, t, e) {
53
+ let a = y();
54
+ const c = new TextDecoder();
55
+ return function(l, i, r) {
56
+ if (l.length === 0)
57
+ e == null || e(a), a = y();
58
+ else if (i > 0) {
59
+ const n = c.decode(l.subarray(0, i)), o = i + (l[i + 1] === 32 ? 2 : 1);
60
+ let d = c.decode(l.subarray(o));
61
+ switch (r && (d += `
62
+ `), n) {
63
+ case "data":
64
+ a.data = a.data ? a.data + `
65
+ ` + d : d;
66
+ break;
67
+ case "event":
68
+ a.event = d;
69
+ break;
70
+ case "id":
71
+ s(a.id = d);
72
+ break;
73
+ case "retry":
74
+ const u = parseInt(d, 10);
75
+ isNaN(u) || t(a.retry = u);
76
+ break;
77
+ }
78
+ }
79
+ };
80
+ }
81
+ function h(s, t) {
82
+ const e = new Uint8Array(s.length + t.length);
83
+ return e.set(s), e.set(t, s.length), e;
84
+ }
85
+ function y() {
86
+ return {
87
+ data: "",
88
+ event: "",
89
+ id: "",
90
+ retry: void 0
91
+ };
92
+ }
93
+ export {
94
+ w as getBytes,
95
+ g as getLines,
96
+ k as getMessages
97
+ };
@@ -0,0 +1,90 @@
1
+ var z = Object.defineProperty, A = Object.defineProperties;
2
+ var B = Object.getOwnPropertyDescriptors;
3
+ var i = Object.getOwnPropertySymbols;
4
+ var L = Object.prototype.hasOwnProperty, M = Object.prototype.propertyIsEnumerable;
5
+ var s = (o, e, t) => e in o ? z(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, a = (o, e) => {
6
+ for (var t in e || (e = {}))
7
+ L.call(e, t) && s(o, t, e[t]);
8
+ if (i)
9
+ for (var t of i(e))
10
+ M.call(e, t) && s(o, t, e[t]);
11
+ return o;
12
+ }, l = (o, e) => A(o, B(e));
13
+ import { jsx as n } from "react/jsx-runtime";
14
+ import { useRef as P, useState as d, useEffect as j } from "react";
15
+ /* empty css */import { ConfigProvider as m } from "antd";
16
+ import w from "antd/es/locale/zh_CN";
17
+ import E from "./components/TextSiders/index.mjs";
18
+ import { JWT as J } from "../utils/index.mjs";
19
+ import { AgentClientProvider as V } from "../context.mjs";
20
+ const ae = (o) => {
21
+ const {
22
+ application: e,
23
+ className: t,
24
+ triggerButton: W,
25
+ size: q,
26
+ theme: c,
27
+ icon: D,
28
+ docViewerUrl: F,
29
+ token: r,
30
+ debug: G,
31
+ env: H,
32
+ plugins: K,
33
+ mcp: O,
34
+ footer: p,
35
+ defaultInput: f,
36
+ onComment: u,
37
+ onSessionLoad: g,
38
+ onSessionUnload: h,
39
+ onMessage: v,
40
+ beforeMessageSend: C,
41
+ bodyStyle: S,
42
+ apiUrl: Q,
43
+ sessionId: x,
44
+ disabled: I,
45
+ transform: b,
46
+ features: N,
47
+ stream: X,
48
+ agentClient: U
49
+ } = o, R = P(null), [T, Y] = d(!1), [Z, k] = d();
50
+ return j(() => {
51
+ if (!r)
52
+ return;
53
+ const y = J(r);
54
+ k(y.rid);
55
+ }, [r]), m.config({
56
+ theme: c
57
+ }), /* @__PURE__ */ n(m, {
58
+ locale: w,
59
+ children: /* @__PURE__ */ n(V, {
60
+ value: l(a({}, o), {
61
+ popupContainer: R,
62
+ agentClient: U,
63
+ footer: p,
64
+ defaultInput: f,
65
+ onComment: u,
66
+ onSessionLoad: g,
67
+ onSessionUnload: h,
68
+ onMessage: v,
69
+ beforeMessageSend: C,
70
+ bodyStyle: S,
71
+ disabled: I,
72
+ transform: b,
73
+ features: N
74
+ }),
75
+ children: !T && /* @__PURE__ */ n("div", {
76
+ className: "chat-text",
77
+ children: /* @__PURE__ */ n("div", {
78
+ className: "text-pannel",
79
+ children: /* @__PURE__ */ n(E, {
80
+ application: e,
81
+ sessionId: x
82
+ })
83
+ })
84
+ })
85
+ })
86
+ });
87
+ };
88
+ export {
89
+ ae as default
90
+ };