UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

53 lines (52 loc) • 2.16 kB
import { n as findNormalizedProviderValue } from "./provider-id-b5XGSf9C.mjs"; import { i as applyOnboardAuthAgentModelsAndProviders, r as applyAgentDefaultModelPrimary } from "./provider-onboard-Di5Hihl4.mjs"; import "./provider-auth-D_oAZ3fr.mjs"; import { t as MINIMAX_DEFAULT_MODEL_ID } from "./provider-models-BmJU7Y5i.mjs"; import { i as MINIMAX_CN_API_BASE_URL, l as buildMinimaxApiModelDefinition, n as MINIMAX_API_BASE_URL } from "./model-definitions-Cy4WuyKd.mjs"; //#region extensions/minimax/onboard.ts function applyMinimaxApiProviderConfigWithBaseUrl(e, t, n) { const r = { ...e.models?.providers }; const i = r.minimax ?? findNormalizedProviderValue(r, "minimax"); const a = i?.models ?? []; const o = buildMinimaxApiModelDefinition(t); const s = a.some((e) => e.id === t) ? a : [...a, o]; const { apiKey: c, ...l } = i ?? { baseUrl: n, models: [] }; const u = typeof c === "string" ? c.trim() === "" || c.trim() === "minimax" ? void 0 : c : c; r.minimax = { ...l, baseUrl: n, api: "anthropic-messages", authHeader: true, ...u ? { apiKey: u } : {}, models: s }; const d = { ...e.agents?.defaults?.models }; const f = `minimax/${t}`; d[f] = { ...d[f], alias: "Minimax" }; return applyOnboardAuthAgentModelsAndProviders(e, { agentModels: d, providers: r }); } function createMinimaxApiConfigPair(e) { const provider = (t, n = MINIMAX_DEFAULT_MODEL_ID) => applyMinimaxApiProviderConfigWithBaseUrl(t, n, e); const defaults = (e, t = MINIMAX_DEFAULT_MODEL_ID) => applyAgentDefaultModelPrimary(provider(e, t), `minimax/${t}`); return { provider, defaults }; } const globalApiConfig = createMinimaxApiConfigPair(MINIMAX_API_BASE_URL); const cnApiConfig = createMinimaxApiConfigPair(MINIMAX_CN_API_BASE_URL); const applyMinimaxApiProviderConfig = globalApiConfig.provider; const applyMinimaxApiConfig = globalApiConfig.defaults; const applyMinimaxApiProviderConfigCn = cnApiConfig.provider; const applyMinimaxApiConfigCn = cnApiConfig.defaults; //#endregion export { applyMinimaxApiProviderConfigCn as i, applyMinimaxApiConfigCn as n, applyMinimaxApiProviderConfig as r, applyMinimaxApiConfig as t };