UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

41 lines (40 loc) • 1.6 kB
import { a as resolveMergedModelProviderConfig } from "./model-provider-config-Bbah_2ON.mjs"; import { t as discoverOpenAICompatibleLocalModels } from "./provider-self-hosted-discovery-CuVyZrfM.mjs"; import "./provider-setup-C508VQAW.mjs"; import { g as LiveModelCatalogHttpError, v as buildOpenAICompatibleLiveModels } from "./provider-catalog-live-runtime-D-M7f_ww.mjs"; import "./provider-catalog-shared-ZRbc_4xZ.mjs"; import { n as normalizeBifrostBaseUrl, t as BIFROST_BASE_URL } from "./defaults-DfY3_fyO.mjs"; //#region extensions/bifrost/models.ts async function listBifrostModels(e) { const t = resolveMergedModelProviderConfig(e.config, "bifrost"); const n = normalizeBifrostBaseUrl(t?.baseUrl ?? "http://localhost:8080/openai/v1"); const r = { ...t, baseUrl: n, api: "openai-completions", models: t?.models ?? [] }; const i = await discoverOpenAICompatibleLocalModels({ baseUrl: r.baseUrl, apiKey: t?.auth === "none" ? void 0 : e.apiKey, configuredProvider: { config: e.config, id: "bifrost" }, env: e.env, signal: e.signal, beforeRequest: e.beforeRequest, label: "Bifrost", rawResult: true, discoverRuntimeContext: false }); e.signal?.throwIfAborted(); e.beforeRequest?.(); if (i.kind !== "success") throw i.kind === "http-error" ? new LiveModelCatalogHttpError("bifrost", i.status) : /* @__PURE__ */ new Error("Bifrost model discovery unavailable. Check the gateway URL and authentication."); return { ...r, models: buildOpenAICompatibleLiveModels(i.rows.map(({ model: e }) => e), r) }; } //#endregion export { listBifrostModels as t };