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