From 12722acb557190a86f4fc879c9d4d4cabdcd2a6a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 10 Jan 2026 16:32:39 +0000 Subject: [PATCH] feat: wizard model picker (#611, thanks @jonasjancarik) --- CHANGELOG.md | 1 + src/commands/model-picker.ts | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e9a2a1dd..bfec10a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### New Features and Changes - Onboarding/Models: add first-class Z.AI (GLM) auth choice (`zai-api-key`) + `--zai-api-key` flag. - Agents: add human-delay pacing between block replies (modes: off/natural/custom, per-agent configurable). (#446) — thanks @tony-freedomology. +- Onboarding/Models: add catalog-backed default model picker to onboarding + configure. (#611) — thanks @jonasjancarik. ### Fixes - Auto-reply: prefer `RawBody` for command/directive parsing (WhatsApp + Discord) and prevent fallback runs from clobbering concurrent session updates. (#643) — thanks @mcinteerj. diff --git a/src/commands/model-picker.ts b/src/commands/model-picker.ts index 5a83094a8..1a1a3147f 100644 --- a/src/commands/model-picker.ts +++ b/src/commands/model-picker.ts @@ -230,7 +230,20 @@ export async function promptDefaultModel( }); } - const initialValue = allowKeep ? KEEP_VALUE : configuredKey || undefined; + let initialValue: string | undefined = allowKeep + ? KEEP_VALUE + : configuredKey || undefined; + if ( + allowKeep && + hasPreferredProvider && + preferredProvider && + resolved.provider !== preferredProvider + ) { + const firstModel = models[0]; + if (firstModel) { + initialValue = modelKey(firstModel.provider, firstModel.id); + } + } const selection = await params.prompter.select({ message: params.message ?? "Default model", @@ -256,6 +269,12 @@ export function applyPrimaryModel( const defaults = cfg.agents?.defaults; const existingModel = defaults?.model; const existingModels = defaults?.models; + const fallbacks = + typeof existingModel === "object" && + existingModel !== null && + "fallbacks" in existingModel + ? (existingModel as { fallbacks?: string[] }).fallbacks + : undefined; return { ...cfg, agents: { @@ -263,13 +282,7 @@ export function applyPrimaryModel( defaults: { ...defaults, model: { - ...(existingModel && - "fallbacks" in (existingModel as Record) - ? { - fallbacks: (existingModel as { fallbacks?: string[] }) - .fallbacks, - } - : undefined), + ...(fallbacks ? { fallbacks } : undefined), primary: model, }, models: {