UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

32 lines (31 loc) 1.51 kB
import { a as resolveAgentModelPrimaryValue } from "./model-input-BuGMCNOz.js"; import { r as logConfigUpdated } from "./logging-Idqd9ylL.js"; import { l as updateDefaultModelPrimaryConfig } from "./shared-CZFRGTsE.js"; import { a as repairCopilotRuntimePluginInstallForModelSelection, i as repairCodexRuntimePluginInstallForModelSelection } from "./runtime-plugin-install-C2YSxeNS.js"; import "./codex-runtime-plugin-install-B2_P31Ru.js"; import "./copilot-runtime-plugin-install-B2_P31Ru.js"; //#region src/commands/models/set.ts /** Command for setting the default text model. */ /** Sets agents.defaults.model.primary and repairs provider runtime plugin installs when needed. */ async function modelsSetCommand(modelRaw, runtime) { const { updated, warning: catalogWarning } = await updateDefaultModelPrimaryConfig({ modelRaw, field: "model" }); if (catalogWarning) runtime.error?.(catalogWarning); const selectedModel = resolveAgentModelPrimaryValue(updated.agents?.defaults?.model) ?? modelRaw; const repaired = await repairCodexRuntimePluginInstallForModelSelection({ cfg: updated, model: selectedModel }); const copilotRepaired = await repairCopilotRuntimePluginInstallForModelSelection({ cfg: updated, model: selectedModel }); const warnings = [...repaired.warnings, ...copilotRepaired.warnings]; for (const warning of warnings) runtime.error?.(warning); logConfigUpdated(runtime); runtime.log(`Default model: ${selectedModel}`); } //#endregion export { modelsSetCommand };