@axiom-lattice/react-sdk 8.0.0 → 8.1.0
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/{AgentDetailSideApp-XIHTVZQ6.mjs → AgentDetailSideApp-J64Y7RKT.mjs} +11 -11
- package/dist/AgentGovernanceWorkbench-N5DMTNRS.mjs +24 -0
- package/dist/{LangfuseDashboard-PYKA7XQ6.mjs → LangfuseDashboard-INSDUIPR.mjs} +2 -2
- package/dist/{MessageGraph-PYBCVFGD.mjs → MessageGraph-LEWE7BDE.mjs} +7 -7
- package/dist/{ReactChart-TN5VMVHH.mjs → ReactChart-SBFZNQ2L.mjs} +7 -7
- package/dist/SkillFlow-U6I2VRDK.mjs +14 -0
- package/dist/{TasksSideApp-C6XFEGZ7.mjs → TasksSideApp-GPD7GCPM.mjs} +8 -8
- package/dist/ThreadMaintenancePanel-TNWSDFIP.mjs +12 -0
- package/dist/{TopologyRuntimeView-R262O6TK.mjs → TopologyRuntimeView-QHOSBVWW.mjs} +8 -8
- package/dist/WorkflowAutomationView-5Q4ONV3C.mjs +22 -0
- package/dist/{chunk-ATU3HLYK.mjs → chunk-24KHOHEI.mjs} +742 -583
- package/dist/chunk-24KHOHEI.mjs.map +1 -0
- package/dist/{chunk-QFH5BFAB.mjs → chunk-5N54V24W.mjs} +5 -5
- package/dist/{chunk-BS6EXA72.mjs → chunk-5SGLNRLH.mjs} +4 -4
- package/dist/{chunk-5OZ7L6I3.mjs → chunk-7PNKDQYG.mjs} +3 -3
- package/dist/{chunk-6YTFHBP4.mjs → chunk-CD2UMRM5.mjs} +2 -2
- package/dist/{chunk-IGY2PP3H.mjs → chunk-GPB3TMDZ.mjs} +4 -4
- package/dist/{chunk-NEXWD46N.mjs → chunk-IK53JBJ6.mjs} +3 -3
- package/dist/{chunk-PPOYWDJA.mjs → chunk-LNTNCTWO.mjs} +3 -3
- package/dist/{chunk-UJS5NABN.mjs → chunk-OY2LSB3A.mjs} +7 -7
- package/dist/{chunk-TAIUUSGV.mjs → chunk-RON4XT5J.mjs} +4 -4
- package/dist/{chunk-WXSL425B.mjs → chunk-TLAIIWGR.mjs} +8 -8
- package/dist/{chunk-Q2222EXS.mjs → chunk-U22DSLN6.mjs} +10 -10
- package/dist/{chunk-XWMOF3KE.mjs → chunk-XAOJDKE7.mjs} +3 -3
- package/dist/{chunk-5CG4N4VQ.mjs → chunk-ZKYJP3RO.mjs} +3 -3
- package/dist/{embed-page-AgentDetailSideApp-NK6VQBXS.js → embed-page-AgentDetailSideApp-6MHCQZ2W.js} +1 -1
- package/dist/{embed-page-AgentGovernanceWorkbench-TKVV2GA6.js → embed-page-AgentGovernanceWorkbench-DZRR5VSK.js} +1 -1
- package/dist/{embed-page-LangfuseDashboard-EYK2T2VK.js → embed-page-LangfuseDashboard-JWH5JGLY.js} +1 -1
- package/dist/{embed-page-MessageGraph-P73B52OR.js → embed-page-MessageGraph-DJSV5HLH.js} +1 -1
- package/dist/{embed-page-ReactChart-LK6DUA4R.js → embed-page-ReactChart-RSR3JSF6.js} +1 -1
- package/dist/{embed-page-SkillFlow-54RIT6M2.js → embed-page-SkillFlow-JZGJAG3O.js} +1 -1
- package/dist/{embed-page-TasksSideApp-RK64OPAA.js → embed-page-TasksSideApp-4LIXWO44.js} +1 -1
- package/dist/{embed-page-ThreadMaintenancePanel-PI3U76W3.js → embed-page-ThreadMaintenancePanel-7CWGP3ZK.js} +1 -1
- package/dist/{embed-page-TopologyRuntimeView-X6QPRQE2.js → embed-page-TopologyRuntimeView-AVSCNALN.js} +1 -1
- package/dist/{embed-page-WorkflowAutomationView-3PE6YCRK.js → embed-page-WorkflowAutomationView-RFYT2AIZ.js} +1 -1
- package/dist/{embed-page-chunk-GYO2ELMI.js → embed-page-chunk-2XFJOQHZ.js} +1 -1
- package/dist/{embed-page-chunk-UV6IYDW5.js → embed-page-chunk-7CDMVSAB.js} +1 -1
- package/dist/{embed-page-chunk-US46Q3B7.js → embed-page-chunk-EVZKWKMQ.js} +2 -2
- package/dist/{embed-page-chunk-KF3HZ4TX.js → embed-page-chunk-IQ75BKOM.js} +1 -1
- package/dist/{embed-page-chunk-MEY3NEJZ.js → embed-page-chunk-JGFRDPYZ.js} +1 -1
- package/dist/{embed-page-chunk-OKZPPZMF.js → embed-page-chunk-KKUDX33F.js} +1 -1
- package/dist/{embed-page-chunk-YWJQVBZV.js → embed-page-chunk-PJJCN6GS.js} +1 -1
- package/dist/{embed-page-chunk-767LVAGR.js → embed-page-chunk-QJKFXJNR.js} +1 -1
- package/dist/{embed-page-chunk-EB43T3BJ.js → embed-page-chunk-TTFIPBIV.js} +130 -130
- package/dist/{embed-page-chunk-BD7DUF2M.js → embed-page-chunk-U5A5D7IS.js} +1 -1
- package/dist/embed-page-en-HDSVQ4O6.js +1 -0
- package/dist/embed-page-en-TSCGSJAI.js +1 -0
- package/dist/embed-page-zh-IR652A6J.js +1 -0
- package/dist/embed-page-zh-Q22DIOB3.js +1 -0
- package/dist/embed-page.js +1 -1
- package/dist/{en-DQDMGSNU.mjs → en-46QZD2TW.mjs} +12 -3
- package/dist/en-46QZD2TW.mjs.map +1 -0
- package/dist/{en-ANSLFEBD.mjs → en-5PDWSPXV.mjs} +3 -2
- package/dist/en-5PDWSPXV.mjs.map +1 -0
- package/dist/index.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +1859 -1680
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/web-app.js +26 -6
- package/dist/web-app.js.map +1 -1
- package/dist/web-app.mjs +2 -2
- package/dist/{zh-BKAP45UO.mjs → zh-2SMAXRUF.mjs} +12 -3
- package/dist/zh-2SMAXRUF.mjs.map +1 -0
- package/dist/{zh-JFU5VIZ6.mjs → zh-6DVLMOZW.mjs} +3 -2
- package/dist/zh-6DVLMOZW.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/AgentGovernanceWorkbench-ZCKD22PH.mjs +0 -24
- package/dist/SkillFlow-XIMU6EET.mjs +0 -14
- package/dist/ThreadMaintenancePanel-KJYC7ZWN.mjs +0 -12
- package/dist/WorkflowAutomationView-2JN3WT7G.mjs +0 -22
- package/dist/chunk-ATU3HLYK.mjs.map +0 -1
- package/dist/embed-page-en-27OIE2UA.js +0 -1
- package/dist/embed-page-en-X6B6RVNL.js +0 -1
- package/dist/embed-page-zh-EQ5X2M32.js +0 -1
- package/dist/embed-page-zh-FXQGY5HD.js +0 -1
- package/dist/en-ANSLFEBD.mjs.map +0 -1
- package/dist/en-DQDMGSNU.mjs.map +0 -1
- package/dist/zh-BKAP45UO.mjs.map +0 -1
- package/dist/zh-JFU5VIZ6.mjs.map +0 -1
- /package/dist/{AgentDetailSideApp-XIHTVZQ6.mjs.map → AgentDetailSideApp-J64Y7RKT.mjs.map} +0 -0
- /package/dist/{AgentGovernanceWorkbench-ZCKD22PH.mjs.map → AgentGovernanceWorkbench-N5DMTNRS.mjs.map} +0 -0
- /package/dist/{LangfuseDashboard-PYKA7XQ6.mjs.map → LangfuseDashboard-INSDUIPR.mjs.map} +0 -0
- /package/dist/{MessageGraph-PYBCVFGD.mjs.map → MessageGraph-LEWE7BDE.mjs.map} +0 -0
- /package/dist/{ReactChart-TN5VMVHH.mjs.map → ReactChart-SBFZNQ2L.mjs.map} +0 -0
- /package/dist/{SkillFlow-XIMU6EET.mjs.map → SkillFlow-U6I2VRDK.mjs.map} +0 -0
- /package/dist/{TasksSideApp-C6XFEGZ7.mjs.map → TasksSideApp-GPD7GCPM.mjs.map} +0 -0
- /package/dist/{ThreadMaintenancePanel-KJYC7ZWN.mjs.map → ThreadMaintenancePanel-TNWSDFIP.mjs.map} +0 -0
- /package/dist/{TopologyRuntimeView-R262O6TK.mjs.map → TopologyRuntimeView-QHOSBVWW.mjs.map} +0 -0
- /package/dist/{WorkflowAutomationView-2JN3WT7G.mjs.map → WorkflowAutomationView-5Q4ONV3C.mjs.map} +0 -0
- /package/dist/{chunk-QFH5BFAB.mjs.map → chunk-5N54V24W.mjs.map} +0 -0
- /package/dist/{chunk-BS6EXA72.mjs.map → chunk-5SGLNRLH.mjs.map} +0 -0
- /package/dist/{chunk-5OZ7L6I3.mjs.map → chunk-7PNKDQYG.mjs.map} +0 -0
- /package/dist/{chunk-6YTFHBP4.mjs.map → chunk-CD2UMRM5.mjs.map} +0 -0
- /package/dist/{chunk-IGY2PP3H.mjs.map → chunk-GPB3TMDZ.mjs.map} +0 -0
- /package/dist/{chunk-NEXWD46N.mjs.map → chunk-IK53JBJ6.mjs.map} +0 -0
- /package/dist/{chunk-PPOYWDJA.mjs.map → chunk-LNTNCTWO.mjs.map} +0 -0
- /package/dist/{chunk-UJS5NABN.mjs.map → chunk-OY2LSB3A.mjs.map} +0 -0
- /package/dist/{chunk-TAIUUSGV.mjs.map → chunk-RON4XT5J.mjs.map} +0 -0
- /package/dist/{chunk-WXSL425B.mjs.map → chunk-TLAIIWGR.mjs.map} +0 -0
- /package/dist/{chunk-Q2222EXS.mjs.map → chunk-U22DSLN6.mjs.map} +0 -0
- /package/dist/{chunk-XWMOF3KE.mjs.map → chunk-XAOJDKE7.mjs.map} +0 -0
- /package/dist/{chunk-5CG4N4VQ.mjs.map → chunk-ZKYJP3RO.mjs.map} +0 -0
package/dist/{embed-page-LangfuseDashboard-EYK2T2VK.js → embed-page-LangfuseDashboard-JWH5JGLY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as X}from"./embed-page-chunk-D7YTSCUO.js";import{G as q,Ja as Q,L as J,Sa as de,a as j}from"./embed-page-chunk-A5GIM22E.js";import{j as G,k as H}from"./embed-page-chunk-US46Q3B7.js";import{a as Y}from"./embed-page-chunk-QV7QAJ4N.js";import{Ra as p,W as T,_a as w,bb as R,qa as F,ta as c}from"./embed-page-chunk-T2HKN7ZS.js";import"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var re=I(de());var t=I(Y()),O=["#6366f1","#8b5cf6","#10b981","#f59e0b","#ef4444","#0ea5e9","#ec4899","#14b8a6"],Z="#6366f1",ee="#10b981",te="#8b5cf6",oe="#ef4444",be="#f59e0b",ue="#0ea5e9";function v(o){return o!==null&&typeof o=="object"&&!Array.isArray(o)}function d(o){return Array.isArray(o)&&o.every(e=>v(e)&&typeof e.bucket=="string"&&(e.value===null||typeof e.value=="number"))}function pe(o){if(!v(o)||!v(o.kpis)||!v(o.series))return!1;let e=o.series,n=e.tokens,r=e.latency;return typeof o.samplingRate=="number"&&typeof o.kpis.traces=="number"&&typeof o.kpis.costUsd=="number"&&typeof o.kpis.inputTokens=="number"&&typeof o.kpis.outputTokens=="number"&&typeof o.kpis.errorRate=="number"&&d(e.traces)&&d(e.cost)&&d(e.errorRate)&&d(e.toolCalls)&&v(n)&&d(n.input)&&d(n.output)&&v(r)&&d(r.p50)&&d(r.p95)&&d(r.p99)&&Array.isArray(o.agents)&&Array.isArray(o.models)&&Array.isArray(o.tools)}function ne(o,e){let n=(0,re.default)(o);return e==="7d"||e==="30d"?n.format("MM-DD"):n.format("MM-DD HH:mm")}function k(o,e){return o.map(n=>ne(n.bucket,e))}function b(o){return o.map(e=>e.value??0)}function u(o){return o.some(e=>(e.value??0)!==0)}var ye=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function D(o){return ye.format(o)}function P(o){return Number.isFinite(o)?o.toLocaleString():"0"}function ae(o){return`$${(Number.isFinite(o)?o:0).toFixed(4)}`}function ie(o,e){let n=Number(o);if(!Number.isFinite(n))return"\u2014";switch(e){case"currency":return ae(n);case"tokens":return D(n);case"percent":return`${(n*100).toFixed(1)}%`;case"ms":return`${Math.round(n)} ms`;default:return P(n)}}function se(o){return{backgroundColor:o.background,borderColor:o.border,borderWidth:1,textStyle:{color:o.text,fontSize:12},extraCssText:"box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12); border-radius: 12px;"}}function he(o,e){return{color:o.textSecondary,fontSize:11,...e?{formatter:e}:{}}}function V(o,e,n=!1){return{type:"category",data:e,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:o.textSecondary,fontSize:11,hideOverlap:!0,...n?{formatter:r=>r.length>18?`${r.slice(0,17)}\u2026`:r}:{}},splitLine:{show:!1}}}function $(o,e,n){return{type:"value",...e?{max:1}:{},axisLine:{show:!1},axisTick:{show:!1},axisLabel:he(o,e?r=>`${Math.round(r*100)}%`:void 0),splitLine:{lineStyle:{color:o.border,type:"dashed"}},...n==="number"?{}:{}}}function C(o,e,n){let r=n.kind??(n.percent?"percent":"number");return{color:O,tooltip:{trigger:"axis",...se(n.theme),valueFormatter:i=>ie(i,r)},legend:{top:0,right:0,icon:"circle",itemWidth:8,itemHeight:8,textStyle:{color:n.theme.textSecondary,fontSize:11}},grid:{left:8,right:16,top:36,bottom:8,containLabel:!0},xAxis:V(n.theme,o),yAxis:$(n.theme,n.percent===!0,r),series:e.map((i,s)=>({name:i.name,type:"line",smooth:.35,symbol:"none",lineStyle:{width:2},...n.stacked?{stack:"total"}:{},...n.area?{areaStyle:{opacity:n.stacked?.18:.12,color:O[s%O.length]}}:{},data:i.data}))}}function y(o,e,n){let r=n.kind??(n.percent?"percent":"number"),i=n.horizontal===!0;return{color:O,tooltip:{trigger:"axis",...se(n.theme),valueFormatter:s=>ie(s,r)},legend:{top:0,right:0,icon:"circle",itemWidth:8,itemHeight:8,textStyle:{color:n.theme.textSecondary,fontSize:11}},grid:i?{left:8,right:24,top:16,bottom:8,containLabel:!0}:{left:8,right:16,top:36,bottom:8,containLabel:!0},xAxis:i?$(n.theme,n.percent===!0,r):V(n.theme,o),yAxis:i?V(n.theme,o,!0):$(n.theme,n.percent===!0,r),series:e.map(s=>({name:s.name,type:"bar",...n.stacked?{stack:"total"}:{},barMaxWidth:i?18:28,itemStyle:{borderRadius:i?[0,6,6,0]:[6,6,0,0]},emphasis:{focus:"series"},data:s.data}))}}var A=({title:o,value:e,hint:n,accent:r,icon:i})=>{let{token:s}=w.useToken();return(0,t.jsx)(F,{size:"small",style:{borderRadius:16,border:`1px solid ${s.colorBorderSecondary}`,background:s.colorBgContainer,boxShadow:s.boxShadowTertiary,height:"100%"},styles:{body:{padding:16}},children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12},children:[(0,t.jsx)("div",{style:{width:40,height:40,flexShrink:0,borderRadius:12,display:"grid",placeItems:"center",background:`${r}1a`,color:r},children:i}),(0,t.jsxs)("div",{style:{minWidth:0},children:[(0,t.jsx)("div",{style:{fontSize:11,fontWeight:600,letterSpacing:.6,textTransform:"uppercase",color:s.colorTextSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o}),(0,t.jsx)("div",{style:{fontSize:24,fontWeight:700,lineHeight:1.2,color:s.colorText,fontVariantNumeric:"tabular-nums"},children:e}),(0,t.jsx)("div",{style:{fontSize:11,color:s.colorTextTertiary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n})]})]})})},f=({title:o,accent:e})=>(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[(0,t.jsx)("span",{style:{width:4,height:16,borderRadius:2,background:e}}),(0,t.jsx)(R.Text,{strong:!0,style:{fontSize:14},children:o})]}),m=({title:o,option:e,hasData:n})=>{let{token:r}=w.useToken(),i=H();return(0,t.jsx)(F,{size:"small",title:(0,t.jsx)("span",{style:{fontSize:12,fontWeight:600,color:r.colorTextSecondary},children:o}),style:{borderRadius:16,border:`1px solid ${r.colorBorderSecondary}`,background:r.colorBgContainer,boxShadow:r.boxShadowTertiary,height:"100%"},styles:{header:{borderBottom:"none",padding:"12px 16px 0",minHeight:0},body:{padding:"4px 8px 10px"}},children:n?(0,t.jsx)(X,{option:e,height:200}):(0,t.jsx)("div",{style:{height:200,display:"grid",placeItems:"center"},children:(0,t.jsx)(R.Text,{type:"secondary",style:{fontSize:12},children:i("common.observability.empty")})})})},Te=({data:o})=>{let e=H(),{token:n}=w.useToken();if(o.version!==G)return(0,t.jsx)(T,{type:"warning",showIcon:!0,message:e("common.observability.unsupportedVersion")});if(!pe(o.payload))return(0,t.jsx)(T,{type:"warning",showIcon:!0,message:e("common.observability.unsupportedVersion")});let r=o.payload,i=o.range,s=r.series.traces,L=r.series.cost,_=r.series.costByModel??[],x=r.series.tokens,h=r.series.latency,E=r.series.errorRate,z=r.series.toolCalls,l={text:n.colorText,textSecondary:n.colorTextTertiary,border:n.colorBorderSecondary,background:n.colorBgElevated},W=r.agents.map(a=>a.name&&a.name.trim()?a.name:a.assistantId==="unattributed"?e("common.observability.unknownAgent"):a.assistantId?a.assistantId.slice(0,8):e("common.observability.unknownAgent")),B=r.models.map(a=>a.model),ce=r.tools.slice(0,10).map(a=>a.tool),K=new Set;for(let a of _)for(let g of a.points)K.add(g.bucket);let U=[...K].sort(),le=U.map(a=>ne(a,i)),M=_.map(a=>{let g=new Map(a.points.map(S=>[S.bucket,S.value??0]));return{name:a.model,data:U.map(S=>g.get(S)??0)}}),N=M.length>0,me=r.agents.reduce((a,g)=>a+g.errorCount,0);return(0,t.jsxs)("div",{style:{display:"grid",gap:20},children:[(0,t.jsx)(R.Text,{type:"secondary",style:{fontSize:12},children:e("common.observability.scopeNote",{environment:r.environment??e("common.observability.allEnvironments"),range:i})}),o.warnings&&o.warnings.length>0?(0,t.jsx)(T,{type:"warning",showIcon:!0,message:e("common.observability.partial")}):null,r.samplingRate<1?(0,t.jsx)(T,{type:"info",showIcon:!0,message:e("common.observability.sampling",{rate:Math.round(r.samplingRate*100)})}):null,(0,t.jsxs)(p,{gutter:[12,12],children:[(0,t.jsx)(c,{xs:12,md:6,children:(0,t.jsx)(A,{title:e("common.observability.kpi.traces"),value:P(r.kpis.traces),hint:e("common.observability.kpi.tracesHint"),accent:Z,icon:(0,t.jsx)(j,{size:18})})}),(0,t.jsx)(c,{xs:12,md:6,children:(0,t.jsx)(A,{title:e("common.observability.kpi.cost"),value:ae(r.kpis.costUsd),hint:"USD",accent:ee,icon:(0,t.jsx)(J,{size:18})})}),(0,t.jsx)(c,{xs:12,md:6,children:(0,t.jsx)(A,{title:e("common.observability.kpi.tokens"),value:D(r.kpis.inputTokens+r.kpis.outputTokens),hint:e("common.observability.kpi.tokensHint",{input:D(r.kpis.inputTokens),output:D(r.kpis.outputTokens)}),accent:te,icon:(0,t.jsx)(q,{size:18})})}),(0,t.jsx)(c,{xs:12,md:6,children:(0,t.jsx)(A,{title:e("common.observability.kpi.errorRate"),value:`${(r.kpis.errorRate*100).toFixed(2)}%`,hint:e("common.observability.kpi.errorsHint",{count:P(me)}),accent:oe,icon:(0,t.jsx)(Q,{size:18})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.traces"),accent:Z}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.tracesByAssistant"),hasData:r.agents.length>0,option:y(W,[{name:e("common.observability.table.calls"),data:r.agents.map(a=>a.calls)}],{theme:l,horizontal:!0,kind:"number"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.tracesOverTime"),hasData:u(s),option:y(k(s,i),[{name:e("common.observability.kpi.traces"),data:b(s)}],{theme:l,kind:"number"})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.cost"),accent:ee}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.costByModel"),hasData:r.models.length>0,option:y(B,[{name:e("common.observability.kpi.cost"),data:r.models.map(a=>a.costUsd)}],{theme:l,kind:"currency"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e(N?"common.observability.chart.costByModelOverTime":"common.observability.chart.costOverTime"),hasData:N?M.some(a=>a.data.some(g=>g!==0)):u(L),option:N?C(le,M,{theme:l,stacked:!0,area:!0,kind:"currency"}):C(k(L,i),[{name:e("common.observability.kpi.cost"),data:b(L)}],{theme:l,area:!0,kind:"currency"})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.tokens"),accent:te}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.tokensByModel"),hasData:r.models.length>0,option:y(B,[{name:e("common.observability.table.inputTokens"),data:r.models.map(a=>a.inputTokens)},{name:e("common.observability.table.outputTokens"),data:r.models.map(a=>a.outputTokens)}],{theme:l,stacked:!0,kind:"tokens"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.tokensOverTime"),hasData:u(x.input)||u(x.output),option:C(k(x.input,i),[{name:"input",data:b(x.input)},{name:"output",data:b(x.output)}],{theme:l,area:!0,stacked:!0,kind:"tokens"})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.errors"),accent:oe}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.errorRateByAssistant"),hasData:r.agents.length>0,option:y(W,[{name:e("common.observability.kpi.errorRate"),data:r.agents.map(a=>a.errorRate)}],{theme:l,horizontal:!0,percent:!0})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.errorRateOverTime"),hasData:u(E),option:C(k(E,i),[{name:e("common.observability.kpi.errorRate"),data:b(E)}],{theme:l,percent:!0,area:!0})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.latency"),accent:be}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.p95ByModel"),hasData:r.models.length>0,option:y(B,[{name:e("common.observability.kpi.p95"),data:r.models.map(a=>a.p95LatencyMs??0)}],{theme:l,horizontal:!0,kind:"ms"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.latencyOverTime"),hasData:u(h.p50)||u(h.p95)||u(h.p99),option:C(k(h.p95,i),[{name:"p50",data:b(h.p50)},{name:"p95",data:b(h.p95)},{name:"p99",data:b(h.p99)}],{theme:l,kind:"ms"})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.tools"),accent:ue}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.toolsByTool"),hasData:r.tools.length>0,option:y(ce,[{name:e("common.observability.table.calls"),data:r.tools.slice(0,10).map(a=>a.count)}],{theme:l,horizontal:!0,kind:"number"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.toolsOverTime"),hasData:u(z),option:y(k(z,i),[{name:e("common.observability.table.calls"),data:b(z)}],{theme:l,kind:"number"})})})]})]})};export{Te as LangfuseDashboard};
|
|
1
|
+
import{a as X}from"./embed-page-chunk-D7YTSCUO.js";import{G as q,Ja as Q,L as J,Sa as de,a as j}from"./embed-page-chunk-A5GIM22E.js";import{j as G,k as H}from"./embed-page-chunk-EVZKWKMQ.js";import{a as Y}from"./embed-page-chunk-QV7QAJ4N.js";import{Ra as p,W as T,_a as w,bb as R,qa as F,ta as c}from"./embed-page-chunk-T2HKN7ZS.js";import"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var re=I(de());var t=I(Y()),O=["#6366f1","#8b5cf6","#10b981","#f59e0b","#ef4444","#0ea5e9","#ec4899","#14b8a6"],Z="#6366f1",ee="#10b981",te="#8b5cf6",oe="#ef4444",be="#f59e0b",ue="#0ea5e9";function v(o){return o!==null&&typeof o=="object"&&!Array.isArray(o)}function d(o){return Array.isArray(o)&&o.every(e=>v(e)&&typeof e.bucket=="string"&&(e.value===null||typeof e.value=="number"))}function pe(o){if(!v(o)||!v(o.kpis)||!v(o.series))return!1;let e=o.series,n=e.tokens,r=e.latency;return typeof o.samplingRate=="number"&&typeof o.kpis.traces=="number"&&typeof o.kpis.costUsd=="number"&&typeof o.kpis.inputTokens=="number"&&typeof o.kpis.outputTokens=="number"&&typeof o.kpis.errorRate=="number"&&d(e.traces)&&d(e.cost)&&d(e.errorRate)&&d(e.toolCalls)&&v(n)&&d(n.input)&&d(n.output)&&v(r)&&d(r.p50)&&d(r.p95)&&d(r.p99)&&Array.isArray(o.agents)&&Array.isArray(o.models)&&Array.isArray(o.tools)}function ne(o,e){let n=(0,re.default)(o);return e==="7d"||e==="30d"?n.format("MM-DD"):n.format("MM-DD HH:mm")}function k(o,e){return o.map(n=>ne(n.bucket,e))}function b(o){return o.map(e=>e.value??0)}function u(o){return o.some(e=>(e.value??0)!==0)}var ye=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function D(o){return ye.format(o)}function P(o){return Number.isFinite(o)?o.toLocaleString():"0"}function ae(o){return`$${(Number.isFinite(o)?o:0).toFixed(4)}`}function ie(o,e){let n=Number(o);if(!Number.isFinite(n))return"\u2014";switch(e){case"currency":return ae(n);case"tokens":return D(n);case"percent":return`${(n*100).toFixed(1)}%`;case"ms":return`${Math.round(n)} ms`;default:return P(n)}}function se(o){return{backgroundColor:o.background,borderColor:o.border,borderWidth:1,textStyle:{color:o.text,fontSize:12},extraCssText:"box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12); border-radius: 12px;"}}function he(o,e){return{color:o.textSecondary,fontSize:11,...e?{formatter:e}:{}}}function V(o,e,n=!1){return{type:"category",data:e,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:o.textSecondary,fontSize:11,hideOverlap:!0,...n?{formatter:r=>r.length>18?`${r.slice(0,17)}\u2026`:r}:{}},splitLine:{show:!1}}}function $(o,e,n){return{type:"value",...e?{max:1}:{},axisLine:{show:!1},axisTick:{show:!1},axisLabel:he(o,e?r=>`${Math.round(r*100)}%`:void 0),splitLine:{lineStyle:{color:o.border,type:"dashed"}},...n==="number"?{}:{}}}function C(o,e,n){let r=n.kind??(n.percent?"percent":"number");return{color:O,tooltip:{trigger:"axis",...se(n.theme),valueFormatter:i=>ie(i,r)},legend:{top:0,right:0,icon:"circle",itemWidth:8,itemHeight:8,textStyle:{color:n.theme.textSecondary,fontSize:11}},grid:{left:8,right:16,top:36,bottom:8,containLabel:!0},xAxis:V(n.theme,o),yAxis:$(n.theme,n.percent===!0,r),series:e.map((i,s)=>({name:i.name,type:"line",smooth:.35,symbol:"none",lineStyle:{width:2},...n.stacked?{stack:"total"}:{},...n.area?{areaStyle:{opacity:n.stacked?.18:.12,color:O[s%O.length]}}:{},data:i.data}))}}function y(o,e,n){let r=n.kind??(n.percent?"percent":"number"),i=n.horizontal===!0;return{color:O,tooltip:{trigger:"axis",...se(n.theme),valueFormatter:s=>ie(s,r)},legend:{top:0,right:0,icon:"circle",itemWidth:8,itemHeight:8,textStyle:{color:n.theme.textSecondary,fontSize:11}},grid:i?{left:8,right:24,top:16,bottom:8,containLabel:!0}:{left:8,right:16,top:36,bottom:8,containLabel:!0},xAxis:i?$(n.theme,n.percent===!0,r):V(n.theme,o),yAxis:i?V(n.theme,o,!0):$(n.theme,n.percent===!0,r),series:e.map(s=>({name:s.name,type:"bar",...n.stacked?{stack:"total"}:{},barMaxWidth:i?18:28,itemStyle:{borderRadius:i?[0,6,6,0]:[6,6,0,0]},emphasis:{focus:"series"},data:s.data}))}}var A=({title:o,value:e,hint:n,accent:r,icon:i})=>{let{token:s}=w.useToken();return(0,t.jsx)(F,{size:"small",style:{borderRadius:16,border:`1px solid ${s.colorBorderSecondary}`,background:s.colorBgContainer,boxShadow:s.boxShadowTertiary,height:"100%"},styles:{body:{padding:16}},children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12},children:[(0,t.jsx)("div",{style:{width:40,height:40,flexShrink:0,borderRadius:12,display:"grid",placeItems:"center",background:`${r}1a`,color:r},children:i}),(0,t.jsxs)("div",{style:{minWidth:0},children:[(0,t.jsx)("div",{style:{fontSize:11,fontWeight:600,letterSpacing:.6,textTransform:"uppercase",color:s.colorTextSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o}),(0,t.jsx)("div",{style:{fontSize:24,fontWeight:700,lineHeight:1.2,color:s.colorText,fontVariantNumeric:"tabular-nums"},children:e}),(0,t.jsx)("div",{style:{fontSize:11,color:s.colorTextTertiary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n})]})]})})},f=({title:o,accent:e})=>(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[(0,t.jsx)("span",{style:{width:4,height:16,borderRadius:2,background:e}}),(0,t.jsx)(R.Text,{strong:!0,style:{fontSize:14},children:o})]}),m=({title:o,option:e,hasData:n})=>{let{token:r}=w.useToken(),i=H();return(0,t.jsx)(F,{size:"small",title:(0,t.jsx)("span",{style:{fontSize:12,fontWeight:600,color:r.colorTextSecondary},children:o}),style:{borderRadius:16,border:`1px solid ${r.colorBorderSecondary}`,background:r.colorBgContainer,boxShadow:r.boxShadowTertiary,height:"100%"},styles:{header:{borderBottom:"none",padding:"12px 16px 0",minHeight:0},body:{padding:"4px 8px 10px"}},children:n?(0,t.jsx)(X,{option:e,height:200}):(0,t.jsx)("div",{style:{height:200,display:"grid",placeItems:"center"},children:(0,t.jsx)(R.Text,{type:"secondary",style:{fontSize:12},children:i("common.observability.empty")})})})},Te=({data:o})=>{let e=H(),{token:n}=w.useToken();if(o.version!==G)return(0,t.jsx)(T,{type:"warning",showIcon:!0,message:e("common.observability.unsupportedVersion")});if(!pe(o.payload))return(0,t.jsx)(T,{type:"warning",showIcon:!0,message:e("common.observability.unsupportedVersion")});let r=o.payload,i=o.range,s=r.series.traces,L=r.series.cost,_=r.series.costByModel??[],x=r.series.tokens,h=r.series.latency,E=r.series.errorRate,z=r.series.toolCalls,l={text:n.colorText,textSecondary:n.colorTextTertiary,border:n.colorBorderSecondary,background:n.colorBgElevated},W=r.agents.map(a=>a.name&&a.name.trim()?a.name:a.assistantId==="unattributed"?e("common.observability.unknownAgent"):a.assistantId?a.assistantId.slice(0,8):e("common.observability.unknownAgent")),B=r.models.map(a=>a.model),ce=r.tools.slice(0,10).map(a=>a.tool),K=new Set;for(let a of _)for(let g of a.points)K.add(g.bucket);let U=[...K].sort(),le=U.map(a=>ne(a,i)),M=_.map(a=>{let g=new Map(a.points.map(S=>[S.bucket,S.value??0]));return{name:a.model,data:U.map(S=>g.get(S)??0)}}),N=M.length>0,me=r.agents.reduce((a,g)=>a+g.errorCount,0);return(0,t.jsxs)("div",{style:{display:"grid",gap:20},children:[(0,t.jsx)(R.Text,{type:"secondary",style:{fontSize:12},children:e("common.observability.scopeNote",{environment:r.environment??e("common.observability.allEnvironments"),range:i})}),o.warnings&&o.warnings.length>0?(0,t.jsx)(T,{type:"warning",showIcon:!0,message:e("common.observability.partial")}):null,r.samplingRate<1?(0,t.jsx)(T,{type:"info",showIcon:!0,message:e("common.observability.sampling",{rate:Math.round(r.samplingRate*100)})}):null,(0,t.jsxs)(p,{gutter:[12,12],children:[(0,t.jsx)(c,{xs:12,md:6,children:(0,t.jsx)(A,{title:e("common.observability.kpi.traces"),value:P(r.kpis.traces),hint:e("common.observability.kpi.tracesHint"),accent:Z,icon:(0,t.jsx)(j,{size:18})})}),(0,t.jsx)(c,{xs:12,md:6,children:(0,t.jsx)(A,{title:e("common.observability.kpi.cost"),value:ae(r.kpis.costUsd),hint:"USD",accent:ee,icon:(0,t.jsx)(J,{size:18})})}),(0,t.jsx)(c,{xs:12,md:6,children:(0,t.jsx)(A,{title:e("common.observability.kpi.tokens"),value:D(r.kpis.inputTokens+r.kpis.outputTokens),hint:e("common.observability.kpi.tokensHint",{input:D(r.kpis.inputTokens),output:D(r.kpis.outputTokens)}),accent:te,icon:(0,t.jsx)(q,{size:18})})}),(0,t.jsx)(c,{xs:12,md:6,children:(0,t.jsx)(A,{title:e("common.observability.kpi.errorRate"),value:`${(r.kpis.errorRate*100).toFixed(2)}%`,hint:e("common.observability.kpi.errorsHint",{count:P(me)}),accent:oe,icon:(0,t.jsx)(Q,{size:18})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.traces"),accent:Z}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.tracesByAssistant"),hasData:r.agents.length>0,option:y(W,[{name:e("common.observability.table.calls"),data:r.agents.map(a=>a.calls)}],{theme:l,horizontal:!0,kind:"number"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.tracesOverTime"),hasData:u(s),option:y(k(s,i),[{name:e("common.observability.kpi.traces"),data:b(s)}],{theme:l,kind:"number"})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.cost"),accent:ee}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.costByModel"),hasData:r.models.length>0,option:y(B,[{name:e("common.observability.kpi.cost"),data:r.models.map(a=>a.costUsd)}],{theme:l,kind:"currency"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e(N?"common.observability.chart.costByModelOverTime":"common.observability.chart.costOverTime"),hasData:N?M.some(a=>a.data.some(g=>g!==0)):u(L),option:N?C(le,M,{theme:l,stacked:!0,area:!0,kind:"currency"}):C(k(L,i),[{name:e("common.observability.kpi.cost"),data:b(L)}],{theme:l,area:!0,kind:"currency"})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.tokens"),accent:te}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.tokensByModel"),hasData:r.models.length>0,option:y(B,[{name:e("common.observability.table.inputTokens"),data:r.models.map(a=>a.inputTokens)},{name:e("common.observability.table.outputTokens"),data:r.models.map(a=>a.outputTokens)}],{theme:l,stacked:!0,kind:"tokens"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.tokensOverTime"),hasData:u(x.input)||u(x.output),option:C(k(x.input,i),[{name:"input",data:b(x.input)},{name:"output",data:b(x.output)}],{theme:l,area:!0,stacked:!0,kind:"tokens"})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.errors"),accent:oe}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.errorRateByAssistant"),hasData:r.agents.length>0,option:y(W,[{name:e("common.observability.kpi.errorRate"),data:r.agents.map(a=>a.errorRate)}],{theme:l,horizontal:!0,percent:!0})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.errorRateOverTime"),hasData:u(E),option:C(k(E,i),[{name:e("common.observability.kpi.errorRate"),data:b(E)}],{theme:l,percent:!0,area:!0})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.latency"),accent:be}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.p95ByModel"),hasData:r.models.length>0,option:y(B,[{name:e("common.observability.kpi.p95"),data:r.models.map(a=>a.p95LatencyMs??0)}],{theme:l,horizontal:!0,kind:"ms"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.latencyOverTime"),hasData:u(h.p50)||u(h.p95)||u(h.p99),option:C(k(h.p95,i),[{name:"p50",data:b(h.p50)},{name:"p95",data:b(h.p95)},{name:"p99",data:b(h.p99)}],{theme:l,kind:"ms"})})})]}),(0,t.jsx)(f,{title:e("common.observability.section.tools"),accent:ue}),(0,t.jsxs)(p,{gutter:[16,16],children:[(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.toolsByTool"),hasData:r.tools.length>0,option:y(ce,[{name:e("common.observability.table.calls"),data:r.tools.slice(0,10).map(a=>a.count)}],{theme:l,horizontal:!0,kind:"number"})})}),(0,t.jsx)(c,{xs:24,md:12,children:(0,t.jsx)(m,{title:e("common.observability.chart.toolsOverTime"),hasData:u(z),option:y(k(z,i),[{name:e("common.observability.table.calls"),data:b(z)}],{theme:l,kind:"number"})})})]})]})};export{Te as LangfuseDashboard};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as $,d as J}from"./embed-page-chunk-3VNL5M2Q.js";import{b as R,d as V,e as S}from"./embed-page-chunk-TSZQWEXD.js";import"./embed-page-chunk-S4XZPBRM.js";import{j as N,k as H,l as L,m as U,n as W,x as A,y as K,z as Y}from"./embed-page-chunk-
|
|
1
|
+
import{c as $,d as J}from"./embed-page-chunk-3VNL5M2Q.js";import{b as R,d as V,e as S}from"./embed-page-chunk-TSZQWEXD.js";import"./embed-page-chunk-S4XZPBRM.js";import{j as N,k as H,l as L,m as U,n as W,x as A,y as K,z as Y}from"./embed-page-chunk-TTFIPBIV.js";import"./embed-page-chunk-JGFRDPYZ.js";import"./embed-page-chunk-PJJCN6GS.js";import"./embed-page-chunk-QJKFXJNR.js";import"./embed-page-chunk-A5GIM22E.js";import{k as w}from"./embed-page-chunk-EVZKWKMQ.js";import{a as g}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-AICFKU43.js";import{Aa as G,Pa as _,bb as z,cb as k,fb as F,t as E,y as D}from"./embed-page-chunk-WXMPVIXV.js";import{Za as P,_ as T,ha as B}from"./embed-page-chunk-T2HKN7ZS.js";import{a as b}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as u}from"./embed-page-chunk-QBTAJ2YI.js";var n=u(b());var I=u(b());var o=u(g());var ae="tracePulse 1.4s ease-in-out infinite",le={running:(0,o.jsx)(G,{style:{color:"#1890ff"}}),success:(0,o.jsx)(E,{style:{color:"#52c41a"}}),error:(0,o.jsx)(D,{style:{color:"#ff4d4f"}})};function de({kind:e}){switch(e){case"human":return(0,o.jsx)(F,{});case"agent":return(0,o.jsx)(z,{});case"tool":return(0,o.jsx)(k,{});case"ai":return(0,o.jsx)(_,{});default:return(0,o.jsx)(k,{})}}var M=I.default.createContext({}),ce=()=>I.default.useContext(M),pe=({data:e,selected:i})=>{let l=w(),{onJumpToMessage:t}=ce(),s=e.isAnswer===!0,a=e.status==="running",p=(e.parallelCount??1)>1,m=!!(t&&e.messageId&&!e.messageId.startsWith("summary:")),v=e.toolCall?L(e.toolCall.name):e.label,y=()=>{if((e.kind==="tool"||e.kind==="agent")&&e.toolCall){let h=U(e.toolCall.response);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(H,{data:{name:e.toolCall.name,parameters:e.toolCall.args,type:"tool_call"},component_key:`${e.toolCall.id}-params`,interactive:!1}),h&&(0,o.jsx)("div",{style:{marginTop:8},children:(0,o.jsx)(N,{content:h})}),(0,o.jsx)(W,{ui:e.toolCall.ui})]})}return e.content?(0,o.jsx)(N,{content:e.content}):(0,o.jsx)("span",{style:{color:"#8c8c8c"},children:e.label})};return(0,o.jsxs)("div",{"data-testid":"trace-card",style:{height:"100%",display:"flex",flexDirection:"column",border:`1px solid ${s||i?"#6366f1":a?"#91caff":"#e5e7eb"}`,borderRadius:12,background:s?"#eef2ff":"#fff",boxShadow:a?"0 0 0 2px rgba(24,144,255,0.18)":i?"0 0 0 2px rgba(99,102,241,0.2)":"none",animation:a?ae:void 0,overflow:"hidden",fontSize:13},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid #f0f0f0",background:"rgba(0,0,0,0.02)"},children:[(0,o.jsx)(de,{kind:e.kind}),(0,o.jsx)("span",{style:{fontWeight:s?700:600,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v}),p&&(0,o.jsx)(P,{color:"purple",style:{marginInlineEnd:0,fontSize:10},children:l("chat.trace.parallelBadge",{count:e.parallelCount??1})}),le[e.status],m&&(0,o.jsx)(T,{type:"text",size:"small",onClick:()=>t?.(e.messageId),children:l("chat.trace.jumpToChat")})]}),(0,o.jsx)("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:12},children:y()})]})},ue=({data:e,selected:i})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(S,{type:"target",position:R.Top}),(0,o.jsx)(pe,{data:e,selected:i}),(0,o.jsx)(S,{type:"source",position:R.Bottom})]}),j={trace:ue};var Z=u(b());var f=u(g()),fe={running:"#1890ff",success:"#52c41a",error:"#ff4d4f"},q=({graph:e,activeNodeId:i,onSelectNode:l})=>{let t=Z.default.useMemo(()=>new Map(e.nodes.map(s=>[s.id,s])),[e.nodes]);return(0,f.jsx)("div",{"data-testid":"trace-overview-rail",style:{display:"flex",flexDirection:"column",gap:10,width:160,padding:8,overflowY:"auto",borderRight:"1px solid #f0f0f0"},children:e.phases.map(s=>(0,f.jsxs)("div",{"data-testid":"trace-rail-phase",children:[(0,f.jsx)("div",{style:{fontSize:12,color:"#8c8c8c",marginBottom:4},children:s.title}),(0,f.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:s.nodeIds.map(a=>{let p=t.get(a);if(!p)return null;let m=a===i;return(0,f.jsx)(B,{title:p.data.label,children:(0,f.jsx)("button",{type:"button","data-testid":"trace-rail-tick",onClick:()=>l?.(a),style:{width:m?12:8,height:m?12:8,borderRadius:"50%",border:"none",padding:0,cursor:"pointer",background:fe[p.data.status],outline:m?"2px solid #6366f1":"none"}})},a)})})]},s.id))})};var d=u(g()),Q=3,X=()=>{},me=`
|
|
2
2
|
@keyframes tracePulse {
|
|
3
3
|
0%, 100% { box-shadow: 0 0 0 2px rgba(24,144,255,0.18); }
|
|
4
4
|
50% { box-shadow: 0 0 0 6px rgba(24,144,255,0.05); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as D}from"./embed-page-chunk-UDSGGVJH.js";import{i as E}from"./embed-page-chunk-
|
|
1
|
+
import{s as D}from"./embed-page-chunk-UDSGGVJH.js";import{i as E}from"./embed-page-chunk-TTFIPBIV.js";import"./embed-page-chunk-JGFRDPYZ.js";import"./embed-page-chunk-PJJCN6GS.js";import{a as T}from"./embed-page-chunk-QJKFXJNR.js";import"./embed-page-chunk-A5GIM22E.js";import{k as v}from"./embed-page-chunk-EVZKWKMQ.js";import{a as C}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-AICFKU43.js";import"./embed-page-chunk-WXMPVIXV.js";import{qa as x}from"./embed-page-chunk-T2HKN7ZS.js";import{a as w}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as p}from"./embed-page-chunk-QBTAJ2YI.js";var u=p(w());var R=p(T());var y=p(C());function g(l,i){if(!l||l.length===0)return{title:{text:i("genui.chart.title"),left:"left"},tooltip:{trigger:"axis"},legend:{right:0,orient:"vertical"},xAxis:{type:"category",data:[]},yAxis:{type:"value"},series:[{type:"line",name:i("genui.chart.seriesDefault",{n:1}),data:[]}],grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}};let s=l[0],t=Object.keys(s);if(t.length===0)return g([],i);let r=t.filter(e=>{let n=s[e];return typeof n=="number"||!isNaN(Number(n))});if(r.length>0){let e=r[0],n=t.find(a=>!r.includes(a))||t[0],o=l.map((a,c)=>a[n]!==void 0?String(a[n]):i("genui.chart.itemDefault",{n:c+1})),f=l.map(a=>{let c=a[e];return typeof c=="number"?c:Number(c)||0});return{title:{text:i("genui.chart.title"),left:"left"},tooltip:{trigger:"axis"},legend:{right:0,orient:"vertical",data:[e]},xAxis:{type:"category",data:o},yAxis:{type:"value"},series:[{type:"line",name:e,data:f}],grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}}}return{title:{text:i("genui.chart.title"),left:"left"},tooltip:{trigger:"axis"},legend:{right:0,orient:"vertical"},xAxis:{type:"category",data:l.map((e,n)=>i("genui.chart.itemDefault",{n:n+1}))},yAxis:{type:"value"},series:[{type:"bar",name:i("genui.chart.countSeries"),data:l.map(()=>1)}],grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0}}}function j(l,i){if(!l||typeof l!="object"||!l.series||!Array.isArray(l.series)||l.series.length===0)return null;let s=l.series.map((e,n)=>{if(!e||typeof e!="object"||!e.type||!e.data||!Array.isArray(e.data)||e.data.length===0)return null;let o={...e,name:e.name||i("genui.chart.seriesDefault",{n:n+1})};if(e.type==="pie"){let f=e.data.map((a,c)=>typeof a=="object"&&a!==null&&"value"in a?{value:a.value,name:a.name||i("genui.chart.itemDefault",{n:c+1})}:typeof a=="number"?{value:a,name:i("genui.chart.itemDefault",{n:c+1})}:null).filter(a=>a!==null);return f.length===0?null:{...o,data:f}}return o}).filter(e=>e!==null);if(s.length===0)return null;let t={...l,series:s},r=s[0].type;if(r!=="pie"){if(!t.xAxis)t.xAxis={type:"category",data:[]};else if(typeof t.xAxis=="object"&&!Array.isArray(t.xAxis)){let e=t.xAxis;if(e.type||(e.type="category"),e.type==="category"&&!e.data){let n=s[0].data;Array.isArray(n)&&n.length>0?Array.isArray(n[0])?e.data=n.map(o=>o[0]):e.data=n.map((o,f)=>i("genui.chart.itemDefault",{n:f+1})):e.data=[]}t.xAxis=e}t.yAxis?typeof t.yAxis=="object"&&!Array.isArray(t.yAxis)&&(t.yAxis.type||(t.yAxis.type="value")):t.yAxis={type:"value"}}if(!t.title)t.title={text:i("genui.chart.title"),left:"left"};else if(typeof t.title=="object"){let e=t.title;e.left||(e.left="left"),e.text||(e.text=i("genui.chart.title")),t.title=e}if(t.tooltip||(t.tooltip={trigger:r==="pie"?"item":"axis"}),!t.legend)s.length>1&&(t.legend={right:0,orient:"vertical"});else if(typeof t.legend=="object"){let e=t.legend;t.legend=e}return r!=="pie"&&!t.grid&&(t.grid={left:"3%",right:"4%",bottom:"3%",containLabel:!0}),t}function O(l,i){let s=null;try{let n=typeof l=="string"?l:l.join("");s=(0,R.parse)(n)}catch(n){return{data:null,error:`Failed to parse JSON: ${n instanceof Error?n.message:String(n)}`}}if(!s||typeof s!="object")return{data:null,error:"Parsed data is not an object"};let t=s.series&&Array.isArray(s.series)&&s.series.length>0,r={table:Array.isArray(s.table)?s.table:void 0},e=null;if(s.echarts?e=s.echarts:t&&(e=s),e){let n=j(e,i);if(n)r.echarts=n;else if(r.table&&r.table.length>0)r.echarts=g(r.table,i);else return{data:null,error:"ECharts configuration is invalid or incomplete. Required: series array with at least one series containing type and data."}}else r.table&&r.table.length>0?r.echarts=g(r.table,i):r.echarts=g([],i);return{data:r,error:null}}var K=l=>{let{children:i}=l,s=v(),t=(0,u.useRef)(null),r=(0,u.useRef)(null),e=(0,u.useRef)(null),[n,o]=(0,u.useState)(null);(0,u.useEffect)(()=>{if(!t.current)return;r.current||(r.current=D(t.current));let a=null;if((typeof i=="string"||Array.isArray(i))&&(a=i),!a){r.current&&r.current.clear(),o(null);return}let{data:c,error:m}=O(a,s);if(m||!c){console.warn("ReactChart failed to parse chart data:",m||"Unknown parse error"),r.current&&r.current.clear(),o(null);return}if(c.table&&Array.isArray(c.table)&&o(c.table),c.echarts)try{r.current.setOption(c.echarts,!0)}catch(d){let A=d instanceof Error?d.message:"Failed to render chart";console.error("Failed to set ECharts option:",d),r.current&&r.current.clear(),o(null)}let h=()=>{r.current&&r.current.resize()};return e.current&&(e.current.disconnect(),e.current=null),t.current&&typeof ResizeObserver<"u"&&(e.current=new ResizeObserver(d=>{requestAnimationFrame(()=>{h()})}),e.current.observe(t.current)),window.addEventListener("resize",h),()=>{e.current&&(e.current.disconnect(),e.current=null),window.removeEventListener("resize",h)}},[i,s]),(0,u.useEffect)(()=>()=>{e.current&&(e.current.disconnect(),e.current=null),r.current&&(r.current.dispose(),r.current=null)},[]);let f=a=>{if(!a||a.length===0)return[];if(Array.isArray(a[0])){let c=a[0];return a.slice(1).map((h,d)=>{let A={};return h.forEach((S,b)=>{A[c[b]||`col_${b}`]=S}),A})}return a};return(0,y.jsxs)(x,{children:[(0,y.jsx)("div",{ref:t,style:{width:"100%",height:"400px",minHeight:"300px"}}),n&&n.length>0&&(0,y.jsx)("div",{style:{marginTop:16},children:(0,y.jsx)(E,{component_key:"chart_table_data",data:{dataSource:f(n),message:s("genui.chart.dataDetails")},interactive:!0,default_open_in_side_app:!0})})]})};export{K as ReactChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as Z,c as he,e as ee,f as Se,g as xe,h as ve,i as be,l as Te,m as Ce}from"./embed-page-chunk-TSZQWEXD.js";import{a as fe,b as ge,c as me,d as ue,e as ke}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import{a as V,b as we}from"./embed-page-chunk-YWJQVBZV.js";import{o as se,t as ne}from"./embed-page-chunk-767LVAGR.js";import{k as q}from"./embed-page-chunk-US46Q3B7.js";import{a as K}from"./embed-page-chunk-QV7QAJ4N.js";import{D as ce,E as de,Ka as U,ea as pe,o as re,sa as ye}from"./embed-page-chunk-WXMPVIXV.js";import{Ia as R,La as C,Ma as le,Za as E,_ as v,_a as _,bb as ae,ua as ie,za as B}from"./embed-page-chunk-T2HKN7ZS.js";import{a as oe}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as W}from"./embed-page-chunk-QBTAJ2YI.js";var h=W(oe());var k=W(oe());var e=W(K()),{Text:d}=ae,{TextArea:Ne}=R,Ee=({data:b})=>{let s=q(),{token:o}=_.useToken(),{config:w}=ne(),{put:Y}=V(),I=he(t=>t.transform[2])>.6,G=se("__GLOBAL__");if(!b)return null;let{skill:g,onClick:D,onDelete:S}=b;if(!g)return null;let[i,A]=(0,k.useState)(g),O=i.subSkills&&i.subSkills.length>0,m=i.subSkills?.length||0,F=(0,k.useMemo)(()=>Math.min(12+Math.sqrt(m)*10,48),[m]),X=i.metadata&&i.metadata.category||"global",T=(0,k.useMemo)(()=>i.metadata?Object.entries(i.metadata).filter(([t,a])=>t&&a):[],[i.metadata]),P=t=>{if(!t)return"";let a=t instanceof Date?t:new Date(t);return Number.isNaN(a.getTime())?"":a.toLocaleString()},J=t=>{navigator.clipboard.writeText(t)},[z,x]=(0,k.useState)(!1),[p,n]=(0,k.useState)({...g,id:g.name}),[c,u]=(0,k.useState)(T.map(([t,a])=>({key:t,value:a}))),[$,M]=(0,k.useState)(!1),[Q,L]=(0,k.useState)(!1);(0,k.useEffect)(()=>{x(!1),A(g),n({...g,id:g.name}),u(Object.entries(g.metadata||{}).map(([t,a])=>({key:t,value:a})))},[g]);let l=(t,a)=>{if(t==="name"){n(r=>({...r,name:a,id:a}));return}n(r=>({...r,[t]:a}))},H=async t=>{t?.stopPropagation(),t?.preventDefault();try{let a=i.id||i.name;if(!a){C.error(s("chatWorkspace.skillNode.idMissing"));return}await G.skills.delete(a),C.success(s("chatWorkspace.skillNode.deleted")),M(!1),S&&await S()}catch(a){C.error(a?.message||s("chatWorkspace.skillNode.deleteFailed"))}},j=t=>{u(t);let a=t.reduce((r,y)=>(y.key&&(r[y.key]=y.value),r),{});n(r=>({...r,metadata:a}))},te=(t,a,r)=>{let y=[...c];y[t]={...y[t],[a]:r},j(y)},We=()=>{j([...c,{key:"",value:""}])},Be=async()=>{try{L(!0);let t={"Content-Type":"application/json"};w.apiKey&&(t.Authorization=`Bearer ${w.apiKey}`);let a={name:p.name,description:p.description,license:p.license||void 0,compatibility:p.compatibility||void 0,metadata:p.metadata||void 0,content:p.content||void 0,subSkills:p.subSkills||void 0},r=await Y(`/api/skills/${i.id}`,a);if(r.success){C.success(s("chatWorkspace.skillNode.updated"));let y=r.data||p;A(y),n({...y,id:y.name}),u(Object.entries(y.metadata||{}).map(([Fe,Me])=>({key:Fe,value:Me}))),x(!1),D?.(y)}else C.error(r.message||s("chatWorkspace.skillNode.updateFailed"))}catch(t){C.error(t.message||s("chatWorkspace.skillNode.updateError"))}finally{L(!1)}},Re=(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:24},children:[(0,e.jsxs)("div",{style:{flex:"0 0 320px",display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.description")}),(0,e.jsx)(Ne,{value:p.description,onChange:t=>l("description",t.target.value),placeholder:s("chatWorkspace.skills.field.description"),rows:3})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.license")}),(0,e.jsx)(R,{value:p.license,onChange:t=>l("license",t.target.value),placeholder:s("chatWorkspace.skills.field.license")})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.compatibility")}),(0,e.jsx)(R,{value:p.compatibility,onChange:t=>l("compatibility",t.target.value),placeholder:s("chatWorkspace.skills.field.compatibility")})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:s("chatWorkspace.skills.field.metadata")}),(0,e.jsx)(v,{size:"small",icon:(0,e.jsx)(U,{}),onClick:We,children:s("chatWorkspace.skillNode.add")})]}),(0,e.jsxs)(B,{direction:"vertical",size:8,style:{width:"100%"},children:[c.length===0&&(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary},children:s("chatWorkspace.skillNode.noMetadata")}),c.map((t,a)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextSecondary},children:s("chatWorkspace.skillNode.meta",{index:a+1})}),(0,e.jsxs)(B,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(R,{value:t.key,placeholder:s("chatWorkspace.skillNode.keyPlaceholder"),style:{width:120},onChange:r=>te(a,"key",r.target.value)}),(0,e.jsx)(R,{value:t.value,placeholder:s("chatWorkspace.skillNode.valuePlaceholder"),style:{flex:1,minWidth:160},onChange:r=>te(a,"value",r.target.value)})]})]},a))]})]}),(0,e.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6,minWidth:400},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.content")}),(0,e.jsx)(Ne,{value:p.content,onChange:t=>l("content",t.target.value),placeholder:s("chatWorkspace.skillNode.contentPlaceholder"),rows:30,style:{fontFamily:"monospace",fontSize:13,flex:1,minHeight:600}})]})]}),Ie=(0,e.jsxs)("div",{style:{width:z?960:720,maxHeight:"95vh",overflowY:"auto",padding:24},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:16},children:(0,e.jsxs)("div",{style:{flex:1},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(d,{strong:!0,style:{fontSize:18,fontWeight:600,color:o.colorText},children:i.name}),(0,e.jsx)(E,{style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},color:"geekblue",children:X.toUpperCase()})]}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6},children:(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${i.id}`})})]})}),z?Re:(0,e.jsxs)(e.Fragment,{children:[i.description&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',i.description,'"']})}),T.length>0&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(ye,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:s("chatWorkspace.skillNode.metadataCount",{count:T.length})})]}),(0,e.jsx)("div",{style:{border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,overflow:"hidden"},children:T.map(([t,a],r)=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"stretch",borderBottom:r===T.length-1?"none":`1px solid ${o.colorBorderSecondary}`},children:[(0,e.jsx)("div",{style:{width:140,padding:"8px 10px",background:o.colorFillTertiary,borderRight:`1px solid ${o.colorBorderSecondary}`,fontSize:11,color:o.colorTextSecondary,fontWeight:600,textTransform:"capitalize"},children:t}),(0,e.jsx)("div",{style:{flex:1,padding:"8px 10px",fontSize:11,color:o.colorText,wordBreak:"break-word"},children:a})]},t))})]}),O&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(re,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:["Sub-Skills (",i.subSkills.length,")"]})]}),(0,e.jsx)(B,{size:[8,8],wrap:!0,children:i.subSkills.map((t,a)=>(0,e.jsx)(E,{style:{fontSize:11,padding:"4px 12px",backgroundColor:o.colorFillTertiary,color:o.colorText,border:`1px solid ${o.colorBorderSecondary}`},children:t},a))})]}),(i.license||i.compatibility)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(B,{size:[8,8],wrap:!0,children:[i.license&&(0,e.jsx)(E,{icon:(0,e.jsx)(de,{}),style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorInfoBg,color:o.colorInfo,border:`1px solid ${o.colorInfoBorder}`,fontWeight:500,lineHeight:"16px"},children:i.license}),i.compatibility&&(0,e.jsx)(E,{style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorSuccessBg,color:o.colorSuccess,border:`1px solid ${o.colorSuccessBorder}`,fontWeight:500,lineHeight:"16px",display:"inline-flex",alignItems:"center",gap:4},children:i.compatibility})]})}),(i.createdAt||i.updatedAt)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(B,{direction:"vertical",size:4,children:[i.createdAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Created: ",P(i.createdAt)]}),i.updatedAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Updated: ",P(i.updatedAt)]})]})}),i.content&&(0,e.jsxs)("div",{style:{marginBottom:0},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(pe,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:s("chatWorkspace.skillNode.contentSection")})]}),(0,e.jsx)("div",{style:{padding:16,background:o.colorFillTertiary,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,maxHeight:400,overflowY:"auto"},children:(0,e.jsx)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.7,whiteSpace:"pre-wrap",fontFamily:"monospace"},children:i.content})})]})]}),(0,e.jsx)(ie,{style:{margin:"16px 0"}}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:z?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v,{block:!0,onClick:()=>{x(!1),n(g)},style:{flex:1},children:s("common.cancel")}),(0,e.jsx)(v,{type:"primary",block:!0,onClick:Be,loading:Q,style:{flex:1},children:s("common.save")})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v,{type:"primary",block:!0,onClick:()=>x(!0),style:{flex:1},children:s("chatWorkspace.skillNode.edit")}),(0,e.jsx)(v,{danger:!0,onClick:t=>{t.stopPropagation(),H(t)},children:s("common.delete")}),(0,e.jsx)(v,{icon:(0,e.jsx)(ce,{}),onClick:()=>J(i.id),title:s("chatWorkspace.skillNode.copyId")})]})})]});return(0,e.jsxs)("div",{style:{position:"relative",padding:4,overflow:"visible"},children:[(0,e.jsx)(ee,{type:"source",position:Z.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsx)(ee,{type:"target",position:Z.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",position:"relative"},onClick:()=>M(!0),children:[(0,e.jsx)("div",{style:{width:F,height:F,borderRadius:"50%",background:"#999",flexShrink:0,boxShadow:"0 1px 4px rgba(0,0,0,0.15)",transition:"transform 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.transform="scale(1.15)"},onMouseLeave:t=>{t.currentTarget.style.transform="scale(1)"}}),I&&(0,e.jsx)(d,{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:4,fontSize:10,color:o.colorTextSecondary,opacity:.45,whiteSpace:"nowrap",pointerEvents:"none",userSelect:"none"},children:i.name})]}),(0,e.jsx)(le,{open:$,onCancel:()=>{M(!1),x(!1),n({...i,id:i.name})},footer:null,width:z?1e3:760,destroyOnClose:!0,title:null,styles:{body:{padding:0}},children:Ie})]})},ze=Ee;var f=W(K()),De=({onNodeClick:b})=>{let s=q(),[o,w,Y]=ve([]),[N,I,G]=be([]),[g,D]=(0,h.useState)(!1),[S,i]=(0,h.useState)([]),[A,O]=(0,h.useState)(!1),[m,F]=(0,h.useState)(null),{token:X}=_.useToken(),{get:T}=V(),P=(0,h.useMemo)(()=>({skill:ze}),[]),J=(0,h.useMemo)(()=>m===null?o:o.map(n=>{let c=n.id===m||N.some(u=>u.source===m&&u.target===n.id||u.target===m&&u.source===n.id);return{...n,style:{opacity:c?1:.2,transition:"opacity 0.2s ease"}}}),[o,N,m]),z=(0,h.useMemo)(()=>m===null?N.map(n=>({...n,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):N.map(n=>{let c=n.source===m||n.target===m;return{...n,style:{stroke:"#1677ff",strokeWidth:c?2.5:1,opacity:c?1:.04,transition:"opacity 0.2s ease"}}}),[N,m]),x=async()=>{O(!0);try{let n=await T("/api/skills");n.success&&n.data&&Array.isArray(n.data.records)&&i(n.data.records)}catch(n){console.error("Failed to fetch skills:",n),i([])}finally{O(!1)}};(0,h.useEffect)(()=>{x()},[]),(0,h.useEffect)(()=>{if(!S||S.length===0){w([]),I([]);return}let n=[],c=new Map,u=[];S.forEach(l=>{c.set(l.name,l),l.subSkills&&l.subSkills.length>0&&l.subSkills.forEach(H=>{S.find(j=>j.name===H)&&u.push({source:l.name,target:H})})});let $=S.map(l=>({id:l.name})),M=u.map(l=>({source:l.source,target:l.target})),Q=ue($).force("link",me(M).id(l=>l.id).distance(80)).force("charge",ke().strength(-300)).force("center",fe(0,0)).force("collide",ge(30)).stop();for(let l=0;l<300;l++)Q.tick();let L=$.map(l=>({id:l.id,type:"skill",data:{skill:c.get(l.id),onClick:()=>b?.(c.get(l.id)),onDelete:x},position:{x:l.x,y:l.y}}));u.forEach(l=>{c.has(l.source)&&c.has(l.target)&&n.push({id:`e${l.source}-${l.target}`,source:l.source,target:l.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"})}),w(L),I(n)},[S,w,I,b]);let p=async()=>{await x()};return A?(0,f.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:s("chat.skills.loading")}):(0,f.jsxs)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[(0,f.jsxs)(xe,{nodes:J,edges:z,onNodesChange:Y,onEdgesChange:G,onNodeMouseEnter:(n,c)=>F(c.id),onNodeMouseLeave:()=>F(null),nodeTypes:P,fitView:!0,children:[(0,f.jsx)(Te,{color:"#eee",gap:20}),(0,f.jsx)(Ce,{})]}),(0,f.jsx)("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:(0,f.jsx)(v,{type:"primary",size:"large",icon:(0,f.jsx)(U,{}),onClick:()=>D(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:X.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})}),(0,f.jsx)(we,{open:g,onCancel:()=>D(!1),onSuccess:p})]})},Ae=b=>(0,f.jsx)(Se,{children:(0,f.jsx)(De,{...b})}),nt=Ae;export{nt as default};
|
|
1
|
+
import{b as Z,c as he,e as ee,f as Se,g as xe,h as ve,i as be,l as Te,m as Ce}from"./embed-page-chunk-TSZQWEXD.js";import{a as fe,b as ge,c as me,d as ue,e as ke}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import{a as V,b as we}from"./embed-page-chunk-PJJCN6GS.js";import{o as se,t as ne}from"./embed-page-chunk-QJKFXJNR.js";import{k as q}from"./embed-page-chunk-EVZKWKMQ.js";import{a as K}from"./embed-page-chunk-QV7QAJ4N.js";import{D as ce,E as de,Ka as U,ea as pe,o as re,sa as ye}from"./embed-page-chunk-WXMPVIXV.js";import{Ia as R,La as C,Ma as le,Za as E,_ as v,_a as _,bb as ae,ua as ie,za as B}from"./embed-page-chunk-T2HKN7ZS.js";import{a as oe}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as W}from"./embed-page-chunk-QBTAJ2YI.js";var h=W(oe());var k=W(oe());var e=W(K()),{Text:d}=ae,{TextArea:Ne}=R,Ee=({data:b})=>{let s=q(),{token:o}=_.useToken(),{config:w}=ne(),{put:Y}=V(),I=he(t=>t.transform[2])>.6,G=se("__GLOBAL__");if(!b)return null;let{skill:g,onClick:D,onDelete:S}=b;if(!g)return null;let[i,A]=(0,k.useState)(g),O=i.subSkills&&i.subSkills.length>0,m=i.subSkills?.length||0,F=(0,k.useMemo)(()=>Math.min(12+Math.sqrt(m)*10,48),[m]),X=i.metadata&&i.metadata.category||"global",T=(0,k.useMemo)(()=>i.metadata?Object.entries(i.metadata).filter(([t,a])=>t&&a):[],[i.metadata]),P=t=>{if(!t)return"";let a=t instanceof Date?t:new Date(t);return Number.isNaN(a.getTime())?"":a.toLocaleString()},J=t=>{navigator.clipboard.writeText(t)},[z,x]=(0,k.useState)(!1),[p,n]=(0,k.useState)({...g,id:g.name}),[c,u]=(0,k.useState)(T.map(([t,a])=>({key:t,value:a}))),[$,M]=(0,k.useState)(!1),[Q,L]=(0,k.useState)(!1);(0,k.useEffect)(()=>{x(!1),A(g),n({...g,id:g.name}),u(Object.entries(g.metadata||{}).map(([t,a])=>({key:t,value:a})))},[g]);let l=(t,a)=>{if(t==="name"){n(r=>({...r,name:a,id:a}));return}n(r=>({...r,[t]:a}))},H=async t=>{t?.stopPropagation(),t?.preventDefault();try{let a=i.id||i.name;if(!a){C.error(s("chatWorkspace.skillNode.idMissing"));return}await G.skills.delete(a),C.success(s("chatWorkspace.skillNode.deleted")),M(!1),S&&await S()}catch(a){C.error(a?.message||s("chatWorkspace.skillNode.deleteFailed"))}},j=t=>{u(t);let a=t.reduce((r,y)=>(y.key&&(r[y.key]=y.value),r),{});n(r=>({...r,metadata:a}))},te=(t,a,r)=>{let y=[...c];y[t]={...y[t],[a]:r},j(y)},We=()=>{j([...c,{key:"",value:""}])},Be=async()=>{try{L(!0);let t={"Content-Type":"application/json"};w.apiKey&&(t.Authorization=`Bearer ${w.apiKey}`);let a={name:p.name,description:p.description,license:p.license||void 0,compatibility:p.compatibility||void 0,metadata:p.metadata||void 0,content:p.content||void 0,subSkills:p.subSkills||void 0},r=await Y(`/api/skills/${i.id}`,a);if(r.success){C.success(s("chatWorkspace.skillNode.updated"));let y=r.data||p;A(y),n({...y,id:y.name}),u(Object.entries(y.metadata||{}).map(([Fe,Me])=>({key:Fe,value:Me}))),x(!1),D?.(y)}else C.error(r.message||s("chatWorkspace.skillNode.updateFailed"))}catch(t){C.error(t.message||s("chatWorkspace.skillNode.updateError"))}finally{L(!1)}},Re=(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:24},children:[(0,e.jsxs)("div",{style:{flex:"0 0 320px",display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.description")}),(0,e.jsx)(Ne,{value:p.description,onChange:t=>l("description",t.target.value),placeholder:s("chatWorkspace.skills.field.description"),rows:3})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.license")}),(0,e.jsx)(R,{value:p.license,onChange:t=>l("license",t.target.value),placeholder:s("chatWorkspace.skills.field.license")})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.compatibility")}),(0,e.jsx)(R,{value:p.compatibility,onChange:t=>l("compatibility",t.target.value),placeholder:s("chatWorkspace.skills.field.compatibility")})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:s("chatWorkspace.skills.field.metadata")}),(0,e.jsx)(v,{size:"small",icon:(0,e.jsx)(U,{}),onClick:We,children:s("chatWorkspace.skillNode.add")})]}),(0,e.jsxs)(B,{direction:"vertical",size:8,style:{width:"100%"},children:[c.length===0&&(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary},children:s("chatWorkspace.skillNode.noMetadata")}),c.map((t,a)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextSecondary},children:s("chatWorkspace.skillNode.meta",{index:a+1})}),(0,e.jsxs)(B,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(R,{value:t.key,placeholder:s("chatWorkspace.skillNode.keyPlaceholder"),style:{width:120},onChange:r=>te(a,"key",r.target.value)}),(0,e.jsx)(R,{value:t.value,placeholder:s("chatWorkspace.skillNode.valuePlaceholder"),style:{flex:1,minWidth:160},onChange:r=>te(a,"value",r.target.value)})]})]},a))]})]}),(0,e.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6,minWidth:400},children:[(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary},children:s("chatWorkspace.skills.field.content")}),(0,e.jsx)(Ne,{value:p.content,onChange:t=>l("content",t.target.value),placeholder:s("chatWorkspace.skillNode.contentPlaceholder"),rows:30,style:{fontFamily:"monospace",fontSize:13,flex:1,minHeight:600}})]})]}),Ie=(0,e.jsxs)("div",{style:{width:z?960:720,maxHeight:"95vh",overflowY:"auto",padding:24},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:16},children:(0,e.jsxs)("div",{style:{flex:1},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(d,{strong:!0,style:{fontSize:18,fontWeight:600,color:o.colorText},children:i.name}),(0,e.jsx)(E,{style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},color:"geekblue",children:X.toUpperCase()})]}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6},children:(0,e.jsx)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${i.id}`})})]})}),z?Re:(0,e.jsxs)(e.Fragment,{children:[i.description&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',i.description,'"']})}),T.length>0&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(ye,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:s("chatWorkspace.skillNode.metadataCount",{count:T.length})})]}),(0,e.jsx)("div",{style:{border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,overflow:"hidden"},children:T.map(([t,a],r)=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"stretch",borderBottom:r===T.length-1?"none":`1px solid ${o.colorBorderSecondary}`},children:[(0,e.jsx)("div",{style:{width:140,padding:"8px 10px",background:o.colorFillTertiary,borderRight:`1px solid ${o.colorBorderSecondary}`,fontSize:11,color:o.colorTextSecondary,fontWeight:600,textTransform:"capitalize"},children:t}),(0,e.jsx)("div",{style:{flex:1,padding:"8px 10px",fontSize:11,color:o.colorText,wordBreak:"break-word"},children:a})]},t))})]}),O&&(0,e.jsxs)("div",{style:{marginBottom:16},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(re,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsxs)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:["Sub-Skills (",i.subSkills.length,")"]})]}),(0,e.jsx)(B,{size:[8,8],wrap:!0,children:i.subSkills.map((t,a)=>(0,e.jsx)(E,{style:{fontSize:11,padding:"4px 12px",backgroundColor:o.colorFillTertiary,color:o.colorText,border:`1px solid ${o.colorBorderSecondary}`},children:t},a))})]}),(i.license||i.compatibility)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(B,{size:[8,8],wrap:!0,children:[i.license&&(0,e.jsx)(E,{icon:(0,e.jsx)(de,{}),style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorInfoBg,color:o.colorInfo,border:`1px solid ${o.colorInfoBorder}`,fontWeight:500,lineHeight:"16px"},children:i.license}),i.compatibility&&(0,e.jsx)(E,{style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:o.colorSuccessBg,color:o.colorSuccess,border:`1px solid ${o.colorSuccessBorder}`,fontWeight:500,lineHeight:"16px",display:"inline-flex",alignItems:"center",gap:4},children:i.compatibility})]})}),(i.createdAt||i.updatedAt)&&(0,e.jsx)("div",{style:{marginBottom:16},children:(0,e.jsxs)(B,{direction:"vertical",size:4,children:[i.createdAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Created: ",P(i.createdAt)]}),i.updatedAt&&(0,e.jsxs)(d,{style:{fontSize:11,color:o.colorTextTertiary,fontFamily:"monospace"},children:["Updated: ",P(i.updatedAt)]})]})}),i.content&&(0,e.jsxs)("div",{style:{marginBottom:0},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,e.jsx)(pe,{style:{fontSize:14,color:o.colorTextSecondary}}),(0,e.jsx)(d,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:s("chatWorkspace.skillNode.contentSection")})]}),(0,e.jsx)("div",{style:{padding:16,background:o.colorFillTertiary,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:6,maxHeight:400,overflowY:"auto"},children:(0,e.jsx)(d,{style:{fontSize:12,color:o.colorText,lineHeight:1.7,whiteSpace:"pre-wrap",fontFamily:"monospace"},children:i.content})})]})]}),(0,e.jsx)(ie,{style:{margin:"16px 0"}}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:z?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v,{block:!0,onClick:()=>{x(!1),n(g)},style:{flex:1},children:s("common.cancel")}),(0,e.jsx)(v,{type:"primary",block:!0,onClick:Be,loading:Q,style:{flex:1},children:s("common.save")})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v,{type:"primary",block:!0,onClick:()=>x(!0),style:{flex:1},children:s("chatWorkspace.skillNode.edit")}),(0,e.jsx)(v,{danger:!0,onClick:t=>{t.stopPropagation(),H(t)},children:s("common.delete")}),(0,e.jsx)(v,{icon:(0,e.jsx)(ce,{}),onClick:()=>J(i.id),title:s("chatWorkspace.skillNode.copyId")})]})})]});return(0,e.jsxs)("div",{style:{position:"relative",padding:4,overflow:"visible"},children:[(0,e.jsx)(ee,{type:"source",position:Z.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsx)(ee,{type:"target",position:Z.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:1,height:1,borderRadius:"50%",pointerEvents:"none"},isConnectable:!1}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",position:"relative"},onClick:()=>M(!0),children:[(0,e.jsx)("div",{style:{width:F,height:F,borderRadius:"50%",background:"#999",flexShrink:0,boxShadow:"0 1px 4px rgba(0,0,0,0.15)",transition:"transform 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.transform="scale(1.15)"},onMouseLeave:t=>{t.currentTarget.style.transform="scale(1)"}}),I&&(0,e.jsx)(d,{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:4,fontSize:10,color:o.colorTextSecondary,opacity:.45,whiteSpace:"nowrap",pointerEvents:"none",userSelect:"none"},children:i.name})]}),(0,e.jsx)(le,{open:$,onCancel:()=>{M(!1),x(!1),n({...i,id:i.name})},footer:null,width:z?1e3:760,destroyOnClose:!0,title:null,styles:{body:{padding:0}},children:Ie})]})},ze=Ee;var f=W(K()),De=({onNodeClick:b})=>{let s=q(),[o,w,Y]=ve([]),[N,I,G]=be([]),[g,D]=(0,h.useState)(!1),[S,i]=(0,h.useState)([]),[A,O]=(0,h.useState)(!1),[m,F]=(0,h.useState)(null),{token:X}=_.useToken(),{get:T}=V(),P=(0,h.useMemo)(()=>({skill:ze}),[]),J=(0,h.useMemo)(()=>m===null?o:o.map(n=>{let c=n.id===m||N.some(u=>u.source===m&&u.target===n.id||u.target===m&&u.source===n.id);return{...n,style:{opacity:c?1:.2,transition:"opacity 0.2s ease"}}}),[o,N,m]),z=(0,h.useMemo)(()=>m===null?N.map(n=>({...n,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):N.map(n=>{let c=n.source===m||n.target===m;return{...n,style:{stroke:"#1677ff",strokeWidth:c?2.5:1,opacity:c?1:.04,transition:"opacity 0.2s ease"}}}),[N,m]),x=async()=>{O(!0);try{let n=await T("/api/skills");n.success&&n.data&&Array.isArray(n.data.records)&&i(n.data.records)}catch(n){console.error("Failed to fetch skills:",n),i([])}finally{O(!1)}};(0,h.useEffect)(()=>{x()},[]),(0,h.useEffect)(()=>{if(!S||S.length===0){w([]),I([]);return}let n=[],c=new Map,u=[];S.forEach(l=>{c.set(l.name,l),l.subSkills&&l.subSkills.length>0&&l.subSkills.forEach(H=>{S.find(j=>j.name===H)&&u.push({source:l.name,target:H})})});let $=S.map(l=>({id:l.name})),M=u.map(l=>({source:l.source,target:l.target})),Q=ue($).force("link",me(M).id(l=>l.id).distance(80)).force("charge",ke().strength(-300)).force("center",fe(0,0)).force("collide",ge(30)).stop();for(let l=0;l<300;l++)Q.tick();let L=$.map(l=>({id:l.id,type:"skill",data:{skill:c.get(l.id),onClick:()=>b?.(c.get(l.id)),onDelete:x},position:{x:l.x,y:l.y}}));u.forEach(l=>{c.has(l.source)&&c.has(l.target)&&n.push({id:`e${l.source}-${l.target}`,source:l.source,target:l.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"})}),w(L),I(n)},[S,w,I,b]);let p=async()=>{await x()};return A?(0,f.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:s("chat.skills.loading")}):(0,f.jsxs)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[(0,f.jsxs)(xe,{nodes:J,edges:z,onNodesChange:Y,onEdgesChange:G,onNodeMouseEnter:(n,c)=>F(c.id),onNodeMouseLeave:()=>F(null),nodeTypes:P,fitView:!0,children:[(0,f.jsx)(Te,{color:"#eee",gap:20}),(0,f.jsx)(Ce,{})]}),(0,f.jsx)("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:(0,f.jsx)(v,{type:"primary",size:"large",icon:(0,f.jsx)(U,{}),onClick:()=>D(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:X.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})}),(0,f.jsx)(we,{open:g,onCancel:()=>D(!1),onSuccess:p})]})},Ae=b=>(0,f.jsx)(Se,{children:(0,f.jsx)(De,{...b})}),nt=Ae;export{nt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ze}from"./embed-page-chunk-
|
|
1
|
+
import{a as Ze}from"./embed-page-chunk-2XFJOQHZ.js";import{c as qe,d as Ke}from"./embed-page-chunk-3VNL5M2Q.js";import{b as Ne,e as Ie,h as He,i as We}from"./embed-page-chunk-TSZQWEXD.js";import"./embed-page-chunk-S4XZPBRM.js";import{C as Ve,D as Ue,E as ue,F as Re,G as Ye,H as Qe,I as Je,K as Xe,L as et,M as tt,N as ot,r as Ge}from"./embed-page-chunk-TTFIPBIV.js";import{g as q,i as _e}from"./embed-page-chunk-JGFRDPYZ.js";import"./embed-page-chunk-PJJCN6GS.js";import{l as Ee,o as Oe}from"./embed-page-chunk-QJKFXJNR.js";import{E as Fe,Ma as me,j as ce,ua as pe}from"./embed-page-chunk-A5GIM22E.js";import{k as j}from"./embed-page-chunk-EVZKWKMQ.js";import{a as A}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-AICFKU43.js";import"./embed-page-chunk-WXMPVIXV.js";import{Da as W,Ia as Ce,Ja as J,Ma as ze,Sa as le,Za as Me,_ as ae,aa as Be,ba as Le,bb as de,fa as be,va as De}from"./embed-page-chunk-T2HKN7ZS.js";import{a as se}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as T}from"./embed-page-chunk-QBTAJ2YI.js";var n=T(se());var it=T(se());var s=T(A()),Tt=[{key:"pending",color:"#7A7A7A"},{key:"in_progress",color:"#3b82f6"},{key:"failed",color:"#ef4444"},{key:"interrupted",color:"#8b5cf6"},{key:"completed",color:"#22c55e"}],rt={high:"#ef4444",medium:"#f59e0b",low:"#22c55e"};function bt(e){return e==="high"||e==="low"?e:"medium"}function Ct(e,i){let f=typeof e=="string"?new Date(e):e,a=new Date().getTime()-f.getTime(),k=Math.floor(a/1e3),o=Math.floor(k/60),r=Math.floor(o/60),l=Math.floor(r/24);return k<60?i("common.time.justNow"):o<60?i("common.time.minutesAgo",{count:o}):r<24?i("common.time.hoursAgo",{count:r}):l<30?i("common.time.daysAgo",{count:l}):f.toLocaleDateString(i.locale)}var Nt=q(({css:e,token:i})=>({container:e`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as ue,q as he}from"./embed-page-chunk-
|
|
1
|
+
import{k as ue,q as he}from"./embed-page-chunk-JGFRDPYZ.js";import{o as oe}from"./embed-page-chunk-QJKFXJNR.js";import{H as ce,Ha as de,K as se,Sa as Ae,wa as le}from"./embed-page-chunk-A5GIM22E.js";import{k as re}from"./embed-page-chunk-EVZKWKMQ.js";import{a as ie}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-WXMPVIXV.js";import{Ma as ae,Oa as C,W as d,Ya as L,Za as S,_ as u,ba as F,bb as c,qa as te,xa as ne,za as h}from"./embed-page-chunk-T2HKN7ZS.js";import{a as Pe}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-EUOOO2LS.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var a=I(Pe());var _=I(Ae());var t=I(ie());function f(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Ee(r){if(!f(r))return;let e=r.checkpoint;if(f(e)&&typeof e.checkpoint_id=="string")return e.checkpoint_id;let o=r.config;if(f(o)&&f(o.configurable)){let s=o.configurable.checkpoint_id;if(typeof s=="string")return s}}function ze(r){if(!f(r))return;if(typeof r.createdAt=="string")return r.createdAt;let e=r.checkpoint;if(f(e)&&typeof e.ts=="string")return e.ts}function He(r){switch(r){case"pending":return"blue";case"running":return"processing";case"success":return"green";case"error":case"failed":case"timeout":return"red";case"interrupted":return"orange";default:return}}function Fe(r){return r==="pending"||r==="running"}function Le(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(2)} MB`}var We=({data:r})=>{let e=re(),o=r?.threadId,s=r?.assistantId,l=oe(s||"__no_assistant__"),D=(0,a.useContext)(ue),{closeSideApp:pe}=he(),[m,ge]=(0,a.useState)(null),[T,ye]=(0,a.useState)(null),[fe,me]=(0,a.useState)([]),[Te,Me]=(0,a.useState)([]),[v,R]=(0,a.useState)(!0),[K,M]=(0,a.useState)(null),[Y,O]=(0,a.useState)(null),[p,J]=(0,a.useState)({}),[b,N]=(0,a.useState)(null),[xe,W]=(0,a.useState)(!1),[ke,B]=(0,a.useState)(""),[we,$]=(0,a.useState)(!1),[Ce,G]=(0,a.useState)(!1),[P,Ie]=(0,a.useState)(null),[U,V]=(0,a.useState)(!1),[A,j]=(0,a.useState)(5),E=(0,a.useRef)(0),x=(0,a.useRef)(0),g=(0,a.useCallback)(async()=>{if(!o||!s){R(!1);return}let n=++E.current;R(!0),J({});let[i,k,X,Z]=await Promise.allSettled([l.getThreadStatus(o),l.getThreadStorage(o),l.getThreadHistory(o,{limit:10}),l.runs.list(o,s)]);if(n!==E.current)return;let w={};i.status==="fulfilled"?ge(i.value):w.status=e("chat.threadMaintenance.statusLoadFailed"),k.status==="fulfilled"?ye(k.value):w.storage=e("chat.threadMaintenance.storageLoadFailed"),X.status==="fulfilled"?me(X.value.flatMap(H=>{let ee=Ee(H);return ee===void 0?[]:[{id:ee,createdAt:ze(H),raw:H}]})):w.history=e("chat.threadMaintenance.historyLoadFailed"),Z.status==="fulfilled"?Me(Z.value):w.runs=e("chat.threadMaintenance.runsLoadFailed"),J(w),R(!1)},[s,l,e,o]);(0,a.useEffect)(()=>(g(),()=>{E.current+=1}),[g]);let Se=async n=>{if(!o)return;let i=++x.current;W(!0),$(!0),B("");try{let k=await l.getThreadStateAtCheckpoint(o,n.id);i===x.current&&B(JSON.stringify(k,null,2))}catch{i===x.current&&B(e("chat.threadMaintenance.stateFailed"))}finally{i===x.current&&$(!1)}},ve=()=>{x.current+=1,W(!1)},Re=async()=>{if(o){G(!0),M(null);try{let n=await l.copyThread(o);Ie(n.id)}catch{M(e("chat.threadMaintenance.copyFailed"))}finally{G(!1)}}},q=async n=>{if(!o)return;V(!0),M(null);let i=Math.min(100,Math.max(1,Math.trunc(A)));j(i);try{if(!(await l.pruneThread(o,n==="delete"?{strategy:n}:{strategy:n,keep:i})).pruned){M(e("chat.threadMaintenance.pruneFailed"));return}if(n==="delete"){pe();return}await g()}catch{M(e("chat.threadMaintenance.pruneFailed"))}finally{V(!1)}},z=(0,a.useCallback)(async(n,i)=>{if(!(!o||!s)){N(n),O(null);try{await l.runs.cancel(o,n,{action:i},s),await g()}catch{O(e("chat.threadMaintenance.runCancelFailed"))}finally{N(null)}}},[s,l,g,e,o]),Q=m?.interrupts??[],be=(0,a.useMemo)(()=>[{title:e("chat.threadMaintenance.runStatus"),dataIndex:"status",render:n=>(0,t.jsx)(S,{color:He(n),children:n})},{title:e("chat.threadMaintenance.runId"),dataIndex:"runId",render:n=>(0,t.jsx)(c.Text,{code:!0,ellipsis:{tooltip:n},style:{maxWidth:180},children:n})},{title:e("chat.threadMaintenance.runCreated"),dataIndex:"createdAt",render:n=>(0,_.default)(n).format("YYYY-MM-DD HH:mm:ss")},{title:e("chat.threadMaintenance.runOwner"),key:"owner",render:(n,i)=>(0,t.jsxs)(h,{size:4,children:[(0,t.jsx)(c.Text,{children:i.owner??"\u2014"}),(0,t.jsx)(c.Text,{type:"secondary",children:"/"}),(0,t.jsx)(c.Text,{type:"secondary",children:i.attempts})]})},{key:"actions",render:(n,i)=>Fe(i.status)?(0,t.jsxs)(h,{size:4,children:[(0,t.jsx)(C,{title:e("chat.threadMaintenance.interruptRunConfirm"),okText:e("chat.threadMaintenance.interruptRun"),cancelText:e("common.cancel"),onConfirm:()=>void z(i.runId,"interrupt"),children:(0,t.jsx)(u,{size:"small",type:"link",loading:b===i.runId,children:e("chat.threadMaintenance.interruptRun")})}),(0,t.jsx)(C,{title:e("chat.threadMaintenance.rollbackRunConfirm"),okText:e("chat.threadMaintenance.rollbackRun"),cancelText:e("common.cancel"),onConfirm:()=>void z(i.runId,"rollback"),children:(0,t.jsx)(u,{size:"small",type:"link",danger:!0,loading:b===i.runId,children:e("chat.threadMaintenance.rollbackRun")})})]}):null}],[z,b,e]),Be=(0,a.useMemo)(()=>[{title:e("chat.threadMaintenance.checkpointId"),dataIndex:"id",render:n=>(0,t.jsx)(c.Text,{code:!0,children:n})},{title:e("chat.threadMaintenance.checkpointTime"),dataIndex:"createdAt",render:n=>n?(0,_.default)(n).format("YYYY-MM-DD HH:mm:ss"):e("chat.threadMaintenance.unknown")},{key:"actions",render:(n,i)=>(0,t.jsx)(u,{size:"small",type:"link",onClick:()=>void Se(i),children:e("chat.threadMaintenance.viewState")})}],[e]);return!o||!s?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:e("chat.threadMaintenance.missingContext")}):(0,t.jsxs)(te,{title:(0,t.jsxs)(h,{children:[(0,t.jsx)(se,{size:16}),e("chat.threadMaintenance.title")]}),extra:(0,t.jsxs)(h,{wrap:!0,children:[(0,t.jsx)(u,{icon:(0,t.jsx)(le,{size:14}),onClick:()=>void g(),loading:v,children:e("common.refresh")}),(0,t.jsx)(u,{icon:(0,t.jsx)(ce,{size:14}),loading:Ce,onClick:()=>void Re(),children:e("chat.threadMaintenance.copy")})]}),children:[(0,t.jsxs)(h,{direction:"vertical",size:14,style:{width:"100%"},children:[K?(0,t.jsx)(d,{type:"error",showIcon:!0,message:K}):null,p.status?(0,t.jsx)(d,{type:"error",showIcon:!0,message:p.status}):null,p.storage?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:p.storage}):null,p.history?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:p.history}):null,p.runs?(0,t.jsx)(d,{type:"warning",showIcon:!0,message:p.runs}):null,P?(0,t.jsx)(d,{type:"success",showIcon:!0,message:e("chat.threadMaintenance.copySuccess",{id:P}),action:D?.selectThread?(0,t.jsx)(u,{size:"small",onClick:()=>D.selectThread(P),children:e("chat.threadMaintenance.switchToCopy")}):null}):null,(0,t.jsxs)(h,{wrap:!0,size:16,children:[(0,t.jsx)(y,{label:e("chat.threadMaintenance.status"),children:(0,t.jsx)(S,{color:m?.status==="idle"?"green":m?.status==="error"?"red":"blue",children:m?.status??e("chat.threadMaintenance.unknown")})}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.pendingMessages"),children:m?.pendingMessages??0}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.storage"),children:T?Le(T.totalBytes):e("chat.threadMaintenance.unknown")}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.checkpoints"),children:T?.checkpoints.count??0}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.channelValues"),children:T?.channelValues.count??0}),(0,t.jsx)(y,{label:e("chat.threadMaintenance.pendingWrites"),children:T?.pendingWrites.count??0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{strong:!0,children:e("chat.threadMaintenance.interrupts")}),(0,t.jsx)("div",{style:{marginTop:6},children:Q.length===0?(0,t.jsx)(c.Text,{type:"secondary",children:e("chat.threadMaintenance.noInterrupts")}):(0,t.jsx)(h,{wrap:!0,children:Q.map(n=>(0,t.jsxs)(S,{color:"orange",children:[n.type,": ",n.interruptId]},n.interruptId))})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{strong:!0,children:e("chat.threadMaintenance.runs")}),Y?(0,t.jsx)(d,{type:"error",showIcon:!0,message:Y,style:{marginTop:6}}):null,(0,t.jsx)(L,{rowKey:"runId",size:"small",columns:be,dataSource:Te,pagination:!1,loading:v,locale:{emptyText:(0,t.jsx)(F,{description:e("chat.threadMaintenance.noRuns")})}})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{strong:!0,children:e("chat.threadMaintenance.history")}),(0,t.jsx)(L,{rowKey:"id",size:"small",columns:Be,dataSource:fe,pagination:!1,loading:v,locale:{emptyText:(0,t.jsx)(F,{description:e("chat.threadMaintenance.noHistory")})}})]}),(0,t.jsxs)(h,{wrap:!0,children:[(0,t.jsx)(C,{title:e("chat.threadMaintenance.pruneDeleteTitle"),description:e("chat.threadMaintenance.pruneDeleteConfirm"),okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onConfirm:()=>void q("delete"),children:(0,t.jsx)(u,{danger:!0,icon:(0,t.jsx)(de,{size:14}),loading:U,children:e("chat.threadMaintenance.pruneDelete")})}),(0,t.jsx)(ne,{"aria-label":e("chat.threadMaintenance.keepLabel"),min:1,max:100,precision:0,step:1,value:A,onChange:n=>{j(typeof n=="number"?Math.min(100,Math.max(1,Math.trunc(n))):1)}}),(0,t.jsx)(C,{title:e("chat.threadMaintenance.pruneKeepTitle"),description:e("chat.threadMaintenance.pruneKeepConfirm",{count:A}),okText:e("chat.threadMaintenance.pruneKeepLatest"),cancelText:e("common.cancel"),onConfirm:()=>void q("keep_latest"),children:(0,t.jsx)(u,{loading:U,children:e("chat.threadMaintenance.pruneKeepLatest")})})]})]}),(0,t.jsx)(ae,{open:xe,title:e("chat.threadMaintenance.stateTitle"),footer:null,onCancel:ve,width:720,children:we?(0,t.jsx)(c.Text,{children:e("chat.threadMaintenance.loadingState")}):(0,t.jsx)("pre",{style:{maxHeight:"60vh",overflow:"auto",margin:0},children:ke})})]})},y=({label:r,children:e})=>(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Text,{type:"secondary",style:{display:"block",fontSize:12},children:r}),(0,t.jsx)(c.Text,{strong:!0,children:e})]});export{We as ThreadMaintenancePanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ue,c as fe}from"./embed-page-chunk-
|
|
1
|
+
import{a as ue,c as fe}from"./embed-page-chunk-KKUDX33F.js";import{a as xe}from"./embed-page-chunk-3VNL5M2Q.js";import{a as ie,b as G,e as V,f as U,g as re,h as se,i as ae,k as le,l as de,m as ce,n as pe}from"./embed-page-chunk-TSZQWEXD.js";import"./embed-page-chunk-S4XZPBRM.js";import{j as O}from"./embed-page-chunk-TTFIPBIV.js";import"./embed-page-chunk-JGFRDPYZ.js";import{a as j}from"./embed-page-chunk-PJJCN6GS.js";import"./embed-page-chunk-QJKFXJNR.js";import{A as $,La as ne,g as te,ia as H,u as L,w as oe}from"./embed-page-chunk-A5GIM22E.js";import{k as N}from"./embed-page-chunk-EVZKWKMQ.js";import{a as D}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-AICFKU43.js";import{G as Q,Na as ee}from"./embed-page-chunk-WXMPVIXV.js";import{Ja as M,Ka as K,Oa as Z,Sa as X,Za as I,ba as P,bb as q,ha as B,ya as J,za as F}from"./embed-page-chunk-T2HKN7ZS.js";import{a as Y}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as T}from"./embed-page-chunk-QBTAJ2YI.js";var s=T(Y());var _=T(xe());var ge=T(Y());var ye=T(D()),me=({steps:t,graphDefinition:o,assistantId:r})=>{let n=(0,ge.useMemo)(()=>fe(o),[o]);return(0,ye.jsx)(ue,{dsl:n,steps:t,assistantId:r})};var e=T(D()),ve=`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
from { transform: rotate(0deg); }
|
|
4
4
|
to { transform: rotate(360deg); }
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as $e,b as Ge}from"./embed-page-chunk-
|
|
1
|
+
import{a as $e,b as Ge}from"./embed-page-chunk-U5A5D7IS.js";import{b as Ue,c as be}from"./embed-page-chunk-KKUDX33F.js";import"./embed-page-chunk-3VNL5M2Q.js";import{f as Ye}from"./embed-page-chunk-TSZQWEXD.js";import"./embed-page-chunk-S4XZPBRM.js";import{S as Ke,j as He}from"./embed-page-chunk-TTFIPBIV.js";import{i as ee}from"./embed-page-chunk-JGFRDPYZ.js";import{a as te}from"./embed-page-chunk-PJJCN6GS.js";import"./embed-page-chunk-QJKFXJNR.js";import{Aa as q,Da as ue,E as ce,Fa as Ne,K as pe,Na as me,Oa as Z,Pa as qe,U as je,W as ge,Y as fe,ba as Ee,ea as _e,h as Oe,ja as Fe,k as de,p as Pe,va as Be}from"./embed-page-chunk-A5GIM22E.js";import{k as P}from"./embed-page-chunk-EVZKWKMQ.js";import{a as E}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-AICFKU43.js";import{Ba as De,G as Te,Ka as le,Sa as Le,sa as Me}from"./embed-page-chunk-WXMPVIXV.js";import{Da as X,Ia as J,Ja as ae,Ma as V,Oa as Ae,_ as $,ba as G,bb as Q,ha as U,qa as Ie}from"./embed-page-chunk-T2HKN7ZS.js";import{a as se}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as A}from"./embed-page-chunk-QBTAJ2YI.js";var i=A(se());var oe=A(se());var j=A(E());function gt(r){let n=r.split(/[\n\r.。;;!!??]+/).filter(Boolean)[0]?.trim()||"";return n=n.replace(/[,,]+$/,"").trim(),n.length>50&&(n=n.slice(0,50)),n||(n=r.slice(0,50).trim()),n}function ft(r){let t=5381;for(let n=0;n<r.length;n++)t=(t<<5)+t+r.charCodeAt(n)>>>0;return t.toString(36).slice(0,6)}var we=({open:r,onCancel:t,onCreated:n,type:f="processing"})=>{let{post:D}=te(),l=P(),{trainingProjects:u,loading:w}=ee(),[g,m]=(0,oe.useState)(null),[y]=X.useForm(),b=u.find(h=>h.id===g)??u[0]??null;(0,oe.useEffect)(()=>{r&&(y.resetFields(),m(null))},[r,y]);let S=async()=>{if(f==="workflow"&&!b)return;let k=((await y.validateFields()).purpose||"").trim(),z=gt(k),I=`wf-${ft(k+Date.now())}`,p=f==="workflow"?{key:I,name:z,description:k,type:"workflow",prompt:"Complete the assigned task accurately and concisely.",metadata:{trainingProjectId:b?.id},workflowYaml:`name: ${I}
|
|
2
2
|
steps: []
|
|
3
3
|
`}:{key:I,name:z,description:k,type:"processing",prompt:`You are the orchestrator for workflow "${z}". Purpose: ${k}. Follow the topology to delegate tasks to sub-agents.`,tools:[],skills:[],subAgents:[],middleware:[{id:"topology",type:"topology",name:l("chatConfig.workflow.middleware.topologyName"),description:l("chatConfig.workflow.middleware.topologyDescription"),enabled:!0,config:{edges:[]}}]};await D("/api/assistants",{id:I,name:z,description:k,graphDefinition:p}),y.resetFields(),n(I,k,f==="workflow"?b?.id:void 0)};return(0,j.jsx)(V,{title:l(f==="workflow"?"chatConfig.workflow.create.title":"chatConfig.workflow.create.titleProcessing"),open:r,onCancel:t,onOk:S,okText:l("common.create"),okButtonProps:{disabled:f==="workflow"&&(w||!b)},destroyOnClose:!0,children:(0,j.jsxs)(X,{form:y,layout:"vertical",initialValues:{purpose:""},children:[(0,j.jsx)(X.Item,{name:"purpose",label:l("chatConfig.workflow.field.purpose"),rules:[{required:!0,message:l("chatConfig.workflow.validation.purposeRequired")}],children:(0,j.jsx)(J.TextArea,{placeholder:l("chatConfig.workflow.field.purposePlaceholder"),rows:4})}),f==="workflow"&&(0,j.jsx)($e,{project:b,projects:u,value:b?.id??null,onChange:m,loading:w})]})})};var Ve=A(se());var e=A(E()),{Text:ye}=Q;function ut(r){if(!r||typeof r!="object")return null;let t=r;return{modelKey:t.modelKey||t.model||void 0,tools:Array.isArray(t.tools)?t.tools:[],middleware:Array.isArray(t.middleware)?t.middleware.filter(n=>n&&typeof n=="object"&&n.type):[],subAgents:Array.isArray(t.subAgents)?t.subAgents:[],skillCategories:Array.isArray(t.skillCategories)?t.skillCategories:[],runConfig:t.runConfig&&typeof t.runConfig=="object"?t.runConfig:void 0}}var mt={filesystem:(0,e.jsx)(je,{size:12}),code_eval:(0,e.jsx)(Ne,{size:12}),browser:(0,e.jsx)(fe,{size:12}),sql:(0,e.jsx)(pe,{size:12}),skill:(0,e.jsx)(ue,{size:12}),http:(0,e.jsx)(_e,{size:12}),scheduler:(0,e.jsx)(ce,{size:12}),metrics:(0,e.jsx)(Oe,{size:12}),topology:(0,e.jsx)(ge,{size:12}),ask_user_to_clarify:(0,e.jsx)(Fe,{size:12}),widget:(0,e.jsx)(de,{size:12}),date:(0,e.jsx)(Pe,{size:12}),task:(0,e.jsx)(ge,{size:12}),custom:(0,e.jsx)(Be,{size:12}),claw:(0,e.jsx)(q,{size:12}),collection:(0,e.jsx)(Ee,{size:12})},bt={filesystem:{bg:"rgba(34,197,94,0.08)",text:"#16a34a",border:"rgba(34,197,94,0.2)"},code_eval:{bg:"rgba(99,102,241,0.08)",text:"#4f46e5",border:"rgba(99,102,241,0.2)"},browser:{bg:"rgba(59,130,246,0.08)",text:"#2563eb",border:"rgba(59,130,246,0.2)"},sql:{bg:"rgba(249,115,22,0.08)",text:"#ea580c",border:"rgba(249,115,22,0.2)"},skill:{bg:"rgba(168,85,247,0.08)",text:"#9333ea",border:"rgba(168,85,247,0.2)"},http:{bg:"rgba(20,184,166,0.08)",text:"#0d9488",border:"rgba(20,184,166,0.2)"},scheduler:{bg:"rgba(245,158,11,0.08)",text:"#d97706",border:"rgba(245,158,11,0.2)"},metrics:{bg:"rgba(236,72,153,0.08)",text:"#db2777",border:"rgba(236,72,153,0.2)"},topology:{bg:"rgba(99,102,241,0.08)",text:"#4f46e5",border:"rgba(99,102,241,0.2)"},ask_user_to_clarify:{bg:"rgba(245,158,11,0.08)",text:"#d97706",border:"rgba(245,158,11,0.2)"},widget:{bg:"rgba(20,184,166,0.08)",text:"#0d9488",border:"rgba(20,184,166,0.2)"},date:{bg:"rgba(139,92,246,0.08)",text:"#7c3aed",border:"rgba(139,92,246,0.2)"},task:{bg:"rgba(99,102,241,0.08)",text:"#4f46e5",border:"rgba(99,102,241,0.2)"},custom:{bg:"rgba(107,114,128,0.08)",text:"#4b5563",border:"rgba(107,114,128,0.2)"},claw:{bg:"rgba(107,114,128,0.08)",text:"#4b5563",border:"rgba(107,114,128,0.2)"},collection:{bg:"rgba(6,182,212,0.08)",text:"#0891b2",border:"rgba(6,182,212,0.2)"}},wt={bg:"rgba(107,114,128,0.08)",text:"#4b5563",border:"rgba(107,114,128,0.2)"};function yt(r){let t=r.split(/[_-]+/).filter(Boolean);return t.length===1?t[0].slice(0,2).toUpperCase():t.map(n=>n[0]).join("").toUpperCase().slice(0,2)}var Xe=[{bg:"rgba(99,102,241,0.1)",text:"#6366f1"},{bg:"rgba(34,197,94,0.1)",text:"#22c55e"},{bg:"rgba(245,158,11,0.1)",text:"#f59e0b"},{bg:"rgba(59,130,246,0.1)",text:"#3b82f6"},{bg:"rgba(239,68,68,0.1)",text:"#ef4444"},{bg:"rgba(168,85,247,0.1)",text:"#a855f7"},{bg:"rgba(20,184,166,0.1)",text:"#14b8a6"},{bg:"rgba(236,72,153,0.1)",text:"#ec4899"}];function Je(r){return Xe[r%Xe.length]}var H=({icon:r,label:t,count:n,children:f})=>(0,e.jsxs)("div",{style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[(0,e.jsx)("span",{style:{color:"#6366f1",display:"flex",alignItems:"center"},children:r}),(0,e.jsx)(ye,{strong:!0,style:{fontSize:11,color:"#52525b",textTransform:"uppercase",letterSpacing:"0.3px"},children:t}),(0,e.jsx)("span",{style:{fontSize:9,fontWeight:600,color:"#a1a1aa",background:"rgba(0,0,0,0.04)",borderRadius:8,padding:"1px 6px",lineHeight:"16px"},children:n})]}),f]}),Qe=({graphDef:r})=>{let t=P(),n=(0,Ve.useMemo)(()=>ut(r),[r]);if(!n)return null;let f=n.middleware.filter(l=>l.enabled!==!1),D=!1;return n.tools.length===0&&f.length===0&&n.subAgents.length===0?null:(0,e.jsx)("div",{style:{pointerEvents:"auto"},children:(0,e.jsxs)("div",{style:{background:"rgba(255,255,255,0.5)",borderRadius:8,width:250,transition:"all 0.25s ease",overflow:"hidden"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:"rgba(99,102,241,0.02)",borderBottom:"1px solid rgba(0,0,0,0.03)"},children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,e.jsx)("div",{style:{width:24,height:24,borderRadius:6,background:"rgba(99,102,241,0.05)",display:"flex",alignItems:"center",justifyContent:"center",color:"#6366f1"},children:(0,e.jsx)(q,{size:13})}),(0,e.jsx)(ye,{strong:!0,style:{fontSize:12,color:"#1a1a1a"},children:t("chat.environment.title")})]})}),(0,e.jsxs)("div",{style:{padding:"10px 12px 12px",maxHeight:"calc(60vh - 48px)",overflowY:"auto"},children:[n.tools.length>0&&(0,e.jsx)(H,{icon:(0,e.jsx)(qe,{size:12}),label:t("chat.environment.tools"),count:n.tools.length,children:(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:n.tools.map((l,u)=>{let w=Je(u);return(0,e.jsx)(U,{title:l,placement:"top",children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:w.text,background:w.bg,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)("span",{style:{fontWeight:700,fontSize:9,opacity:.7},children:yt(l)}),(0,e.jsx)("span",{children:l})]})},l)})})}),f.length>0&&(0,e.jsx)(H,{icon:(0,e.jsx)(de,{size:12}),label:t("chat.environment.capabilities"),count:f.length,children:(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:f.map(l=>{let u=bt[l.type]||wt,w=mt[l.type]||(0,e.jsx)(q,{size:12});return(0,e.jsx)(U,{title:l.name||l.type,placement:"top",children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:u.text,background:u.bg,border:`1px solid ${u.border}`,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[w,(0,e.jsx)("span",{children:l.name||l.type})]})},l.type)})})}),n.subAgents.length>0&&(0,e.jsx)(H,{icon:(0,e.jsx)(me,{size:12}),label:t("chat.environment.subAgents"),count:n.subAgents.length,children:(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:n.subAgents.map((l,u)=>{let w=Je(u+3);return(0,e.jsx)(U,{title:l,placement:"top",children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:w.text,background:w.bg,cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)(me,{size:10}),(0,e.jsx)("span",{children:l})]})},l)})})}),(n.modelKey||n.runConfig)&&(0,e.jsx)(H,{icon:(0,e.jsx)(ce,{size:12}),label:t("chat.environment.runtime"),count:n.modelKey?1:0,children:(0,e.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[n.modelKey&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:"#4f46e5",background:"rgba(99,102,241,0.08)",border:"1px solid rgba(99,102,241,0.2)",cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)(q,{size:10}),(0,e.jsx)("span",{children:t("chat.environment.model",{model:n.modelKey})})]}),!!n.runConfig?.databaseKey&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:"#ea580c",background:"rgba(249,115,22,0.08)",border:"1px solid rgba(249,115,22,0.2)",cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)(pe,{size:10}),(0,e.jsx)("span",{children:t("chat.environment.db",{db:String(n.runConfig?.databaseKey)})})]}),n.skillCategories&&n.skillCategories.length>0&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:6,fontSize:10,fontWeight:500,color:"#9333ea",background:"rgba(168,85,247,0.08)",border:"1px solid rgba(168,85,247,0.2)",cursor:"default",whiteSpace:"nowrap",lineHeight:"16px"},children:[(0,e.jsx)(ue,{size:10}),(0,e.jsx)("span",{children:t("chat.environment.skills",{skills:n.skillCategories.join(", ")})})]})]})}),D&&(0,e.jsx)(H,{icon:(0,e.jsx)(fe,{size:12}),label:t("chat.environment.channels"),count:0,children:(0,e.jsx)(ye,{type:"secondary",style:{fontSize:10,fontStyle:"italic"},children:t("chat.environment.noChannels")})})]})]})})};var o=A(E()),{Text:Y}=Q,ht=300;function Ze(r){if(typeof r=="string")try{let t=JSON.parse(r);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}return r&&typeof r=="object"&&!Array.isArray(r)?r:null}function kt(r){let t=null;if(typeof r=="string")try{t=JSON.parse(r)}catch{return null}else r&&typeof r=="object"&&(t=r);if(!t)return null;if(t.type!=="workflow")return console.warn("[extractDSL] type is not 'workflow':",t.type),null;if(typeof t.workflowYaml!="string")return console.warn("[extractDSL] workflowYaml not found or not a string, keys:",Object.keys(t)),null;try{return be(t.workflowYaml)}catch(n){return console.error("[extractDSL] expandWorkflow failed:",n.message,n),null}}function xt({workflows:r,selectedId:t,onSelect:n,onCreate:f,onDelete:D,dsl:l,agentNameMap:u,onSpecClick:w,environmentConfig:g}){let m=P(),y=r.find(p=>p.id===t),[b,S]=(0,i.useState)(!0),[h,k]=(0,i.useState)(""),z=(0,i.useMemo)(()=>{let p=h.trim().toLowerCase();return p?r.filter(x=>x.name.toLowerCase().includes(p)||x.description.toLowerCase().includes(p)):r},[r,h]);(0,i.useEffect)(()=>{t?S(!1):(S(!0),k(""))},[t]);let I=p=>{n(p),S(!1)};return(0,o.jsx)("div",{style:{display:"flex",height:"100%",width:"100%"},children:(0,o.jsxs)("div",{style:{flex:1,position:"relative"},children:[y?(0,o.jsxs)(o.Fragment,{children:[l?(0,o.jsx)(Ue,{dsl:l,agentNameMap:u}):(0,o.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,o.jsx)(ae,{tip:m("chatWorkspace.workflowAutomation.loadingDsl")})}),!b&&(0,o.jsx)("div",{style:{position:"absolute",top:12,left:12,zIndex:10},children:(0,o.jsx)($,{type:"default",icon:(0,o.jsx)(De,{}),onClick:()=>S(!0),style:{width:32,height:32,borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0",background:"rgba(255,255,255,0.95)",color:"#6366f1",display:"flex",alignItems:"center",justifyContent:"center"}})}),(0,o.jsxs)("div",{style:{position:"absolute",top:12,left:b?12:56,zIndex:10,display:"flex",alignItems:"center",gap:6,height:32,padding:"0 14px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0"},children:[(0,o.jsx)(Z,{size:16,color:"#6366f1"}),(0,o.jsx)(Y,{strong:!0,style:{fontSize:13},children:y.name}),(0,o.jsx)(Me,{style:{color:"#6366f1",cursor:"pointer",fontSize:15},onClick:w})]}),(0,o.jsx)("div",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"flex",alignItems:"center",height:32,padding:"0 14px",background:"rgba(255,255,255,0.95)",borderRadius:10,boxShadow:"0 2px 12px rgba(0,0,0,0.08)",border:"1px solid #f0f0f0"},children:(0,o.jsx)(Ae,{title:m("chatWorkspace.workflowAutomation.deleteTitle"),description:m("chatWorkspace.workflowAutomation.deleteBody"),onConfirm:()=>D(y.id),okText:m("common.delete"),cancelText:m("common.cancel"),okButtonProps:{danger:!0},children:(0,o.jsx)(Te,{style:{color:"#ff4d4f",cursor:"pointer",fontSize:15}})})}),!b&&(0,o.jsx)("div",{style:{position:"absolute",top:52,left:b?12:56,zIndex:20},children:(0,o.jsx)(Qe,{graphDef:g},y.id)})]}):(0,o.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,o.jsx)(G,{description:m("chatWorkspace.workflowAutomation.selectWorkflow")})}),b&&(0,o.jsxs)(o.Fragment,{children:[t&&(0,o.jsx)("div",{onClick:()=>S(!1),style:{position:"absolute",inset:0,zIndex:25,background:"transparent"}}),(0,o.jsxs)(Ie,{size:"small",title:(0,o.jsx)(Y,{strong:!0,style:{fontSize:15,color:"#1a1a1a"},children:m("chatWorkspace.workflowAutomation.title")}),extra:(0,o.jsx)($,{type:"text",size:"small",icon:(0,o.jsx)(le,{}),onClick:f,style:{color:"#6366f1"}}),styles:{body:{padding:"12px 16px 16px"},header:{padding:"14px 16px 10px",borderBottom:"1px solid rgba(0,0,0,0.04)"}},style:{position:"absolute",left:16,top:t?56:48,bottom:16,width:300,zIndex:30,borderRadius:16,boxShadow:"0 4px 24px rgba(0,0,0,0.12)",border:"1px solid #f0f0f0",overflow:"auto",background:"rgba(255, 255, 255, 0.92)"},children:[(0,o.jsx)("div",{style:{marginBottom:12},children:(0,o.jsx)(J,{prefix:(0,o.jsx)(Le,{style:{color:"#bbb"}}),placeholder:m("chatWorkspace.workflowAutomation.filterPlaceholder"),value:h,onChange:p=>k(p.target.value),allowClear:!0,size:"small",style:{borderRadius:10,border:"1px solid rgba(0,0,0,0.06)"}})}),z.length===0?(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",color:"#bbb"},children:[(0,o.jsx)(Z,{size:28,style:{marginBottom:10,opacity:.4}}),(0,o.jsx)(Y,{type:"secondary",style:{fontSize:13},children:h.trim()?m("chatWorkspace.workflowAutomation.noMatch"):m("chatWorkspace.workflowAutomation.emptyTitle")})]}):z.map(p=>{let x=t===p.id;return(0,o.jsxs)("div",{onClick:()=>I(p.id),style:{display:"flex",alignItems:"center",gap:12,padding:"13px 15px",borderRadius:12,cursor:"pointer",transition:"all 0.2s ease",background:x?"rgba(99, 102, 241, 0.07)":"rgba(255, 255, 255, 0.5)",border:x?"1px solid rgba(99, 102, 241, 0.25)":"1px solid transparent",marginBottom:6},onMouseEnter:R=>{x||(R.currentTarget.style.background="rgba(255, 255, 255, 0.92)",R.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.05)",R.currentTarget.style.transform="translateY(-1px)",R.currentTarget.style.borderColor="rgba(0,0,0,0.06)")},onMouseLeave:R=>{x||(R.currentTarget.style.background="rgba(255, 255, 255, 0.5)",R.currentTarget.style.boxShadow="none",R.currentTarget.style.transform="translateY(0)",R.currentTarget.style.borderColor="transparent")},children:[(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:38,height:38,borderRadius:10,background:x?"rgba(99, 102, 241, 0.12)":"rgba(0, 0, 0, 0.04)",flexShrink:0,transition:"background 0.2s ease"},children:(0,o.jsx)(Z,{size:18,color:x?"#6366f1":"#888"})}),(0,o.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,o.jsx)(Y,{strong:!0,ellipsis:{tooltip:p.name},style:{fontSize:14,color:x?"#6366f1":"#1a1a1a",transition:"color 0.2s ease"},children:p.name}),p.description&&(0,o.jsx)("div",{style:{fontSize:12,color:"#999",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:3,lineHeight:"18px"},children:p.description})]})]},p.id)})]})]})]})})}var vt=()=>{let r=P(),{get:t,del:n}=te(),{workspaceId:f,trainingProjects:D,loading:l}=ee(),[u,w]=(0,i.useState)([]),[g,m]=(0,i.useState)(null),[y,b]=(0,i.useState)(null),[S,h]=(0,i.useState)(null),[k,z]=(0,i.useState)([]),[I,p]=(0,i.useState)(new Map),x=(0,i.useCallback)(async()=>{try{let s=await t("/api/assistants");if(s.success&&s.data?.records){let c=[],a=new Map;for(let d of s.data.records){if(d.id&&d.name){let v=typeof d.graphDefinition=="object"&&d.graphDefinition!==null?d.graphDefinition:void 0;a.set(d.id,{name:d.name,type:v?.type??"unknown"})}if(d.graphDefinition)if(typeof d.graphDefinition=="string")try{c.push(JSON.parse(d.graphDefinition))}catch{}else typeof d.graphDefinition=="object"&&c.push(d.graphDefinition)}z(c),p(a)}}catch{}},[t]),[R,he]=(0,i.useState)(!0),[ne,et]=(0,i.useState)(420),_=(0,i.useRef)(null),[tt,ot]=(0,i.useState)(!0),[ke,xe]=(0,i.useState)(null),[nt,ve]=(0,i.useState)(!1),[Ce,F]=(0,i.useState)(!1),[rt,Se]=(0,i.useState)(null),it=(0,i.useMemo)(()=>["create_workflow","update_workflow","validate_workflow","create_agent","update_agent","delete_agent"],[]),T=(0,i.useCallback)(async()=>{let s=await t("/api/assistants");if(s.success&&s.data?.records){let c=s.data.records.filter(a=>(Ze(a.graphDefinition)??void 0)?.type==="workflow").map(a=>{let d=Ze(a.graphDefinition)??void 0,v=typeof d?.workflowYaml=="string"?d.workflowYaml:"",B=d?.metadata,N=0;try{N=be(v).nodes.filter(W=>W.type!=="terminal").length}catch{}return{id:a.id,name:a.name,description:a.description||"",type:"workflow",stepCount:N,trainingProjectId:typeof B?.trainingProjectId=="string"?B.trainingProjectId:void 0}});w(c)}xe(null)},[t]),K=(0,i.useCallback)(async s=>{try{let c=await t(`/api/assistants/${s}`);if(c.success&&c.data){let a=c.data.graphDefinition,d=kt(a);if(b(d),!a)h(null);else if(typeof a=="string")try{h(JSON.parse(a))}catch{h(null)}else h(typeof a=="object"?a:null)}}catch{b(null),h(null)}},[t]);(0,i.useEffect)(()=>{let s=!1;return(async()=>{try{await T(),await x()}catch(a){s||xe(a instanceof Error?a.message:r("chatWorkspace.workflowAutomation.loadFailed"))}finally{s||ot(!1)}})(),()=>{s=!0}},[T]),(0,i.useEffect)(()=>{g?K(g):b(null)},[g,K]);let st=(0,i.useCallback)(s=>{s.preventDefault(),_.current={startX:s.clientX,startWidth:ne}},[ne]);(0,i.useEffect)(()=>{let s=a=>{if(!_.current)return;let d=_.current.startX-a.clientX,v=Math.min(900,Math.max(400,_.current.startWidth+d));et(v)},c=()=>{_.current=null};return window.addEventListener("mousemove",s),window.addEventListener("mouseup",c),()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)}},[]);let L=(0,i.useRef)(null),Re=(0,i.useRef)({fetchWorkflows:T,fetchDSL:K});Re.current={fetchWorkflows:T,fetchDSL:K};let We=(0,i.useRef)(g);We.current=g;let at=(0,i.useCallback)(()=>{L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{L.current=null;let{fetchWorkflows:s,fetchDSL:c}=Re.current;s().catch(d=>{console.warn("Failed to refresh workflows:",d)});let a=We.current;a&&c(a).catch(d=>{console.warn("Failed to refresh workflow DSL:",d)})},ht)},[]);(0,i.useEffect)(()=>()=>{L.current&&(clearTimeout(L.current),L.current=null)},[]);let lt=(0,i.useCallback)(s=>{m(s)},[]),ze=(0,i.useCallback)((s,c,a)=>{F(!1),T().then(()=>{m(s),a&&w(d=>d.map(v=>v.id===s?{...v,trainingProjectId:a}:v)),c&&Se({requestId:s,content:c})})},[T]),dt=(0,i.useCallback)(async s=>{await n(`/api/assistants/${s}`),g===s&&m(null),await T()},[n,T,g]),O=(0,i.useMemo)(()=>u.find(s=>s.id===g)||null,[u,g]),re=O?.trainingProjectId??D[0]?.id??null,ct=(0,i.useMemo)(()=>g&&O?{id:g,name:O.name,type:"workflow"}:null,[g,O]),pt=(0,i.useMemo)(()=>{let s=y?.nodes.filter(C=>C.type!=="terminal"&&C.ref).map(C=>C.ref).filter((C,W,M)=>M.indexOf(C)===W)??[];if(s.length===0)return S;let c=k.filter(C=>{let W=C.key;return W&&s.includes(W)});if(c.length===0)return S;let a={...S??{}},d=new Set(a.tools??[]),v=[...a.middleware??[]],B=new Set(a.subAgents??[]),N=new Set(v.map(C=>C.type).filter(Boolean));for(let C of c){let W=C;for(let M of W.tools??[])d.add(M);for(let M of W.middleware??[]){let ie=M.type;ie&&!N.has(ie)&&(v.push(M),N.add(ie))}for(let M of W.subAgents??[])B.add(M)}return a.tools=Array.from(d),a.middleware=v,a.subAgents=Array.from(B),a},[y,S,k]);return tt?(0,o.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,o.jsx)(ae,{size:"large",tip:r("chatWorkspace.workflowAutomation.loading")})}):ke?(0,o.jsx)(G,{description:ke}):u.length===0?(0,o.jsxs)("div",{style:{width:"100%",height:"100%"},children:[(0,o.jsx)(we,{open:Ce,onCancel:()=>F(!1),onCreated:ze,type:"workflow"}),(0,o.jsx)(G,{description:r("chatWorkspace.workflowAutomation.noDefinitions"),children:(0,o.jsx)($,{type:"primary",icon:(0,o.jsx)(le,{}),onClick:()=>F(!0),children:r("chatWorkspace.workflowAutomation.createWorkflow")})})]}):(0,o.jsxs)("div",{style:{width:"100%",height:"100%"},children:[(0,o.jsx)(we,{open:Ce,onCancel:()=>F(!1),onCreated:ze,type:"workflow"}),(0,o.jsx)(V,{title:O?.name,open:nt,onCancel:()=>ve(!1),footer:null,width:"85vw",centered:!0,styles:{body:{maxHeight:"calc(85vh - 120px)",overflow:"auto",padding:"12px 24px 24px"}},children:O?.description?(0,o.jsx)(He,{content:O.description}):(0,o.jsx)(Y,{type:"secondary",children:r("chatWorkspace.workflowAutomation.noDescription")})}),(0,o.jsx)(Ye,{children:(0,o.jsxs)("div",{style:{height:"100%",width:"100%",position:"relative",overflow:"hidden"},children:[(0,o.jsx)(xt,{workflows:u,selectedId:g,onSelect:lt,onCreate:()=>F(!0),onDelete:dt,dsl:y,agentNameMap:I,onSpecClick:()=>ve(!0),environmentConfig:pt}),!R&&g&&(0,o.jsx)("div",{style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",zIndex:20},children:(0,o.jsx)("div",{onClick:()=>he(!0),style:{writingMode:"vertical-rl",textOrientation:"mixed",padding:"16px 8px",background:"#6366f1",color:"#fff",borderRadius:"8px 0 0 8px",cursor:"pointer",fontSize:12,fontWeight:500,userSelect:"none"},children:r("chatWorkspace.workflowAutomation.copilot")})}),R&&g&&re&&!l&&(0,o.jsxs)("div",{style:{position:"absolute",right:16,top:48,bottom:12,zIndex:15,width:ne,borderRadius:16,overflow:"hidden",boxShadow:"0 4px 24px rgba(0,0,0,0.12)"},children:[(0,o.jsx)("div",{onMouseDown:st,style:{position:"absolute",left:0,top:0,bottom:0,width:6,cursor:"ew-resize",zIndex:2,background:"transparent"}}),(0,o.jsx)(Ke,{defaultWorkspaceId:f??void 0,defaultProjectId:re??void 0,children:(0,o.jsx)(Ge,{workflowContext:ct,onClose:()=>he(!1),onToolCompleted:s=>{it.includes(s)&&at()},initialMessageRequest:rt,onInitialMessageSubmitted:s=>Se(c=>c?.requestId===s?null:c)})},`${f??"default"}:${re??"default"}`)]})]})})]})},Qt=vt;export{vt as WorkflowAutomationView,Qt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as M,E as N,F as S,I as z,J as w}from"./embed-page-chunk-
|
|
1
|
+
import{C as M,E as N,F as S,I as z,J as w}from"./embed-page-chunk-TTFIPBIV.js";import{g as D}from"./embed-page-chunk-JGFRDPYZ.js";import{r as $,s as L}from"./embed-page-chunk-A5GIM22E.js";import{k as v}from"./embed-page-chunk-EVZKWKMQ.js";import{a as B}from"./embed-page-chunk-QV7QAJ4N.js";import{Ja as O,Sa as P,ba as C,bb as R}from"./embed-page-chunk-T2HKN7ZS.js";import{a as Y}from"./embed-page-chunk-R5QL57JJ.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var f=I(Y());function q(t,o){if(t.parentId&&t.parentId!==t.id&&o.has(t.parentId))return t.parentId;for(let c of t.dependencies??[])if(c!==t.id&&o.has(c))return c}function A(t,o){let u=o?.hideCompleted??!1?t.filter(e=>!w(e.status)):t,g=new Map(u.map(e=>[e.id,e])),p=new Map;for(let e of u)p.set(e.id,q(e,g));let l=new Set;for(let e of p.keys()){if(l.has(e))continue;let n=new Map,d=e,y=0;for(;d!==void 0&&!l.has(d)&&!n.has(d);)n.set(d,y),y+=1,d=p.get(d);if(d!==void 0&&n.has(d)){let h=n.get(d);for(let[x,s]of n)s>=h&&l.add(x)}}for(let e of l)p.set(e,void 0);let m=new Map;for(let e of u)m.set(e.id,[]);for(let e of u){let n=p.get(e.id);n!==void 0&&m.get(n).push(e.id)}let r=e=>({task:g.get(e),children:(m.get(e)??[]).map(r)});return u.filter(e=>p.get(e.id)===void 0).map(e=>r(e.id))}var i=I(B()),{Text:E}=R,J=16,K=3,Q=D(({css:t,token:o})=>({root:t`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as gr,b as Sn}from"./embed-page-chunk-
|
|
1
|
+
import{a as gr,b as Sn}from"./embed-page-chunk-U5A5D7IS.js";import{b as qi,c as $i}from"./embed-page-chunk-KKUDX33F.js";import{a as Io}from"./embed-page-chunk-2XFJOQHZ.js";import{c as xo,d as To}from"./embed-page-chunk-3VNL5M2Q.js";import{b as st,c as Mi,d as ko,e as Rt,f as wo,g as Ni,h as Rn,i as In,j as Oi,l as Fi,m as _i}from"./embed-page-chunk-TSZQWEXD.js";import{a as cn}from"./embed-page-chunk-D7YTSCUO.js";import{a as Ki,b as Hi}from"./embed-page-chunk-IQ75BKOM.js";import{J as Wi,K as Ro,L as Co,M as So,N as zi,O as Ao,P as Bi,Q as ji,R as Po,S as Cn,U as pr,V as Gi,b as Si,d as mo,e as Ai,f as yo,g as vo,j as xn,o as Tn,p as ho,q as Pi,t as Ei,u as Di,v as Li,w as bo}from"./embed-page-chunk-TTFIPBIV.js";import{g as Ci,i as Nt}from"./embed-page-chunk-JGFRDPYZ.js";import{a as et}from"./embed-page-chunk-PJJCN6GS.js";import{b as Xr,j as Jr,l as ei,o as vt,t as co}from"./embed-page-chunk-QJKFXJNR.js";import{D as ui,F as pi,Ha as Ti,J as gi,M as fi,O as mi,Oa as fo,Pa as Ri,Q as go,Qa as Ii,Z as yi,g as li,i as di,j as Gn,na as vi,oa as hi,pa as bi,ra as ki,sa as wi,v as ci,za as xi}from"./embed-page-chunk-A5GIM22E.js";import{k as W}from"./embed-page-chunk-EVZKWKMQ.js";import{a as z}from"./embed-page-chunk-QV7QAJ4N.js";import{B as oi,G as uo,Ka as Mt,P as wn,Pa as ii,Q as ri,Ra as ai,Sa as cr,Ta as ur,cb as si,ea as dr,i as ti,s as ni,sa as po,z as jn}from"./embed-page-chunk-WXMPVIXV.js";import{Da as ge,Ia as Me,Ja as Tt,La as at,Ma as We,W as Qt,Ya as lo,Za as He,_ as U,_a as Qr,aa as kn,ba as Gt,bb as Be,eb as Yr,fa as it,ha as Yt,ja as sr,ka as lr,pa as Ur,sa as dn,va as Zr,ya as Vr,za as Lt}from"./embed-page-chunk-T2HKN7ZS.js";import{a as Ce}from"./embed-page-chunk-R5QL57JJ.js";import{f as C}from"./embed-page-chunk-QBTAJ2YI.js";var Hs={react:{label:"capability",color:"blue"},capability:{label:"capability",color:"blue"},deep_agent:{label:"orchestrator",color:"orange"},orchestrator:{label:"orchestrator",color:"orange"},processing:{label:"workflow",color:"purple"},workflow:{label:"workflow",color:"purple"},a2a_remote:{label:"remote",color:"cyan"},remote:{label:"remote",color:"cyan"}};function An(e){return Hs[e]??{label:"capability",color:"blue"}}var Us={enabled:"green",draft:"orange",disabled:"default"};function Zi(e){return Us[e]??"default"}var Ui={blue:"#3b82f6",orange:"#f59e0b",green:"#22c55e",purple:"#a855f7",cyan:"#06b6d4"};function Kn(e){return Ui[e]??Ui.cyan}function Yd(e){let t={enabled:"#22c55e",draft:"#f59e0b",disabled:"#d9d9d9"};return t[e]??t.disabled}function Pn(e){return typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{}}function mr(e){return((Pn(e).metadata??{}).tags??"").split(",").map(r=>r.trim()).filter(Boolean)}function yr(e){let o=(Pn(e).metadata??{}).version;return o?o.startsWith("v")?o:`v${o}`:"v1"}function vr(e){let o=(Pn(e).metadata??{}).status??"enabled";return o==="draft"||o==="disabled"?o:"enabled"}function fr(e){let n=Pn(e).subAgents??[],o=Array.isArray(n)?n.filter(Boolean):[];return Array.from(new Set(o))}function Xd(e){return e.map(t=>{let n=Pn(t),o=String(n.type??"react");return{id:t.id,name:t.name,description:t.description,type:An(o).label,tags:mr(t),version:yr(t),status:vr(t),subAgents:fr(t)}})}function Jd(e){let t=new Set(e.map(r=>r.id)),n=e.map(r=>({id:r.id,label:r.name,type:An(String(Pn(r).type??"react")).label,subAgentCount:fr(r).length})),o=[];for(let r of e)for(let i of fr(r))t.has(i)&&o.push({source:r.id,target:i});return{nodes:n,edges:o}}var Se=C(Ce());var te=C(Ce());var b=C(z()),{TextArea:Zs}=Me,{Text:It}=Be,Vi=["data","execution","workflow","assistant"],Qi={data:"chatConfig.agentPanel.category.data",execution:"chatConfig.agentPanel.category.execution",workflow:"chatConfig.agentPanel.category.workflow",assistant:"chatConfig.agentPanel.category.assistant",other:"chatConfig.agentPanel.category.other"},Vs={react:"chatConfig.agentPanel.typeDesc.react",deep_agent:"chatConfig.agentPanel.typeDesc.deepAgent",processing:"chatConfig.agentPanel.typeDesc.processing"},qn=(e,t)=>{if(Array.isArray(e)){let n=e.map(o=>qn(o));return(t==="tools"||t==="subAgents")&&n.every(o=>typeof o=="string")?[...n].sort():n}return e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,qn(o,n)])):e},Yi=e=>{if(typeof e!="string")return qn(e??null);try{return qn(JSON.parse(e))}catch{return e}},Xi=e=>JSON.stringify(qn({...e,tools:[...e.tools].sort(),subAgents:[...e.subAgents].sort()})),Qs=Ci(({token:e,css:t})=>({modalBody:t`
|
|
2
2
|
padding: 0;
|
|
3
3
|
height: 92vh;
|
|
4
4
|
width: 100%;
|