UNPKG

manifest

Version:

Self-hosted Manifest LLM router with embedded server, SQLite database, and dashboard

2 lines (1 loc) 1.95 kB
import{b as _,D as $,a as b,k as w,i as c,g as u,F as S,m as C,S as y,t as g,d as A}from"./vendor-C-Y5oNOq.js";import{x as k,y as U,n as P}from"./index-C4Qw7vZo.js";import"./auth-CU91cd7V.js";var K=g('<div class=panel style="max-width:440px;margin:0 auto;padding:32px"><h2 style="margin:0 0 8px">Select an agent</h2><p style="color:hsl(var(--muted-foreground));font-size:var(--font-size-sm);margin:0 0 24px">Which agent should this provider be added to?</p><div style=display:flex;flex-direction:column;gap:8px>'),R=g("<div style=display:flex;align-items:center;justify-content:center;min-height:200px><span class=spinner role=status aria-label=Loading style=width:24px;height:24px>"),j=g("<div class=container--sm style=padding-top:80px>"),z=g('<button class="btn btn--outline"style=justify-content:flex-start;text-align:left>');const D=()=>{const p=_(),[s]=$(),[f,h]=b(!1),r=t=>Array.isArray(t)?t[0]:t,m=t=>{const e=new URLSearchParams,d=r(s.provider)||"custom";e.set("provider",d);const i=r(s.name),o=r(s.baseUrl),a=r(s.apiKey),n=r(s.models);return i&&e.set("name",i),o&&e.set("baseUrl",o),a&&e.set("apiKey",a),n&&e.set("models",n),`/agents/${encodeURIComponent(t)}/routing?${e.toString()}`},x=async()=>{h(!0);try{const e=(await U("my-agent"))?.agent?.name??"my-agent";P(e),p(m(e),{replace:!0})}catch{h(!1)}},[l]=w(async()=>{const e=(await k())?.agents??[];return e.length===1&&e[0]?p(m(e[0].agent_name),{replace:!0}):e.length===0&&await x(),e}),v=t=>{p(m(t),{replace:!0})};return(()=>{var t=j();return c(t,u(y,{get when(){return C(()=>!l.loading)()&&(l()?.length??0)>1},get children(){var e=K(),d=e.firstChild,i=d.nextSibling,o=i.nextSibling;return c(o,u(S,{get each(){return l()},children:a=>(()=>{var n=z();return n.$$click=()=>v(a.agent_name),c(n,()=>a.display_name??a.agent_name),n})()})),e}}),null),c(t,u(y,{get when(){return l.loading||f()||(l()?.length??0)<=1},get children(){return R()}}),null),t})()};A(["click"]);export{D as default};