UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

34 lines (33 loc) • 1.5 kB
import { i as resolveAgentModelPrimaryValue } from "./model-input-CIqVjBTV.js"; import { r as logConfigUpdated } from "./logging-BVA6CZPz.js"; import { t as applyDefaultModelPrimaryUpdate, u as updateConfig } from "./shared-BSu_bkyn.js"; import { r as repairCodexRuntimePluginInstallForModelSelection } from "./codex-runtime-plugin-install-B6o3rSbp.js"; import { r as repairCopilotRuntimePluginInstallForModelSelection } from "./copilot-runtime-plugin-install-r0sOidm9.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 = await updateConfig((cfg, context) => { return applyDefaultModelPrimaryUpdate({ cfg, resolveCfg: context.runtimeConfig, modelRaw, field: "model" }); }); 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 };