PageSourceSearch

https://inference.club/_nuxt/C_rOQzyi.js

js inference.club collected 2026-09-24 12:30:24 UTC 13,761 bytes, 6 lines download raw bytes

1import{e as Z,G as K,f as Q,i as ee,H as te,c as a,a as t,g,b as f,d as u,h as c,l as k,E as _,t as l,p as I,F as z,r as C,o,I as P,n as V}from"./DdRirg_F.js";import{s as U}from"./BN3NQjU0.js";import{_ as se}from"./CJsQHrVp.js";import{u as oe}from"./rt51KvPn.js";import{C as re}from"./CT6oeXmt.js";import{R as ae}from"./DgI_Fsgj.js";import{T as O}from"./CZuNODCi.js";import{L as N}from"./BPUnTXX5.js";import{B as ne}from"./p1Qte30L.js";import{S as le}from"./llS6sEYV.js";import{C as de}from"./CG73N2kr.js";import{A as ie}from"./DOcZEn-G.js";import{S as ue}from"./3Ehr0cgQ.js";import{P as ce}from"./D1Lb80-q.js";import"./x_rD_Ya3.js";/**
2 * @license lucide-vue-next v0.503.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const me=Z("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);function pe(){const S=`${K().public.apiBase}/api/inference/control`,E=()=>{var i;return(i=document.cookie.split("; ").find(x=>x.startsWith("csrftoken=")))==null?void 0:i.split("=")[1]};return{loadBoard:async()=>{const i=await fetch(`${S}/`,{credentials:"include"});if(i.status===401||i.status===403)throw new Error("unauthorized");if(!i.ok)throw new Error("Failed to load control board");return i.json()},scale:async(i,x,p)=>{const v=E(),b=await fetch(`${S}/scale/`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...v?{"X-CSRFToken":v}:{}},body:JSON.stringify({provider_id:i,deployment:x,replicas:p})});if(!b.ok){const B=await b.json().catch(()=>({}));throw new Error(B.detail||"Scale failed")}return b.json()}}}const ge={class:"mx-auto w-full max-w-6xl px-3 py-6 sm:px-6"},fe={class:"mb-5 flex items-start justify-between gap-3"},xe={class:"flex items-center gap-2 text-2xl font-bold"},be=["disabled"],ve={key:0,class:"mb-4 flex items-start gap-2 rounded-lg border border-rose-400/60 bg-rose-500/10 p-3 text-sm text-rose-700 dark:text-rose-300"},_e={key:1,class:"py-16 text-center text-muted-foreground"},he={key:2,class:"rounded-lg border border-amber-400/60 bg-amber-500/10 p-4 text-sm text-amber-700 dark:text-amber-300"},ye={key:3,class:"flex items-start gap-2 rounded-lg border border-rose-400/60 bg-rose-500/10 p-4 text-sm text-rose-700 dark:text-rose-300"},ke={key:4,class:"rounded-lg border bg-background p-6 text-center text-sm text-muted-foreground"},we={class:"mb-3 flex flex-wrap items-center gap-x-3 gap-y-1"},ze={class:"flex items-center gap-2"},Ce={class:"font-semibold"},Se={key:0,class:"rounded bg-amber-500/15 px-1.5 py-0.5 text-2xs font-medium uppercase tracking-wide text-amber-600 dark:text-amber-400"},Me={class:"grid gap-4 sm:grid-cols-2"},Be={class:"mb-3 flex items-start justify-between gap-2"},$e={class:"flex items-center gap-2"},Pe={class:"text-lg font-bold"},Ve={key:0,class:"rounded bg-muted px-1.5 py-0.5 text-2xs font-medium uppercase tracking-wide text-muted-foreground"},Ee={class:"text-xs text-muted-foreground"},Re={key:0,class:"rounded bg-emerald-500/15 px-2 py-0.5 text-2xs font-semibold uppercase tracking-wide text-emerald-600 dark:text-emerald-400"},Te={key:1,class:"inline-flex items-center gap-1 rounded bg-muted px-2 py-0.5 text-2xs font-semibold uppercase tracking-wide text-muted-foreground"},Ae={class:"mb-3 grid grid-cols-2 gap-3"},je={class:"mb-1 flex items-center gap-1 text-2xs font-medium uppercase tracking-wide text-muted-foreground"},Ge={class:"text-sm"},Le={class:"text-base font-bold"},Ne={class:"mt-1 flex h-2 w-full overflow-hidden rounded-full bg-muted"},Fe=["title"],Ie={class:"mt-0.5 text-2xs text-muted-foreground"},Ue={key:0},Oe={class:"mb-1 flex items-center gap-1 text-2xs font-medium uppercase tracking-wide text-muted-foreground"},Ye={class:"text-sm"},qe={class:"text-base font-bold"},He={key:0,class:"text-muted-foreground"},We={class:"mt-1 h-1.5 w-full overflow-hidden rounded-full bg-muted"},De={key:0,class:"space-y-1.5"},Je=["src"],Xe={key:1,class:"grid size-5 place-items-center rounded bg-muted text-2xs"},Ze={class:"min-w-0 flex-1"},Ke={class:"flex items-center gap-1.5"},Qe={class:"truncate text-sm font-medium"},et={class:"flex items-center gap-1.5 text-2xs"},tt={key:0,class:"text-muted-foreground"},st=["disabled","onClick"],ot={key:1,class:"rounded-lg border border-dashed px-2.5 py-3 text-center text-xs text-muted-foreground"},rt={key:2,class:"mt-3"},at={class:"space-y-1.5"},nt=["src"],lt={key:1,class:"grid size-5 place-items-center rounded bg-muted text-2xs text-muted-foreground"},dt={class:"min-w-0 flex-1"},it={class:"truncate text-sm"},ut={class:"text-2xs"},ct={class:"text-muted-foreground"},mt=["disabled","onClick"],pt={key:0,class:"mt-3 text-xs text-muted-foreground"},gt={key:5,class:"mt-2 text-2xs text-muted-foreground"},Pt=Q({__name:"control",setup(Y){const{loadBoard:S,scale:E}=pe(),M=k(null),h=k(!0),i=k(""),x=k(new Set),p=k({}),v=k(""),b=async()=>{try{M.value=await S(),i.value=""}catch(n){i.value=n.message==="unauthorized"?"unauthorized":"failed"}finally{h.value=!1}},B=async(n,e,d)=>{if(!x.value.has(e.deployment)&&!(d===0&&!confirm(`Park ${e.name} (${e.deployment})? It will stop serving and free its VRAM.`))){v.value="",x.value=new Set(x.value).add(e.deployment),p.value={...p.value,[e.deployment]:d===1?"starting":"stopping"};try{await E(n,e.deployment,d)}catch(r){v.value=`${e.name}: ${r.message}`,delete p.value[e.deployment],p.value={...p.value}}finally{const r=new Set(x.value);r.delete(e.deployment),x.value=r,setTimeout(async()=>{await b(),delete p.value[e.deployment],p.value={...p.value}},1500)}}},R=n=>p.value[n.deployment]??n.state,$=n=>x.value.has(n.deployment),{pause:q,resume:H}=oe(b,15e3,{immediate:!1});ee(()=>{b(),H()}),te(()=>q());const T=I(()=>{var n;return((n=M.value)==null?void 0:n.providers)??[]}),W=I(()=>!h.value&&!i.value&&T.value.length===0),y=n=>n==null?"—":`${n.toFixed(1)}`,A=n=>n==null?null:Math.round(n),j=n=>{const e=n.gpu.vram_total_gb;if(!e||e<=0)return{segments:[],otherPct:0};const d=n.services.filter(m=>(m.live_vram_gb??0)>0).map(m=>({name:m.name,gb:m.live_vram_gb,pct:Math.min(100,m.live_vram_gb/e*100),color:U(m.name,m.type)})).sort((m,w)=>w.gb-m.gb),r=d.reduce((m,w)=>m+w.gb,0),s=n.gpu.vram_used_gb??r,L=Math.max(0,Math.min(100-d.reduce((m,w)=>m+w.pct,0),(s-r)/e*100));return{segments:d,otherPct:L}},D=n=>U(n.name,n.type),G={running:{label:"running",dot:"bg-emerald-500",text:"text-emerald-600 dark:text-emerald-400"}
6,starting:{label:"starting",dot:"bg-amber-500 animate-pulse",text:"text-amber-600 dark:text-amber-400"},stopping:{label:"stopping",dot:"bg-amber-500 animate-pulse",text:"text-amber-600 dark:text-amber-400"},parked:{label:"parked",dot:"bg-muted-foreground/40",text:"text-muted-foreground"},failed:{label:"failed",dot:"bg-rose-500",text:"text-rose-600 dark:text-rose-400"}},J={llm:"bg-sky-500/15 text-sky-600 dark:text-sky-400",stt:"bg-violet-500/15 text-violet-600 dark:text-violet-400",tts:"bg-fuchsia-500/15 text-fuchsia-600 dark:text-fuchsia-400",image:"bg-amber-500/15 text-amber-600 dark:text-amber-400",video:"bg-rose-500/15 text-rose-600 dark:text-rose-400",music:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",mesh:"bg-teal-500/15 text-teal-600 dark:text-teal-400"},X=n=>J[n]??"bg-muted text-muted-foreground",F=n=>n.fits===!0?{label:"fits",cls:"text-emerald-600 dark:text-emerald-400"}:n.fits===!1?{label:"won't fit",cls:"text-rose-600 dark:text-rose-400"}:{label:"fit unknown",cls:"text-muted-foreground"};return(n,e)=>(o(),a("div",ge,[t("div",fe,[t("div",null,[t("h1",xe,[f(c(re),{class:"size-6 text-primary"}
6),e[0]||(e[0]=u(" Control center ",-1))]),e[1]||(e[1]=t("p",{class:"text-sm text-muted-foreground"}," Your GPU boxes at a glance — what's running, how much VRAM is free, and what fits. ",-1))]),t("button",{class:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-muted",disabled:h.value,onClick:b},[f(c(ae),{class:_(["size-3.5",h.value?"animate-spin":""])},null,8,["class"]),e[2]||(e[2]=u(" Refresh ",-1))],8,be)]),v.value?(o(),a("div",ve,[f(c(O),{class:"mt-0.5 size-4 shrink-0"}),u(" "+l(v.value),1)])):g("",!0),h.value&&!M.value?(o(),a("div",_e,[f(c(N),{class:"mx-auto mb-2 size-6 animate-spin"}),e[3]||(e[3]=u(" Loading your cluster… ",-1))])):i.value==="unauthorized"?(o(),a("div",he," You need to be signed in as the cluster owner to use the control center. ")):i.value==="failed"?(o(),a("div",ye,[f(c(O),{class:"mt-0.5 size-4 shrink-0"}),e[4]||(e[4]=u(" Couldn't load the control board. It will retry automatically. ",-1))])):W.value?(o(),a("div",ke,[f(c(ne),{class:"mx-auto mb-2 size-6"}),e[5]||(e[5]=u(" No cluster is opted in yet. Enable ",-1)),e[6]||(e[6]=t("span",{class:"font-medium"},"cluster control",-1)),e[7]||(e[7]=u(" on one of your kubernetes providers to manage its inference services here. ",-1))])):g("",!0),(o(!0),a(z,null,C(T.value,d=>(o(),a("div",{key:d.provider.id,class:"mb-8"},[t("div",we,[t("div",ze,[f(c(le),{class:"size-4 text-muted-foreground"}),t("span",Ce,l(d.provider.name),1),f(se,{online:d.provider.online},null,8,["online"])]),d.provider.has_live_state?g("",!0):(o(),a("span",Se," no live telemetry — agent offline "))]),t("div",Me,[(o(!0),a(z,null,C(d.boxes,r=>(o(),a("div",{key:r.box,class:_(["rounded-xl border bg-card p-4",r.schedulable?"":"opacity-70"])},[t("div",Be,[t("div",null,[t("div",$e,[t("span",Pe,l(r.box),1),r.arch?(o(),a("span",Ve,l(r.arch),1)):g("",!0)]),t("div",Ee,l(r.gpu.count)+"× "+l(r.gpu.model||"GPU"),1)]),r.schedulable?(o(),a("span",Re," schedulable ")):(o(),a("span",Te,[f(c(de),{class:"size-3"}),u(" "+l(r.unschedulable_reason||"unavailable"),1)]))]),t("div",Ae,[t("div",null,[t("div",je,[f(c(me),{class:"size-3"}),e[8]||(e[8]=u(" VRAM ",-1))]),t("div",Ge,[t("span",Le,l(y(r.gpu.vram_free_gb)),1),e[9]||(e[9]=t("span",{class:"text-muted-foreground"}," GB free",-1))]),t("div",Ne,[(o(!0),a(z,null,C(j(r).segments,s=>(o(),a("div",{key:s.name,class:"h-full first:rounded-l-full",style:P({width:`${s.pct}%`,backgroundColor:s.color}),title:`${s.name} · ${y(s.gb)} GB`},null,12,Fe))),128)),j(r).otherPct>0?(o(),a("div",{key:0,class:"h-full bg-muted-foreground/40",style:P({width:`${j(r).otherPct}%`}),title:"other / unattributed"},null,4)):g("",!0)]),t("div",Ie,[u(l(y(r.gpu.vram_used_gb))+" / "+l(y(r.gpu.vram_total_gb))+" GB ",1),r.gpu.unified?(o(),a("span",Ue,"· unified")):g("",!0)])]),t("div",null,[t("div",Oe,[f(c(ie),{class:"size-3"}),e[10]||(e[10]=u(" Utilization ",-1))]),t("div",Ye,[t("span",qe,l(A(r.gpu.utilization_pct)??"—"),1),A(r.gpu.utilization_pct)!=null?(o(),a("span",He,"%")):g("",!0)]),t("div",We,[t("div",{class:"h-full rounded-full bg-sky-500",style:P({width:`${A(r.gpu.utilization_pct)??0}%`})},null,4)])])]),r.services.length?(o(),a("div",De,[(o(!0),a(z,null,C(r.services,s=>(o(),a("div",{key:s.name,class:"flex items-center gap-2 rounded-lg border bg-background px-2.5 py-1.5",style:P(s.live_vram_gb?{borderLeftColor:D(s),borderLeftWidth:"3px"}:{})},[s.logo_url?(o(),a("img",{key:0,src:s.logo_url,alt:"",class:"size-5 rounded object-contain"},null,8,Je)):(o(),a("span",Xe,l(s.name.slice(0,2)),1)),t("div",Ze,[t("div",Ke,[t("span",Qe,l(s.name),1),t("span",{class:_(["rounded px-1 py-0.5 text-2xs font-semibold uppercase",X(s.type)])},l(s.type),3)]),t("div",et,[t("span",{class:_(["inline-flex items-center gap-1",G[R(s)].text])},[t("span",{class:_(["inline-block size-1.5 rounded-full",G[R(s)].dot])},null,2),u(" "+l(G[R(s)].label),1)],2),s.live_vram_gb!=null?(o(),a("span",tt," · "+l(y(s.live_vram_gb))+" GB ",1)):g("",!0)])]),t("button",{class:"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-2xs hover:bg-muted disabled:opacity-50",disabled:$(s),title:"Park (scale to 0)",onClick:L=>
6B(d.provider.id,s,0)},[$(s)?(o(),V(c(N),{key:0,class:"size-3 animate-spin"})):(o(),V(c(ue),{key:1,class:"size-3"})),e[11]||(e[11]=u(" Stop ",-1))],8,st)],4))),128))])):(o(),a("div",ot," Nothing running here ")),r.startable.length?(o(),a("div",rt,[e[13]||(e[13]=t("div",{class:"mb-1 text-2xs font-medium uppercase tracking-wide text-muted-foreground"}," Start a service here ",-1)),t("div",at,[(o(!0),a(z,null,C(r.startable,s=>(o(),a("div",{key:s.name,class:"flex items-center gap-2 rounded-lg border border-dashed bg-background/60 px-2.5 py-1.5"},[s.logo_url?(o(),a("img",{key:0,src:s.logo_url,alt:"",class:"size-5 rounded object-contain opacity-70"},null,8,nt)):(o(),a("span",lt,l(s.name.slice(0,2)),1)),t("div",dt,[t("span",it,l(s.name),1),t("div",ut,[t("span",{class:_(F(s).cls)},l(F(s).label),3),t("span",ct," · "+l(s.expected_vram_gb!=null?y(s.expected_vram_gb)+" GB":"VRAM unknown"),1)])]),t("button",{class:_(["inline-flex items-center gap-1 rounded-md border px-2 py-1 text-2xs hover:bg-muted disabled:opacity-50",s.fits===!1?"border-rose-400/60 text-rose-600 dar
6k:text-rose-400":""]),disabled:$(s),title:"Unpark (scale to 1)",onClick:L=>B(d.provider.id,s,1)},[$(s)?(o(),V(c(N),{key:0,class:"size-3 animate-spin"})):(o(),V(c(ce),{key:1,class:"size-3"})),e[12]||(e[12]=u(" Start ",-1))],10,mt)]))),128))])])):g("",!0)],2))),128))]),d.parked_elsewhere.length?(o(),a("div",pt,[e[14]||(e[14]=t("span",{class:"font-medium"},"Parked (no box match):",-1)),u(" "+l(d.parked_elsewhere.map(r=>r.name).join(", ")),1)])):g("",!0)]))),128)),T.value.length?(o(),a("p",gt," Stop parks a service (scale to 0, frees VRAM); Start unparks it (scale to 1) on its box. ")):g("",!0)]))}});export{Pt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.