fix: preserve provider-scoped model options

This commit is contained in:
Shakker
2026-04-26 11:35:04 +01:00
parent 3fe0718932
commit 8344fae387
3 changed files with 9 additions and 1 deletions

View File

@@ -177,6 +177,7 @@ export async function promptAuthConfig(
initialSelections: modelAllowlist?.initialSelections,
message: modelAllowlist?.message,
preferredProvider,
loadCatalog: false,
});
if (allowlistSelection.models) {
next = applyModelFallbacksFromSelection(next, allowlistSelection.models, {

View File

@@ -738,6 +738,7 @@ describe("promptModelAllowlist", () => {
config,
prompter,
preferredProvider: "openai-codex",
loadCatalog: false,
});
expect(loadModelCatalog).not.toHaveBeenCalled();

View File

@@ -788,6 +788,7 @@ export async function promptModelAllowlist(params: {
allowedKeys?: string[];
initialSelections?: string[];
preferredProvider?: string;
loadCatalog?: boolean;
}): Promise<PromptModelAllowlistResult> {
const cfg = params.config;
const existingKeys = resolveConfiguredModelKeys(cfg);
@@ -839,11 +840,12 @@ export async function promptModelAllowlist(params: {
cfg,
})
: undefined;
const loadCatalog = params.loadCatalog ?? true;
const scopedFastKeys =
allowedKeys.length > 0
? allowedKeys
: preferredProvider && hasRealSeed
: !loadCatalog && preferredProvider && hasRealSeed
? initialSeeds.filter((key) => {
const entry = splitModelKey(key);
return entry ? matchesPreferredProvider?.(entry.provider) === true : false;
@@ -888,6 +890,10 @@ export async function promptModelAllowlist(params: {
return { models: [], scopeKeys };
}
if (!loadCatalog) {
return {};
}
const allowlistProgress = params.prompter.progress("Loading available models");
let catalog: Awaited<ReturnType<typeof loadModelCatalog>>;
try {