@wandox/sdk 0.1.36 → 0.1.37

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 (107) hide show
  1. package/dist/{V1Workbench-BTDED9f0.js → V1Workbench-CqWNz8eg.js} +206 -206
  2. package/dist/{V1Workbench-dkHeo8tR.cjs → V1Workbench-UL6m_GSU.cjs} +1 -1
  3. package/dist/V2Workbench-a7fIKHSI.js +2352 -0
  4. package/dist/V2Workbench-tUL0KmKo.cjs +2 -0
  5. package/dist/{WorkbenchRuntime-C-WMn1Qs.cjs → WorkbenchRuntime-BPjLWyHy.cjs} +5 -5
  6. package/dist/{WorkbenchRuntime-DwnSaeU0.js → WorkbenchRuntime-kI4h_Boi.js} +149 -143
  7. package/dist/{arc-DnAFTAlx.cjs → arc-B5N4v9Jv.cjs} +1 -1
  8. package/dist/{arc-lrZAmC97.js → arc-BRgfV2vT.js} +1 -1
  9. package/dist/{architectureDiagram-3BPJPVTR-qSATMtIu.js → architectureDiagram-3BPJPVTR-DUgD63Rt.js} +3 -3
  10. package/dist/{architectureDiagram-3BPJPVTR-CPhTU6Eo.cjs → architectureDiagram-3BPJPVTR-DjM6oFEx.cjs} +1 -1
  11. package/dist/{blockDiagram-GPEHLZMM-CDwrkiVy.js → blockDiagram-GPEHLZMM-6EI7pONG.js} +3 -3
  12. package/dist/{blockDiagram-GPEHLZMM-XVMF04BT.cjs → blockDiagram-GPEHLZMM-Bbk0DebD.cjs} +1 -1
  13. package/dist/{c4Diagram-AAUBKEIU-CGowpJup.js → c4Diagram-AAUBKEIU-CPATCWpo.js} +2 -2
  14. package/dist/{c4Diagram-AAUBKEIU-DffwDzj1.cjs → c4Diagram-AAUBKEIU-UW4tUuYO.cjs} +1 -1
  15. package/dist/{channel-CY7r6qlF.js → channel-BOuHczM9.js} +1 -1
  16. package/dist/{channel-BXFE-BpN.cjs → channel-BPVKsQR4.cjs} +1 -1
  17. package/dist/{chunk-2J33WTMH-DuCYldMe.js → chunk-2J33WTMH-BMA-WoY7.js} +1 -1
  18. package/dist/{chunk-2J33WTMH-D4rEqGzt.cjs → chunk-2J33WTMH-JkZNZ2FQ.cjs} +1 -1
  19. package/dist/{chunk-4BX2VUAB-Cxp0_Qfx.js → chunk-4BX2VUAB-CoubCo12.js} +1 -1
  20. package/dist/{chunk-4BX2VUAB-BsCUMKlS.cjs → chunk-4BX2VUAB-DJjQ2iym.cjs} +1 -1
  21. package/dist/{chunk-55IACEB6-BLJmAN4x.js → chunk-55IACEB6-B8_bbLHJ.js} +1 -1
  22. package/dist/{chunk-55IACEB6-XDcbyyvP.cjs → chunk-55IACEB6-k8m2Tb0O.cjs} +1 -1
  23. package/dist/{chunk-727SXJPM-1bTbq9QM.cjs → chunk-727SXJPM-Dk4Qx6Cj.cjs} +1 -1
  24. package/dist/{chunk-727SXJPM-BjPhiU2p.js → chunk-727SXJPM-w5uqNLUJ.js} +5 -5
  25. package/dist/{chunk-AQP2D5EJ-CGe-fbI_.js → chunk-AQP2D5EJ-BC_iX9X6.js} +3 -3
  26. package/dist/{chunk-AQP2D5EJ-EH5FWOXH.cjs → chunk-AQP2D5EJ-rJ3mY-t4.cjs} +1 -1
  27. package/dist/{chunk-FMBD7UC4-BEhZw-9x.cjs → chunk-FMBD7UC4-C_CgBQVs.cjs} +1 -1
  28. package/dist/{chunk-FMBD7UC4-BrTtqwn9.js → chunk-FMBD7UC4-DZlFTSR3.js} +1 -1
  29. package/dist/{chunk-ND2GUHAM-C22ALL-1.js → chunk-ND2GUHAM-SOVIggp_.js} +1 -1
  30. package/dist/{chunk-ND2GUHAM-CTAo-Gfu.cjs → chunk-ND2GUHAM-rYKw1ewI.cjs} +1 -1
  31. package/dist/{chunk-QZHKN3VN-C_Ih-bcC.js → chunk-QZHKN3VN-BzYA6_MS.js} +1 -1
  32. package/dist/{chunk-QZHKN3VN-R1cC06zp.cjs → chunk-QZHKN3VN-D_n03X4c.cjs} +1 -1
  33. package/dist/{classDiagram-4FO5ZUOK-scM2IOJa.cjs → classDiagram-4FO5ZUOK-Cus7V0-B.cjs} +1 -1
  34. package/dist/{classDiagram-4FO5ZUOK-C_wQW8PQ.js → classDiagram-4FO5ZUOK-yY-LWEE5.js} +2 -2
  35. package/dist/{classDiagram-v2-Q7XG4LA2-scM2IOJa.cjs → classDiagram-v2-Q7XG4LA2-Cus7V0-B.cjs} +1 -1
  36. package/dist/{classDiagram-v2-Q7XG4LA2-B0_wL31A.js → classDiagram-v2-Q7XG4LA2-D_2oVIAG.js} +2 -2
  37. package/dist/{cose-bilkent-S5V4N54A-DpRpmxlF.cjs → cose-bilkent-S5V4N54A-C8A50UJc.cjs} +1 -1
  38. package/dist/{cose-bilkent-S5V4N54A-DXGf68xP.js → cose-bilkent-S5V4N54A-DtK_d2nt.js} +6 -6
  39. package/dist/{dagre-BM42HDAG-DAmZKlMa.js → dagre-BM42HDAG-B9o52kSq.js} +1 -1
  40. package/dist/{dagre-BM42HDAG-Bllljh6b.cjs → dagre-BM42HDAG-CctSzO0L.cjs} +1 -1
  41. package/dist/{diagram-2AECGRRQ-e4xTSyXB.js → diagram-2AECGRRQ-DEOJdLIi.js} +2 -2
  42. package/dist/{diagram-2AECGRRQ-BtVZDvFi.cjs → diagram-2AECGRRQ-DeefcALf.cjs} +1 -1
  43. package/dist/{diagram-5GNKFQAL-DDznFCpC.cjs → diagram-5GNKFQAL-C9cD2jn6.cjs} +1 -1
  44. package/dist/{diagram-5GNKFQAL-B57ntKRP.js → diagram-5GNKFQAL-DyxjjnMI.js} +3 -3
  45. package/dist/{diagram-KO2AKTUF-CZHRsaEN.js → diagram-KO2AKTUF-4juRrpvB.js} +2 -2
  46. package/dist/{diagram-KO2AKTUF-B1_pEYsh.cjs → diagram-KO2AKTUF-Mo7XhFrv.cjs} +1 -1
  47. package/dist/{diagram-LMA3HP47-DCOfsSfF.cjs → diagram-LMA3HP47-BFs_xRRv.cjs} +1 -1
  48. package/dist/{diagram-LMA3HP47-Dw1iJ4GY.js → diagram-LMA3HP47-CxL8EBEI.js} +2 -2
  49. package/dist/{diagram-OG6HWLK6-DBRyn55R.js → diagram-OG6HWLK6-BX-585Ye.js} +3 -3
  50. package/dist/{diagram-OG6HWLK6-C9iJ1_vk.cjs → diagram-OG6HWLK6-CB1fsChK.cjs} +1 -1
  51. package/dist/{erDiagram-TEJ5UH35-CwU_D9zQ.js → erDiagram-TEJ5UH35-DC0Ho0nI.js} +4 -4
  52. package/dist/{erDiagram-TEJ5UH35-CQLcSzGq.cjs → erDiagram-TEJ5UH35-vPdDZRYq.cjs} +1 -1
  53. package/dist/{flowDiagram-I6XJVG4X-DeoNy8j_.js → flowDiagram-I6XJVG4X-7BW5uO8c.js} +6 -6
  54. package/dist/{flowDiagram-I6XJVG4X-BXfh71rU.cjs → flowDiagram-I6XJVG4X-BiRLUlz2.cjs} +1 -1
  55. package/dist/{ganttDiagram-6RSMTGT7-zl3WHbE2.cjs → ganttDiagram-6RSMTGT7-BMrijLIp.cjs} +1 -1
  56. package/dist/{ganttDiagram-6RSMTGT7-Df26R8Yw.js → ganttDiagram-6RSMTGT7-Bhohg83R.js} +3 -3
  57. package/dist/{gitGraphDiagram-PVQCEYII-B1DCGlgk.cjs → gitGraphDiagram-PVQCEYII-Bq_8mOSi.cjs} +1 -1
  58. package/dist/{gitGraphDiagram-PVQCEYII-D4lV7Wyt.js → gitGraphDiagram-PVQCEYII-CwSJFsFx.js} +3 -3
  59. package/dist/{index-CgghWcty.cjs → index-Bl0cgfIz.cjs} +1 -1
  60. package/dist/{index-D2f85EfC.cjs → index-BygO8jcH.cjs} +1 -1
  61. package/dist/{index-B6ippZgO.js → index-CQYJcpLn.js} +155 -155
  62. package/dist/{index-B7ymMLUP.js → index-Dhd78ysx.js} +677 -673
  63. package/dist/{index-C5MgqruW.js → index-RmIugmM4.js} +38 -38
  64. package/dist/{index-Fogne5nt.cjs → index-dISfYziG.cjs} +182 -182
  65. package/dist/{infoDiagram-5YYISTIA-CQzoD1R6.cjs → infoDiagram-5YYISTIA-B-PYR74F.cjs} +1 -1
  66. package/dist/{infoDiagram-5YYISTIA-BVUPRn39.js → infoDiagram-5YYISTIA-BNytnCXI.js} +1 -1
  67. package/dist/{ishikawaDiagram-YF4QCWOH-B2szA0Bd.cjs → ishikawaDiagram-YF4QCWOH-4OKBUv_s.cjs} +1 -1
  68. package/dist/{ishikawaDiagram-YF4QCWOH-D-w9d_mh.js → ishikawaDiagram-YF4QCWOH-BG80wXBr.js} +1 -1
  69. package/dist/{journeyDiagram-JHISSGLW-DvxAjmWW.js → journeyDiagram-JHISSGLW-g82mk2Fe.js} +4 -4
  70. package/dist/{journeyDiagram-JHISSGLW-BlZOXaNG.cjs → journeyDiagram-JHISSGLW-yt60VGMo.cjs} +1 -1
  71. package/dist/{kanban-definition-UN3LZRKU-uWpfk339.cjs → kanban-definition-UN3LZRKU-BFH_hAyY.cjs} +1 -1
  72. package/dist/{kanban-definition-UN3LZRKU-3ITzwD_V.js → kanban-definition-UN3LZRKU-BmK56MSs.js} +2 -2
  73. package/dist/{linear-h0PKX5pS.js → linear-BpsU0HcQ.js} +1 -1
  74. package/dist/{linear-xTyNvSvf.cjs → linear-zILWiTVq.cjs} +1 -1
  75. package/dist/{mermaid.core-BNCrNPF3.cjs → mermaid.core-BvN-J_AM.cjs} +3 -3
  76. package/dist/{mermaid.core-B-oz1JHo.js → mermaid.core-NivSZeQG.js} +35 -35
  77. package/dist/{mindmap-definition-RKZ34NQL-iv6ScGf8.js → mindmap-definition-RKZ34NQL-BXoEIZmG.js} +3 -3
  78. package/dist/{mindmap-definition-RKZ34NQL-CP2xdC8i.cjs → mindmap-definition-RKZ34NQL-C3LWrNPx.cjs} +1 -1
  79. package/dist/{pieDiagram-4H26LBE5-DBlTRpYF.cjs → pieDiagram-4H26LBE5-CN01uXEU.cjs} +1 -1
  80. package/dist/{pieDiagram-4H26LBE5-DG5ob37D.js → pieDiagram-4H26LBE5-y5XnB67r.js} +3 -3
  81. package/dist/{quadrantDiagram-W4KKPZXB-BIJcQpbE.cjs → quadrantDiagram-W4KKPZXB-BdWRtxg8.cjs} +1 -1
  82. package/dist/{quadrantDiagram-W4KKPZXB-gdLXyrgM.js → quadrantDiagram-W4KKPZXB-DoHOsDDM.js} +2 -2
  83. package/dist/{requirementDiagram-4Y6WPE33-BZupS8ve.cjs → requirementDiagram-4Y6WPE33-B6ltwG99.cjs} +1 -1
  84. package/dist/{requirementDiagram-4Y6WPE33-Devp3bFn.js → requirementDiagram-4Y6WPE33-BUqcv09v.js} +3 -3
  85. package/dist/{sankeyDiagram-5OEKKPKP-DclF12AE.js → sankeyDiagram-5OEKKPKP-D3yaTkog.js} +1 -1
  86. package/dist/{sankeyDiagram-5OEKKPKP-YmUkqYvM.cjs → sankeyDiagram-5OEKKPKP-Dw_I3L5w.cjs} +1 -1
  87. package/dist/{sequenceDiagram-3UESZ5HK-Bp3v1G4L.js → sequenceDiagram-3UESZ5HK-Dlw7AYVR.js} +3 -3
  88. package/dist/{sequenceDiagram-3UESZ5HK-Cc6KiFLH.cjs → sequenceDiagram-3UESZ5HK-Dw-Oo3gQ.cjs} +1 -1
  89. package/dist/{stateDiagram-AJRCARHV-DzpR85VO.js → stateDiagram-AJRCARHV-G5aGpm4h.js} +2 -2
  90. package/dist/{stateDiagram-AJRCARHV-BhKrmX4f.cjs → stateDiagram-AJRCARHV-RlkILcfR.cjs} +1 -1
  91. package/dist/{stateDiagram-v2-BHNVJYJU-C0Aq_ia1.cjs → stateDiagram-v2-BHNVJYJU-B5MqneJj.cjs} +1 -1
  92. package/dist/{stateDiagram-v2-BHNVJYJU-DwsxsR-W.js → stateDiagram-v2-BHNVJYJU-U7btkN-c.js} +2 -2
  93. package/dist/{timeline-definition-PNZ67QCA-AdSmOXjp.cjs → timeline-definition-PNZ67QCA-DZWO25QG.cjs} +1 -1
  94. package/dist/{timeline-definition-PNZ67QCA-B87x3yay.js → timeline-definition-PNZ67QCA-I1bAZF32.js} +2 -2
  95. package/dist/{vennDiagram-CIIHVFJN-GqWq5zHi.js → vennDiagram-CIIHVFJN-GqC6bKPW.js} +1 -1
  96. package/dist/{vennDiagram-CIIHVFJN-CLpzW4Nc.cjs → vennDiagram-CIIHVFJN-OMVDPAYS.cjs} +1 -1
  97. package/dist/wandox.cjs +1 -1
  98. package/dist/wandox.css +1 -1
  99. package/dist/wandox.js +3 -3
  100. package/dist/wandox.umd.js +625 -625
  101. package/dist/{wardleyDiagram-YWT4CUSO-Cls7iV6P.cjs → wardleyDiagram-YWT4CUSO-BS6EQ76K.cjs} +1 -1
  102. package/dist/{wardleyDiagram-YWT4CUSO-5_EScJ4X.js → wardleyDiagram-YWT4CUSO-B_ri0S8_.js} +2 -2
  103. package/dist/{xychartDiagram-2RQKCTM6-D8JYg9fO.cjs → xychartDiagram-2RQKCTM6-BIi1O5Px.cjs} +1 -1
  104. package/dist/{xychartDiagram-2RQKCTM6-DbdkH607.js → xychartDiagram-2RQKCTM6-VaspgPkc.js} +2 -2
  105. package/package.json +1 -1
  106. package/dist/V2Workbench-P9muvE1U.js +0 -2170
  107. package/dist/V2Workbench-Un5ZzXV7.cjs +0 -2
