@wandox/sdk 0.1.37 → 0.1.38

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