openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
18 lines (17 loc) • 1.12 kB
JavaScript
import { n as findNormalizedProviderValue, r as normalizeProviderId } from "./provider-id-b5XGSf9C.mjs";
//#region src/plugins/embedding-provider-config.ts
/** Provider id for OpenAI-compatible remote embedding servers. */
const OPENAI_COMPATIBLE_EMBEDDING_PROVIDER_ID = "openai-compatible";
const OPENAI_COMPATIBLE_MODEL_APIS = /* @__PURE__ */ new Set(["openai-completions", "openai-responses"]);
/** Reads a configured provider's backing API id when runtime lookup should follow an alias. */
function resolveConfiguredGenericEmbeddingProviderId(e, t) {
const n = t?.models?.providers;
const r = n?.[e] ?? findNormalizedProviderValue(n, e);
if (!r) return;
const i = r.api?.trim();
const a = i ? normalizeProviderId(i) : void 0;
const o = a ? OPENAI_COMPATIBLE_MODEL_APIS.has(a) ? OPENAI_COMPATIBLE_EMBEDDING_PROVIDER_ID : a : r.baseUrl?.trim() ? OPENAI_COMPATIBLE_EMBEDDING_PROVIDER_ID : void 0;
return o && o !== normalizeProviderId(e) ? o : void 0;
}
//#endregion
export { OPENAI_COMPATIBLE_MODEL_APIS as n, resolveConfiguredGenericEmbeddingProviderId as r, OPENAI_COMPATIBLE_EMBEDDING_PROVIDER_ID as t };