@@ -1,2170 +0,0 @@
1
- import { ds as a, af as as, c$ as e, aZ as $s, ai as ns, a_ as We, bK as Ps, a$ as ma, dZ as As, K as js, aa as ha, a9 as Ye, d5 as ks, Q as xa, P as pa, d9 as Ms, dF as $, ch as _a, S as ba, J as Ge, cZ as fa, cN as wa, dN as ya, cc as ga, cG as ja, cF as ka, as as va, ap as Na, o as Ca, m as Ra, v as Sa, b0 as Fs, b1 as Ia, bB as Ls, b2 as Qe, n as Ea, ar as $a, cH as Pa, cI as Aa, aE as vs, b3 as Ma, aY as Fa, b4 as Ns, b5 as La, b6 as Ta, b7 as Da, b8 as Oa, ej as Va } from "./index-B7ymMLUP.js";
2
- import { n as qa, A as za, l as Oe, m as Ze, p as Ba, h as Ts, R as Je, c as Ds, a as Os, d as Cs, i as Ha, e as Ua, f as Ka, u as Wa, j as Ya, o as Rs, b as Ga, S as Qa } from "./WorkbenchRuntime-DwnSaeU0.js";
3
- import { D as Za } from "./index-B6ippZgO.js";
4
- var Ja = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M864 144H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zM464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16z" } }] }, name: "appstore", theme: "filled" };
5
- function Xe() {
6
- return Xe = Object.assign ? Object.assign.bind() : function(t) {
7
- for (var l = 1; l < arguments.length; l++) {
8
- var x = arguments[l];
9
- for (var m in x)
10
- Object.prototype.hasOwnProperty.call(x, m) && (t[m] = x[m]);
11
- }
12
- return t;
13
- }, Xe.apply(this, arguments);
14
- }
15
- const Xa = (t, l) => /* @__PURE__ */ a.createElement(as, Xe({}, t, {
16
- ref: l,
17
- icon: Ja
18
- })), en = /* @__PURE__ */ a.forwardRef(Xa);
19
- var sn = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M320 224h-66v-56c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v56h-66c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8h66v56c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-56h66c4.4 0 8-3.6 8-8V232c0-4.4-3.6-8-8-8zm-60 508h-80V292h80v440zm644-436h-66v-96c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v96h-66c-4.4 0-8 3.6-8 8v416c0 4.4 3.6 8 8 8h66v96c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-96h66c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8zm-60 364h-80V364h80v296zM612 404h-66V232c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v172h-66c-4.4 0-8 3.6-8 8v200c0 4.4 3.6 8 8 8h66v172c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V620h66c4.4 0 8-3.6 8-8V412c0-4.4-3.6-8-8-8zm-60 145a3 3 0 01-3 3h-74a3 3 0 01-3-3v-74a3 3 0 013-3h74a3 3 0 013 3v74z" } }] }, name: "sliders", theme: "outlined" };
20
- function es() {
21
- return es = Object.assign ? Object.assign.bind() : function(t) {
22
- for (var l = 1; l < arguments.length; l++) {
23
- var x = arguments[l];
24
- for (var m in x)
25
- Object.prototype.hasOwnProperty.call(x, m) && (t[m] = x[m]);
26
- }
27
- return t;
28
- }, es.apply(this, arguments);
29
- }
30
- const an = (t, l) => /* @__PURE__ */ a.createElement(as, es({}, t, {
31
- ref: l,
32
- icon: sn
33
- })), Vs = /* @__PURE__ */ a.forwardRef(an);
34
- var nn = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, name: "unordered-list", theme: "outlined" };
35
- function ss() {
36
- return ss = Object.assign ? Object.assign.bind() : function(t) {
37
- for (var l = 1; l < arguments.length; l++) {
38
- var x = arguments[l];
39
- for (var m in x)
40
- Object.prototype.hasOwnProperty.call(x, m) && (t[m] = x[m]);
41
- }
42
- return t;
43
- }, ss.apply(this, arguments);
44
- }
45
- const on = (t, l) => /* @__PURE__ */ a.createElement(as, ss({}, t, {
46
- ref: l,
47
- icon: nn
48
- })), tn = /* @__PURE__ */ a.forwardRef(on), Ue = "__all__", Ss = "__my__", Ke = "__library_all__", cn = "__library__:", ln = [
49
- { key: "all", label: "全部场景" },
50
- { key: "my", label: "我的场景" },
51
- { key: "map", label: "使用地图" }
52
- ];
53
- function rn(t) {
54
- return t === "map" ? "搜索当前地图下的场景" : t === "my" ? "搜索我的场景" : "搜索全部场景";
55
- }
56
- function dn({
57
- open: t,
58
- source: l,
59
- categories: x,
60
- categoryKey: m,
61
- search: p,
62
- cards: k,
63
- executing: R,
64
- loadingPlaybookId: _,
65
- onClose: v,
66
- onSourceChange: P,
67
- onCategoryChange: ee,
68
- onSearchChange: W,
69
- onSelectScene: ce
70
- }) {
71
- return /* @__PURE__ */ e.jsx(
72
- Za,
73
- {
74
- open: t,
75
- onClose: v,
76
- placement: "bottom",
77
- height: "min(82vh, 780px)",
78
- destroyOnClose: !1,
79
- styles: {
80
- body: { padding: 0, background: "var(--wc-bg)" },
81
- header: { display: "none" }
82
- },
83
- getContainer: !1,
84
- title: null,
85
- closeIcon: null,
86
- push: !1,
87
- children: /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__drawer", children: [
88
- /* @__PURE__ */ e.jsxs("header", { className: "wandox-console-chat__drawer-top", children: [
89
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__drawer-title", children: /* @__PURE__ */ e.jsx(
90
- "nav",
91
- {
92
- className: "wandox-console-chat__drawer-tabs",
93
- "aria-label": "场景来源",
94
- children: ln.map((u) => /* @__PURE__ */ e.jsx(
95
- "button",
96
- {
97
- type: "button",
98
- className: l === u.key ? "is-active" : "",
99
- onClick: () => P(u.key),
100
- children: u.label
101
- },
102
- u.key
103
- ))
104
- }
105
- ) }),
106
- /* @__PURE__ */ e.jsx(
107
- "button",
108
- {
109
- type: "button",
110
- className: "wandox-console-chat__drawer-close",
111
- onClick: v,
112
- "aria-label": "关闭",
113
- children: /* @__PURE__ */ e.jsx($s, {})
114
- }
115
- )
116
- ] }),
117
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__drawer-middle", children: [
118
- l !== "my" && /* @__PURE__ */ e.jsxs("aside", { className: "wandox-console-chat__drawer-cats", children: [
119
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__drawer-catslabel", children: "场景分类" }),
120
- x.map((u) => {
121
- const L = u.key === m;
122
- return /* @__PURE__ */ e.jsxs(
123
- "button",
124
- {
125
- type: "button",
126
- className: `wandox-console-chat__drawer-cat${L ? " wandox-console-chat__drawer-cat--active" : ""}`,
127
- onClick: () => ee(u.key),
128
- children: [
129
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__drawer-cat-name", children: u.name }),
130
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__drawer-cat-count", children: u.count })
131
- ]
132
- },
133
- u.key
134
- );
135
- })
136
- ] }),
137
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__drawer-body", children: [
138
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__drawer-toolbar", children: /* @__PURE__ */ e.jsx(
139
- ns,
140
- {
141
- allowClear: !0,
142
- prefix: /* @__PURE__ */ e.jsx(We, {}),
143
- placeholder: rn(l),
144
- value: p,
145
- onChange: (u) => W(u.target.value)
146
- }
147
- ) }),
148
- k.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__drawer-empty", children: p ? "没有匹配的场景" : "暂无可用场景" }) : /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scenes", children: k.map((u) => {
149
- const L = _ === u.playbook_id;
150
- return /* @__PURE__ */ e.jsx(
151
- "button",
152
- {
153
- type: "button",
154
- className: "wandox-console-scene",
155
- disabled: R || !!_,
156
- "aria-busy": L,
157
- onClick: () => void ce(u),
158
- children: /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene__body", children: [
159
- /* @__PURE__ */ e.jsx("strong", { title: u.title, children: u.title }),
160
- u.desc && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-scene__desc", title: u.desc, children: u.desc }),
161
- L && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-scene__loading", children: "正在读取场景..." })
162
- ] })
163
- },
164
- u.key
165
- );
166
- }) })
167
- ] })
168
- ] })
169
- ] })
170
- }
171
- );
172
- }
173
- const un = (t) => {
174
- const { onError: l } = t;
175
- l == null || l(new Error("该场景暂不支持文件上传"));
176
- };
177
- function qs({
178
- field: t,
179
- value: l,
180
- uploading: x,
181
- fileNameMap: m,
182
- getOptionState: p,
183
- onChange: k,
184
- onUpload: R
185
- }) {
186
- const _ = qa(t.type), v = R ?? ((P, ee) => un);
187
- return /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-field", children: [
188
- /* @__PURE__ */ e.jsxs("label", { htmlFor: `wc-param-${t.name}`, children: [
189
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-field__label-text", children: t.label || t.name }),
190
- t.description || t.hint ? /* @__PURE__ */ e.jsx(Ps, { title: t.description || t.hint, children: /* @__PURE__ */ e.jsx(
191
- ma,
192
- {
193
- "aria-label": `${t.label || t.name}说明`
194
- }
195
- ) }) : null,
196
- t.required && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-field__required", children: "必填" }),
197
- _ && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-field__required", children: "多值" })
198
- ] }),
199
- /* @__PURE__ */ e.jsx(
200
- za,
201
- {
202
- field: t,
203
- value: l,
204
- uploading: x,
205
- fileNameMap: m,
206
- getOptionState: p,
207
- onChange: k,
208
- onUpload: v,
209
- onDownloadTemplate: (P) => window.open(P.path, "_blank", "noopener,noreferrer")
210
- }
211
- )
212
- ] });
213
- }
214
- function mn(t) {
215
- if (Array.isArray(t)) return t;
216
- const l = t;
217
- return Array.isArray(l == null ? void 0 : l.user_playbooks) ? l.user_playbooks : [];
218
- }
219
- function hn({
220
- agentId: t,
221
- agentName: l,
222
- playbookId: x,
223
- playbookParams: m,
224
- initialMessage: p,
225
- initialAttachments: k,
226
- useMapCards: R = [],
227
- useMapCategories: _ = [],
228
- playbooks: v = [],
229
- userPlaybooks: P = [],
230
- agents: ee = [],
231
- onChangeAgent: W,
232
- onBack: ce,
233
- onSelectScene: u,
234
- onReady: L
235
- }) {
236
- const z = localStorage.getItem("sso_token") || "", S = localStorage.getItem("sso_domain") || "maiduo", Z = localStorage.getItem("sso_company") || "", se = a.useRef(null), ae = a.useRef(!1), [O, N] = a.useState(!1), [Y, ne] = a.useState(""), [B, T] = a.useState(""), [A, me] = a.useState("map"), [he, le] = a.useState(Ue), [M, I] = a.useState(null), we = a.useRef(null);
237
- a.useEffect(() => {
238
- if (!M || O) return;
239
- const s = setTimeout(() => {
240
- var n;
241
- (n = we.current) == null || n.focus();
242
- }, 120);
243
- return () => clearTimeout(s);
244
- }, [M, O]);
245
- const [J, H] = a.useState([]), [V, j] = a.useState({}), ye = As(
246
- J,
247
- V,
248
- j
249
- ), oe = a.useMemo(
250
- () => Oe(J, V).filter(
251
- (s) => s.required && Ze(V[s.name])
252
- ),
253
- [J, V]
254
- ), [te, fe] = a.useState("chat"), [G, xe] = a.useState([]), [b, ie] = a.useState(null), [re, Ce] = a.useState("results"), [h, D] = a.useState(!1), [de, Se] = a.useState([]);
255
- a.useEffect(() => {
256
- L == null || L({
257
- showInspectionResults: (s) => {
258
- fe("robot"), Ce("results"), ie(s || null);
259
- }
260
- });
261
- }, [L]);
262
- const [ge, Ie] = a.useState([]), [U, o] = a.useState(!1), [y, C] = a.useState(void 0), [g, F] = a.useState([]), [pe, je] = a.useState(""), [q, K] = a.useState(
263
- "map"
264
- ), [Re, ke] = a.useState(void 0), Q = a.useRef(0), ve = a.useRef(0), [Pe, os] = a.useState(
265
- js
266
- ), [Ve, ts] = a.useState({}), [Ae, cs] = a.useState(
267
- () => /* @__PURE__ */ new Set()
268
- ), qe = a.useCallback(
269
- (s, n, c) => ({
270
- key: `${n}-${s.playbook_id}`,
271
- title: s.name || "未命名场景",
272
- desc: s.description || "",
273
- reason: c,
274
- tags: [],
275
- playbook_id: s.playbook_id,
276
- input_fields: s.input_fields || [],
277
- categoryKey: n,
278
- video_url: s.video_url,
279
- video_duration: s.video_duration,
280
- view_count: s.view_count
281
- }),
282
- []
283
- ), Ee = a.useMemo(() => {
284
- const s = P.map(
285
- (i) => qe(i, Ss, "我的场景")
286
- ), n = /* @__PURE__ */ new Map();
287
- for (const i of v) {
288
- const w = i.category_name || i.category || i.type || "默认场景", f = `${cn}${w}`, be = n.get(f) || [];
289
- be.push(qe(i, f, w)), n.set(f, be);
290
- }
291
- const c = Array.from(n.values()).flat(), r = [
292
- {
293
- key: Ke,
294
- name: "全部场景",
295
- count: c.length,
296
- cards: c
297
- },
298
- ...Array.from(n, ([i, w]) => {
299
- var f;
300
- return {
301
- key: i,
302
- name: ((f = w[0]) == null ? void 0 : f.reason) || "默认场景",
303
- count: w.length,
304
- cards: w
305
- };
306
- })
307
- ], d = [
308
- {
309
- key: Ue,
310
- name: "全部场景",
311
- count: R.length,
312
- cards: R
313
- },
314
- ..._.map((i) => ({
315
- key: i.key,
316
- name: i.name,
317
- count: i.count,
318
- cards: R.filter((w) => w.categoryKey === i.key)
319
- }))
320
- ];
321
- return { allCategories: r, mapCategories: d, myCards: s };
322
- }, [
323
- l,
324
- v,
325
- qe,
326
- R,
327
- _,
328
- P
329
- ]), ze = a.useMemo(() => A === "all" ? Ee.allCategories : A === "map" ? Ee.mapCategories : [], [Ee, A]), Me = a.useMemo(
330
- () => R.map(
331
- (s) => ({
332
- category: null,
333
- category_name: s.reason,
334
- description: s.desc,
335
- domain: "",
336
- id: 0,
337
- name: s.title,
338
- playbook_id: s.playbook_id,
339
- scope: "usemap",
340
- status: "available",
341
- sub_category: null,
342
- tags: s.tags.map((n) => n.name),
343
- input_fields: s.input_fields,
344
- video_url: s.video_url,
345
- video_duration: s.video_duration,
346
- view_count: s.view_count,
347
- type: "",
348
- version: ""
349
- })
350
- ),
351
- [R]
352
- ), zs = a.useMemo(() => {
353
- const s = /* @__PURE__ */ new Map();
354
- for (const n of [
355
- ...v,
356
- ...P,
357
- ...Me
358
- ])
359
- n.playbook_id && s.set(n.playbook_id, n);
360
- return Array.from(s.values());
361
- }, [v, P, Me]), Bs = a.useMemo(() => {
362
- const s = /* @__PURE__ */ new Map();
363
- for (const n of v) {
364
- const c = n.category_name || n.category || n.type || "默认场景", r = s.get(c) || [];
365
- r.push(n), s.set(c, r);
366
- }
367
- return [
368
- { key: "__my__", label: "我的场景", playbooks: [] },
369
- ...Array.from(s, ([n, c]) => ({
370
- key: `all:${n}`,
371
- label: n,
372
- playbooks: c
373
- }))
374
- ];
375
- }, [v]), Hs = a.useMemo(() => {
376
- const s = new Map(
377
- Me.map((n) => [
378
- n.playbook_id,
379
- n
380
- ])
381
- );
382
- return _.map((n) => ({
383
- key: `map:${n.key}`,
384
- label: n.name,
385
- playbooks: R.filter((c) => c.categoryKey === n.key).map((c) => s.get(c.playbook_id)).filter((c) => !!c)
386
- }));
387
- }, [R, _, Me]), Us = q === "map" ? Hs : Bs, Ks = a.useMemo(() => {
388
- var c;
389
- const s = B.trim().toLowerCase(), n = A === "my" ? Ee.myCards : ((c = ze.find((r) => r.key === he)) == null ? void 0 : c.cards) || [];
390
- return s ? n.filter(
391
- (r) => r.title.toLowerCase().includes(s) || r.desc.toLowerCase().includes(s)
392
- ) : n;
393
- }, [
394
- ze,
395
- he,
396
- Ee.myCards,
397
- A,
398
- B
399
- ]), Ws = a.useCallback((s) => {
400
- const n = Array.isArray(s) ? s : [];
401
- Ie(n), o(n.length > 0);
402
- }, []), ue = a.useMemo(
403
- () => ee.find((s) => s.id === t),
404
- [ee, t]
405
- ), { messageData: Ys, executing: E, stopping: Gs, actions: Qs } = Ba({
406
- activeAgent: t,
407
- ssoToken: z,
408
- ssoDomain: S,
409
- ssoCompany: Z,
410
- onRecommendationsUpdate: Ws
411
- }), {
412
- sendMessage: Fe,
413
- executePlaybook: ls,
414
- respondToProposal: is,
415
- stopCurrent: Zs,
416
- retrigger: rs
417
- } = Qs, {
418
- messages: _e,
419
- messagesTotal: ds,
420
- loading: us,
421
- loadMessages: ms,
422
- loadMoreMessages: hs
423
- } = Ys, Le = a.useMemo(() => {
424
- for (let s = _e.length - 1; s >= 0; s--)
425
- if (_e[s].role === "assistant") return _e[s].id;
426
- }, [_e]), Te = a.useCallback(async () => {
427
- if (!t || !z) {
428
- F([]);
429
- return;
430
- }
431
- try {
432
- const s = await ha({
433
- agent_id: t,
434
- limit: 8
435
- });
436
- F(Array.isArray(s.data) ? s.data : []);
437
- } catch {
438
- }
439
- }, [t, z]);
440
- a.useEffect(() => {
441
- Te();
442
- }, [Te]);
443
- const X = a.useCallback(
444
- async (s) => {
445
- await ls(s), Te();
446
- },
447
- [ls, Te]
448
- ), xs = a.useCallback(async (s) => {
449
- const n = String(s.playbook_id || "").trim();
450
- if (!n) throw new Error("场景缺少 playbook_id");
451
- const { data: c } = await Ye({
452
- playbook_id: n
453
- });
454
- return ks(s, c);
455
- }, []);
456
- a.useEffect(() => {
457
- ae.current || (ae.current = !0, (async () => {
458
- if (await ms(), x) {
459
- const s = (p == null ? void 0 : p.trim()) || "执行场景";
460
- X({
461
- message: s,
462
- playbook_id: x,
463
- playbook_params: m || {}
464
- });
465
- } else p != null && p.trim() && Fe(p.trim(), void 0, k);
466
- })());
467
- }, [
468
- x,
469
- p,
470
- k,
471
- m,
472
- X,
473
- ms,
474
- Fe
475
- ]), a.useEffect(() => {
476
- if (!t) return;
477
- let s = !1;
478
- return (async () => {
479
- try {
480
- const { data: n } = await xa({ agent_id: t });
481
- if (s) return;
482
- const c = (n == null ? void 0 : n.children) || [];
483
- xe(c), ie(null);
484
- } catch {
485
- xe([]);
486
- }
487
- })(), () => {
488
- s = !0;
489
- };
490
- }, [t]), a.useEffect(() => {
491
- Le && Le !== y && C(Le);
492
- }, [Le, y]), a.useEffect(() => {
493
- if (te !== "robot" || re !== "history" || !b) {
494
- Se([]);
495
- return;
496
- }
497
- const s = G.find((c) => c.name === b);
498
- if (!s) return;
499
- let n = !1;
500
- return D(!0), (async () => {
501
- try {
502
- const c = await pa({
503
- agent_id: s.agent_id,
504
- limit: 50
505
- });
506
- if (n) return;
507
- const d = (Array.isArray(c == null ? void 0 : c.data) ? c.data : []).map(
508
- (i, w) => ({
509
- id: i.id || i.execute_id || `record_${w}`,
510
- action_name: i.action_name || i.display_name || "未知动作",
511
- status: i.status || "pending",
512
- created_at: i.created_at || "",
513
- completed_at: i.completed_at,
514
- output_data: i.output_data,
515
- error: i.error
516
- })
517
- );
518
- Se(d);
519
- } catch {
520
- Se([]);
521
- } finally {
522
- n || D(!1);
523
- }
524
- })(), () => {
525
- n = !0;
526
- };
527
- }, [te, re, b, G]);
528
- const Be = a.useCallback(
529
- (s, n, c) => {
530
- if (o(!1), n) {
531
- X({
532
- message: s,
533
- playbook_id: n
534
- });
535
- return;
536
- }
537
- Fe(s, void 0, c);
538
- },
539
- [X, Fe]
540
- ), Js = a.useCallback((s) => {
541
- me(s), le(
542
- s === "all" ? Ke : s === "map" ? Ue : Ss
543
- ), T(""), I(null), H([]), j({});
544
- }, []), Xs = a.useCallback(() => {
545
- me("all"), le(Ke), T(""), I(null), H([]), j({}), N(!0);
546
- }, []), ea = a.useCallback(() => {
547
- N(!1), I(null), H([]), j({});
548
- }, []), Ne = a.useCallback(
549
- (s, n = {}) => {
550
- I({
551
- key: s.playbook_id,
552
- playbook_id: s.playbook_id,
553
- title: s.name,
554
- desc: s.description ?? "",
555
- reason: "",
556
- tags: [],
557
- categoryKey: "",
558
- input_fields: s.input_fields || []
559
- });
560
- const c = Ms(s.input_fields || []);
561
- H(c), j(Ts(c, n));
562
- },
563
- []
564
- ), sa = a.useCallback(
565
- async (s) => {
566
- var c;
567
- if (E || Y) return;
568
- const n = String(s.playbook_id || "").trim();
569
- if (!n) {
570
- $.error("场景缺少 playbook_id");
571
- return;
572
- }
573
- ne(n);
574
- try {
575
- const r = {
576
- category: null,
577
- category_name: s.reason || void 0,
578
- description: s.desc,
579
- domain: "",
580
- id: 0,
581
- name: s.title,
582
- playbook_id: n,
583
- scope: "",
584
- status: "available",
585
- sub_category: null,
586
- tags: s.tags.map((w) => w.name),
587
- type: "",
588
- version: "",
589
- input_fields: s.input_fields,
590
- video_url: s.video_url,
591
- video_duration: s.video_duration,
592
- view_count: s.view_count
593
- }, { data: d } = await Ye({
594
- playbook_id: n
595
- });
596
- if (!d || typeof d != "object" || Array.isArray(d))
597
- throw new Error("场景详情为空");
598
- const i = ks(r, d);
599
- if (N(!1), (c = i.input_fields) != null && c.length) {
600
- Ne(i);
601
- return;
602
- }
603
- Be(i.name, i.playbook_id), u == null || u(s);
604
- } catch (r) {
605
- const d = r instanceof Error ? r.message : "场景加载失败";
606
- $.error(d);
607
- } finally {
608
- ne("");
609
- }
610
- },
611
- [
612
- E,
613
- Ne,
614
- Be,
615
- u,
616
- Y
617
- ]
618
- ), ps = a.useCallback(
619
- async (s) => {
620
- if (!E) {
621
- if (o(!1), s.input_fields && s.input_fields.length > 0) {
622
- Ne(s);
623
- return;
624
- }
625
- try {
626
- await X({
627
- message: s.name,
628
- playbook_id: s.playbook_id
629
- });
630
- } catch (n) {
631
- const c = n instanceof Error ? n.message : "执行失败";
632
- $.error(c);
633
- }
634
- }
635
- },
636
- [E, X, Ne]
637
- ), aa = a.useCallback(
638
- async (s) => {
639
- var c;
640
- if (E || pe) return;
641
- const n = String(s.playbook_id || "").trim();
642
- if (n) {
643
- je(n), o(!1);
644
- try {
645
- const r = _a(s), d = await xs(s);
646
- if ((c = d.input_fields) != null && c.length) {
647
- Ne(d, r);
648
- return;
649
- }
650
- await X({
651
- message: d.name,
652
- playbook_id: d.playbook_id
653
- });
654
- } catch (r) {
655
- const d = r instanceof Error ? r.message : "场景参数加载失败";
656
- $.error(d);
657
- } finally {
658
- je("");
659
- }
660
- }
661
- },
662
- [
663
- E,
664
- X,
665
- Ne,
666
- xs,
667
- pe
668
- ]
669
- ), na = a.useCallback(async () => {
670
- if (!M || E) return;
671
- const n = Oe(J, V).filter(
672
- (d) => d.required && Ze(V[d.name])
673
- );
674
- if (n.length > 0) {
675
- $.warning(`请先填写 ${n.length} 项必填参数`);
676
- return;
677
- }
678
- N(!1), o(!1);
679
- const c = M, r = V;
680
- I(null), H([]), j({});
681
- try {
682
- const d = c.title || (p == null ? void 0 : p.trim()) || "执行场景";
683
- await X({
684
- message: d,
685
- playbook_id: c.playbook_id,
686
- playbook_params: r
687
- }), u == null || u(c);
688
- } catch (d) {
689
- const i = d instanceof Error ? d.message : "执行失败";
690
- $.error(i);
691
- }
692
- }, [
693
- M,
694
- J,
695
- V,
696
- E,
697
- X,
698
- p,
699
- u
700
- ]), oa = a.useCallback((s) => {
701
- ve.current += 1, ke({
702
- requestId: ++Q.current,
703
- playbooks: s
704
- });
705
- }, []), ta = a.useCallback(() => {
706
- const s = ++ve.current;
707
- ke({
708
- requestId: ++Q.current,
709
- playbooks: [],
710
- loading: !0
711
- }), (async () => {
712
- await new Promise((n) => {
713
- window.requestAnimationFrame(() => n());
714
- });
715
- try {
716
- const { data: n } = await ba({
717
- agent_id: t
718
- });
719
- if (s !== ve.current) return;
720
- ke({
721
- requestId: ++Q.current,
722
- playbooks: mn(n)
723
- });
724
- } catch {
725
- if (s !== ve.current) return;
726
- $.error("我的场景加载失败"), ke({
727
- requestId: ++Q.current,
728
- playbooks: []
729
- });
730
- }
731
- })();
732
- }, [t]), ca = a.useCallback((s) => {
733
- ke(
734
- (n) => (n == null ? void 0 : n.requestId) === s ? void 0 : n
735
- );
736
- }, []), la = /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__scene-quick", children: [
737
- /* @__PURE__ */ e.jsx(
738
- Ge,
739
- {
740
- menu: {
741
- selectedKeys: [q],
742
- items: [
743
- { key: "all", label: "全部场景" },
744
- { key: "map", label: "使用地图" }
745
- ],
746
- onClick: ({ key: s }) => {
747
- ve.current += 1, K(s);
748
- }
749
- },
750
- trigger: ["click"],
751
- placement: "topLeft",
752
- children: /* @__PURE__ */ e.jsxs(
753
- "button",
754
- {
755
- type: "button",
756
- className: "wandox-console-chat__scene-source",
757
- disabled: E,
758
- children: [
759
- /* @__PURE__ */ e.jsx("span", { children: q === "map" ? "使用地图" : "全部场景" }),
760
- /* @__PURE__ */ e.jsx(
761
- "svg",
762
- {
763
- className: "wandox-console-chat__scene-source-arrow",
764
- width: "12",
765
- height: "12",
766
- viewBox: "0 0 24 24",
767
- fill: "currentColor",
768
- "aria-hidden": "true",
769
- focusable: "false",
770
- children: /* @__PURE__ */ e.jsx("path", { d: "M8.413 0.963a2 2 0 0 1 2.738.712l4.872 8.301a4 4 0 0 1 0 4.049l-4.872 8.3a2 2 0 1 1-3.45-2.025L12.574 12 7.701 3.7A2 2 0 0 1 8.413.963Z" })
771
- }
772
- )
773
- ]
774
- }
775
- )
776
- }
777
- ),
778
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__scene-separator", "aria-hidden": !0, children: "|" }),
779
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__scene-categories", children: Us.map((s) => /* @__PURE__ */ e.jsx(
780
- "button",
781
- {
782
- type: "button",
783
- className: "wandox-console-chat__choose-scene",
784
- disabled: E,
785
- onClick: () => s.key === "__my__" ? ta() : oa(s.playbooks),
786
- children: s.label
787
- },
788
- s.key
789
- )) })
790
- ] }), _s = a.useCallback(async (s) => {
791
- var i;
792
- const n = (i = s.meta_content) != null && i.playbook_id ? "数据报表" : "对话内容", c = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
793
- if (fa(s)) {
794
- const w = wa(s);
795
- if (!w) {
796
- $.warning("没有可导出的表格数据");
797
- return;
798
- }
799
- const f = w.fields.map((He) => He.label).join(","), be = w.rows.map(
800
- (He) => w.fields.map((ua) => ya(He[ua.name])).join(",")
801
- ), da = `\uFEFF${[f, ...be].join(`
802
- `)}`;
803
- ga(
804
- new Blob([da], { type: "text/csv;charset=utf-8;" }),
805
- `${n}_${c}.csv`
806
- );
807
- return;
808
- }
809
- const r = document.querySelector(
810
- `[data-message-id="${s.message_id || s.id}"] .wandox-message-content`
811
- );
812
- if (!r) {
813
- $.warning("无法定位消息内容");
814
- return;
815
- }
816
- const d = window.open("", "_blank");
817
- if (!d) {
818
- $.warning("请允许弹出窗口");
819
- return;
820
- }
821
- d.document.write(
822
- `<!DOCTYPE html><html><head><meta charset="utf-8"><title>${n}_${c}</title><style>body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;padding:20px;color:#333}table{border-collapse:collapse;width:100%}th,td{border:1px solid #d9d9d9;padding:6px 8px;font-size:13px;text-align:left}th{background:#fafafa}img{max-width:100%}pre{white-space:pre-wrap;word-break:break-all;font-size:12px;background:#f5f5f5;padding:12px;border-radius:4px}button,.ant-btn,.ant-tooltip-open{display:none!important}</style></head><body>${r.innerHTML}</body></html>`
823
- ), d.document.close(), d.onload = () => {
824
- d.print(), d.close();
825
- };
826
- }, []), bs = a.useCallback(
827
- (s) => {
828
- var d, i, w;
829
- const n = _e.find(
830
- (f) => f.message_id === s || f.id === s
831
- ), c = ja(n);
832
- if (!c) {
833
- $.warning("缺少场景 ID,无法配置定时触发");
834
- return;
835
- }
836
- const r = ((i = (d = n == null ? void 0 : n.actions) == null ? void 0 : d.find((f) => f.playbook_id === c)) == null ? void 0 : i.display_name) || ((w = n == null ? void 0 : n.meta_content) == null ? void 0 : w.playbook_name) || c;
837
- os({
838
- visible: !0,
839
- messageId: s,
840
- agentId: t,
841
- playbookId: c,
842
- playbookName: r
843
- });
844
- },
845
- [t, _e]
846
- ), ia = a.useCallback(() => {
847
- os(js);
848
- }, []), De = a.useCallback(
849
- (s) => {
850
- const n = s.message_id;
851
- return n && Object.prototype.hasOwnProperty.call(Ve, n) ? Ve[n] : ka(s);
852
- },
853
- [Ve]
854
- ), fs = a.useCallback(
855
- async (s, n, c) => {
856
- var w;
857
- const r = s.message_id;
858
- if (!r || Ae.has(r)) return !1;
859
- const d = De(s), i = Pa(
860
- d,
861
- n
862
- );
863
- ts((f) => ({
864
- ...f,
865
- [r]: i
866
- })), cs((f) => new Set(f).add(r));
867
- try {
868
- const f = await va(
869
- { domain: S },
870
- {
871
- message_id: r,
872
- rating: i,
873
- tags: (w = c == null ? void 0 : c.tags) != null && w.length ? c.tags : void 0,
874
- text: (c == null ? void 0 : c.text) || void 0
875
- }
876
- );
877
- if ((f == null ? void 0 : f.success) === !1)
878
- throw new Error(f.message || "反馈提交失败");
879
- return !0;
880
- } catch (f) {
881
- return ts((be) => ({
882
- ...be,
883
- [r]: d
884
- })), $.error(
885
- f instanceof Error ? f.message : "反馈提交失败,请稍后重试"
886
- ), !1;
887
- } finally {
888
- cs((f) => {
889
- const be = new Set(f);
890
- return be.delete(r), be;
891
- });
892
- }
893
- },
894
- [Ae, De, S]
895
- ), ws = a.useCallback(
896
- async (s) => {
897
- o(!1);
898
- try {
899
- await rs(s);
900
- } catch (n) {
901
- const c = n instanceof Error ? n.message : "重新生成失败";
902
- $.error(c);
903
- }
904
- },
905
- [rs]
906
- ), ys = a.useCallback(() => {
907
- o((s) => !s);
908
- }, []), gs = a.useCallback(
909
- (s, n) => {
910
- if (s.role !== "assistant" || s.execution_status === "executing") return null;
911
- const r = n && s.id === y && ge.length > 0, d = U ? "隐藏推荐" : r ? `显示推荐(${ge.length})` : "推荐";
912
- return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
913
- /* @__PURE__ */ e.jsx(
914
- Na,
915
- {
916
- msg: s,
917
- domain: S,
918
- onExportMessage: _s,
919
- exportIcon: "copy",
920
- showSolidify: !1,
921
- onOpenScheduleDialog: bs,
922
- onRetrigger: ws,
923
- feedbackRating: De(s),
924
- feedbackPending: !!s.message_id && Ae.has(s.message_id),
925
- onFeedback: fs,
926
- extraActions: r ? /* @__PURE__ */ e.jsx(Ps, { title: d, children: /* @__PURE__ */ e.jsxs(
927
- "button",
928
- {
929
- type: "button",
930
- className: `wandox-console-chat__toolbar-toggle${U ? " is-active" : ""}`,
931
- "aria-label": d,
932
- "aria-expanded": U,
933
- onClick: ys,
934
- children: [
935
- /* @__PURE__ */ e.jsx(tn, {}),
936
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__toolbar-toggle-count", children: ge.length })
937
- ]
938
- }
939
- ) }) : null
940
- }
941
- ),
942
- r && U && /* @__PURE__ */ e.jsx(
943
- "ul",
944
- {
945
- className: "wandox-console-chat__recommendations",
946
- "aria-label": "推荐场景",
947
- children: ge.map((i, w) => /* @__PURE__ */ e.jsx(
948
- "li",
949
- {
950
- className: "wandox-console-chat__recommendations-item",
951
- children: /* @__PURE__ */ e.jsxs(
952
- "button",
953
- {
954
- type: "button",
955
- className: "wandox-console-chat__recommendations-pill",
956
- disabled: E,
957
- onClick: () => {
958
- ps(i);
959
- },
960
- title: i.description || i.name,
961
- children: [
962
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__recommendations-pill-label", children: i.name }),
963
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__recommendations-pill-arrow", children: /* @__PURE__ */ e.jsx(Je, {}) })
964
- ]
965
- }
966
- )
967
- },
968
- `${i.playbook_id || i.name}-${w}`
969
- ))
970
- }
971
- )
972
- ] });
973
- },
974
- [
975
- E,
976
- Ae,
977
- De,
978
- ps,
979
- _s,
980
- fs,
981
- bs,
982
- ws,
983
- ge,
984
- y,
985
- U,
986
- S,
987
- ys
988
- ]
989
- ), ra = a.useMemo(
990
- () => /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__body", children: [
991
- /* @__PURE__ */ e.jsx(
992
- Ca,
993
- {
994
- messages: _e,
995
- executing: E,
996
- ssoToken: z,
997
- ssoDomain: S,
998
- ssoCompany: Z,
999
- onExecutePlaybook: X,
1000
- onRespondToProposal: is,
1001
- containerRef: se,
1002
- messagesTotal: ds,
1003
- loadMoreMessages: hs,
1004
- loading: us,
1005
- initialLoadingContent: /* @__PURE__ */ e.jsx(Ra, {}),
1006
- conversationKey: t,
1007
- messageToolbar: gs
1008
- }
1009
- ),
1010
- /* @__PURE__ */ e.jsx(
1011
- Sa,
1012
- {
1013
- messages: _e,
1014
- scrollContainerRef: se,
1015
- mode: "deepseek"
1016
- }
1017
- )
1018
- ] }),
1019
- [
1020
- t,
1021
- X,
1022
- E,
1023
- hs,
1024
- _e,
1025
- us,
1026
- ds,
1027
- gs,
1028
- is,
1029
- Z,
1030
- S,
1031
- z
1032
- ]
1033
- );
1034
- return (
1035
- // wandox-root:Assistant 组件的 CSS 变量(--wandox-*)作用域
1036
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-root wandox-console-chat", children: [
1037
- /* @__PURE__ */ e.jsxs("header", { className: "wandox-console-chat__top", children: [
1038
- /* @__PURE__ */ e.jsxs(
1039
- "button",
1040
- {
1041
- type: "button",
1042
- className: "wandox-console-chat__back",
1043
- onClick: ce,
1044
- children: [
1045
- /* @__PURE__ */ e.jsx(Ds, {}),
1046
- /* @__PURE__ */ e.jsx("span", { children: "返回" })
1047
- ]
1048
- }
1049
- ),
1050
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__agent-selector", children: /* @__PURE__ */ e.jsx(
1051
- Ge,
1052
- {
1053
- menu: {
1054
- items: ee.map((s) => ({
1055
- key: s.id,
1056
- disabled: s.id === t,
1057
- label: /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-agent-menu-item", children: [
1058
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-agent-menu-item__icon", children: s.icon }),
1059
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-agent-menu-item__name", children: s.name }),
1060
- s.id === t && /* @__PURE__ */ e.jsx(Ia, { className: "wandox-console-agent-menu-item__check" })
1061
- ] })
1062
- })),
1063
- onClick: ({ key: s }) => W == null ? void 0 : W(s)
1064
- },
1065
- trigger: ["click"],
1066
- placement: "bottomLeft",
1067
- children: /* @__PURE__ */ e.jsxs(
1068
- "button",
1069
- {
1070
- type: "button",
1071
- className: "wandox-console-chat__title",
1072
- "aria-label": "切换智能体",
1073
- title: "切换智能体",
1074
- children: [
1075
- (ue == null ? void 0 : ue.icon) && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__title-icon", children: ue.icon }),
1076
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__title-name", children: l || (ue == null ? void 0 : ue.name) || "智能体" }),
1077
- /* @__PURE__ */ e.jsx(Fs, { className: "wandox-console-chat__title-arrow" })
1078
- ]
1079
- }
1080
- )
1081
- }
1082
- ) }),
1083
- /* @__PURE__ */ e.jsxs(
1084
- "button",
1085
- {
1086
- type: "button",
1087
- className: "wandox-console-chat__all-scenes",
1088
- disabled: E,
1089
- onClick: Xs,
1090
- children: [
1091
- /* @__PURE__ */ e.jsx(en, {}),
1092
- /* @__PURE__ */ e.jsx("span", { children: "全部场景" })
1093
- ]
1094
- }
1095
- ),
1096
- /* @__PURE__ */ e.jsx(Os, { benefit: ue == null ? void 0 : ue.packageBenefit })
1097
- ] }),
1098
- /* @__PURE__ */ e.jsxs("nav", { className: "wandox-console-chat__topbar", children: [
1099
- /* @__PURE__ */ e.jsx(
1100
- "button",
1101
- {
1102
- type: "button",
1103
- className: `wandox-console-chat__topbar-tab ${te === "chat" ? "active" : ""}`,
1104
- onClick: () => fe("chat"),
1105
- children: "智能体会话"
1106
- }
1107
- ),
1108
- /* @__PURE__ */ e.jsx(
1109
- "button",
1110
- {
1111
- type: "button",
1112
- className: `wandox-console-chat__topbar-tab ${te === "robot" ? "active" : ""}`,
1113
- onClick: () => {
1114
- fe("robot"), ie(null);
1115
- },
1116
- children: /* @__PURE__ */ e.jsx("span", { children: "巡检机器人" })
1117
- }
1118
- )
1119
- ] }),
1120
- te === "chat" ? ra : /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot", children: [
1121
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-chips", children: G.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty", children: "该智能体暂无巡检机器人" }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1122
- G.length > 0 && /* @__PURE__ */ e.jsx(
1123
- "button",
1124
- {
1125
- type: "button",
1126
- className: `wandox-console-chat__robot-chip ${b === null ? "active" : ""}`,
1127
- onClick: () => ie(null),
1128
- children: "全部"
1129
- }
1130
- ),
1131
- G.map((s) => /* @__PURE__ */ e.jsx(
1132
- "button",
1133
- {
1134
- type: "button",
1135
- className: `wandox-console-chat__robot-chip ${b === s.name ? "active" : ""}`,
1136
- onClick: () => ie(s.name),
1137
- children: s.name
1138
- },
1139
- s.agent_id
1140
- ))
1141
- ] }) }),
1142
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-tabs", children: [
1143
- /* @__PURE__ */ e.jsx(
1144
- "button",
1145
- {
1146
- type: "button",
1147
- className: `wandox-console-chat__robot-tab ${re === "results" ? "active" : ""}`,
1148
- onClick: () => Ce("results"),
1149
- children: "巡检结果"
1150
- }
1151
- ),
1152
- /* @__PURE__ */ e.jsxs(
1153
- "button",
1154
- {
1155
- type: "button",
1156
- className: `wandox-console-chat__robot-tab ${re === "history" ? "active" : ""}`,
1157
- onClick: () => Ce("history"),
1158
- children: [
1159
- "执行记录",
1160
- re === "history" && b && de.length > 0 && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__robot-tab-badge", children: de.length })
1161
- ]
1162
- }
1163
- )
1164
- ] }),
1165
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-content", children: re === "results" ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-empty", children: [
1166
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-icon", children: /* @__PURE__ */ e.jsx(Cs, {}) }),
1167
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-title", children: b ? `${b} 暂无巡检结果` : "请选择一个机器人查看巡检结果" }),
1168
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-desc", children: "巡检结果会在机器人执行后展示在这里" })
1169
- ] }) : b ? h ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-loading", children: [
1170
- /* @__PURE__ */ e.jsx(Ls, { size: "small" }),
1171
- /* @__PURE__ */ e.jsx("span", { children: "加载中..." })
1172
- ] }) : de.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty", children: /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-title", children: "暂无执行记录" }) }) : /* @__PURE__ */ e.jsx("ul", { className: "wandox-console-chat__robot-history", children: de.map((s) => /* @__PURE__ */ e.jsxs(
1173
- "li",
1174
- {
1175
- className: `wandox-console-chat__robot-history-item wandox-console-chat__robot-history-item--${s.status}`,
1176
- children: [
1177
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-history-info", children: [
1178
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__robot-history-name", children: s.action_name }),
1179
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-chat__robot-history-time", children: s.created_at ? new Date(s.created_at).toLocaleString(
1180
- "zh-CN",
1181
- {
1182
- month: "2-digit",
1183
- day: "2-digit",
1184
- hour: "2-digit",
1185
- minute: "2-digit"
1186
- }
1187
- ) : "" })
1188
- ] }),
1189
- /* @__PURE__ */ e.jsx(
1190
- "span",
1191
- {
1192
- className: `wandox-console-chat__robot-history-status wandox-console-chat__robot-history-status--${s.status}`,
1193
- children: {
1194
- pending: "等待中",
1195
- running: "执行中",
1196
- success: "成功",
1197
- failed: "失败"
1198
- }[s.status] || s.status
1199
- }
1200
- )
1201
- ]
1202
- },
1203
- s.id
1204
- )) }) : /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat__robot-empty", children: [
1205
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-icon", children: /* @__PURE__ */ e.jsx(Cs, {}) }),
1206
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-title", children: "请先选择机器人" }),
1207
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__robot-empty-desc", children: "在上方选择机器人以查看其执行记录" })
1208
- ] }) })
1209
- ] }),
1210
- te === "chat" && g.length > 0 && !(M && !O) && /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__recent", children: /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__recent-bar", children: g.map((s, n) => /* @__PURE__ */ e.jsx(
1211
- "button",
1212
- {
1213
- type: "button",
1214
- className: "wandox-console-chat__recent-chip",
1215
- disabled: E || !!pe,
1216
- title: s.description || s.name,
1217
- onClick: () => {
1218
- aa(s);
1219
- },
1220
- children: s.name
1221
- },
1222
- `${s.playbook_id || s.name}-${n}`
1223
- )) }) }),
1224
- te === "chat" && /* @__PURE__ */ e.jsx("div", { className: "wandox-console-chat__input", children: M && !O ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-input-playbook wandox-console-prompt", children: [
1225
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-prompt__head", children: [
1226
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scenechoice", children: [
1227
- /* @__PURE__ */ e.jsx("span", { children: "已选择场景" }),
1228
- /* @__PURE__ */ e.jsx("strong", { children: M.title })
1229
- ] }),
1230
- /* @__PURE__ */ e.jsx(
1231
- "button",
1232
- {
1233
- type: "button",
1234
- className: "wandox-console-changescene",
1235
- onClick: () => {
1236
- I(null), H([]), j({});
1237
- },
1238
- children: "重新选择"
1239
- }
1240
- )
1241
- ] }),
1242
- /* @__PURE__ */ e.jsx(
1243
- "div",
1244
- {
1245
- ref: we,
1246
- tabIndex: -1,
1247
- className: "wandox-console-taskarea wandox-console-taskarea--static",
1248
- children: M.desc || M.title
1249
- }
1250
- ),
1251
- J.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramarea", children: [
1252
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramhead", children: [
1253
- /* @__PURE__ */ e.jsx(Vs, {}),
1254
- /* @__PURE__ */ e.jsx("strong", { children: "确认分析范围" }),
1255
- /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-paramhead__status", children: [
1256
- /* @__PURE__ */ e.jsx(Qe, {}),
1257
- " ",
1258
- oe.length > 0 ? `待填 ${oe.length} 项必填参数` : "参数已就绪"
1259
- ] })
1260
- ] }),
1261
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-params", children: Oe(
1262
- J,
1263
- V
1264
- ).map((s) => /* @__PURE__ */ e.jsx(
1265
- qs,
1266
- {
1267
- field: s,
1268
- value: V[s.name],
1269
- uploading: !1,
1270
- fileNameMap: {},
1271
- getOptionState: ye.getFieldState,
1272
- onChange: (n, c) => j((r) => ({
1273
- ...r,
1274
- [n]: c
1275
- }))
1276
- },
1277
- s.name
1278
- )) })
1279
- ] }),
1280
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-prompt__foot", children: [
1281
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-input-playbook__tip", children: "· 已继承当前上下文" }),
1282
- /* @__PURE__ */ e.jsxs(
1283
- "button",
1284
- {
1285
- type: "button",
1286
- className: "wandox-console-start",
1287
- disabled: !M || E || oe.length > 0,
1288
- onClick: na,
1289
- children: [
1290
- "开始执行",
1291
- /* @__PURE__ */ e.jsx(Je, {})
1292
- ]
1293
- }
1294
- )
1295
- ] })
1296
- ] }) : /* @__PURE__ */ e.jsx(
1297
- Ea,
1298
- {
1299
- onSend: Be,
1300
- executing: E,
1301
- stopping: Gs,
1302
- onStop: Zs,
1303
- placeholder: "今天帮你做些什么? / 快速调用场景",
1304
- ssoToken: z,
1305
- ssoDomain: S,
1306
- ssoCompany: Z,
1307
- leadingActions: la,
1308
- uploadButtonAsLeading: !0,
1309
- uploadButtonLabel: "添加文件",
1310
- mentionTriggerChar: "/",
1311
- mentionListRequest: Re,
1312
- onMentionListRequestHandled: ca,
1313
- autoFocusInput: !M,
1314
- playbooks: zs,
1315
- onRequestPlaybookParams: Ne
1316
- }
1317
- ) }),
1318
- /* @__PURE__ */ e.jsx(
1319
- dn,
1320
- {
1321
- open: O,
1322
- source: A,
1323
- categories: ze,
1324
- categoryKey: he,
1325
- search: B,
1326
- cards: Ks,
1327
- executing: E,
1328
- loadingPlaybookId: Y,
1329
- onClose: ea,
1330
- onSourceChange: Js,
1331
- onCategoryChange: le,
1332
- onSearchChange: T,
1333
- onSelectScene: sa
1334
- }
1335
- ),
1336
- /* @__PURE__ */ e.jsx(
1337
- $a,
1338
- {
1339
- open: Pe.visible,
1340
- agentId: Pe.agentId,
1341
- playbookId: Pe.playbookId,
1342
- playbookName: Pe.playbookName,
1343
- onClose: ia
1344
- }
1345
- )
1346
- ] })
1347
- );
1348
- }
1349
- const { TextArea: xn } = ns;
1350
- function pn({
1351
- useMapCards: t,
1352
- useMapCategories: l,
1353
- playbooks: x = [],
1354
- selectedCategoryKey: m,
1355
- onCategorySelect: p,
1356
- loading: k,
1357
- useMapError: R,
1358
- onRetry: _,
1359
- onStartAnalysis: v,
1360
- agents: P,
1361
- selectedAgentId: ee,
1362
- onAgentSelect: W,
1363
- onOpenAgentChat: ce
1364
- }) {
1365
- const [u, L] = a.useState(""), [z, S] = a.useState(""), Z = a.useRef(null), [se, ae] = a.useState([]), [O, N] = a.useState(!1), [Y, ne] = a.useState(""), B = a.useRef(0), [T, A] = a.useState({}), [me, he] = a.useState({}), [le, M] = a.useState({}), [I, we] = a.useState([]), [J, H] = a.useState(!1), V = a.useRef(null), j = a.useMemo(
1366
- () => t.length > 0 ? t : Ha(x),
1367
- [t, x]
1368
- ), ye = a.useMemo(() => m ? j.filter((o) => o.categoryKey === m) : j, [j, m]), oe = a.useMemo(() => {
1369
- const o = z.trim().toLowerCase();
1370
- return o ? ye.filter(
1371
- (y) => y.title.toLowerCase().includes(o) || y.desc.toLowerCase().includes(o)
1372
- ) : ye;
1373
- }, [ye, z]), te = a.useMemo(() => oe.slice(0, 6), [oe]), fe = k || R && j.length === 0 || oe.length > 0, [G, xe] = a.useState("");
1374
- a.useEffect(() => {
1375
- B.current += 1, xe(""), L(""), ae([]), A({}), N(!1), ne("");
1376
- }, [m]), a.useEffect(() => {
1377
- G && !j.some((o) => o.playbook_id === G) && (B.current += 1, xe(""), L(""), ae([]), A({}), N(!1), ne(""));
1378
- }, [G, j]);
1379
- const b = a.useMemo(
1380
- () => j.find((o) => o.playbook_id === G) ?? null,
1381
- [j, G]
1382
- );
1383
- a.useEffect(() => {
1384
- if (k || b) return;
1385
- const o = window.setTimeout(() => {
1386
- var C, g;
1387
- const y = (g = (C = Z.current) == null ? void 0 : C.resizableTextArea) == null ? void 0 : g.textArea;
1388
- y == null || y.focus();
1389
- }, 0);
1390
- return () => window.clearTimeout(o);
1391
- }, [k, b]);
1392
- const ie = a.useCallback(async (o) => {
1393
- const y = String(o.playbook_id || "").trim();
1394
- if (!y) {
1395
- $.error("场景缺少 playbook_id");
1396
- return;
1397
- }
1398
- const C = ++B.current;
1399
- xe(y), ae([]), A({}), he({}), M({}), N(!0), ne("");
1400
- try {
1401
- const { data: g } = await Ye({
1402
- playbook_id: y
1403
- });
1404
- if (C !== B.current) return;
1405
- if (!g || typeof g != "object" || Array.isArray(g))
1406
- throw new Error("场景详情为空");
1407
- const F = Ms(
1408
- Aa(g)
1409
- );
1410
- ae(F), A(Ts(F));
1411
- } catch (g) {
1412
- if (C !== B.current) return;
1413
- const F = g instanceof Error ? g.message : "场景参数加载失败";
1414
- ne(F), $.error("场景参数加载失败,请稍后重试");
1415
- } finally {
1416
- C === B.current && N(!1);
1417
- }
1418
- }, []), re = () => {
1419
- B.current += 1, xe(""), L(""), ae([]), A({}), N(!1), ne("");
1420
- }, Ce = As(se, T, A), h = a.useMemo(
1421
- () => Oe(se, T),
1422
- [se, T]
1423
- ), D = a.useCallback((o, y) => {
1424
- A((C) => ({ ...C, [o]: y }));
1425
- }, []), de = a.useCallback(
1426
- (o, y) => async ({ file: C, onSuccess: g, onError: F }) => {
1427
- var pe, je;
1428
- he((q) => ({ ...q, [o]: !0 }));
1429
- try {
1430
- const q = C, K = await vs(q), Re = (pe = K == null ? void 0 : K.data) == null ? void 0 : pe.url, ke = ((je = K == null ? void 0 : K.data) == null ? void 0 : je.name) || q.name;
1431
- if (!Re) throw new Error("上传结果缺少文件地址");
1432
- M((Q) => ({ ...Q, [Re]: ke })), A((Q) => {
1433
- if (y <= 1) return { ...Q, [o]: Re };
1434
- const ve = Array.isArray(Q[o]) ? Q[o] : Q[o] ? [Q[o]] : [];
1435
- return { ...Q, [o]: [...ve, Re] };
1436
- }), g == null || g(K), $.success("上传成功");
1437
- } catch (q) {
1438
- const K = q instanceof Error ? q : new Error("上传失败");
1439
- F == null || F(K), $.error(K.message);
1440
- } finally {
1441
- he((q) => ({ ...q, [o]: !1 }));
1442
- }
1443
- },
1444
- []
1445
- ), Se = a.useCallback(
1446
- async (o) => {
1447
- const y = Array.from(o.target.files ?? []);
1448
- if (o.target.value = "", y.length !== 0) {
1449
- H(!0);
1450
- try {
1451
- const C = await Promise.all(
1452
- y.map(async (g) => {
1453
- var q, K;
1454
- const F = await vs(g), pe = (q = F == null ? void 0 : F.data) == null ? void 0 : q.url, je = ((K = F == null ? void 0 : F.data) == null ? void 0 : K.name) || g.name;
1455
- if (!pe) throw new Error("上传结果缺少文件地址");
1456
- return {
1457
- type: g.type.startsWith("image/") ? "image" : "file",
1458
- url: pe,
1459
- name: je,
1460
- mime_type: g.type
1461
- };
1462
- })
1463
- );
1464
- we((g) => [...g, ...C]), $.success(`已添加 ${C.length} 个附件`);
1465
- } catch (C) {
1466
- $.error(C instanceof Error ? C.message : "上传失败");
1467
- } finally {
1468
- H(!1);
1469
- }
1470
- }
1471
- },
1472
- []
1473
- ), ge = a.useCallback((o) => {
1474
- we((y) => y.filter((C) => C.url !== o));
1475
- }, []), Ie = a.useMemo(
1476
- () => h.filter(
1477
- (o) => o.required && Ze(T[o.name])
1478
- ),
1479
- [h, T]
1480
- ), U = a.useMemo(
1481
- () => P.find((o) => o.id === ee) ?? P.find((o) => o.current) ?? P[0],
1482
- [P, ee]
1483
- );
1484
- return /* @__PURE__ */ e.jsx("div", { className: "wandox-console-view", children: /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-homecenter", children: [
1485
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-homecenter-hero", children: [
1486
- U && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-home-header", children: [
1487
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-home-header__agent", children: [
1488
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-home-header__avatar", children: U.icon }),
1489
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-home-header__identity", children: [
1490
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-home-header__selector-row", children: [
1491
- /* @__PURE__ */ e.jsx(
1492
- Ge,
1493
- {
1494
- menu: {
1495
- items: P.map((o) => ({
1496
- key: o.id,
1497
- disabled: o.id === U.id,
1498
- label: /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-agent-menu-item", children: [
1499
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-agent-menu-item__icon", children: o.icon }),
1500
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-agent-menu-item__name", children: o.name }),
1501
- o.id === U.id && /* @__PURE__ */ e.jsx(Qe, { className: "wandox-console-agent-menu-item__check" })
1502
- ] })
1503
- })),
1504
- onClick: ({ key: o }) => W == null ? void 0 : W(o)
1505
- },
1506
- trigger: ["click"],
1507
- placement: "bottomLeft",
1508
- children: /* @__PURE__ */ e.jsxs(
1509
- "button",
1510
- {
1511
- type: "button",
1512
- className: "wandox-console-home-header__selector",
1513
- "aria-label": "切换智能体",
1514
- children: [
1515
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-home-header__name", children: U.name }),
1516
- /* @__PURE__ */ e.jsx(Fs, { className: "wandox-console-home-header__arrow" })
1517
- ]
1518
- }
1519
- )
1520
- }
1521
- ),
1522
- /* @__PURE__ */ e.jsx(Os, { benefit: U.packageBenefit })
1523
- ] }),
1524
- U.desc && /* @__PURE__ */ e.jsx(
1525
- "p",
1526
- {
1527
- className: "wandox-console-home-header__description",
1528
- title: U.desc,
1529
- children: U.desc
1530
- }
1531
- )
1532
- ] })
1533
- ] }),
1534
- /* @__PURE__ */ e.jsxs(
1535
- "button",
1536
- {
1537
- type: "button",
1538
- className: "wandox-console-home-header__history",
1539
- onClick: () => ce == null ? void 0 : ce(),
1540
- children: [
1541
- /* @__PURE__ */ e.jsx("span", { children: "会话记录" }),
1542
- /* @__PURE__ */ e.jsx(Ma, { className: "wandox-console-home-header__history-arrow" })
1543
- ]
1544
- }
1545
- )
1546
- ] }),
1547
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-prompt", children: [
1548
- b && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-prompt__head", children: [
1549
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scenechoice", children: [
1550
- /* @__PURE__ */ e.jsx("span", { children: "已选择场景" }),
1551
- /* @__PURE__ */ e.jsx("strong", { children: b.title })
1552
- ] }),
1553
- /* @__PURE__ */ e.jsx(
1554
- "button",
1555
- {
1556
- type: "button",
1557
- className: "wandox-console-changescene",
1558
- onClick: re,
1559
- children: "重新选择"
1560
- }
1561
- )
1562
- ] }),
1563
- b ? /* @__PURE__ */ e.jsx("div", { className: "wandox-console-taskarea wandox-console-taskarea--static", children: b.desc || b.title }) : /* @__PURE__ */ e.jsx("div", { className: "wandox-console-taskarea", children: /* @__PURE__ */ e.jsx(
1564
- xn,
1565
- {
1566
- ref: Z,
1567
- value: u,
1568
- onChange: (o) => L(o.target.value),
1569
- autoSize: { minRows: 2 },
1570
- variant: "borderless",
1571
- placeholder: "直接描述你的问题,或选择一个场景开始"
1572
- }
1573
- ) }),
1574
- b && O && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramarea wandox-console-paramarea--state", children: [
1575
- /* @__PURE__ */ e.jsx(Fa, {}),
1576
- /* @__PURE__ */ e.jsx("span", { children: "正在读取场景参数..." })
1577
- ] }),
1578
- b && !O && Y && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramarea wandox-console-paramarea--state", children: [
1579
- /* @__PURE__ */ e.jsx("span", { children: "场景参数加载失败" }),
1580
- /* @__PURE__ */ e.jsxs(
1581
- "button",
1582
- {
1583
- type: "button",
1584
- className: "wandox-console-paramarea__retry",
1585
- onClick: () => void ie(b),
1586
- children: [
1587
- /* @__PURE__ */ e.jsx(Ns, {}),
1588
- "重试"
1589
- ]
1590
- }
1591
- )
1592
- ] }),
1593
- b && !O && !Y && h.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramarea", children: [
1594
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-paramhead", children: [
1595
- /* @__PURE__ */ e.jsx(Vs, {}),
1596
- /* @__PURE__ */ e.jsx("strong", { children: "确认分析范围" }),
1597
- /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-paramhead__status", children: [
1598
- /* @__PURE__ */ e.jsx(Qe, {}),
1599
- " ",
1600
- Ie.length > 0 ? `待填 ${Ie.length} 项必填参数` : "参数已就绪"
1601
- ] })
1602
- ] }),
1603
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-params", children: h.map((o) => /* @__PURE__ */ e.jsx(
1604
- qs,
1605
- {
1606
- field: o,
1607
- value: T[o.name],
1608
- uploading: !!me[o.name],
1609
- fileNameMap: le,
1610
- getOptionState: Ce.getFieldState,
1611
- onChange: D,
1612
- onUpload: de
1613
- },
1614
- o.name
1615
- )) })
1616
- ] }),
1617
- /* @__PURE__ */ e.jsxs(
1618
- "div",
1619
- {
1620
- className: `wandox-console-prompt__foot${b ? " wandox-console-prompt__foot--scene" : ""}`,
1621
- children: [
1622
- !b && /* @__PURE__ */ e.jsx(
1623
- "button",
1624
- {
1625
- type: "button",
1626
- className: "wandox-console-attach",
1627
- onClick: () => {
1628
- var o;
1629
- return (o = V.current) == null ? void 0 : o.click();
1630
- },
1631
- disabled: J,
1632
- title: J ? "上传中…" : "附件",
1633
- children: /* @__PURE__ */ e.jsx(La, {})
1634
- }
1635
- ),
1636
- /* @__PURE__ */ e.jsx(
1637
- "input",
1638
- {
1639
- ref: V,
1640
- type: "file",
1641
- multiple: !0,
1642
- accept: "image/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv,.zip",
1643
- hidden: !0,
1644
- onChange: Se
1645
- }
1646
- ),
1647
- b ? /* @__PURE__ */ e.jsxs(
1648
- "button",
1649
- {
1650
- type: "button",
1651
- className: "wandox-console-start",
1652
- disabled: O || !!Y || Ie.length > 0,
1653
- onClick: () => {
1654
- v == null || v({
1655
- playbookId: b.playbook_id,
1656
- playbookParams: T,
1657
- message: b.title,
1658
- attachments: I
1659
- });
1660
- },
1661
- children: [
1662
- "开始执行",
1663
- /* @__PURE__ */ e.jsx(Je, {})
1664
- ]
1665
- }
1666
- ) : /* @__PURE__ */ e.jsx("div", { className: "wandox-console-prompt__foot-right", children: /* @__PURE__ */ e.jsx(
1667
- "button",
1668
- {
1669
- type: "button",
1670
- className: "wandox-console-prompt__send",
1671
- disabled: !u.trim(),
1672
- onClick: () => {
1673
- v == null || v({
1674
- playbookParams: {},
1675
- message: u.trim(),
1676
- attachments: I
1677
- });
1678
- },
1679
- "aria-label": "发送",
1680
- children: /* @__PURE__ */ e.jsx(Ta, {})
1681
- }
1682
- ) })
1683
- ]
1684
- }
1685
- )
1686
- ] }),
1687
- I.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "wandox-console-attachments", children: I.map((o) => /* @__PURE__ */ e.jsxs("span", { className: "wandox-console-attach-item", children: [
1688
- o.type === "image" ? /* @__PURE__ */ e.jsx(
1689
- "img",
1690
- {
1691
- src: o.url,
1692
- alt: o.name,
1693
- className: "wandox-console-attach-item__thumb"
1694
- }
1695
- ) : /* @__PURE__ */ e.jsx(Da, { className: "wandox-console-attach-item__icon" }),
1696
- /* @__PURE__ */ e.jsx(
1697
- "span",
1698
- {
1699
- className: "wandox-console-attach-item__name",
1700
- title: o.name,
1701
- children: o.name
1702
- }
1703
- ),
1704
- /* @__PURE__ */ e.jsx(
1705
- "button",
1706
- {
1707
- type: "button",
1708
- className: "wandox-console-attach-item__remove",
1709
- "aria-label": "移除附件",
1710
- onClick: () => ge(o.url),
1711
- children: /* @__PURE__ */ e.jsx($s, {})
1712
- }
1713
- )
1714
- ] }, o.url)) }),
1715
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scenehead", children: [
1716
- /* @__PURE__ */ e.jsx(
1717
- "div",
1718
- {
1719
- className: "wandox-console-chips",
1720
- role: "tablist",
1721
- "aria-label": "场景分类",
1722
- children: l.slice(0, 5).map((o) => /* @__PURE__ */ e.jsx(
1723
- "button",
1724
- {
1725
- type: "button",
1726
- role: "tab",
1727
- "aria-selected": m === o.key,
1728
- className: `wandox-console-chip${m === o.key ? " wandox-console-chip--active" : ""}`,
1729
- onClick: () => p == null ? void 0 : p(o.key),
1730
- children: /* @__PURE__ */ e.jsx("span", { children: o.name })
1731
- },
1732
- o.key
1733
- ))
1734
- }
1735
- ),
1736
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scenesearch", children: /* @__PURE__ */ e.jsx(
1737
- ns,
1738
- {
1739
- allowClear: !0,
1740
- prefix: /* @__PURE__ */ e.jsx(We, {}),
1741
- placeholder: "搜索当前地图下的场景",
1742
- value: z,
1743
- onChange: (o) => S(o.target.value)
1744
- }
1745
- ) })
1746
- ] })
1747
- ] }),
1748
- fe && /* @__PURE__ */ e.jsxs(
1749
- "section",
1750
- {
1751
- className: "wandox-console-scene-section",
1752
- "aria-label": "个性化场景",
1753
- children: [
1754
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scene-section__header", children: /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx("h2", { children: "为你推荐" }) }) }),
1755
- k ? /* @__PURE__ */ e.jsxs(
1756
- "div",
1757
- {
1758
- className: "wandox-console-agents__loading",
1759
- style: { justifyContent: "center", padding: "40px 0" },
1760
- children: [
1761
- /* @__PURE__ */ e.jsx(Ls, { size: "small" }),
1762
- /* @__PURE__ */ e.jsx("span", { children: "正在加载场景..." })
1763
- ]
1764
- }
1765
- ) : R && j.length === 0 ? /* @__PURE__ */ e.jsxs(
1766
- "div",
1767
- {
1768
- className: "wandox-console-agents__error",
1769
- style: { alignItems: "center", padding: "32px 0" },
1770
- children: [
1771
- /* @__PURE__ */ e.jsx("span", { children: R }),
1772
- /* @__PURE__ */ e.jsxs("button", { type: "button", onClick: _, children: [
1773
- /* @__PURE__ */ e.jsx(Ns, {}),
1774
- "重试"
1775
- ] })
1776
- ]
1777
- }
1778
- ) : oe.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene-section__empty", children: [
1779
- /* @__PURE__ */ e.jsx(We, {}),
1780
- /* @__PURE__ */ e.jsx("span", { children: z ? "没有匹配的场景" : "当前分类暂无场景" })
1781
- ] }) : /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scenes-wrap", children: /* @__PURE__ */ e.jsx("div", { className: "wandox-console-scenes", children: te.map((o) => /* @__PURE__ */ e.jsx(
1782
- "button",
1783
- {
1784
- type: "button",
1785
- className: `wandox-console-scene${G === o.playbook_id ? " wandox-console-scene--selected" : ""}`,
1786
- onClick: () => ie(o),
1787
- children: /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-scene__body", children: [
1788
- /* @__PURE__ */ e.jsx("strong", { title: o.title, children: o.title }),
1789
- o.desc && /* @__PURE__ */ e.jsx("span", { className: "wandox-console-scene__desc", title: o.desc, children: o.desc })
1790
- ] })
1791
- },
1792
- o.key
1793
- )) }) })
1794
- ]
1795
- }
1796
- )
1797
- ] }) });
1798
- }
1799
- const _n = [
1800
- {
1801
- id: "conversation",
1802
- title: "智能体",
1803
- desc: "与智能体自由对话或选择场景执行任务",
1804
- icon: /* @__PURE__ */ e.jsx(Ka, {}),
1805
- accent: "#4f46e5"
1806
- },
1807
- {
1808
- id: "automation",
1809
- title: "自动化",
1810
- desc: "管理与执行自动化流程、定时任务与驾驶舱",
1811
- icon: /* @__PURE__ */ e.jsx(Oa, {}),
1812
- accent: "#4f46e5"
1813
- }
1814
- ], $e = {
1815
- id: "notification",
1816
- title: "通知配置",
1817
- icon: /* @__PURE__ */ e.jsx(Ua, {}),
1818
- accent: "#e0730c"
1819
- };
1820
- function bn({
1821
- features: t,
1822
- onOpenFeature: l,
1823
- activeId: x
1824
- }) {
1825
- return /* @__PURE__ */ e.jsxs("header", { className: "wandox-console-topnav", "aria-label": "控制台顶部导航", children: [
1826
- /* @__PURE__ */ e.jsx("nav", { className: "wandox-console-topnav__pill", "aria-label": "工作台", children: t.map((m) => {
1827
- const p = x === m.id;
1828
- return /* @__PURE__ */ e.jsxs(
1829
- "button",
1830
- {
1831
- type: "button",
1832
- className: `wandox-console-topnav__pill-btn${p ? " wandox-console-topnav__pill-btn--active" : ""}`,
1833
- title: m.title,
1834
- "aria-label": m.title,
1835
- "aria-current": p ? "page" : void 0,
1836
- onClick: () => l(m.id),
1837
- children: [
1838
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-topnav__pill-icon", children: m.icon }),
1839
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-topnav__pill-text", children: m.title })
1840
- ]
1841
- },
1842
- m.id
1843
- );
1844
- }) }),
1845
- /* @__PURE__ */ e.jsx(
1846
- "button",
1847
- {
1848
- type: "button",
1849
- className: "wandox-console-topnav__notify",
1850
- style: {
1851
- "--notify-accent": $e.accent
1852
- },
1853
- title: $e.title,
1854
- "aria-label": $e.title,
1855
- onClick: () => l($e.id),
1856
- children: /* @__PURE__ */ e.jsx("span", { className: "wandox-console-topnav__notify-icon", children: $e.icon })
1857
- }
1858
- )
1859
- ] });
1860
- }
1861
- function fn({
1862
- className: t = "",
1863
- state: l = "idle"
1864
- }) {
1865
- return /* @__PURE__ */ e.jsx(
1866
- "img",
1867
- {
1868
- className: `wandox-console-companion${t ? ` ${t}` : ""}`,
1869
- "data-state": l,
1870
- src: Va,
1871
- alt: "",
1872
- "aria-hidden": "true"
1873
- }
1874
- );
1875
- }
1876
- function Is({ fading: t }) {
1877
- return /* @__PURE__ */ e.jsxs(
1878
- "div",
1879
- {
1880
- className: `wandox-console-init${t ? " wandox-console-init--fading" : ""}`,
1881
- "aria-hidden": !0,
1882
- children: [
1883
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__halo wandox-console-init__halo--a" }),
1884
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__halo wandox-console-init__halo--b" }),
1885
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-init__inner", children: [
1886
- /* @__PURE__ */ e.jsx(
1887
- fn,
1888
- {
1889
- className: "wandox-console-init__companion",
1890
- state: "thinking"
1891
- }
1892
- ),
1893
- /* @__PURE__ */ e.jsxs("div", { children: [
1894
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__title", children: "正在准备你的控制台" }),
1895
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__subtitle", children: "正在加载智能体与场景数据…" })
1896
- ] }),
1897
- /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-init__dots", "aria-hidden": !0, children: [
1898
- /* @__PURE__ */ e.jsx("span", {}),
1899
- /* @__PURE__ */ e.jsx("span", {}),
1900
- /* @__PURE__ */ e.jsx("span", {}),
1901
- /* @__PURE__ */ e.jsx("span", {}),
1902
- /* @__PURE__ */ e.jsx("span", {})
1903
- ] })
1904
- ] }),
1905
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-init__footnote", children: "由 Wandox AI 提供动力" })
1906
- ]
1907
- }
1908
- );
1909
- }
1910
- function Es({
1911
- title: t,
1912
- onBack: l,
1913
- hideHeader: x = !1,
1914
- className: m,
1915
- children: p
1916
- }) {
1917
- return /* @__PURE__ */ e.jsxs(
1918
- "div",
1919
- {
1920
- className: `wandox-console-featureview${m ? ` ${m}` : ""}`,
1921
- children: [
1922
- !x && /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-featureview__bar", children: [
1923
- /* @__PURE__ */ e.jsxs(
1924
- "button",
1925
- {
1926
- type: "button",
1927
- className: "wandox-console-featureview__back",
1928
- onClick: l,
1929
- children: [
1930
- /* @__PURE__ */ e.jsx(Ds, {}),
1931
- "返回控制台"
1932
- ]
1933
- }
1934
- ),
1935
- /* @__PURE__ */ e.jsx("span", { className: "wandox-console-featureview__title", children: t })
1936
- ] }),
1937
- /* @__PURE__ */ e.jsx("div", { className: "wandox-console-featureview__body", children: p })
1938
- ]
1939
- }
1940
- );
1941
- }
1942
- function jn({
1943
- agents: t,
1944
- initialAgentId: l,
1945
- initialPlaybookId: x,
1946
- initialPlaybookParams: m,
1947
- onReady: p
1948
- } = {}) {
1949
- const {
1950
- agents: k,
1951
- agentLoading: R,
1952
- selectedAgentId: _,
1953
- selectedAgent: v,
1954
- selectAgent: P,
1955
- ...ee
1956
- } = Wa({ presetAgents: t, initialAgentId: l }), [W, ce] = a.useState(null), u = a.useRef(null), L = a.useRef(!1), [z, S] = a.useState("home"), [Z, se] = a.useState(
1957
- null
1958
- ), [ae, O] = a.useState(!1), [N, Y] = a.useState(null), [ne, B] = a.useState(""), T = v == null ? void 0 : v.name, A = a.useCallback((h) => {
1959
- if (u.current) {
1960
- u.current.showInspectionResults(h);
1961
- return;
1962
- }
1963
- ce({ robotName: h });
1964
- }, []);
1965
- a.useEffect(() => {
1966
- p == null || p({ showInspectionResults: A });
1967
- }, [A, p]), a.useEffect(() => {
1968
- !W || u.current || !_ || z === "chat" || (Y({
1969
- agentId: _,
1970
- agentName: T,
1971
- playbookParams: {},
1972
- message: ""
1973
- }), S("chat"));
1974
- }, [z, W, _, T]), a.useEffect(() => {
1975
- B("");
1976
- }, [_]);
1977
- const {
1978
- playbooks: me,
1979
- userPlaybooks: he,
1980
- useMapCategories: le,
1981
- useMapCards: M,
1982
- sceneLoading: I,
1983
- useMapError: we,
1984
- reload: J
1985
- } = ee, H = a.useMemo(
1986
- () => le.length > 0 ? le : Ya(me),
1987
- [le, me]
1988
- );
1989
- a.useEffect(() => {
1990
- if (H.length === 0) return;
1991
- H.some(
1992
- (D) => D.key === ne
1993
- ) || B(H[0].key);
1994
- }, [H]);
1995
- const V = a.useRef(!1);
1996
- a.useEffect(() => {
1997
- if (V.current || !x || !_ || I)
1998
- return;
1999
- const h = k.find(
2000
- (D) => D.id === _ && Rs(D, l)
2001
- );
2002
- h && (V.current = !0, Y({
2003
- agentId: _,
2004
- agentName: h.name,
2005
- playbookId: x,
2006
- playbookParams: m || {},
2007
- message: ""
2008
- }), S("chat"));
2009
- }, [
2010
- I,
2011
- k,
2012
- l,
2013
- x,
2014
- m,
2015
- _,
2016
- T
2017
- ]), a.useEffect(() => {
2018
- if (L.current || !l || x || !_ || I)
2019
- return;
2020
- const h = k.find(
2021
- (D) => D.id === _ && Rs(D, l)
2022
- );
2023
- h && (L.current = !0, Y({
2024
- agentId: h.id,
2025
- agentName: h.name,
2026
- playbookParams: {},
2027
- message: ""
2028
- }), S("chat"));
2029
- }, [k, I, l, x, _]);
2030
- const [j, ye] = a.useState(!0), [oe, te] = a.useState(!1);
2031
- a.useEffect(() => {
2032
- if (!j || !(!R && k.length > 0 && !!_ && !I)) return;
2033
- te(!0);
2034
- const de = setTimeout(() => ye(!1), 280);
2035
- return () => clearTimeout(de);
2036
- }, [R, k.length, _, I, j]);
2037
- const fe = a.useCallback(() => {
2038
- S("home"), se(null), O(!1);
2039
- }, []), G = a.useCallback(
2040
- (h) => {
2041
- if (h === "conversation") {
2042
- fe();
2043
- return;
2044
- }
2045
- O(!1), se(h);
2046
- },
2047
- [fe]
2048
- ), xe = (h) => {
2049
- P(h), S("home");
2050
- }, b = (h) => {
2051
- if (h === _) return;
2052
- const D = k.find((de) => de.id === h);
2053
- P(h), Y({
2054
- agentId: h,
2055
- agentName: D == null ? void 0 : D.name,
2056
- playbookParams: {},
2057
- message: ""
2058
- });
2059
- }, ie = () => {
2060
- _ && (Y({
2061
- agentId: _,
2062
- agentName: T,
2063
- playbookParams: {},
2064
- message: ""
2065
- }), S("chat"));
2066
- }, re = (h) => {
2067
- Y({
2068
- agentId: _,
2069
- agentName: T,
2070
- playbookId: h.playbookId,
2071
- playbookParams: h.playbookParams,
2072
- message: h.message,
2073
- attachments: h.attachments
2074
- }), S("chat");
2075
- };
2076
- return z === "chat" && N ? /* @__PURE__ */ e.jsxs("div", { className: "wandox-console-chat-shell", children: [
2077
- /* @__PURE__ */ e.jsx(
2078
- hn,
2079
- {
2080
- agentId: N.agentId,
2081
- agentName: N.agentName,
2082
- playbookId: N.playbookId,
2083
- playbookParams: N.playbookParams,
2084
- initialMessage: N.message,
2085
- initialAttachments: N.attachments,
2086
- useMapCards: M,
2087
- useMapCategories: le,
2088
- playbooks: me,
2089
- userPlaybooks: he,
2090
- agents: k,
2091
- onReady: (h) => {
2092
- u.current = h, W && (h.showInspectionResults(W.robotName), ce(null));
2093
- },
2094
- onChangeAgent: b,
2095
- onBack: () => {
2096
- u.current = null, S("home");
2097
- },
2098
- onSelectScene: () => {
2099
- }
2100
- },
2101
- `${N.agentId}:${N.playbookId || "free-chat"}`
2102
- ),
2103
- j && /* @__PURE__ */ e.jsx(Is, { fading: oe })
2104
- ] }) : /* @__PURE__ */ e.jsxs(
2105
- "div",
2106
- {
2107
- className: `wandox-console${ae ? " wandox-console--secondary" : ""}`,
2108
- children: [
2109
- j && /* @__PURE__ */ e.jsx(Is, { fading: oe }),
2110
- !ae && /* @__PURE__ */ e.jsx(
2111
- bn,
2112
- {
2113
- features: _n,
2114
- activeId: Z ?? "conversation",
2115
- onOpenFeature: G
2116
- }
2117
- ),
2118
- /* @__PURE__ */ e.jsxs("main", { className: "wandox-console-main", children: [
2119
- Z === "automation" && /* @__PURE__ */ e.jsx(
2120
- Es,
2121
- {
2122
- title: "自动化",
2123
- onBack: () => se(null),
2124
- hideHeader: !0,
2125
- className: "wandox-console-featureview--automation",
2126
- children: /* @__PURE__ */ e.jsx(
2127
- Ga,
2128
- {
2129
- onCockpitEnter: () => O(!0),
2130
- onCockpitExit: () => O(!1),
2131
- onInboxEnter: () => O(!0)
2132
- }
2133
- )
2134
- }
2135
- ),
2136
- Z === "notification" && /* @__PURE__ */ e.jsx(
2137
- Es,
2138
- {
2139
- title: "通知配置",
2140
- onBack: () => se(null),
2141
- hideHeader: !0,
2142
- children: /* @__PURE__ */ e.jsx(Qa, {})
2143
- }
2144
- ),
2145
- !Z && /* @__PURE__ */ e.jsx(
2146
- pn,
2147
- {
2148
- useMapCards: M,
2149
- useMapCategories: H,
2150
- playbooks: me,
2151
- selectedCategoryKey: ne,
2152
- onCategorySelect: B,
2153
- loading: I,
2154
- useMapError: we,
2155
- onRetry: J,
2156
- onStartAnalysis: re,
2157
- agents: k,
2158
- selectedAgentId: _,
2159
- onAgentSelect: xe,
2160
- onOpenAgentChat: ie
2161
- }
2162
- )
2163
- ] })
2164
- ]
2165
- }
2166
- );
2167
- }
2168
- export {
2169
- jn as default
2170
- };