@yuku123/z-agent-component 0.1.2 → 0.1.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.
@@ -1,10 +1,15 @@
1
- import { createRequest as W } from "@yuku123/z-frontend-common";
2
- import ge, { useState as me, useRef as J, useEffect as X } from "react";
3
- import { Breadcrumb as Ae, Button as te, Input as Te } from "antd";
4
- import { InboxOutlined as he, SearchOutlined as be, ExclamationCircleOutlined as Ee, ReloadOutlined as ve } from "@ant-design/icons";
5
- import { useNavigate as ye } from "react-router-dom";
6
- const re = W({ baseURL: "/api", timeout: 15e3 }), L = W({ baseURL: "/api", timeout: 15e3 }), N = W({ baseURL: "/api", timeout: 15e3 });
7
- function B(r) {
1
+ import { createRequest as U } from "@yuku123/z-frontend-common";
2
+ import me, { useState as Ae, useRef as J, useEffect as X } from "react";
3
+ import { Breadcrumb as Te, Button as te, Input as he } from "antd";
4
+ import { InboxOutlined as be, SearchOutlined as Ee, ExclamationCircleOutlined as ve, ReloadOutlined as ye } from "@ant-design/icons";
5
+ import { useNavigate as Se } from "react-router-dom";
6
+ import * as re from "echarts/core";
7
+ import { BarChart as xe, LineChart as Oe } from "echarts/charts";
8
+ import { GridComponent as Pe, LegendComponent as ke, TitleComponent as we, TooltipComponent as Re } from "echarts/components";
9
+ import { CanvasRenderer as _e } from "echarts/renderers";
10
+ import je from "echarts-for-react/lib/core";
11
+ const ne = U({ baseURL: "/api", timeout: 15e3 }), W = U({ baseURL: "/api", timeout: 15e3 }), B = U({ baseURL: "/api", timeout: 15e3 });
12
+ function N(r) {
8
13
  const i = function(s, o = {}) {
9
14
  const c = { ...o };
10
15
  return c.body !== void 0 && (c.data = c.body, delete c.body), typeof c.method == "string" && (c.method = c.method.toUpperCase()), c.url = s, r.request(c);
@@ -13,36 +18,36 @@ function B(r) {
13
18
  typeof r[s] == "function" ? i[s] = r[s].bind(r) : i[s] = r[s];
14
19
  }), i;
15
20
  }
16
- const Se = B(re);
17
- B(L);
18
- B(N);
19
- function We({ apiBase: r } = {}) {
21
+ const Ge = N(ne);
22
+ N(W);
23
+ N(B);
24
+ function Ze({ apiBase: r } = {}) {
20
25
  if (r !== void 0)
21
- for (const i of [re, L, N])
26
+ for (const i of [ne, W, B])
22
27
  i.defaults.baseURL = r;
23
28
  }
24
29
  const Z = { GET: "GET", DELETE: "DELETE" }, w = {};
25
30
  function e(r, i, a, s, o) {
26
31
  w[r] || (w[r] = {}), w[r][i] = { verb: a, path: s, transform: o };
27
32
  }
28
- function xe(r, i) {
33
+ function Ce(r, i) {
29
34
  let a = 0;
30
35
  return r.replace(/\{(\w+)\}/g, () => String(i[a++] ?? ""));
31
36
  }
32
- class Oe extends Error {
37
+ class Ie extends Error {
33
38
  constructor(i, a, s) {
34
39
  super(`[apiRouter] ${i}.${a}() 未注册路由(${s}):本次没有发出任何请求。若该端点本应存在,请先在 agent/api/routes.js 里 reg('${i}', '${a}', ...)。`), this.name = "ApiRouteError", this.__missing_route = !0, this.api = i, this.method = a;
35
40
  }
36
41
  }
37
- class Pe extends Error {
42
+ class $e extends Error {
38
43
  constructor(i, a, s) {
39
44
  super(`[apiRouter] ${i}.${a}() 参数形状不对:${s}`), this.name = "ApiParamError", this.__param_shape = !0, this.api = i, this.method = a;
40
45
  }
41
46
  }
42
- function ke(r, i) {
43
- return i.startsWith("/ctc/ac") || i.startsWith("/ctc/authorization") || i.startsWith("/ctc/surl") ? N : i.startsWith("/auth/") ? L : Se;
47
+ function De(r, i) {
48
+ return i.startsWith("/ctc/ac") || i.startsWith("/ctc/authorization") || i.startsWith("/ctc/surl") ? B : i.startsWith("/auth/") ? W : Ge;
44
49
  }
45
- function we(r) {
50
+ function Le(r) {
46
51
  const i = { data: void 0, params: void 0 };
47
52
  if (!r.length) return i;
48
53
  const a = r[0];
@@ -52,13 +57,13 @@ function we(r) {
52
57
  }
53
58
  return i;
54
59
  }
55
- function _e(r, i, a, s) {
60
+ function Ue(r, i, a, s) {
56
61
  const o = {};
57
62
  if (r === Z.GET || r === Z.DELETE) {
58
63
  const n = i[0];
59
64
  if (n != null) {
60
65
  if (typeof n != "object" || Array.isArray(n))
61
- throw new Pe(
66
+ throw new $e(
62
67
  a,
63
68
  s,
64
69
  `GET/DELETE 端点收到标量参数 ${JSON.stringify(n)},query 参数名未知,请改用 {params:{<参数名>: 值}}`
@@ -67,7 +72,7 @@ function _e(r, i, a, s) {
67
72
  }
68
73
  return o;
69
74
  }
70
- const { data: c, params: f } = we(i);
75
+ const { data: c, params: f } = Le(i);
71
76
  return c !== void 0 && (o.data = c), f !== void 0 && (o.params = f), o;
72
77
  }
73
78
  function h(r) {
@@ -78,11 +83,11 @@ function h(r) {
78
83
  var c, f;
79
84
  const o = (c = w[r]) == null ? void 0 : c[a];
80
85
  if (!o) {
81
- const n = w[r] ? "方法名未注册" : "api key 未注册", p = new Oe(r, a, n);
86
+ const n = w[r] ? "方法名未注册" : "api key 未注册", p = new Ie(r, a, n);
82
87
  throw console.error(p.message), p;
83
88
  }
84
89
  try {
85
- const n = xe(o.path, s), p = ke(o.verb, n), A = _e(o.verb, s, r, a), T = await p.request({
90
+ const n = Ce(o.path, s), p = De(o.verb, n), A = Ue(o.verb, s, r, a), T = await p.request({
86
91
  method: o.verb,
87
92
  url: n,
88
93
  ...A
@@ -237,14 +242,14 @@ e("sceneApi", "canvasGet", "GET", "/v1/scenes/canvas");
237
242
  e("sceneApi", "configGet", "GET", "/v1/scenes/config");
238
243
  e("sceneApi", "nodes", "GET", "/v1/scenes/nodes");
239
244
  e("sceneApi", "chatHistory", "GET", "/v1/scenes/chat-history");
240
- const Le = h("agentApi"), Ne = h("flowApi"), Be = h("statsApi");
245
+ const Qe = h("agentApi"), Ke = h("flowApi"), et = h("statsApi");
241
246
  h("pluginApi");
242
247
  h("memoryApi");
243
248
  h("triggerApi");
244
- const ze = h("templateApi");
249
+ const tt = h("templateApi");
245
250
  h("textGenApi");
246
251
  h("humanInputApi");
247
- const Ye = h("llmApi"), qe = h("mcpApi"), Fe = h("scriptApi"), Me = h("skillApi"), Ve = h("productApi"), He = h("sceneApi"), Je = h("ossApi");
252
+ const rt = h("llmApi"), nt = h("mcpApi"), at = h("scriptApi"), it = h("skillApi"), st = h("productApi"), ot = h("sceneApi"), lt = h("ossApi");
248
253
  var j = { exports: {} }, P = {};
249
254
  /**
250
255
  * @license React
@@ -256,7 +261,7 @@ var j = { exports: {} }, P = {};
256
261
  * LICENSE file in the root directory of this source tree.
257
262
  */
258
263
  var Q;
259
- function Re() {
264
+ function We() {
260
265
  if (Q) return P;
261
266
  Q = 1;
262
267
  var r = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment");
@@ -288,25 +293,25 @@ var k = {};
288
293
  * LICENSE file in the root directory of this source tree.
289
294
  */
290
295
  var K;
291
- function je() {
296
+ function Be() {
292
297
  return K || (K = 1, process.env.NODE_ENV !== "production" && (function() {
293
298
  function r(t) {
294
299
  if (t == null) return null;
295
300
  if (typeof t == "function")
296
- return t.$$typeof === ue ? null : t.displayName || t.name || null;
301
+ return t.$$typeof === de ? null : t.displayName || t.name || null;
297
302
  if (typeof t == "string") return t;
298
303
  switch (t) {
299
304
  case b:
300
305
  return "Fragment";
301
- case ne:
306
+ case ae:
302
307
  return "Profiler";
303
308
  case O:
304
309
  return "StrictMode";
305
- case oe:
306
- return "Suspense";
307
310
  case le:
311
+ return "Suspense";
312
+ case ce:
308
313
  return "SuspenseList";
309
- case pe:
314
+ case ue:
310
315
  return "Activity";
311
316
  }
312
317
  if (typeof t == "object")
@@ -315,14 +320,14 @@ function je() {
315
320
  ), t.$$typeof) {
316
321
  case S:
317
322
  return "Portal";
318
- case ie:
323
+ case se:
319
324
  return t.displayName || "Context";
320
- case ae:
325
+ case ie:
321
326
  return (t._context.displayName || "Context") + ".Consumer";
322
- case se:
327
+ case oe:
323
328
  var l = t.render;
324
329
  return t = t.displayName, t || (t = l.displayName || l.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
325
- case ce:
330
+ case pe:
326
331
  return l = t.displayName || null, l !== null ? l : r(t.type) || "Memo";
327
332
  case C:
328
333
  l = t._payload, t = t._init;
@@ -396,10 +401,10 @@ function je() {
396
401
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
397
402
  )), t = this.props.ref, t !== void 0 ? t : null;
398
403
  }
399
- function A(t, l, d, g, R, D) {
404
+ function A(t, l, d, g, _, D) {
400
405
  var m = d.ref;
401
406
  return t = {
402
- $$typeof: _,
407
+ $$typeof: R,
403
408
  type: t,
404
409
  key: l,
405
410
  props: d,
@@ -421,7 +426,7 @@ function je() {
421
426
  configurable: !1,
422
427
  enumerable: !1,
423
428
  writable: !0,
424
- value: R
429
+ value: _
425
430
  }), Object.defineProperty(t, "_debugTask", {
426
431
  configurable: !1,
427
432
  enumerable: !1,
@@ -429,11 +434,11 @@ function je() {
429
434
  value: D
430
435
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
431
436
  }
432
- function T(t, l, d, g, R, D) {
437
+ function T(t, l, d, g, _, D) {
433
438
  var m = l.children;
434
439
  if (m !== void 0)
435
440
  if (g)
436
- if (de(m)) {
441
+ if (fe(m)) {
437
442
  for (g = 0; g < m.length; g++)
438
443
  E(m[g]);
439
444
  Object.freeze && Object.freeze(m);
@@ -444,8 +449,8 @@ function je() {
444
449
  else E(m);
445
450
  if (Y.call(l, "key")) {
446
451
  m = r(t);
447
- var x = Object.keys(l).filter(function(fe) {
448
- return fe !== "key";
452
+ var x = Object.keys(l).filter(function(ge) {
453
+ return ge !== "key";
449
454
  });
450
455
  g = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", H[m + g] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
451
456
  `A props object containing a "key" prop is being spread into JSX:
@@ -462,8 +467,8 @@ React keys must be passed directly to JSX without using spread:
462
467
  }
463
468
  if (m = null, d !== void 0 && (a(d), m = "" + d), f(l) && (a(l.key), m = "" + l.key), "key" in l) {
464
469
  d = {};
465
- for (var U in l)
466
- U !== "key" && (d[U] = l[U]);
470
+ for (var L in l)
471
+ L !== "key" && (d[L] = l[L]);
467
472
  } else d = l;
468
473
  return m && n(
469
474
  d,
@@ -473,7 +478,7 @@ React keys must be passed directly to JSX without using spread:
473
478
  m,
474
479
  d,
475
480
  o(),
476
- R,
481
+ _,
477
482
  D
478
483
  );
479
484
  }
@@ -481,9 +486,9 @@ React keys must be passed directly to JSX without using spread:
481
486
  y(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === C && (t._payload.status === "fulfilled" ? y(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
482
487
  }
483
488
  function y(t) {
484
- return typeof t == "object" && t !== null && t.$$typeof === _;
489
+ return typeof t == "object" && t !== null && t.$$typeof === R;
485
490
  }
486
- var v = ge, _ = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), ne = Symbol.for("react.profiler"), ae = Symbol.for("react.consumer"), ie = Symbol.for("react.context"), se = Symbol.for("react.forward_ref"), oe = Symbol.for("react.suspense"), le = Symbol.for("react.suspense_list"), ce = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), pe = Symbol.for("react.activity"), ue = Symbol.for("react.client.reference"), I = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, de = Array.isArray, $ = console.createTask ? console.createTask : function() {
491
+ var v = me, R = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), ae = Symbol.for("react.profiler"), ie = Symbol.for("react.consumer"), se = Symbol.for("react.context"), oe = Symbol.for("react.forward_ref"), le = Symbol.for("react.suspense"), ce = Symbol.for("react.suspense_list"), pe = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), ue = Symbol.for("react.activity"), de = Symbol.for("react.client.reference"), I = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, fe = Array.isArray, $ = console.createTask ? console.createTask : function() {
487
492
  return null;
488
493
  };
489
494
  v = {
@@ -519,10 +524,10 @@ React keys must be passed directly to JSX without using spread:
519
524
  })()), k;
520
525
  }
521
526
  var ee;
522
- function Ge() {
523
- return ee || (ee = 1, process.env.NODE_ENV === "production" ? j.exports = Re() : j.exports = je()), j.exports;
527
+ function Ne() {
528
+ return ee || (ee = 1, process.env.NODE_ENV === "production" ? j.exports = We() : j.exports = Be()), j.exports;
524
529
  }
525
- var u = Ge();
530
+ var u = Ne();
526
531
  const G = {
527
532
  // 卡片表面
528
533
  surfaceAlt: "#fafbfc",
@@ -534,7 +539,7 @@ const G = {
534
539
  }, z = {
535
540
  md: 12
536
541
  };
537
- function Xe({
542
+ function ct({
538
543
  icon: r,
539
544
  title: i = "暂无数据",
540
545
  description: a,
@@ -569,7 +574,7 @@ function Xe({
569
574
  marginBottom: 16,
570
575
  fontSize: 28,
571
576
  color: "#9ca3af"
572
- }, children: r || /* @__PURE__ */ u.jsx(he, {}) }),
577
+ }, children: r || /* @__PURE__ */ u.jsx(be, {}) }),
573
578
  /* @__PURE__ */ u.jsx("div", { style: {
574
579
  fontSize: p[c],
575
580
  fontWeight: 600,
@@ -600,7 +605,7 @@ function Xe({
600
605
  }
601
606
  );
602
607
  }
603
- function Ze({
608
+ function pt({
604
609
  error: r,
605
610
  title: i = "加载失败",
606
611
  description: a,
@@ -640,7 +645,7 @@ function Ze({
640
645
  color: "#dc2626",
641
646
  fontSize: p ? 28 : 18,
642
647
  flexShrink: 0
643
- }, children: /* @__PURE__ */ u.jsx(Ee, {}) }),
648
+ }, children: /* @__PURE__ */ u.jsx(ve, {}) }),
644
649
  /* @__PURE__ */ u.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
645
650
  /* @__PURE__ */ u.jsx("div", { style: {
646
651
  fontSize: p ? 16 : 14,
@@ -659,7 +664,7 @@ function Ze({
659
664
  {
660
665
  type: "primary",
661
666
  danger: !0,
662
- icon: /* @__PURE__ */ u.jsx(ve, {}),
667
+ icon: /* @__PURE__ */ u.jsx(ye, {}),
663
668
  onClick: s,
664
669
  size: p ? "middle" : "small",
665
670
  style: { marginTop: 12 },
@@ -671,7 +676,7 @@ function Ze({
671
676
  }
672
677
  );
673
678
  }
674
- function Qe({
679
+ function ut({
675
680
  value: r,
676
681
  onChange: i,
677
682
  onSearch: a,
@@ -684,7 +689,7 @@ function Qe({
684
689
  enterButton: n,
685
690
  ...p
686
691
  }) {
687
- const [A, T] = me(r || ""), E = J(null), y = J(r || "");
692
+ const [A, T] = Ae(r || ""), E = J(null), y = J(r || "");
688
693
  X(() => {
689
694
  r !== void 0 && r !== A && (T(r || ""), y.current = r || "");
690
695
  }, [r]), X(() => () => {
@@ -692,7 +697,7 @@ function Qe({
692
697
  }, []);
693
698
  const v = (b) => {
694
699
  y.current = b, i && i(b);
695
- }, _ = (b) => {
700
+ }, R = (b) => {
696
701
  const O = b.target.value;
697
702
  if (T(O), E.current && clearTimeout(E.current), O === "") {
698
703
  v("");
@@ -703,11 +708,11 @@ function Qe({
703
708
  E.current && clearTimeout(E.current), v(b), a && a(b);
704
709
  };
705
710
  return /* @__PURE__ */ u.jsx(
706
- Te,
711
+ he,
707
712
  {
708
713
  ...p,
709
714
  value: A,
710
- onChange: _,
715
+ onChange: R,
711
716
  onPressEnter: S,
712
717
  onKeyDown: (b) => {
713
718
  b.key === "Enter" ? (b.preventDefault(), S(A)) : b.key === "Escape" && (T(""), S(""));
@@ -716,7 +721,7 @@ function Qe({
716
721
  allowClear: f ? { clearIcon: /* @__PURE__ */ u.jsx("span", { onClick: () => {
717
722
  T(""), S("");
718
723
  }, children: "×" }) } : !1,
719
- prefix: /* @__PURE__ */ u.jsx(be, { style: { color: "#9ca3af" } }),
724
+ prefix: /* @__PURE__ */ u.jsx(Ee, { style: { color: "#9ca3af" } }),
720
725
  style: {
721
726
  width: c,
722
727
  borderRadius: z.md,
@@ -725,7 +730,7 @@ function Qe({
725
730
  }
726
731
  );
727
732
  }
728
- function Ke({
733
+ function dt({
729
734
  title: r,
730
735
  subtitle: i,
731
736
  breadcrumb: a,
@@ -733,7 +738,7 @@ function Ke({
733
738
  back: o,
734
739
  onBack: c
735
740
  }) {
736
- const f = ye();
741
+ const f = Se();
737
742
  return /* @__PURE__ */ u.jsx("div", { style: {
738
743
  marginBottom: 12,
739
744
  paddingBottom: 10,
@@ -784,7 +789,7 @@ function Ke({
784
789
  }
785
790
  ),
786
791
  a && a.length > 0 ? /* @__PURE__ */ u.jsx(
787
- Ae,
792
+ Te,
788
793
  {
789
794
  items: a.map((n, p) => {
790
795
  const A = p === a.length - 1;
@@ -821,23 +826,36 @@ function Ke({
821
826
  }, children: s })
822
827
  ] }) });
823
828
  }
829
+ re.use([
830
+ xe,
831
+ Oe,
832
+ Pe,
833
+ ke,
834
+ we,
835
+ Re,
836
+ _e
837
+ ]);
838
+ function ft(r) {
839
+ return /* @__PURE__ */ u.jsx(je, { echarts: re, ...r });
840
+ }
824
841
  export {
825
- Qe as S,
826
- Le as a,
827
- Be as b,
828
- ze as c,
829
- We as d,
830
- Xe as e,
831
- Ne as f,
832
- Fe as g,
833
- Me as h,
842
+ ft as R,
843
+ ut as S,
844
+ Qe as a,
845
+ et as b,
846
+ tt as c,
847
+ Ze as d,
848
+ ct as e,
849
+ Ke as f,
850
+ at as g,
851
+ it as h,
834
852
  u as j,
835
- Ye as l,
836
- qe as m,
837
- Je as o,
838
- Ve as p,
839
- Ke as r,
840
- He as s,
841
- Ze as t,
842
- Se as u
853
+ rt as l,
854
+ nt as m,
855
+ lt as o,
856
+ st as p,
857
+ dt as r,
858
+ ot as s,
859
+ pt as t,
860
+ Ge as u
843
861
  };