fix(models): attach provider to inline model definitions

When resolving models from custom provider configurations, ensure the
provider name is attached to each inline model entry. This fixes model
resolution for custom providers where the model definition exists in
the config but lacks an explicit provider field.

Without this fix, inline models from custom providers (like amazon-bedrock)
would fail to resolve because the provider context was lost during the
flatMap operation.
This commit is contained in:
Andrew Lauppe 2026-01-20 01:28:13 -05:00 committed by Peter Steinberger
parent 7f25523d89
commit 9ca5cb2db9

View File

@ -39,7 +39,7 @@ export function resolveModel(
if (!model) {
const providers = cfg?.models?.providers ?? {};
const inlineModels =
providers[provider]?.models ??
providers[provider]?.models?.map((entry) => ({ ...entry, provider })) ??
Object.values(providers)
.flatMap((entry) => entry?.models ?? [])
.map((entry) => ({ ...entry, provider }));