openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 1.54 kB
JavaScript
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Qt as n,Xt as r,wa as i,xa as a}from"./control-ui-connection-Bfj9beF_.js";import{Kh as o,Uh as s,Xr as c,Yr as l,Zr as u,eg as d,rg as f,tg as p}from"./control-ui-boot-shared-DFTSUQQ0.js";import{n as m,t as h}from"./en-settings-YsyvL-Mv.js";var g=t({EMPTY_MODEL_PROVIDERS_DATA:()=>x,loadModelProvidersData:()=>y});function _(e){return f(e)?d(`model providers`):r(e,`request failed`)}function v(e){return e.then(e=>({ok:!0,result:e}),e=>({ok:!1,error:e}))}async function y(e,t){let n=(n=!1)=>v(c(e,{agentId:t.agentId,...n?{refresh:!0}:{},...t.signal?{signal:t.signal}:{}})),r=v(o(e,t)),i=t.refresh?r.then(()=>n(!0)):void 0,a=i?i.then(e=>e.ok?e:n()):n(),[s,l,u]=await Promise.all([r,a,i??Promise.resolve(void 0)]);return{authStatus:s.ok?s.result:null,providerOutcomes:l.ok?l.result.providerOutcomes??[]:[],catalogError:u&&!u.ok?_(u.error):l.ok?b(l.result):_(l.error),providerUsage:null,providerUsageFailed:!1,updatedAt:Date.now(),error:s.ok?s.result.unavailable?.message??null:_(s.error)}}function b(e){let t=new Set((e.providerOutcomes??[]).filter(e=>e.status===`unavailable`).map(e=>e.provider));return u(e,t.size?i(`modelProviders.defaults.discoverFailedFor`,{providers:[...t].join(`, `)}):i(`modelProviders.defaults.discoverFailed`))}var x;function S(){return(S=e((()=>{a(),h(),n(),p(),s(),l(),m(),x={authStatus:null,providerOutcomes:[],catalogError:null,providerUsage:null,providerUsageFailed:!1,updatedAt:null,error:null}})))()}export{g as a,y as i,b as n,S as r,x as t};