fix(models): show custom provider models in combo picker

Merge customModels from /api/models/custom into the isCustomProvider
branch so custom compatible providers display imported models instead
of the prefix/model-id placeholder. Mirrors the passthrough pattern;
filter by providerId since providerAlias stores the raw provider ID.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Sapto
2026-06-26 10:56:19 +07:00
committed by decolua
parent f46811c75e
commit 520f5049bf

View File

@@ -249,9 +249,22 @@ export default function ModelSelectModal({
value: `${nodePrefix}/${fullModel.replace(`${providerId}/`, "")}`,
}));
// Merge custom models registered via /api/models/custom for this provider
// providerAlias in DB uses the raw providerId, not the display prefix
const registeredCustom = customModels
.filter((m) => m.providerAlias === providerId)
.map((m) => ({
id: m.id,
name: m.name || m.id,
value: `${nodePrefix}/${m.id}`,
isCustom: true,
}));
const seen = new Set(nodeModels.map((m) => m.value));
const mergedModels = [...nodeModels, ...registeredCustom.filter((m) => !seen.has(m.value))];
// Always show compatible providers that are connected, even with no aliases.
// When no aliases exist, show a placeholder so users know it's available.
const modelsToShow = nodeModels.length > 0 ? nodeModels : [{
const modelsToShow = mergedModels.length > 0 ? mergedModels : [{
id: `__placeholder__${providerId}`,
name: `${nodePrefix}/model-id`,
value: `${nodePrefix}/model-id`,
@@ -264,7 +277,7 @@ export default function ModelSelectModal({
color: providerInfo.color,
models: modelsToShow,
isCustom: true,
hasModels: nodeModels.length > 0,
hasModels: mergedModels.length > 0,
};
} else {
const hardcodedModels = getModelsByProviderId(providerId);