Files
openclaw/src/commands/models/set.ts
2026-02-16 00:43:15 +00:00

13 lines
522 B
TypeScript

import type { RuntimeEnv } from "../../runtime.js";
import { logConfigUpdated } from "../../config/logging.js";
import { applyDefaultModelPrimaryUpdate, updateConfig } from "./shared.js";
export async function modelsSetCommand(modelRaw: string, runtime: RuntimeEnv) {
const updated = await updateConfig((cfg) => {
return applyDefaultModelPrimaryUpdate({ cfg, modelRaw, field: "model" });
});
logConfigUpdated(runtime);
runtime.log(`Default model: ${updated.agents?.defaults?.model?.primary ?? modelRaw}`);
}