@versot/vaguspi 0.1.4 → 0.1.5
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/bin.js +31 -41
- package/dist/bin.js.map +3 -3
- package/gui/assets/index-DL6d29Yn.js +19 -0
- package/gui/assets/settings-B-1r6vjG.js +60 -0
- package/gui/assets/vendor-D5Ls3_dM.js +41 -0
- package/gui/index.html +3 -3
- package/package.json +1 -1
- package/gui/assets/index-Dl4o9eCz.js +0 -19
- package/gui/assets/settings-V9zrDr2c.js +0 -60
- package/gui/assets/vendor-CkEpMl6t.js +0 -40
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import{j as e,u as _,t as n,a as te,r as f,b as Ne,h as _e,c as Je,d as Ve}from"./vendor-D5Ls3_dM.js";function Ye({size:r=14}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),e.jsx("path",{d:"M21 3v5h-5"}),e.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),e.jsx("path",{d:"M8 21H3v-5"})]})}function Ge({size:r=14}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}),e.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),e.jsx("path",{d:"M12 22V12"})]})}function Te({size:r=14}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),e.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),e.jsx("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),e.jsx("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]})}function Xe({size:r=13}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"})})}function Ze({size:r=15}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Qe({size:r=15}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),e.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),e.jsx("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),e.jsx("line",{x1:"2",x2:"22",y1:"2",y2:"22"})]})}function qe({size:r=13}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function Pe({size:r=13}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})}function eo({providers:r,selectedId:o,adding:l,onSelect:t,onAdd:s,t:u}){const{theme:i}=_();return e.jsxs("div",{style:{width:220,flexShrink:0,borderRight:`1px solid ${u.color.border}`,padding:10,background:i==="light"?"#ffffff":u.color.surface},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 10px 6px"},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:u.color.muted,letterSpacing:"0.04em"},children:n("自定义供应商")}),e.jsx("button",{onClick:s,title:n("添加供应商"),onMouseEnter:d=>d.currentTarget.style.color=u.color.fg,onMouseLeave:d=>d.currentTarget.style.color=u.color.muted,style:{background:"transparent",border:"none",color:u.color.muted,cursor:"pointer",display:"flex",padding:2,transition:"color 0.15s"},children:e.jsx(Pe,{size:14})})]}),r.length===0&&!l&&e.jsx("div",{style:{fontSize:12,color:u.color.muted,padding:"8px 10px"},children:n("暂无供应商")}),r.map(d=>{const p=o===d.id&&!l,x=d.enabled!==!1;return e.jsxs("div",{onClick:()=>t(d.id),onMouseEnter:m=>{p||(m.currentTarget.style.background=u.color.surface)},onMouseLeave:m=>{p||(m.currentTarget.style.background="transparent")},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 10px",borderRadius:9,fontSize:13,color:u.color.fg,cursor:"pointer",transition:"background 0.15s",background:p?u.color.border:"transparent"},children:[e.jsx(Ge,{size:14}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.id}),e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:x?"#10B981":u.color.muted,flexShrink:0}})]},d.id)})]})}const Le=[{value:"openai-completions",label:"OpenAI Completions (/v1/chat/completions)"},{value:"openai-responses",label:"OpenAI Responses (/v1/responses)"},{value:"anthropic-messages",label:"Anthropic Messages (/v1/messages)"},{value:"google-generative-ai",label:"Google Gemini (/v1beta/models)"}];function oo(r){return r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${Math.round(r/1e3)}K`:String(r)}function He({value:r,onChange:o,t:l}){var d;const[t,s]=f.useState(!1),u=fe(),i=((d=Le.find(p=>p.value===r))==null?void 0:d.label)??r;return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{type:"button",onClick:()=>s(p=>!p),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,background:u,border:`1px solid ${l.color.border}`,borderRadius:8,padding:"8px 12px",fontSize:13,color:l.color.fg,cursor:"pointer"},children:[e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{flexShrink:0},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]}),t&&e.jsx("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:50,background:u,border:`1px solid ${l.color.border}`,borderRadius:10,padding:4,boxShadow:"0 8px 24px rgba(0,0,0,0.25)"},children:Le.map(p=>{const x=p.value===r;return e.jsxs("button",{type:"button",onClick:()=>{o(p.value),s(!1)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",border:"none",background:x?l.color.border:"transparent",color:l.color.fg,borderRadius:7,padding:"7px 10px",fontSize:12.5,cursor:"pointer",textAlign:"left"},children:[e.jsx("span",{children:p.label}),x&&e.jsx("span",{style:{color:l.color.primary},children:"✓"})]},p.value)})})]})}function ee({label:r,children:o}){const l=te();return e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",fontSize:12,fontWeight:500,color:l.color.muted,marginBottom:6},children:r}),o]})}function Se({title:r,description:o,children:l}){const{theme:t}=_(),s=te(),u=t==="light"?"#ffffff":s.color.surface;return e.jsxs("div",{style:{marginBottom:30},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:s.color.fg,marginBottom:4},children:r}),o!==void 0&&e.jsx("div",{style:{fontSize:12,color:s.color.muted,marginBottom:10,lineHeight:1.5},children:o}),e.jsx("div",{style:{background:u,border:`1px solid ${s.color.border}`,borderRadius:12,overflow:"hidden"},children:l})]})}function fe(){const{theme:r}=_(),o=te();return r==="light"?"#ffffff":o.color.surface}function ae({label:r,hint:o,control:l,t,last:s=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,padding:"13px 18px",borderBottom:s?"none":`1px solid ${t.color.border}`},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:13,color:t.color.fg},children:r}),o!==void 0&&e.jsx("div",{style:{fontSize:11.5,color:t.color.muted,marginTop:3,lineHeight:1.5},children:o})]}),e.jsx("div",{style:{flexShrink:0},children:l})]})}function We({options:r,value:o,onChange:l,t}){return e.jsx("div",{style:{display:"inline-flex",background:t.color.bg,border:`1px solid ${t.color.border}`,borderRadius:9,padding:3,gap:2},children:r.map(s=>{const u=s.value===o;return e.jsx("button",{onClick:()=>l(s.value),style:{border:"none",background:u?t.color.surface:"transparent",color:u?t.color.fg:t.color.muted,borderRadius:6,padding:"5px 14px",fontSize:12.5,fontWeight:u?500:400,cursor:"pointer",transition:"all 0.15s",whiteSpace:"nowrap"},children:s.label},s.value)})})}function Ie({checked:r,onChange:o,t:l}){return e.jsx("button",{role:"switch","aria-checked":r,onClick:()=>o(!r),style:{width:34,height:20,borderRadius:99,border:"none",cursor:"pointer",flexShrink:0,background:r?l.color.accent:l.color.border,position:"relative",transition:"background 0.15s"},children:e.jsx("span",{style:{position:"absolute",top:2,left:r?16:2,width:16,height:16,borderRadius:"50%",background:"#fff",boxShadow:"0 1px 2px rgba(0,0,0,0.25)",transition:"left 0.15s"}})})}function Be({value:r,onChange:o,min:l=10,max:t=20,t:s}){const[u,i]=f.useState(String(r));f.useEffect(()=>{i(String(r))},[r]);const d=x=>{const m=x.trim();if(m===""){i(String(r));return}const g=Number(m);Number.isFinite(g)?o(Math.min(t,Math.max(l,Math.round(g)))):i(String(r))},p={width:26,height:30,border:"none",background:"transparent",color:s.color.muted,fontSize:15,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"};return e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",border:`1px solid ${s.color.border}`,borderRadius:8,overflow:"hidden",background:s.color.bg},children:[e.jsx("button",{onClick:()=>o(Math.max(l,r-1)),style:p,"aria-label":n("减小字号"),children:"−"}),e.jsx("input",{type:"text",inputMode:"numeric",value:u,onChange:x=>i(x.target.value.replace(/[^\d]/g,"")),onBlur:()=>d(u),onKeyDown:x=>{x.key==="Enter"&&x.currentTarget.blur()},"aria-label":n("字号"),style:{width:40,height:30,border:"none",outline:"none",textAlign:"center",background:"transparent",color:s.color.fg,fontSize:12.5}}),e.jsx("button",{onClick:()=>o(Math.min(t,r+1)),style:p,"aria-label":n("增大字号"),children:"+"}),e.jsx("span",{style:{paddingRight:10,fontSize:12,color:s.color.muted},children:"px"})]})}function ro({form:r,setForm:o,onAdd:l,canAdd:t,inputStyle:s,t:u}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontSize:16,fontWeight:600,color:u.color.fg},children:n("添加模型供应商")}),e.jsx("div",{style:{fontSize:12,color:u.color.muted,margin:"4px 0 20px"},children:n("配置一个完全自定义的 API 端点和初始模型")}),e.jsx(ee,{label:n("名称"),children:e.jsx("input",{style:s,placeholder:n("如:openai"),value:r.id,onChange:i=>o({...r,id:i.target.value})})}),e.jsx(ee,{label:"Base URL",children:e.jsx("input",{style:s,placeholder:"https://api.example.com/v1",value:r.baseUrl,onChange:i=>o({...r,baseUrl:i.target.value})})}),e.jsx(ee,{label:"API Key",children:e.jsx("input",{style:s,type:"password",placeholder:n("输入 API Key(可选)"),value:r.apiKey,onChange:i=>o({...r,apiKey:i.target.value})})}),e.jsx(ee,{label:n("API 格式"),children:e.jsx(He,{value:r.api,onChange:i=>o({...r,api:i}),t:u})}),e.jsx("button",{onClick:l,disabled:!t,onMouseEnter:i=>{t&&(i.currentTarget.style.filter="brightness(1.15)")},onMouseLeave:i=>{i.currentTarget.style.filter="none"},style:{width:"100%",background:t?u.color.primary:u.color.border,color:t?"#fff":u.color.muted,border:"none",borderRadius:10,padding:"11px 16px",fontSize:13.5,fontWeight:500,cursor:t?"pointer":"default",transition:"filter 0.15s"},children:n("添加供应商")})]})}function Oe(r,o){return r==="light"?"#ffffff":o.color.surface}function no({open:r,form:o,setForm:l,onAdd:t,onClose:s,inputStyle:u,t:i,onProbe:d,provider:p}){const{theme:x}=_(),[m,g]=f.useState("idle"),w=f.useRef(void 0);return r?e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:s,children:e.jsxs("div",{style:{background:Oe(x,i),border:`1px solid ${i.color.border}`,borderRadius:14,padding:22,width:400,maxWidth:"90vw",boxShadow:"0 12px 40px rgba(0,0,0,0.35)"},onClick:M=>M.stopPropagation(),children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:i.color.fg},children:n("添加模型")}),e.jsx("div",{style:{fontSize:12,color:i.color.muted,margin:"4px 0 18px"},children:n("配置模型的标识与参数,保存后可在聊天中选用。")}),e.jsx(ee,{label:n("模型 ID"),children:e.jsx("input",{style:u,autoFocus:!0,placeholder:n("如 gpt-4o(自动探测兼容配置)"),value:o.id,onChange:M=>{const I=M.target.value;if(l(z=>({...z,id:I})),w.current!==void 0&&window.clearTimeout(w.current),d&&p&&I.trim()!==""){const z=I.trim();g("probing"),w.current=window.setTimeout(()=>{w.current=void 0,d({baseUrl:p.baseUrl,api:p.api,apiKey:p.apiKey,model:z}).then(b=>{b.ok&&b.compat?(l(v=>{var S;return v.id.trim()===z?{...v,compat:b.compat??void 0,reasoning:b.reasoning,vision:((S=b.input)==null?void 0:S.includes("image"))??v.vision}:v}),g("ok")):g("fail")}).catch(()=>g("fail"))},600)}else g("idle")},onKeyDown:M=>{M.key==="Enter"&&o.id.trim()!==""&&m!=="probing"&&t()}})}),(()=>{if(o.id.trim()!==""){if(m==="probing")return e.jsx("div",{style:{fontSize:11.5,color:"#6366f1",background:"rgba(99,102,241,0.08)",borderRadius:6,padding:"5px 10px",marginTop:-4,marginBottom:4},children:n("正在自动探测模型能力…")});if(m==="ok")return e.jsx("div",{style:{fontSize:11.5,color:"#10B981",background:"rgba(16,185,129,0.1)",borderRadius:6,padding:"5px 10px",marginTop:-4,marginBottom:4},children:n("✓ 自动探测完成:compat/图片/思考配置已自动填入")});if(m==="fail")return e.jsx("div",{style:{fontSize:11.5,color:"#E5484D",background:"rgba(229,72,77,0.08)",borderRadius:6,padding:"5px 10px",marginTop:-4,marginBottom:4},children:n("自动探测失败 — 请检查 baseUrl / apiKey,或稍后重试")})}return null})(),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11.5,fontWeight:500,color:i.color.muted,marginBottom:4},children:n("上下文窗口 (tokens)")}),e.jsx("input",{style:u,type:"number",min:0,placeholder:"2000000",value:o.contextWindow,onChange:M=>l({...o,contextWindow:M.target.value})})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11.5,fontWeight:500,color:i.color.muted,marginBottom:4},children:n("最大输出 (tokens)")}),e.jsx("input",{style:u,type:"number",min:0,placeholder:"131072",value:o.maxTokens,onChange:M=>l({...o,maxTokens:M.target.value})})]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,marginTop:14,cursor:"pointer",fontSize:12.5,color:i.color.fg,userSelect:"none"},children:[e.jsx("input",{type:"checkbox",checked:o.vision,onChange:M=>l({...o,vision:M.target.checked}),style:{width:15,height:15,accentColor:i.color.primary,cursor:"pointer"}}),e.jsx("span",{children:n("支持图片理解")}),e.jsx("span",{style:{color:i.color.muted,fontSize:11},children:n("(决定聊天中能否添加图片附件)")})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:20},children:[e.jsx("button",{onClick:s,style:{background:"transparent",border:`1px solid ${i.color.border}`,color:i.color.muted,borderRadius:8,padding:"7px 18px",fontSize:12.5,cursor:"pointer"},children:n("取消")}),e.jsx("button",{onClick:t,disabled:o.id.trim()===""||m==="probing",onMouseEnter:M=>{o.id.trim()!==""&&m!=="probing"&&(M.currentTarget.style.filter="brightness(1.15)")},onMouseLeave:M=>{M.currentTarget.style.filter="none"},style:{background:i.color.primary,color:"#fff",border:"none",borderRadius:8,padding:"7px 18px",fontSize:12.5,fontWeight:500,cursor:o.id.trim()===""||m==="probing"?"not-allowed":"pointer",transition:"filter 0.15s",opacity:o.id.trim()===""||m==="probing"?.5:1},children:m==="probing"?"正在探测…":"添加"})]})]})}):null}function to({confirmDeleteId:r,providers:o,onConfirm:l,onClose:t,t:s}){var i;const{theme:u}=_();return r===null?null:e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:t,children:e.jsxs("div",{style:{background:Oe(u,s),border:`1px solid ${s.color.border}`,borderRadius:14,padding:22,width:340,maxWidth:"90vw",boxShadow:"0 12px 40px rgba(0,0,0,0.35)"},onClick:d=>d.stopPropagation(),children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:s.color.fg},children:n("删除供应商")}),e.jsxs("div",{style:{fontSize:12.5,color:s.color.muted,margin:"10px 0 22px",lineHeight:1.7},children:[n("确定删除供应商")," ",e.jsxs("span",{style:{color:s.color.fg,fontWeight:500},children:["“",((i=o.find(d=>d.id===r))==null?void 0:i.id)??r,"”"]})," ",n("吗?其下模型将一并移除,此操作不可撤销。")]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:t,style:{background:"transparent",border:`1px solid ${s.color.border}`,color:s.color.muted,borderRadius:8,padding:"7px 18px",fontSize:12.5,cursor:"pointer"},children:n("取消")}),e.jsx("button",{onClick:()=>{l(r),t()},onMouseEnter:d=>d.currentTarget.style.filter="brightness(1.15)",onMouseLeave:d=>d.currentTarget.style.filter="none",style:{background:"#E5484D",color:"#fff",border:"none",borderRadius:8,padding:"7px 18px",fontSize:12.5,fontWeight:500,cursor:"pointer",transition:"filter 0.15s"},children:n("确认删除")})]})]})})}function io({provider:r,detail:o,setDetail:l,showKey:t,setShowKey:s,testingId:u,testResult:i,editingModelId:d,modelForm:p,setModelForm:x,probeHint:m,onEditProbe:g,addModelOpen:w,addModelForm:M,setAddModelForm:I,confirmDeleteId:z,providers:b,onToggleEnabled:v,onDelete:S,onConfirmDelete:R,onTest:A,onAddModel:W,onRemoveModel:F,onStartEdit:K,onSaveEdit:a,onCancelEdit:k,onCancelDelete:T,onOpenAddModel:E,onCloseAddModel:H,inputStyle:D,t:h,onProbe:J}){const{theme:X}=_(),B=r,Z=X==="light"?"#ffffff":h.color.surface;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:16},children:[e.jsx("input",{style:{...D,flex:1,minWidth:120,fontWeight:600,fontSize:14},value:o.id,onChange:y=>l({...o,id:y.target.value}),"aria-label":n("供应商名称")}),e.jsxs("div",{style:{display:"inline-flex",background:h.color.bg,border:`1px solid ${h.color.border}`,borderRadius:99,padding:2,gap:2,flexShrink:0},children:[e.jsx("button",{onClick:v,onMouseEnter:y=>{B.enabled!==!1&&(y.currentTarget.style.filter="brightness(1.15)")},onMouseLeave:y=>{y.currentTarget.style.filter="none"},style:{border:"none",borderRadius:99,padding:"4px 12px",fontSize:12,cursor:"pointer",background:B.enabled!==!1?"#10B981":"transparent",color:B.enabled!==!1?"#fff":h.color.muted,transition:"filter 0.15s"},children:n("已启用")}),e.jsx("button",{onClick:v,onMouseEnter:y=>{B.enabled===!1&&(y.currentTarget.style.filter="brightness(1.15)")},onMouseLeave:y=>{y.currentTarget.style.filter="none"},style:{border:"none",borderRadius:99,padding:"4px 12px",fontSize:12,cursor:"pointer",background:B.enabled===!1?h.color.fg:"transparent",color:B.enabled===!1?h.color.bg:h.color.muted,transition:"filter 0.15s"},children:n("禁用")})]}),e.jsx("button",{onClick:S,title:n("删除供应商"),onMouseEnter:y=>{y.currentTarget.style.borderColor="#E5484D",y.currentTarget.style.color="#E5484D"},onMouseLeave:y=>{y.currentTarget.style.borderColor=h.color.border,y.currentTarget.style.color=h.color.muted},style:{background:"transparent",border:`1px solid ${h.color.border}`,color:h.color.muted,borderRadius:8,width:30,height:30,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0,transition:"all 0.15s"},children:e.jsx(Te,{})})]}),e.jsx(ee,{label:"Base URL",children:e.jsx("input",{style:D,placeholder:"https://api.example.com/v1",value:o.baseUrl,onChange:y=>l({...o,baseUrl:y.target.value})})}),e.jsx(ee,{label:n("API 格式"),children:e.jsx(He,{value:o.api,onChange:y=>l({...o,api:y}),t:h})}),e.jsx(ee,{label:"API Key",children:e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("input",{style:{...D,flex:1},type:t?"text":"password",placeholder:n("留空保持不变"),value:o.apiKey,onChange:y=>l({...o,apiKey:y.target.value})}),e.jsx("button",{onClick:()=>s(!t),title:t?"隐藏":"显示",onMouseEnter:y=>y.currentTarget.style.color=h.color.fg,onMouseLeave:y=>y.currentTarget.style.color=h.color.muted,style:{background:"transparent",border:`1px solid ${h.color.border}`,color:h.color.muted,borderRadius:8,width:34,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0,transition:"all 0.15s"},children:t?e.jsx(Qe,{}):e.jsx(Ze,{})})]})}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:h.color.fg,marginBottom:8},children:n("模型列表")}),B.models.length===0&&e.jsx("div",{style:{fontSize:12,color:h.color.muted,marginBottom:10},children:n("暂无模型 — 添加一个以在聊天中可用。")}),B.models.map(y=>e.jsxs("div",{children:[e.jsxs("div",{onMouseEnter:$=>$.currentTarget.style.background=h.color.border,onMouseLeave:$=>$.currentTarget.style.background=Z,style:{display:"flex",alignItems:"center",gap:8,padding:"8px 10px",borderRadius:8,background:Z,marginBottom:6,fontSize:13,transition:"background 0.15s"},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name??y.id}),y.contextWindow!==void 0&&e.jsx("span",{style:{fontSize:11,color:h.color.fg,background:h.color.bg,border:`1px solid ${h.color.border}`,borderRadius:99,padding:"2px 8px",flexShrink:0},children:oo(y.contextWindow)}),u===y.id?e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",style:{color:h.color.primary},children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3",strokeDasharray:"40",strokeLinecap:"round",opacity:"0.35"}),e.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:e.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"0.8s",repeatCount:"indefinite"})})]}):e.jsx("span",{role:"button","aria-label":`测试 ${y.id}`,onClick:()=>A(y.id),onMouseEnter:$=>$.currentTarget.style.color=h.color.fg,onMouseLeave:$=>$.currentTarget.style.color=h.color.muted,style:{color:h.color.muted,cursor:"pointer",display:"flex",padding:2,transition:"color 0.15s"},children:e.jsx(qe,{size:13})}),e.jsx("span",{role:"button","aria-label":`编辑 ${y.id}`,onClick:()=>K(y),onMouseEnter:$=>$.currentTarget.style.color=h.color.fg,onMouseLeave:$=>$.currentTarget.style.color=h.color.muted,style:{color:h.color.muted,cursor:"pointer",display:"flex",padding:2,transition:"color 0.15s"},children:e.jsx(Xe,{size:13})}),e.jsx("span",{role:"button","aria-label":`删除模型 ${y.id}`,onClick:()=>F(y.id),onMouseEnter:$=>$.currentTarget.style.color=h.color.fg,onMouseLeave:$=>$.currentTarget.style.color=h.color.muted,style:{color:h.color.muted,cursor:"pointer",display:"flex",padding:2,transition:"color 0.15s"},children:e.jsx(Te,{size:13})})]}),(i==null?void 0:i.modelId)===y.id&&e.jsx("div",{style:{marginBottom:8},children:i.ok?e.jsx("span",{style:{fontSize:12,color:"#10B981",background:"rgba(16,185,129,0.12)",borderRadius:6,padding:"3px 10px",display:"inline-block"},children:n("连接成功!")}):e.jsx("span",{style:{fontSize:12,color:"#E5484D",background:"rgba(229,72,77,0.1)",borderRadius:6,padding:"3px 10px",display:"inline-block"},children:i.status===0?"无法连接":i.reason==="auth"?"认证失败":i.reason==="model"?"模型不存在":`连接失败 (HTTP ${i.status})`})}),d===y.id&&e.jsxs("div",{style:{background:h.color.bg,border:`1px solid ${h.color.border}`,borderRadius:8,padding:"10px 12px",marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11.5,fontWeight:500,color:h.color.muted,marginBottom:4},children:n("上下文窗口 (tokens)")}),e.jsx("input",{style:D,type:"number",min:0,placeholder:"128000",value:p.contextWindow,onChange:$=>x({...p,contextWindow:$.target.value})})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11.5,fontWeight:500,color:h.color.muted,marginBottom:4},children:n("最大输出 (tokens)")}),e.jsx("input",{style:D,type:"number",min:0,placeholder:"8192",value:p.maxTokens,onChange:$=>x({...p,maxTokens:$.target.value})})]})]}),J&&g&&e.jsx("button",{type:"button",onClick:()=>g(y.id,()=>{}),style:{marginTop:10,background:"transparent",border:`1px solid ${h.color.border}`,color:h.color.muted,borderRadius:7,padding:"4px 12px",fontSize:11.5,cursor:"pointer"},children:n("自动探测模型能力")}),m&&e.jsx("div",{style:{marginTop:6,fontSize:11.5,color:m.ok?"#10B981":"#E5484D"},children:m.text}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,marginTop:12,cursor:"pointer",fontSize:12.5,color:h.color.fg,userSelect:"none"},children:[e.jsx("input",{type:"checkbox",checked:p.reasoning,onChange:$=>x({...p,reasoning:$.target.checked}),style:{width:15,height:15,accentColor:h.color.primary,cursor:"pointer"}}),e.jsx("span",{children:n("支持思考 / 推理")}),e.jsx("span",{style:{color:h.color.muted,fontSize:11},children:n("(聊天中可开关思考模式)")})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,marginTop:12,cursor:"pointer",fontSize:12.5,color:h.color.fg,userSelect:"none"},children:[e.jsx("input",{type:"checkbox",checked:p.vision,onChange:$=>x({...p,vision:$.target.checked}),style:{width:15,height:15,accentColor:h.color.primary,cursor:"pointer"}}),e.jsx("span",{children:n("支持图片理解")}),e.jsx("span",{style:{color:h.color.muted,fontSize:11},children:n("(聊天中能否添加图片附件)")})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:10},children:[e.jsx("button",{onClick:k,style:{background:"transparent",border:`1px solid ${h.color.border}`,color:h.color.muted,borderRadius:7,padding:"5px 14px",fontSize:12,cursor:"pointer"},children:n("取消")}),e.jsx("button",{onClick:a,style:{background:h.color.primary,color:"#fff",border:"none",borderRadius:7,padding:"5px 14px",fontSize:12,fontWeight:500,cursor:"pointer"},children:n("保存")})]})]})]},y.id)),e.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:12},children:e.jsxs("button",{onClick:E,onMouseEnter:y=>{y.currentTarget.style.borderColor=h.color.fg,y.currentTarget.style.color=h.color.fg},onMouseLeave:y=>{y.currentTarget.style.borderColor=h.color.border,y.currentTarget.style.color=h.color.muted},style:{background:"transparent",border:`1px dashed ${h.color.border}`,color:h.color.muted,borderRadius:9,padding:"8px 18px",fontSize:12.5,cursor:"pointer",display:"flex",alignItems:"center",gap:6,transition:"all 0.15s"},children:[e.jsx(Pe,{size:13})," ",n("添加模型")]})}),e.jsx(no,{open:w,form:M,setForm:I,onAdd:W,onClose:H,inputStyle:D,t:h,onProbe:J,provider:r}),e.jsx(to,{confirmDeleteId:z,providers:b,onConfirm:R,onClose:T,t:h})]})}function so({providers:r,inputStyle:o,t:l,onSave:t,onRefresh:s,onTest:u,onProbe:i}){const[d,p]=f.useState(null),[x,m]=f.useState(!1),[g,w]=f.useState({id:"",baseUrl:"",api:"openai-completions",apiKey:""}),[M,I]=f.useState(!1),[z,b]=f.useState({id:"",baseUrl:"",apiKey:"",api:"openai-completions"}),[v,S]=f.useState(!1),[R,A]=f.useState({id:"",contextWindow:"2000000",maxTokens:"131072",vision:!1}),[W,F]=f.useState(null),[K,a]=f.useState(null),[k,T]=f.useState(null),[E,H]=f.useState({contextWindow:"",maxTokens:"",vision:!0,reasoning:!1}),[D,h]=f.useState(),[J,X]=f.useState(void 0),B=d!==null&&!x?r.find(j=>j.id===d)??null:null,Z=j=>{const L=r.find(N=>N.id===j);if(!L)return;p(j),m(!1),T(null),X(void 0);const P={id:L.id,baseUrl:L.baseUrl,api:L.api,apiKey:L.apiKey??""};Q.current=JSON.stringify(P),w(P)},y=()=>{m(!0),p(null),T(null),b({id:"",baseUrl:"",apiKey:"",api:"openai-completions"})},$=()=>{const j=z.id.trim(),L=z.baseUrl.trim();if(!j||!L)return;t([...r,{id:j,baseUrl:L,api:z.api,apiKey:z.apiKey.trim()||void 0,models:[]}]);const P={id:j,baseUrl:L,api:z.api,apiKey:z.apiKey};Q.current=JSON.stringify(P),m(!1),p(j),w(P)},ue=j=>{t(r.filter(L=>L.id!==j)),d===j&&(p(null),Q.current="",w({id:"",baseUrl:"",api:"openai-completions",apiKey:""}))};f.useEffect(()=>{if(!x&&d===null&&r.length>0){const j=r[0];j!==void 0&&Z(j.id)}},[x,r.length,d]);const Q=f.useRef("");f.useEffect(()=>{if(d===null||!r.find(N=>N.id===d))return;const L=JSON.stringify(g);if(L===Q.current)return;const P=window.setTimeout(()=>{(async()=>{const N=g.id.trim(),V=g.baseUrl.trim();N&&(Q.current=L,await t(r.map(oe=>oe.id===d?{...oe,id:N,baseUrl:V||oe.baseUrl,api:g.api,apiKey:g.apiKey.trim()!==""?g.apiKey.trim():oe.apiKey}:oe)),N!==d&&p(N))})()},700);return()=>window.clearTimeout(P)},[g,d]);const be=()=>{B&&t(r.map(j=>j.id===B.id?{...j,enabled:j.enabled===!1}:j))},ie=async j=>{if(!B)return;a(j),X(void 0);const L=await u({baseUrl:g.baseUrl.trim()||B.baseUrl,api:g.api||B.api,apiKey:g.apiKey.trim()||B.apiKey,model:j});X({modelId:j,...L}),a(null)},me=()=>{if(!B)return;const j=R.id.trim();if(!j)return;const L=R.compat,P=R.reasoning;t(r.map(N=>N.id===B.id?{...N,models:[...N.models,{id:j,contextWindow:R.contextWindow!==""?Number(R.contextWindow):void 0,maxTokens:R.maxTokens!==""?Number(R.maxTokens):void 0,input:R.vision?["text","image"]:["text"],...P!==void 0?{reasoning:P}:{},...L?{compat:L}:{}}]}:N)),S(!1)},ye=j=>{B&&(t(r.map(L=>L.id===B.id?{...L,models:L.models.filter(P=>P.id!==j)}:L)),k===j&&T(null))},pe=j=>{var L;T(j.id),h(void 0),H({contextWindow:j.contextWindow!==void 0?String(j.contextWindow):"",maxTokens:j.maxTokens!==void 0?String(j.maxTokens):"",vision:((L=j.input)==null?void 0:L.includes("image"))??!0,reasoning:j.reasoning??!1,compat:j.compat})},se=()=>{!B||k===null||(t(r.map(j=>j.id===B.id?{...j,models:j.models.map(L=>L.id===k?{...L,contextWindow:E.contextWindow!==""?Number(E.contextWindow):void 0,maxTokens:E.maxTokens!==""?Number(E.maxTokens):void 0,input:E.vision?["text","image"]:["text"],reasoning:E.reasoning,...E.compat?{compat:E.compat}:{}}:L)}:j)),T(null),h(void 0))},je=(j,L)=>{B&&i({baseUrl:B.baseUrl,api:B.api,apiKey:B.apiKey,model:j}).then(P=>{P.ok?(H(N=>{var V;return{...N,compat:P.compat??void 0,reasoning:P.reasoning??N.reasoning,vision:((V=P.input)==null?void 0:V.includes("image"))??N.vision}}),L({ok:!0,text:n("✓ 自动探测完成:compat/图片/思考配置已自动填入")})):L({ok:!1,text:n("自动探测失败 — 请检查 baseUrl / apiKey,或稍后重试")})}).catch(()=>L({ok:!1,text:n("自动探测失败 — 请检查 baseUrl / apiKey,或稍后重试")}))},ve=z.id.trim()!==""&&z.baseUrl.trim()!=="";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",marginBottom:20},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:22,fontWeight:600,color:l.color.fg},children:n("模型设置")}),e.jsx("div",{style:{fontSize:13,color:l.color.muted,margin:"4px 0 0"},children:n("管理自定义模型供应商,配置后可在聊天时选择使用。")})]}),e.jsx("button",{onClick:s,title:n("刷新配置"),style:{background:"transparent",border:`1px solid ${l.color.border}`,color:l.color.muted,borderRadius:8,width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0},children:e.jsx(Ye,{})})]}),e.jsxs("div",{style:{display:"flex",border:`1px solid ${l.color.border}`,borderRadius:14,overflow:"hidden",background:l.color.bg},children:[e.jsx(eo,{providers:r,selectedId:d,adding:x,onSelect:Z,onAdd:y,t:l}),e.jsx("div",{style:{flex:1,padding:"22px 24px",minWidth:0},children:!x&&B!==null?e.jsx(io,{provider:B,detail:g,setDetail:w,showKey:M,setShowKey:I,testingId:K,testResult:J,editingModelId:k,modelForm:E,setModelForm:H,probeHint:D,onEditProbe:je,addModelOpen:v,addModelForm:R,setAddModelForm:A,confirmDeleteId:W,providers:r,onToggleEnabled:be,onDelete:()=>F(d),onConfirmDelete:j=>ue(j),onTest:ie,onAddModel:me,onRemoveModel:ye,onStartEdit:pe,onSaveEdit:se,onCancelEdit:()=>T(null),onCancelDelete:()=>F(null),onOpenAddModel:()=>{A({id:"",contextWindow:"2000000",maxTokens:"131072",vision:!1}),S(!0)},onCloseAddModel:()=>S(!1),inputStyle:o,t:l,onProbe:i}):e.jsx(ro,{form:z,setForm:b,onAdd:$,canAdd:ve,inputStyle:o,t:l})})]})]})}const lo=["const themePreview: ThemeConfig = {",' surface: "sidebar",',' accent: "#339CFF",'," contrast: 45,","};"];function $e({title:r,themeName:o,dark:l,active:t,showLineNumbers:s,codeFontSize:u,t:i}){const d=Je(o),p=t?"当前生效":l?"深色":"浅色";return e.jsxs("div",{style:{flex:"1 1 300px",background:d.bg,border:`1px solid ${d.border}`,borderRadius:12,overflow:"hidden",boxShadow:t?`0 0 0 1.5px ${i.color.accent}`:"none"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:d.header,borderBottom:`1px solid ${d.border}`},children:[e.jsx("span",{style:{fontSize:12,color:d.text,opacity:.85},children:r}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:11,color:d.text,opacity:.6},children:o}),e.jsx("span",{style:{fontSize:11,fontWeight:500,color:t?"#fff":d.text,background:t?i.color.accent:"transparent",border:t?"none":`1px solid ${d.border}`,borderRadius:99,padding:"2px 10px"},children:p})]})]}),e.jsx("div",{style:{padding:"12px 0 14px",fontSize:u,lineHeight:1.65,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",color:d.text},children:lo.map((x,m)=>e.jsxs("div",{style:{display:"flex",paddingLeft:16,paddingRight:16},children:[s&&e.jsx("span",{style:{width:26,flexShrink:0,textAlign:"right",marginRight:14,color:d.text,opacity:.35,userSelect:"none"},children:m+1}),e.jsx("span",{style:{whiteSpace:"pre"},children:_e(x,d).map((g,w)=>g.color!==void 0?e.jsx("span",{style:{color:g.color},children:g.text},w):g.text)})]},m))})]})}function ao({draft:r,onChange:o,t:l}){const{theme:t,preference:s,setPreference:u}=_(),{locale:i,setLocale:d}=Ne();return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontSize:22,fontWeight:600,color:l.color.fg},children:n("外观")}),e.jsxs("div",{style:{marginTop:24},children:[e.jsxs(Se,{title:n("界面设置"),description:n("设置应用主题和界面文字大小。"),children:[e.jsx(ae,{label:n("界面主题"),hint:n("选择浅色、深色或跟随系统主题。"),control:e.jsx(We,{options:[{value:"light",label:"浅色"},{value:"dark",label:"深色"},{value:"system",label:"跟随系统"}],value:s,onChange:u,t:l}),t:l}),e.jsx(ae,{label:n("界面语言"),hint:n("切换界面显示语言,立即生效。"),control:e.jsx(We,{options:[{value:"zh",label:n("中文")},{value:"en",label:"English"}],value:i,onChange:p=>d(p),t:l}),t:l}),e.jsx(ae,{label:n("界面字号"),hint:n("调整应用界面的文字大小,图标和布局尺寸不受影响。"),last:!0,control:e.jsx(Be,{value:r.uiFontSize,onChange:p=>o({uiFontSize:p}),t:l}),t:l})]}),e.jsxs(Se,{title:n("代码设置"),description:n("设置代码内容的主题、字号和显示方式,不受界面字号影响。"),children:[e.jsx(ae,{label:n("显示行号"),hint:n("在代码内容和差异视图中显示行号。"),control:e.jsx(Ie,{checked:r.showLineNumbers,onChange:p=>o({showLineNumbers:p}),t:l}),t:l}),e.jsx(ae,{label:n("长行自动换行"),hint:n("代码内容过长时自动换行。"),control:e.jsx(Ie,{checked:r.wrapLongLines,onChange:p=>o({wrapLongLines:p}),t:l}),t:l}),e.jsx(ae,{label:n("代码字号"),hint:n("调整代码块、文件预览和差异视图的默认字号。"),last:!0,control:e.jsx(Be,{value:r.codeFontSize,onChange:p=>o({codeFontSize:p}),min:10,max:24,t:l}),t:l})]}),e.jsx(Se,{title:n("代码预览"),description:n("同时预览浅色与深色代码主题,当前界面使用的主题会标记为“当前生效”。"),children:e.jsxs("div",{style:{display:"flex",gap:14,flexWrap:"wrap",padding:18},children:[e.jsx($e,{title:n("浅色预览"),themeName:"GitHub Light",dark:!1,active:t==="light",showLineNumbers:r.showLineNumbers,codeFontSize:r.codeFontSize,t:l}),e.jsx($e,{title:n("深色预览"),themeName:"GitHub Dark",dark:!0,active:t==="dark",showLineNumbers:r.showLineNumbers,codeFontSize:r.codeFontSize,t:l})]})})]})]})}const ne=864e5,Re=["#6366F1","#22D3EE","#FBBF24","#F472B6","#34D399","#A78BFA","#F87171","#60A5FA"],co=["#ebedf0","#9be9a8","#40c463","#30a14e","#216e39"],uo=["#272b33","#0e4429","#006d32","#26a641","#39d353"];function ce(r){return r>=1e9?`${(r/1e9).toFixed(2)}G`:r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:String(Math.round(r))}function Ke(r){return r>=1e3?`$${(r/1e3).toFixed(2)}K`:r>=100?`$${r.toFixed(1)}`:`$${r.toFixed(2)}`}function Ee(r){return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`}function po(r){const o=[...new Set(r.map(i=>Math.floor(i.ts/ne)))].toSorted((i,d)=>i-d);let l=0,t=0;for(let i=0;i<o.length;i++)t=i===0||o[i]===(o[i-1]??0)+1?t+1:1,t>l&&(l=t);const s=Math.floor(Date.now()/ne);let u=0;for(let i=o.length-1;i>=0&&o[i]===s-u;i--)u++;return{current:u,longest:l}}function go(r){const o=new Map;for(const l of r)for(const[t,s]of Object.entries(l.byModel))o.set(t,(o.get(t)??0)+s);return[...o.entries()].map(([l,t])=>({model:l,tokens:t})).toSorted((l,t)=>t.tokens-l.tokens)}function de({label:r,value:o,sub:l,accent:t}){const s=te(),u=fe();return e.jsxs("div",{style:{background:u,border:`1px solid ${s.color.border}`,borderRadius:14,padding:"18px 20px",display:"flex",flexDirection:"column",gap:6},children:[e.jsx("div",{style:{fontSize:12,color:s.color.muted,fontWeight:500},children:r}),e.jsx("div",{style:{fontSize:26,fontWeight:700,color:t??s.color.fg,letterSpacing:"-0.02em",fontVariantNumeric:"tabular-nums"},children:o}),l!==void 0&&e.jsx("div",{style:{fontSize:11.5,color:s.color.muted},children:l})]})}function xo({daily:r}){const o=te(),{theme:l}=_(),[t,s]=f.useState(null),u=l==="light"?co:uo,i=new Date;i.setHours(0,0,0,0);const d=i.getTime(),p=d-52*7*ne,x=new Map,m=new Map,g=Math.max(...r.map(a=>a.tokens),0),w=g>0?Math.log2(g):1;for(const a of r){const k=Ee(new Date(a.ts)),T=a.tokens===0?0:Math.max(1,Math.min(4,Math.round(Math.log2(a.tokens)/w*4)));x.set(k,T),m.set(k,a.tokens)}const M=new Date(p),I=new Date(M);I.setDate(I.getDate()-(M.getDay()+6)%7);const z=I.getTime(),b=[];for(let a=0;z+a*7*ne<d+ne;a++)b.push(z+a*7*ne);const v=13,S=3,R=20,A=b.length*(v+S),W=7*(v+S)+R,F=["","Mon","","Wed","","Fri",""],K=[];{let a=-1,k=0;for(let T=0;T<b.length;T++){const E=b[T];if(E===void 0)continue;const H=new Date(E),D=H.getFullYear()*100+H.getMonth();if(D!==a){if(a!==-1){const h=T*(v+S)-k;K.push({x:k+h/2,label:`${a%100+1}月`})}a=D,k=T*(v+S)}}if(a!==-1){const T=b.length*(v+S)-k;K.push({x:k+T/2,label:`${a%100+1}月`})}}return e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-start",position:"relative"},children:[e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:S,paddingTop:14},children:F.map((a,k)=>e.jsx("div",{style:{height:v,lineHeight:`${v}px`,fontSize:9,color:o.color.muted,textAlign:"right",paddingRight:4},children:a},k))}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsxs("svg",{viewBox:`0 0 ${A} ${W}`,width:"100%",preserveAspectRatio:"xMinYMin meet",style:{display:"block"},children:[b.map((a,k)=>Array.from({length:7},(T,E)=>{const H=new Date(new Date(a).getTime()+E*ne),D=Ee(H),h=H.getTime()>d,J=h?0:x.get(D)??0,X=u[J]??u[0],B=k*(v+S),Z=E*(v+S),y=h?0:m.get(D)??0;return e.jsx("rect",{x:B,y:Z,width:v,height:v,rx:2.5,fill:X,onMouseMove:$=>{h||s({x:$.clientX,y:$.clientY,date:D,tokens:y})},onMouseLeave:()=>s(null)},D)})),K.map((a,k)=>e.jsx("text",{x:a.x,y:7*(v+S)+R-4,fontSize:9,fill:o.color.muted,textAnchor:"middle",children:a.label},`${a.label}-${k}`))]})}),t!==null&&e.jsxs("div",{style:{position:"fixed",left:t.x+12,top:t.y+12,zIndex:200,pointerEvents:"none",background:o.color.surface,border:`1px solid ${o.color.border}`,borderRadius:8,padding:"8px 10px",fontSize:12,boxShadow:"0 4px 16px rgba(0,0,0,0.2)",color:o.color.fg,minWidth:110},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:t.date}),e.jsx("div",{style:{color:o.color.muted},children:t.tokens>0?`${ce(t.tokens)} tokens`:"无活跃"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,alignSelf:"flex-end",fontSize:10,color:o.color.muted},children:[e.jsx("span",{children:n("较少")}),u.map(a=>e.jsx("span",{style:{width:10,height:10,borderRadius:2,background:a,display:"inline-block"}},a)),e.jsx("span",{children:n("较多")})]})]})}function Fe({title:r,rows:o,total:l,mode:t}){const s=te(),u=fe(),i=o.slice(0,6),d=o.slice(6).reduce((x,m)=>x+m.value,0),p=d>0?[...i,{model:"其他",value:d}]:i;return e.jsxs("div",{style:{background:u,border:`1px solid ${s.color.border}`,borderRadius:14,padding:20},children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:s.color.fg,marginBottom:16},children:r}),p.length===0?e.jsx("div",{style:{fontSize:12,color:s.color.muted,padding:"8px 0"},children:n("暂无数据。")}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:13},children:p.map((x,m)=>{const g=l>0?x.value/l*100:0,w=Re[m%Re.length],M=x.model==="其他",[I,z]=M?[void 0,"其他"]:x.model.split("/");return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:9,height:9,borderRadius:3,background:w,flexShrink:0}}),e.jsxs("span",{style:{flex:1,fontSize:13,color:s.color.fg,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[I!==void 0&&e.jsxs("span",{style:{color:s.color.muted},children:[I,"/"]}),z]}),e.jsx("span",{style:{fontSize:12.5,fontWeight:600,color:s.color.fg,fontVariantNumeric:"tabular-nums"},children:t==="cost"?Ke(x.value):ce(x.value)}),e.jsxs("span",{style:{width:44,fontSize:11,color:s.color.muted,textAlign:"right"},children:[g.toFixed(1),"%"]})]}),e.jsx("div",{style:{height:5,borderRadius:3,background:s.color.border,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.max(1,g)}%`,background:w,borderRadius:3}})})]},x.model)})})]})}function ho({stats:r,t:o}){const l=fe(),t=f.useMemo(()=>(r==null?void 0:r.daily)??[],[r]),s=t.reduce((W,F)=>W+F.tokens,0),u=(r==null?void 0:r.totalCost)??0,i=(r==null?void 0:r.sessionCount)??t.reduce((W,F)=>W+F.sessions,0),d=(r==null?void 0:r.messageCount)??t.reduce((W,F)=>W+F.messages,0),p=t.length,x=(r==null?void 0:r.peakTokens)??0,m=(r==null?void 0:r.maxDurationMs)??0,g=f.useMemo(()=>po(t),[t]),w=f.useMemo(()=>go(t),[t]),M=t.length>0?t[0]:void 0,I=t.length>0?t[t.length-1]:void 0,z=M!==void 0?new Date(M.ts):null,b=I!==void 0?new Date(I.ts):null,v=p>0?s/p:0,S=m>0?(m/36e5).toFixed(1):"—",R=f.useMemo(()=>((r==null?void 0:r.perModel)??[]).map(W=>({model:W.model,value:W.cost})).toSorted((W,F)=>F.value-W.value),[r]),A=R.reduce((W,F)=>W+F.value,0);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:22},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10},children:[e.jsx("span",{style:{fontSize:20,fontWeight:600,color:o.color.fg},children:n("使用统计")}),e.jsx("span",{style:{fontSize:13,color:o.color.muted,borderBottom:`2px solid ${o.color.primary}`,paddingBottom:2},children:n("应用用量")})]})}),r===null?e.jsx("div",{style:{color:o.color.muted,fontSize:13,padding:"60px 0",textAlign:"center"},children:n("加载中…")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(160px, 1fr))",gap:14},children:[e.jsx(de,{label:n("Tokens 总用量"),value:ce(s),sub:"input + output(不含缓存复读)"}),e.jsx(de,{label:n("总花费"),value:Ke(u),accent:"#F472B6",sub:v>0?`日均 ${ce(v)} tokens`:void 0}),e.jsx(de,{label:n("峰值单会话"),value:ce(x),sub:S!=="—"?`最长会话 ${S} 小时`:"暂无"}),e.jsx(de,{label:n("会话数"),value:String(i)}),e.jsx(de,{label:n("消息数"),value:String(d)}),e.jsx(de,{label:n("活跃天数"),value:String(p),sub:z!==null?`自 ${z.getFullYear()}年${z.getMonth()+1}月起`:"暂无数据"})]}),e.jsxs("div",{style:{background:l,border:`1px solid ${o.color.border}`,borderRadius:14,padding:22},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:18},children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:o.color.fg},children:n("活跃热力图")}),e.jsx("div",{style:{fontSize:12,color:o.color.muted},children:s>0?`累计 ${ce(s)} tokens · 当前连击 ${g.current} 天`:"暂无活跃数据"})]}),t.length===0?e.jsx("div",{style:{fontSize:12,color:o.color.muted,padding:"8px 0"},children:n("暂无活跃数据。")}):e.jsx(xo,{daily:t})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(340px, 1fr))",gap:16},children:[e.jsx(Fe,{title:n("模型用量(Token 占比)"),rows:w.map(W=>({model:W.model,value:W.tokens})),total:s,mode:"tokens"}),e.jsx(Fe,{title:n("模型花费(USD 占比)"),rows:R,total:A,mode:"cost"})]}),e.jsxs("div",{style:{display:"flex",gap:28,fontSize:12,color:o.color.muted,paddingTop:4,flexWrap:"wrap"},children:[e.jsxs("span",{children:[n("最长连击")," ",e.jsx("b",{style:{color:o.color.fg},children:g.longest})," ",n("天")]}),e.jsxs("span",{children:[n("最近活跃")," ",e.jsx("b",{style:{color:o.color.fg},children:b!==null?`${b.getMonth()+1}月${b.getDate()}日`:"—"})]}),z!==null&&e.jsxs("span",{children:[n("起始于")," ",e.jsxs("b",{style:{color:o.color.fg},children:[z.getFullYear(),"年",z.getMonth()+1,"月",z.getDate(),"日"]})]})]})]})]})}const fo=`
|
|
2
|
+
@keyframes vagus-fade-up {
|
|
3
|
+
from { opacity: 0; transform: translateY(10px); }
|
|
4
|
+
to { opacity: 1; transform: translateY(0); }
|
|
5
|
+
}
|
|
6
|
+
@keyframes vagus-pop {
|
|
7
|
+
0% { opacity: 0; transform: scale(0.96); }
|
|
8
|
+
60% { opacity: 1; transform: scale(1.01); }
|
|
9
|
+
100% { opacity: 1; transform: scale(1); }
|
|
10
|
+
}
|
|
11
|
+
@keyframes vagus-shimmer {
|
|
12
|
+
0% { background-position: -400px 0; }
|
|
13
|
+
100% { background-position: 400px 0; }
|
|
14
|
+
}
|
|
15
|
+
@keyframes vagus-pulse {
|
|
16
|
+
0%, 100% { opacity: 1; }
|
|
17
|
+
50% { opacity: 0.35; }
|
|
18
|
+
}
|
|
19
|
+
@keyframes vagus-spin {
|
|
20
|
+
to { transform: rotate(360deg); }
|
|
21
|
+
}
|
|
22
|
+
.vagus-mcp-input:focus { border-color: var(--vagus-focus, #4f8cff) !important; box-shadow: 0 0 0 3px var(--vagus-focus-ring, rgba(79,140,255,0.18)) !important; }
|
|
23
|
+
.vagus-mcp-btn-press:active { transform: scale(0.96); }
|
|
24
|
+
.vagus-mcp-lift { transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease; }
|
|
25
|
+
.vagus-mcp-lift:hover { transform: translateY(-1px); }
|
|
26
|
+
`;function bo(r){if(typeof r.command=="string"){const o=Array.isArray(r.args)?r.args.join(" "):"";return`${r.command}${o?" "+o:""}`}return typeof r.url=="string"?r.url:JSON.stringify(r).slice(0,80)}function mo(r){return r.type==="http"||typeof r.url=="string"?{label:"HTTP",color:"#3fb950"}:{label:"STDIO",color:"#4f8cff"}}function yo(){return e.jsx("svg",{width:"52",height:"52",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 22v-5M9 8V2M15 8V2M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8h12z"})})}function jo(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"})})}function Ae(){return e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})}function vo(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function ko(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}function So(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"7",rx:"2"}),e.jsx("rect",{x:"3",y:"13",width:"18",height:"7",rx:"2"}),e.jsx("path",{d:"M7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6"})]})}function wo(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"}),e.jsx("path",{d:"M19 15l.9 2.1L22 18l-2.1.9L19 21l-.9-2.1L16 18l2.1-.9L19 15z"})]})}function Co(r){const o=/("(?:[^"\\]|\\.)*"(?=\s*:))|("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|(true|false|null)|([\]{}[,:])/g,l=[];let t=0,s=0,u;for(;(u=o.exec(r))!==null;){u.index>t&&l.push(r.slice(t,u.index));const[i,d,p,x,m]=u;let g="#8b90a0";d?g="#79c0ff":p?g="#7ee787":x?g="#e3b341":m&&(g="#d2a8ff"),l.push(e.jsx("span",{style:{color:g},children:i},s++)),t=u.index+i.length}return t<r.length&&l.push(r.slice(t)),l}function Mo({request:r,t:o}){const{theme:l}=_(),t=l!=="light",[s,u]=f.useState([]),[i,d]=f.useState(!0),[p,x]=f.useState(null),[m,g]=f.useState(!1),[w,M]=f.useState(null),[I,z]=f.useState("form"),[b,v]=f.useState(""),[S,R]=f.useState("stdio"),[A,W]=f.useState(""),[F,K]=f.useState(""),[a,k]=f.useState("30000"),[T,E]=f.useState(""),[H,D]=f.useState(""),[h,J]=f.useState(""),[X,B]=f.useState(null),[Z,y]=f.useState(null),[$,ue]=f.useState(!1),Q=o.color.primary,be=t?`${Q}33`:`${Q}22`,ie=t?"0 1px 2px rgba(0,0,0,0.25), 0 6px 20px rgba(0,0,0,0.18)":"0 1px 2px rgba(15,23,42,0.04), 0 6px 20px rgba(15,23,42,0.06)",me=t?"radial-gradient(120% 180% at 85% -20%, rgba(79,140,255,0.22), transparent 55%), radial-gradient(100% 160% at 10% -30%, rgba(121,192,255,0.12), transparent 50%)":"radial-gradient(120% 180% at 85% -20%, rgba(37,99,235,0.10), transparent 55%), radial-gradient(100% 160% at 10% -30%, rgba(59,130,246,0.06), transparent 50%)",ye=t?"linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 37%, rgba(255,255,255,0.04) 63%)":"linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.09) 37%, rgba(0,0,0,0.04) 63%)",pe=f.useCallback(async()=>Promise.resolve(!0),[]);f.useEffect(()=>{pe()},[pe]);const se=f.useCallback(async()=>{d(!0);try{const c=await r("mcp.list");u(c),x(null)}catch(c){x(c instanceof Error?c.message:"加载失败")}finally{d(!1)}},[r]);f.useEffect(()=>{se()},[se]);const je=async()=>{if(x(null),I==="json"){let c;try{c=JSON.parse(h)}catch{x("JSON 格式无效");return}const C=c,U=C.mcpServers??C,Y=Object.entries(U);if(Y.length===0){x("未找到服务器配置");return}for(const[G,O]of Y){const ze=await r(w?"mcp.update":"mcp.add",{name:G,config:typeof O=="object"&&O!==null?O:{}});if(!ze.ok){x(`「${G}」${ze.error??(w?"更新失败":"添加失败")}`);return}}J("")}else{if(!b.trim()){x("请输入名称");return}if(S==="stdio"&&!A.trim()){x("请输入命令");return}if(S==="http"&&!H.trim()){x("请输入 URL");return}let c;if(T.trim())try{c=JSON.parse(T)}catch{x("环境变量 JSON 格式无效");return}const C=Number.parseInt(a,10),U=S==="stdio"?{command:A.trim(),args:F.split(/\s+/).map(O=>O.trim()).filter(Boolean),...C>0?{timeout:C}:{},...c?{env:c}:{}}:{type:"http",url:H.trim(),...C>0?{timeout:C}:{}},G=await r(w?"mcp.update":"mcp.add",{name:b.trim(),config:U});if(!G.ok){x(G.error??(w?"更新失败":"添加失败"));return}v(""),W(""),K(""),D(""),E("")}g(!1),M(null),await se(),r("session.reload",{})},ve=c=>{M(c),g(!0),z("form"),x(null),v(c.name);const C=c.config,U=C.type==="http"||typeof C.url=="string";R(U?"http":"stdio"),U?(D(typeof C.url=="string"?C.url:""),W(""),K("")):(W(typeof C.command=="string"?C.command:""),K(Array.isArray(C.args)?C.args.join(" "):""),D("")),k(typeof C.timeout=="number"?String(C.timeout):"30000"),E(C.env&&typeof C.env=="object"&&Object.keys(C.env).length>0?JSON.stringify(C.env,null,2):""),J(JSON.stringify({[c.name]:C},null,2))},j=()=>{g(!1),M(null),x(null)},L=async c=>{y(c);try{const C=await r("mcp.remove",{name:c});if(!C.ok){x(C.error??"移除失败"),y(null);return}await se(),r("session.reload",{})}catch(C){x(C instanceof Error?C.message:"移除失败")}finally{y(null)}},N=(()=>{if(S==="stdio"){if(!A.trim())return null;let C;if(T.trim())try{C=JSON.parse(T)}catch{return null}const U=Number.parseInt(a,10);return{command:A.trim(),args:F.split(/\s+/).map(Y=>Y.trim()).filter(Boolean),...U>0?{timeout:U}:{},...C?{env:C}:{}}}if(!H.trim())return null;const c=Number.parseInt(a,10);return{type:"http",url:H.trim(),...c>0?{timeout:c}:{}}})(),V=I==="json"?h.trim()?h:null:N===null?null:JSON.stringify({[b.trim()||"server-name"]:N},null,2),oe=async()=>{if(V!==null)try{await navigator.clipboard.writeText(V),ue(!0),setTimeout(()=>ue(!1),1600)}catch{}},le={width:"100%",background:t?o.color.bg:"#ffffff",border:`1px solid ${o.color.border}`,borderRadius:10,padding:"9px 12px",fontSize:13,outline:"none",color:o.color.fg,fontFamily:"inherit",boxSizing:"border-box",transition:"border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease"},Ce={...le,fontFamily:"monospace",fontSize:12,minHeight:160,resize:"vertical",lineHeight:1.6,background:o.color.bg},re={fontSize:12,fontWeight:600,color:o.color.fg,marginBottom:6,display:"block",letterSpacing:"0.01em"},ge={fontSize:11,color:o.color.muted,marginTop:6,lineHeight:1.5},q={marginBottom:18},Me={borderRadius:10,padding:"9px 18px",fontSize:13,cursor:"pointer",fontWeight:600,background:`linear-gradient(180deg, ${o.color.primary}, ${t?"#3d74e0":"#1d4fd7"})`,color:"#fff",border:"none",display:"inline-flex",alignItems:"center",gap:7,boxShadow:t?"0 1px 0 rgba(255,255,255,0.12) inset, 0 2px 8px rgba(79,140,255,0.35)":"0 1px 0 rgba(255,255,255,0.5) inset, 0 2px 8px rgba(37,99,235,0.28)",transition:"filter 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease"},ke={borderRadius:10,padding:"9px 16px",fontSize:13,cursor:"pointer",fontWeight:500,background:t?o.color.surface:"#ffffff",color:o.color.fg,border:`1px solid ${o.color.border}`,display:"inline-flex",alignItems:"center",gap:6,transition:"background 0.15s ease, border-color 0.15s ease"},Ue={...ke,color:o.color.muted,border:"none",background:"transparent",padding:"6px 10px",borderRadius:8};return e.jsxs("div",{style:{position:"relative"},children:[e.jsx("style",{children:fo}),e.jsx("div",{style:{position:"relative",background:me,border:`1px solid ${o.color.border}`,borderRadius:14,padding:"22px 24px",marginBottom:24,overflow:"hidden"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:11,flexShrink:0,background:`linear-gradient(135deg, ${o.color.primary}22, ${o.color.accent}11)`,border:`1px solid ${o.color.primary}30`,display:"flex",alignItems:"center",justifyContent:"center",color:o.color.primary},children:e.jsx(So,{})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:19,fontWeight:650,color:o.color.fg,letterSpacing:"-0.01em"},children:n("MCP 服务器")}),e.jsx("div",{style:{fontSize:12.5,color:o.color.muted,marginTop:3,lineHeight:1.5},children:n("连接 Model Context Protocol 服务器,扩展 AI 助手的能力")})]})]})}),i&&e.jsx("div",{style:{fontSize:13,color:o.color.muted,padding:40,textAlign:"center"},children:e.jsx("span",{style:{display:"inline-block",animation:"vagus-pulse 1.4s ease-in-out infinite"},children:n("加载 MCP 配置…")})}),!i&&e.jsxs(e.Fragment,{children:[!m&&e.jsxs("div",{style:{animation:"vagus-fade-up 0.35s ease both"},children:[p&&e.jsxs("div",{style:{fontSize:13,color:"#e5484d",background:t?"rgba(248,81,73,0.10)":"rgba(220,38,38,0.06)",border:`1px solid ${t?"rgba(248,81,73,0.25)":"rgba(220,38,38,0.2)"}`,borderRadius:10,padding:"9px 14px",marginBottom:16,display:"flex",alignItems:"center",gap:9,animation:"vagus-pop 0.25s ease both"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 8v4M12 16h.01",stroke:"#fff",strokeWidth:"2",fill:"none"})]}),p]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:18},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:o.color.success,display:"inline-block",animation:"vagus-pulse 2.5s ease-in-out infinite"}}),e.jsxs("span",{style:{fontSize:13,color:o.color.muted},children:[s.length," 个服务器已配置"]})]})}),e.jsxs("button",{onClick:()=>g(!0),className:"vagus-mcp-btn-press",style:Me,onMouseEnter:c=>{c.currentTarget.style.filter="brightness(1.1)"},onMouseLeave:c=>{c.currentTarget.style.filter="none"},children:[e.jsx(Ae,{})," ",n("新建 MCP 服务器")]})]}),i&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0,1,2].map(c=>e.jsx("div",{style:{height:62,borderRadius:12,background:ye,backgroundSize:"800px 100%",animation:"vagus-shimmer 1.6s linear infinite",border:`1px solid ${o.color.border}`}},c))}),!i&&s.length===0&&e.jsxs("div",{style:{padding:56,textAlign:"center",border:`1.5px dashed ${o.color.border}`,borderRadius:16,animation:"vagus-fade-up 0.35s ease both"},children:[e.jsx("div",{style:{color:o.color.muted,marginBottom:14,opacity:.8},children:e.jsx(yo,{})}),e.jsx("div",{style:{fontSize:15,fontWeight:600,color:o.color.fg,marginBottom:6},children:n("还没有配置 MCP 服务器")}),e.jsx("div",{style:{fontSize:12.5,color:o.color.muted,lineHeight:1.6},children:n("添加一台服务器,让 AI 助手获得新的能力")})]}),!i&&s.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:s.map((c,C)=>{const U=mo(c.config),Y=X===c.name,G=Z===c.name;return e.jsxs("div",{onMouseEnter:()=>B(c.name),onMouseLeave:()=>B(null),className:"vagus-mcp-lift",style:{display:"flex",alignItems:"center",gap:14,background:Y?t?"rgba(255,255,255,0.03)":"#fbfcfe":o.color.surface,border:`1px solid ${Y?o.color.primary+"55":o.color.border}`,borderRadius:13,padding:"13px 16px",boxShadow:Y?ie:"none",opacity:G?.45:1,transition:"opacity 0.2s ease",animation:"vagus-fade-up 0.35s ease both",animationDelay:`${Math.min(C*45,200)}ms`},children:[e.jsx("div",{style:{width:44,height:26,borderRadius:8,background:`${U.color}1c`,color:U.color,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,letterSpacing:"0.06em",border:`1px solid ${U.color}30`},children:U.label}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{fontSize:13.5,fontWeight:600,color:o.color.fg,marginBottom:3,display:"flex",alignItems:"center",gap:8},children:[c.name,e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:o.color.success,display:"inline-block",animation:Y?"vagus-pulse 1.8s ease-in-out infinite":"none",opacity:.9}})]}),e.jsx("div",{style:{fontSize:12,color:o.color.muted,fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:bo(c.config)})]}),e.jsxs("button",{onClick:()=>ve(c),className:"vagus-mcp-btn-press",style:ke,onMouseEnter:O=>{O.currentTarget.style.borderColor=o.color.primary,O.currentTarget.style.color=o.color.primary},onMouseLeave:O=>{O.currentTarget.style.borderColor=o.color.border,O.currentTarget.style.color=o.color.fg},children:[e.jsx(ko,{})," ",n("编辑")]}),e.jsx("button",{onClick:()=>void L(c.name),disabled:G,className:"vagus-mcp-btn-press",style:{...Ue,opacity:G?.6:1},onMouseEnter:O=>{O.currentTarget.style.color=o.color.error,O.currentTarget.style.background=t?"rgba(248,81,73,0.10)":"rgba(220,38,38,0.06)"},onMouseLeave:O=>{O.currentTarget.style.color=o.color.muted,O.currentTarget.style.background="transparent"},children:G?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:12,height:12,borderRadius:"50%",border:`2px solid ${o.color.error}40`,borderTopColor:o.color.error,animation:"vagus-spin 0.7s linear infinite",display:"inline-block"}}),n("移除中…")]}):e.jsxs(e.Fragment,{children:[e.jsx(jo,{})," ",n("移除")]})})]},c.name)})})]}),m&&e.jsxs("div",{style:{animation:"vagus-fade-up 0.3s ease both"},children:[e.jsxs("button",{onClick:j,style:{border:"none",background:"none",color:o.color.muted,fontSize:12.5,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:5,marginBottom:18,padding:"4px 8px 4px 0",transition:"color 0.15s ease"},onMouseEnter:c=>{c.currentTarget.style.color=o.color.fg},onMouseLeave:c=>{c.currentTarget.style.color=o.color.muted},children:[e.jsx(vo,{})," ",n("返回列表")]}),e.jsx("div",{style:{fontSize:17,fontWeight:650,color:o.color.fg,marginBottom:4,letterSpacing:"-0.01em"},children:w?"编辑 MCP 服务器":"新建 MCP 服务器"}),e.jsx("div",{style:{fontSize:12.5,color:o.color.muted,marginBottom:22,lineHeight:1.5},children:w?`修改「${w.name}」的配置,保存后自动生效`:"填写配置,实时预览生成的 MCP 配置 JSON"}),e.jsxs("div",{style:{display:"flex",position:"relative",background:t?o.color.bg:"#f1f2f4",borderRadius:11,padding:4,marginBottom:22,border:`1px solid ${o.color.border}`},children:[e.jsx("div",{style:{position:"absolute",top:4,bottom:4,left:I==="form"?4:"calc(50% + 0px)",width:"calc(50% - 8px)",background:t?o.color.surface:"#ffffff",borderRadius:8,boxShadow:t?"0 1px 0 rgba(255,255,255,0.06) inset, 0 2px 8px rgba(0,0,0,0.25)":"0 1px 0 rgba(255,255,255,0.8) inset, 0 1px 4px rgba(0,0,0,0.10)",transition:"left 0.22s cubic-bezier(0.22, 1, 0.36, 1)"}}),["form","json"].map(c=>e.jsx("div",{onClick:()=>z(c),style:{flex:1,textAlign:"center",padding:"8px 0",fontSize:13,cursor:"pointer",position:"relative",zIndex:1,color:I===c?o.color.fg:o.color.muted,fontWeight:I===c?600:400,transition:"color 0.2s ease"},children:c==="form"?"表单":"JSON"},c))]}),p&&e.jsxs("div",{style:{fontSize:13,color:"#e5484d",background:t?"rgba(248,81,73,0.10)":"rgba(220,38,38,0.06)",border:`1px solid ${t?"rgba(248,81,73,0.25)":"rgba(220,38,38,0.2)"}`,borderRadius:10,padding:"9px 14px",marginBottom:16,display:"flex",alignItems:"center",gap:9,animation:"vagus-pop 0.25s ease both"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 8v4M12 16h.01",stroke:"#fff",strokeWidth:"2",fill:"none"})]}),p]}),e.jsxs("div",{style:{display:"flex",gap:20,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,minWidth:0,minHeight:400},children:[I==="form"&&e.jsxs("div",{style:{background:o.color.bg,border:`1px solid ${o.color.border}`,borderRadius:16,padding:"22px 24px",boxShadow:ie},children:[e.jsxs("div",{style:{...q},children:[e.jsx("label",{style:re,children:n("名称")}),e.jsx("input",{className:"vagus-mcp-input",style:le,placeholder:"my-mcp-server",value:b,onChange:c=>v(c.target.value)})]}),e.jsxs("div",{style:{...q,marginBottom:20},children:[e.jsx("label",{style:re,children:n("连接方式")}),e.jsx("div",{style:{display:"flex",gap:10},children:["stdio","http"].map(c=>{const C=S===c;return e.jsx("button",{onClick:()=>R(c),className:"vagus-mcp-btn-press",style:{flex:1,padding:"10px 0",borderRadius:10,fontSize:13,cursor:"pointer",background:C?`linear-gradient(180deg, ${o.color.primary}, ${t?"#3d74e0":"#1d4fd7"})`:t?o.color.bg:"#ffffff",color:C?"#fff":o.color.fg,border:C?"none":`1px solid ${o.color.border}`,fontWeight:C?600:400,boxShadow:C?t?"0 2px 10px rgba(79,140,255,0.30)":"0 2px 10px rgba(37,99,235,0.22)":"none",transition:"all 0.18s ease"},children:c==="stdio"?"stdio(本地命令)":"http(远程)"},c)})})]}),e.jsx("div",{style:{height:1,background:o.color.border,margin:"2px 0 20px",opacity:.7}}),S==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...q},children:[e.jsx("label",{style:re,children:n("命令")}),e.jsx("input",{className:"vagus-mcp-input",style:{...le,fontFamily:"monospace",fontSize:12.5},placeholder:"npx",value:A,onChange:c=>W(c.target.value)})]}),e.jsxs("div",{style:{...q},children:[e.jsx("label",{style:re,children:n("参数")}),e.jsx("input",{className:"vagus-mcp-input",style:{...le,fontFamily:"monospace",fontSize:12.5},placeholder:"-y @modelcontextprotocol/server-memory",value:F,onChange:c=>K(c.target.value)}),e.jsx("div",{style:ge,children:n("多个参数用空格分隔")})]})]}):e.jsxs("div",{style:{...q},children:[e.jsx("label",{style:re,children:"URL"}),e.jsx("input",{className:"vagus-mcp-input",style:{...le,fontFamily:"monospace",fontSize:12.5},placeholder:"https://mcp.example.com",value:H,onChange:c=>D(c.target.value)})]}),e.jsx("div",{style:{height:1,background:o.color.border,margin:"2px 0 20px",opacity:.7}}),e.jsxs("div",{style:{...q},children:[e.jsx("label",{style:re,children:n("超时时间(毫秒)")}),e.jsx("input",{className:"vagus-mcp-input",style:{...le,maxWidth:220},placeholder:"30000",value:a,onChange:c=>k(c.target.value)}),e.jsx("div",{style:ge,children:n("默认 30000 ms(30 秒),设为 0 表示不限制")})]}),S==="stdio"&&e.jsxs("div",{style:{...q,marginBottom:0},children:[e.jsx("label",{style:re,children:n("环境变量(可选)")}),e.jsx("textarea",{className:"vagus-mcp-input",style:{...Ce,minHeight:100},placeholder:JSON.stringify({MY_API_KEY:"your-key"},null,2),value:T,onChange:c=>E(c.target.value)}),e.jsx("div",{style:ge,children:n("JSON 格式,留空则不设置")})]})]}),I==="json"&&e.jsxs("div",{style:{background:o.color.bg,border:`1px solid ${o.color.border}`,borderRadius:16,padding:"22px 24px",boxShadow:ie},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:14},children:[e.jsx(wo,{}),e.jsx("span",{style:{fontSize:12.5,fontWeight:600,color:o.color.fg,letterSpacing:"0.02em"},children:n("完整配置")})]}),e.jsxs("div",{style:{...q,marginBottom:0},children:[e.jsx("textarea",{className:"vagus-mcp-input",style:{...Ce,minHeight:200},placeholder:JSON.stringify({"my-mcp-server":{type:"http",url:""}},null,2),value:h,onChange:c=>J(c.target.value)}),e.jsxs("div",{style:ge,children:["支持 ","{",'"server-name": ',"{...}","}"," 或 ","{",'"mcpServers": ',"{",'"server-name": ',"{...}","}","}",",可一次添加多台"]})]})]})]}),e.jsx("div",{style:{width:340,flexShrink:0,position:"sticky",top:0},children:e.jsxs("div",{style:{background:o.color.bg,border:`1px solid ${o.color.border}`,borderRadius:16,padding:"16px 18px",boxShadow:ie},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:o.color.muted,letterSpacing:"0.06em",textTransform:"uppercase"},children:n("预生成配置")}),e.jsx("button",{onClick:()=>void oe(),style:{border:`1px solid ${o.color.border}`,background:"transparent",borderRadius:6,padding:"3px 8px",fontSize:10.5,color:o.color.muted,cursor:"pointer",transition:"all 0.15s ease"},onMouseEnter:c=>{c.currentTarget.style.borderColor=o.color.primary,c.currentTarget.style.color=o.color.primary},onMouseLeave:c=>{c.currentTarget.style.borderColor=o.color.border,c.currentTarget.style.color=o.color.muted},children:$?"✓ 已复制":"复制"})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12,lineHeight:1.6,whiteSpace:"pre",background:t?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.02)",borderRadius:8,padding:"10px 12px",boxSizing:"border-box",overflow:"visible"},children:V===null?e.jsxs("span",{style:{color:o.color.muted,opacity:.5},children:[`{
|
|
27
|
+
"server-name": {
|
|
28
|
+
}
|
|
29
|
+
`,e.jsx("span",{style:{animation:"vagus-pulse 1.4s ease-in-out infinite"},children:I==="json"?" // 在此粘贴或输入 MCP 配置 JSON":" // 填写左侧表单自动生成"}),`
|
|
30
|
+
}`]}):e.jsxs(e.Fragment,{children:[Co(V),e.jsx("div",{style:{height:4}}),e.jsxs("div",{style:{fontSize:10.5,color:o.color.muted,opacity:.5,whiteSpace:"nowrap"},children:[JSON.stringify(V).length," B"]})]})})]})})]}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:20},children:[e.jsxs("button",{onClick:()=>void je(),className:"vagus-mcp-btn-press",style:Me,onMouseEnter:c=>{c.currentTarget.style.filter="brightness(1.1)"},onMouseLeave:c=>{c.currentTarget.style.filter="none"},children:[e.jsx(Ae,{})," ",w?"保存":"添加"]}),e.jsx("button",{onClick:j,className:"vagus-mcp-btn-press",style:ke,children:n("取消")})]})]})]}),e.jsx("style",{children:`
|
|
31
|
+
:root { --vagus-focus: ${Q}; --vagus-focus-ring: ${be}; }
|
|
32
|
+
`})]})}const De={wrench:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M14.7 6.3a4.5 4.5 0 0 0-6.4 6.4L3 18v3h3l5.3-5.3a4.5 4.5 0 0 0 6.4-6.4l-3 3-2.3-2.3 3-3z"})}),box:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M3 17l9 4 9-4M3 12l9 4 9-4M3 7l9 4 9-4-9-4z"})}),puzzle:e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 7a4 4 0 1 1 3 6.9c-.8-.4-1.3-1.2-1.3-2.1V9h-2.8A2.8 2.8 0 0 1 10 6.2c0-.8.3-1.5.8-2.1A4 4 0 0 1 14 7z"}),e.jsx("path",{d:"M4 14a4 4 0 0 0 6.9 3A4 4 0 0 0 5 12.7h2.8V10A2.8 2.8 0 0 1 11.8 8c.8 0 1.5.3 2.1.8a4 4 0 0 0-3 6.9V14H7.6z"})]})},zo=e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 8v4M12 16h.01"})]});let xe;function To({request:r,t:o}){const{theme:l}=_(),t=l!=="light",[s,u]=f.useState(()=>xe??[]),[i,d]=f.useState(xe===void 0),[p,x]=f.useState(null),[m,g]=f.useState(null),w=f.useCallback(b=>{xe=b,u(b)},[]);f.useEffect(()=>{let b=!1;return(async()=>{try{const v=await r("skills.list");b||(w(v),x(null))}catch(v){!b&&xe===void 0&&x(v instanceof Error?v.message:"加载失败")}finally{b||d(!1)}})(),()=>{b=!0}},[w,r]);const M=f.useCallback(async b=>{g(b.name),x(null);try{const v=await r("skills.setEnabled",{name:b.name,enabled:!b.enabled});w(v)}catch(v){x(v instanceof Error?v.message:"切换失败")}finally{g(null)}},[w,r]),I=s.filter(b=>b.source==="agents").length,z={local:{label:"本地",accent:"#818cf8",icon:"wrench"},agents:{label:"共享",accent:"#34d399",icon:"box"},package:{label:"包",accent:"#f59e0b",icon:"puzzle"},project:{label:"项目",accent:"#3b82f6",icon:"layers"}};return e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:22},children:[e.jsx("h1",{style:{margin:0,fontSize:22,fontWeight:700,letterSpacing:"-0.02em",color:o.color.fg},children:n("技能")}),e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:8,marginTop:8,fontSize:12.5,color:o.color.muted},children:[e.jsx("span",{children:n("全局可复用的技能包,按名称去重")}),!i&&s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",style:{color:o.color.border},children:"·"}),e.jsxs("span",{children:[s.length," 个技能"]}),e.jsx("span",{"aria-hidden":"true",style:{color:o.color.border},children:"·"}),e.jsxs("span",{children:[I," 共享"]})]})]})]}),p&&e.jsxs("div",{role:"alert",style:{display:"flex",alignItems:"flex-start",gap:9,fontSize:12.5,lineHeight:1.55,color:o.color.error,background:t?"rgba(248,81,73,0.09)":"rgba(220,38,38,0.05)",border:`1px solid ${t?"rgba(248,81,73,0.24)":"rgba(220,38,38,0.18)"}`,borderRadius:11,padding:"10px 13px",marginBottom:18},children:[e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{marginTop:1,flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 8v5M12 17h.01"})]}),e.jsx("span",{children:p})]}),i&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,padding:"40px 0",color:o.color.muted,fontSize:13},children:[e.jsx("span",{style:{width:13,height:13,flexShrink:0,border:"2px solid currentColor",borderRightColor:"transparent",borderRadius:"50%",animation:"sk-spin 700ms linear infinite"}}),n("正在读取技能…")]}),!i&&s.length===0&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:200,color:o.color.muted},children:[e.jsx("div",{style:{width:42,height:42,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",color:o.color.muted,background:t?"rgba(15,17,23,0.5)":"rgba(245,246,250,0.9)",marginBottom:12},children:De.box}),e.jsx("div",{style:{color:o.color.fg,fontSize:14,fontWeight:650},children:n("暂无全局技能")}),e.jsx("div",{style:{marginTop:5,fontSize:12.5},children:n("在 ~/.pi/agent/skills/ 或 ~/.agents/skills/ 添加 SKILL.md。")})]}),!i&&s.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:s.map((b,v)=>{const S=z[b.source]??{label:"其他",accent:"#8b90a0",icon:"box"},R=v===s.length-1;return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) auto",alignItems:"center",gap:13,padding:"11px 10px",borderRadius:10,borderBottom:R?"none":`1px solid ${o.color.border}`,transition:"background 140ms ease",opacity:m===b.name?.6:1},onMouseEnter:A=>{A.currentTarget.style.background=t?"rgba(129,140,248,0.07)":"rgba(99,102,241,0.05)"},onMouseLeave:A=>{A.currentTarget.style.background="transparent"},children:[e.jsx("div",{style:{width:38,height:38,borderRadius:10,flexShrink:0,background:`${S.accent}16`,color:S.accent,border:`1px solid ${S.accent}28`,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{transform:"scale(1.1)",display:"flex"},children:De[S.icon]??zo})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7},children:[e.jsx("h3",{style:{margin:0,fontSize:13.5,lineHeight:1.3,fontWeight:660,color:o.color.fg},children:b.name}),e.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,lineHeight:1,fontWeight:650,color:S.accent,background:`${S.accent}16`,border:`1px solid ${S.accent}28`,borderRadius:999,padding:"2.5px 7px"},children:S.label})]}),b.description&&e.jsx("p",{style:{margin:"3px 0 0",fontSize:12,lineHeight:1.5,color:o.color.muted,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.description}),e.jsx("div",{style:{marginTop:4,fontSize:10.5,color:o.color.muted,fontFamily:o.font.mono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.path})]}),e.jsx("button",{role:"switch","aria-checked":b.enabled,"aria-label":`${b.enabled?"禁用":"启用"}技能 ${b.name}`,disabled:m===b.name,onClick:()=>void M(b),style:{width:40,height:22,borderRadius:99,border:"none",cursor:"pointer",position:"relative",flexShrink:0,background:b.enabled?"linear-gradient(120deg, #818cf8, #8b5cf6)":o.color.border,transition:"background 150ms ease"},children:e.jsx("span",{style:{position:"absolute",top:2,left:b.enabled?20:2,width:18,height:18,borderRadius:"50%",background:"#fff",boxShadow:"0 1px 3px rgba(0,0,0,0.25)",transition:"left 150ms ease"}})})]},`${b.source}:${b.name}`)})}),e.jsx("style",{children:`
|
|
33
|
+
@keyframes sk-spin { to { transform: rotate(360deg); } }
|
|
34
|
+
@media (prefers-reduced-motion: reduce) {
|
|
35
|
+
[data-theme] * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
|
|
36
|
+
}
|
|
37
|
+
`})]})}function $o({providers:r,usageStats:o,onClose:l,onSave:t,onRefresh:s,onTest:u,cat:i,onCatChange:d,onProbe:p,request:x,projectCwd:m}){const g=te(),w=Ve();Ne();const[M,I]=f.useState(()=>({uiFontSize:w.uiFontSize,showLineNumbers:w.showLineNumbers,wrapLongLines:w.wrapLongLines,codeFontSize:w.codeFontSize})),z=W=>I(F=>({...F,...W})),b=()=>{w.update(M),l()},v=W=>({display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:9,fontSize:13,cursor:"pointer",background:W?g.color.surface:"transparent",color:W?g.color.fg:g.color.muted,fontWeight:W?500:400}),S={fontSize:11,fontWeight:600,color:g.color.muted,padding:"14px 10px 6px",letterSpacing:"0.05em"},{theme:R}=_(),A={width:"100%",background:R==="light"?"#ffffff":g.color.surface,border:`1px solid ${g.color.border}`,borderRadius:8,padding:"8px 12px",fontSize:13,outline:"none",color:g.color.fg};return e.jsxs("div",{style:{flex:1,display:"flex",minHeight:0,background:g.color.bg,fontSize:14},children:[e.jsxs("aside",{style:{width:220,flexShrink:0,borderRight:`1px solid ${g.color.border}`,padding:"20px 12px",display:"flex",flexDirection:"column",gap:4,overflowY:"auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0 10px 14px"},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:g.color.fg},children:n("设置")}),e.jsx("button",{onClick:b,style:{marginLeft:"auto",border:"none",background:"none",color:g.color.muted,fontSize:12,cursor:"pointer"},children:n("← 返回")})]}),e.jsx("div",{style:S,children:n("基础设置")}),e.jsxs("div",{style:v(i==="appearance"),onClick:()=>d("appearance"),children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:e.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"})}),n("外观")]}),e.jsxs("div",{style:v(i==="models"),onClick:()=>d("models"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[e.jsx("path",{d:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n("模型设置")]}),e.jsx("div",{style:S,children:n("Agents 能力")}),e.jsxs("div",{style:v(i==="mcp"),onClick:()=>d("mcp"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[e.jsx("path",{d:"M4 20h4l10-10a2.83 2.83 0 0 0-4-4L4 16v4z"}),e.jsx("path",{d:"M13.5 6.5l4 4"})]}),n("MCP 服务器")]}),e.jsxs("div",{style:v(i==="skills"),onClick:()=>d("skills"),children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:e.jsx("path",{d:"M14.7 6.3a4.5 4.5 0 0 0-6.4 6.4L3 18v3h3l5.3-5.3a4.5 4.5 0 0 0 6.4-6.4l-3 3-2.3-2.3 3-3z"})}),n("技能")]}),e.jsx("div",{style:S,children:n("数据与统计")}),e.jsxs("div",{style:v(i==="usage"),onClick:()=>d("usage"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[e.jsx("path",{d:"M3 3v18h18"}),e.jsx("path",{d:"M7 14l4-4 3 3 5-6"})]}),n("使用统计")]})]}),e.jsx("main",{style:{flex:1,overflowY:"auto",minWidth:0,padding:"28px 36px 60px",scrollbarGutter:"stable"},children:e.jsxs("div",{style:{maxWidth:980,margin:"0 auto"},children:[i==="usage"&&e.jsx(ho,{stats:o,t:g}),i==="models"&&e.jsx(so,{providers:r,inputStyle:A,t:g,onSave:t,onRefresh:s,onTest:u,onProbe:p}),i==="appearance"&&e.jsx(ao,{draft:M,onChange:z,t:g}),i==="mcp"&&e.jsx(Mo,{request:x,t:g}),i==="skills"&&e.jsx(To,{request:x,t:g})]})})]})}const Lo=["npm:@foo/pi-tools","git:github.com/user/repo","/absolute/path/to/package"],we="linear-gradient(120deg, #818cf8 0%, #a78bfa 55%, #c084fc 100%)";let he;function Wo(r){const o=[];return r.resources.extensions>0&&o.push(`${r.resources.extensions} 扩展`),r.resources.skills>0&&o.push(`${r.resources.skills} 技能`),r.resources.prompts>0&&o.push(`${r.resources.prompts} 模板`),r.resources.themes>0&&o.push(`${r.resources.themes} 主题`),o.length>0?o.join(" · "):"未声明资源"}function Ro({request:r,t:o,onClose:l}){const{theme:t}=_(),s=t!=="light",[u,i]=f.useState(()=>he??[]),[d,p]=f.useState(he===void 0),[x,m]=f.useState(null),[g,w]=f.useState(null),[M,I]=f.useState(""),[z,b]=f.useState(!1),[v,S]=f.useState(null),R=f.useCallback(a=>{he=a,i(a)},[]),A=f.useCallback(async()=>{const a=await r("plugin.list");R(a),m(null)},[R,r]);f.useEffect(()=>{let a=!1;return(async()=>{try{const k=await r("plugin.list");a||(R(k),m(null))}catch(k){!a&&he===void 0&&m(k instanceof Error?k.message:"加载失败")}finally{a||p(!1)}})(),()=>{a=!0}},[R,r]);const W=async a=>{const k=a.trim();if(!k){m("请输入包源,例如 npm:@foo/pi-tools");return}b(!0),m(null);try{const T=await r("plugin.install",{source:k});if(!T.ok){m(T.error??"安装失败");return}I(""),await A()}catch(T){m(T instanceof Error?T.message:"安装失败")}finally{b(!1)}},F=async a=>{w(a),m(null);try{const k=await r("plugin.uninstall",{source:a});if(!k.ok){m(k.error??"卸载失败");return}await A()}catch(k){m(k instanceof Error?k.message:"卸载失败")}finally{w(null)}},K=u.reduce((a,k)=>(a.extensions+=k.resources.extensions,a.skills+=k.resources.skills,a.prompts+=k.resources.prompts,a.themes+=k.resources.themes,a),{extensions:0,skills:0,prompts:0,themes:0});return e.jsxs("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",background:o.color.bg,color:o.color.fg,overflow:"hidden",fontFamily:o.font.sans},children:[e.jsx("style",{children:`
|
|
38
|
+
.piweb-pkg * { box-sizing: border-box; }
|
|
39
|
+
.piweb-pkg-back:focus-visible, .piweb-pkg-action:focus-visible, .piweb-pkg-install:focus-visible {
|
|
40
|
+
outline: 3px solid rgba(129,140,248,0.4);
|
|
41
|
+
outline-offset: 2px;
|
|
42
|
+
}
|
|
43
|
+
.piweb-pkg-action:active:not(:disabled) { transform: scale(0.97); }
|
|
44
|
+
.piweb-pkg-action:disabled { cursor: wait !important; opacity: 0.6; }
|
|
45
|
+
.piweb-pkg-spinner {
|
|
46
|
+
width: 13px; height: 13px; flex-shrink: 0;
|
|
47
|
+
border: 2px solid currentColor;
|
|
48
|
+
border-right-color: transparent;
|
|
49
|
+
border-radius: 50%;
|
|
50
|
+
animation: piweb-pkg-spin 700ms linear infinite;
|
|
51
|
+
}
|
|
52
|
+
@keyframes piweb-pkg-spin { to { transform: rotate(360deg); } }
|
|
53
|
+
@media (prefers-reduced-motion: reduce) {
|
|
54
|
+
.piweb-pkg *, .piweb-pkg *::before, .piweb-pkg *::after {
|
|
55
|
+
animation-duration: 0.01ms !important;
|
|
56
|
+
animation-iteration-count: 1 !important;
|
|
57
|
+
transition-duration: 0.01ms !important;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`}),e.jsxs("header",{style:{flex:"none",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"0 18px",height:54,borderBottom:`1px solid ${o.color.border}`,background:s?"rgba(15,17,23,0.88)":"rgba(255,255,255,0.9)",backdropFilter:"blur(12px)",position:"relative",zIndex:2},children:[e.jsx("div",{style:{position:"absolute",left:0,right:0,top:0,height:2,background:we,opacity:.9,pointerEvents:"none"}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("button",{className:"piweb-pkg-back",onClick:l,"aria-label":n("返回上一页"),style:{width:40,height:40,border:`1px solid ${o.color.border}`,borderRadius:9,background:"transparent",color:o.color.muted,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"color 150ms ease, border-color 150ms ease, background 150ms ease"},onMouseEnter:a=>{a.currentTarget.style.color="#a5b4fc",a.currentTarget.style.borderColor="rgba(129,140,248,0.5)",a.currentTarget.style.background="rgba(129,140,248,0.09)"},onMouseLeave:a=>{a.currentTarget.style.color=o.color.muted,a.currentTarget.style.borderColor=o.color.border,a.currentTarget.style.background="transparent"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),e.jsx("div",{style:{fontSize:14,fontWeight:680,letterSpacing:"-0.01em",color:o.color.fg},children:n("Pi 包管理")})]}),e.jsxs("div",{"aria-live":"polite",style:{display:"inline-flex",alignItems:"center",gap:7,fontSize:11.5,fontWeight:550,color:o.color.muted},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}),u.filter(a=>a.installed).length," 已安装"]}),K.extensions>0&&e.jsxs("span",{children:["· ",K.extensions," 扩展"]})]})]}),e.jsx("main",{className:"piweb-pkg-scroll",style:{flex:1,overflowY:"auto",padding:"26px 32px 60px",scrollbarGutter:"stable",background:s?"radial-gradient(1100px 380px at 50% -140px, rgba(99,102,241,0.14), transparent 72%)":"radial-gradient(1100px 380px at 50% -140px, rgba(99,102,241,0.09), transparent 72%)"},children:e.jsxs("div",{style:{width:"100%",maxWidth:980,margin:"0 auto"},children:[e.jsxs("div",{style:{marginBottom:22,textAlign:"center"},children:[e.jsx("h1",{style:{margin:0,fontSize:28,lineHeight:1.15,fontWeight:760,letterSpacing:"-0.025em",background:we,WebkitBackgroundClip:"text",backgroundClip:"text",color:"transparent"},children:n("Pi 包管理")}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flexWrap:"wrap",gap:8,marginTop:9,fontSize:12.5,color:o.color.muted},children:[e.jsx("span",{children:n("与 pi CLI 完全互通 —— 这里安装的包,")}),e.jsx("code",{style:{fontFamily:o.font.mono,fontSize:11.5,color:o.color.fg,background:o.color.surface,padding:"1px 6px",borderRadius:5},children:"pi list"}),e.jsx("span",{children:n("同样可见,反之亦然")})]})]}),e.jsxs("div",{style:{display:"flex",gap:9,marginBottom:22,padding:14,borderRadius:14,background:s?"rgba(129,140,248,0.06)":"rgba(99,102,241,0.05)",border:`1px solid ${s?"rgba(129,140,248,0.18)":"rgba(99,102,241,0.16)"}`},children:[e.jsx("input",{className:"piweb-pkg-install",value:M,onChange:a=>I(a.target.value),onKeyDown:a=>{a.key==="Enter"&&W(M)},placeholder:n("输入包源安装,例如 npm:@foo/pi-tools"),"aria-label":n("Pi 包源"),style:{flex:1,minWidth:0,height:40,borderRadius:9,border:`1px solid ${o.color.border}`,background:s?"rgba(0,0,0,0.25)":"#ffffff",padding:"0 13px",fontSize:13,fontFamily:o.font.mono,color:o.color.fg,outline:"none"},onFocus:a=>{a.currentTarget.style.borderColor="rgba(129,140,248,0.6)"},onBlur:a=>{a.currentTarget.style.borderColor=o.color.border}}),e.jsxs("button",{className:"piweb-pkg-action",onClick:()=>void W(M),disabled:z,style:{height:40,padding:"0 20px",borderRadius:9,border:"none",background:we,color:"#fff",fontSize:13,fontWeight:650,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:7,boxShadow:"0 4px 12px rgba(99,102,241,0.24)"},children:[z&&e.jsx("span",{className:"piweb-pkg-spinner"}),z?"安装中":"安装"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:20,fontSize:11.5,color:o.color.muted,flexWrap:"wrap"},children:[e.jsx("span",{children:n("支持:")}),Lo.map(a=>e.jsx("button",{onClick:()=>I(a),style:{fontFamily:o.font.mono,fontSize:11,color:"#a5b4fc",background:"rgba(129,140,248,0.09)",border:`1px solid ${s?"rgba(129,140,248,0.22)":"rgba(99,102,241,0.18)"}`,borderRadius:999,padding:"3px 9px",cursor:"pointer"},children:a},a)),e.jsx("span",{"aria-hidden":"true",style:{color:o.color.border},children:"·"}),e.jsx("span",{children:e.jsx("a",{href:"https://pi.dev/packages",target:"_blank",rel:"noreferrer",style:{color:"#a5b4fc",textDecoration:"none"},children:n("浏览 pi.dev/packages ↗")})})]}),x&&e.jsxs("div",{role:"alert",style:{display:"flex",alignItems:"flex-start",gap:9,fontSize:12.5,lineHeight:1.55,color:o.color.error,background:s?"rgba(248,81,73,0.09)":"rgba(220,38,38,0.05)",border:`1px solid ${s?"rgba(248,81,73,0.24)":"rgba(220,38,38,0.18)"}`,borderRadius:11,padding:"10px 13px",marginBottom:18},children:[e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{marginTop:1,flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 8v5M12 17h.01"})]}),e.jsx("span",{children:x})]}),d&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:11,padding:"40px 0",color:o.color.muted,fontSize:13},children:[e.jsx("span",{className:"piweb-pkg-spinner"}),n("正在读取已安装的包…")]}),!d&&u.length===0&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:220,color:o.color.muted},children:[e.jsx("div",{style:{width:42,height:42,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",color:"#a5b4fc",background:"rgba(129,140,248,0.1)",marginBottom:12,fontSize:18},children:"📦"}),e.jsx("div",{style:{color:o.color.fg,fontSize:14,fontWeight:650},children:n("还没有安装任何 pi 包")}),e.jsxs("div",{style:{marginTop:5,fontSize:12.5,textAlign:"center"},children:[n("在上面输入")," ",e.jsx("code",{style:{fontFamily:o.font.mono,fontSize:11.5,color:o.color.fg},children:n("npm:@包名")})," 安装,或到"," ",e.jsx("a",{href:"https://pi.dev/packages",target:"_blank",rel:"noreferrer",style:{color:"#a5b4fc"},children:"pi.dev/packages"})," ","浏览生态。"]})]}),!d&&u.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:u.map(a=>{const k=v===a.source,T=g===a.source;return e.jsxs("article",{className:"piweb-pkg-row",onMouseEnter:()=>S(a.source),onMouseLeave:()=>S(null),style:{display:"flex",alignItems:"center",gap:13,padding:"12px 14px",borderRadius:12,border:`1px solid ${o.color.border}`,background:k?s?"rgba(129,140,248,0.07)":"rgba(99,102,241,0.04)":"transparent",borderLeft:k?"3px solid #818cf8":"3px solid transparent",paddingLeft:k?11:14,transition:"background 140ms ease, border-left-color 140ms ease, padding-left 140ms ease",opacity:T?.6:1},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:10,flexShrink:0,background:"rgba(129,140,248,0.1)",color:"#a5b4fc",border:"1px solid rgba(129,140,248,0.22)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M14 7a4 4 0 1 1 3 6.9c-.8-.4-1.3-1.2-1.3-2.1V9h-2.8A2.8 2.8 0 0 1 10 6.2c0-.8.3-1.5.8-2.1A4 4 0 0 1 14 7z"}),e.jsx("path",{d:"M4 14a4 4 0 0 0 6.9 3A4 4 0 0 0 5 12.7h2.8V10A2.8 2.8 0 0 1 11.8 8c.8 0 1.5.3 2.1.8a4 4 0 0 0-3 6.9V14H7.6z"})]})}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("code",{style:{fontSize:12.5,fontWeight:650,color:o.color.fg,fontFamily:o.font.mono},children:a.source}),e.jsx("span",{style:{fontSize:10,fontWeight:650,letterSpacing:"0.02em",color:a.scope==="user"?"#a5b4fc":o.color.muted,background:a.scope==="user"?"rgba(129,140,248,0.1)":"transparent",border:`1px solid ${a.scope==="user"?"rgba(129,140,248,0.25)":o.color.border}`,borderRadius:999,padding:"2px 7px"},children:a.scope==="user"?"全局":"项目"}),a.installed?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,fontWeight:650,color:"#3fb950",background:"rgba(63,185,80,0.09)",border:"1px solid rgba(63,185,80,0.16)",borderRadius:999,padding:"2.5px 7px"},children:[e.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}),n("已安装")]}):e.jsx("span",{style:{fontSize:10,fontWeight:650,color:o.color.warning,background:"rgba(210,153,34,0.09)",border:"1px solid rgba(210,153,34,0.18)",borderRadius:999,padding:"2.5px 7px"},children:n("未安装")})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:7,marginTop:4,fontSize:11,color:o.color.muted},children:[e.jsx("span",{children:Wo(a)}),a.installedPath&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",style:{color:o.color.border},children:"·"}),e.jsx("code",{style:{fontFamily:o.font.mono,fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:300},children:a.installedPath})]})]})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:e.jsxs("button",{className:"piweb-pkg-action",onClick:()=>void F(a.source),disabled:T,"aria-label":`卸载 ${a.source}`,style:{minHeight:34,borderRadius:8,padding:"0 13px",fontSize:12,cursor:"pointer",fontWeight:600,border:`1px solid ${o.color.border}`,background:"transparent",color:o.color.fg,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},onMouseEnter:E=>{T||(E.currentTarget.style.borderColor=o.color.error,E.currentTarget.style.color=o.color.error,E.currentTarget.style.background=s?"rgba(248,81,73,0.06)":"rgba(220,38,38,0.04)")},onMouseLeave:E=>{E.currentTarget.style.borderColor=o.color.border,E.currentTarget.style.color=o.color.fg,E.currentTarget.style.background="transparent"},children:[T&&e.jsx("span",{className:"piweb-pkg-spinner"}),T?"卸载中":"卸载"]})})]},a.source)})}),e.jsxs("div",{style:{marginTop:26,fontSize:11.5,lineHeight:1.7,color:o.color.muted,textAlign:"center"},children:[n("在 pi TUI 中用")," ",e.jsx("code",{style:{fontFamily:o.font.mono,fontSize:11,color:o.color.fg},children:n("pi install npm:<包名>")})," ",n("安装的包同样出现在这里。"),e.jsx("br",{}),n("卸载请到 TUI 使用")," ",e.jsx("code",{style:{fontFamily:o.font.mono,fontSize:11,color:o.color.fg},children:"pi remove"}),n(",或在这里点击“卸载”。")]})]})})]})}export{Mo as McpView,Ro as PluginsView,$o as SettingsView};
|