fix: clean model config typing

This commit is contained in:
Peter Steinberger
2026-01-06 01:08:36 +00:00
parent b04c838c15
commit e73573eaea
13 changed files with 184 additions and 90 deletions

View File

@@ -8,15 +8,17 @@ export async function modelsSetCommand(modelRaw: string, runtime: RuntimeEnv) {
const key = `${resolved.provider}/${resolved.model}`;
const nextModels = { ...cfg.agent?.models };
if (!nextModels[key]) nextModels[key] = {};
const existingModel = cfg.agent?.model as
| { primary?: string; fallbacks?: string[] }
| undefined;
return {
...cfg,
agent: {
...cfg.agent,
model: {
...((cfg.agent?.model as {
primary?: string;
fallbacks?: string[];
}) ?? {}),
...(existingModel?.fallbacks
? { fallbacks: existingModel.fallbacks }
: undefined),
primary: key,
},
models: nextModels,