fix: m.type → m.kind||m.type in remaining consumers (ModelSelectModal, providers page, route)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
decolua
2026-06-14 16:21:20 +07:00
parent dd1e0f9bcc
commit c5c9061eac
3 changed files with 10 additions and 10 deletions

View File

@@ -123,12 +123,12 @@ export default function ModelSelectModal({
// For these kinds, providers without hardcoded models can still be picked (provider-as-model fallback)
const ALLOW_PROVIDER_FALLBACK_KINDS = new Set(["tts", "image", "webFetch"]);
// Filter a models[] array by kindFilter (keep only matching m.type)
const mKind = (m) => m.kind || m.type;
// Filter a models[] array by kindFilter (keep only matching kind)
const filterByKind = (models) => {
// No kindFilter → LLM context: keep only LLM models (no type or type === "llm")
if (!kindFilter) return models.filter((m) => m.isPlaceholder || !m.type || m.type === "llm");
if (!kindFilter) return models.filter((m) => m.isPlaceholder || !mKind(m) || mKind(m) === "llm");
if (!TYPED_KINDS.has(kindFilter)) return models;
return models.filter((m) => m.isPlaceholder || m.type === kindFilter);
return models.filter((m) => m.isPlaceholder || mKind(m) === kindFilter);
};
// Get all active provider IDs from connections (filtered by kindFilter if set)
@@ -181,8 +181,8 @@ export default function ModelSelectModal({
let combined = aliasModels;
if (kindFilter && TYPED_KINDS.has(kindFilter)) {
combined = getModelsByProviderId(providerId)
.filter((m) => m.type === kindFilter)
.map((m) => ({ id: m.id, name: m.name, value: `${alias}/${m.id}`, type: m.type }));
.filter((m) => mKind(m) === kindFilter)
.map((m) => ({ id: m.id, name: m.name, value: `${alias}/${m.id}`, kind: mKind(m) }));
// Fallback: provider-as-model when no hardcoded models match (tts/image/webFetch only)
if (combined.length === 0 && ALLOW_PROVIDER_FALLBACK_KINDS.has(kindFilter)) {
const supports = (providerInfo.serviceKinds || ["llm"]).includes(kindFilter);
@@ -263,7 +263,7 @@ export default function ModelSelectModal({
.map((m) => ({ id: m.id, name: m.name || m.id, value: `${alias}/${m.id}`, isCustom: true }));
const merged = [
...hardcodedModels.map((m) => ({ id: m.id, name: m.name, value: `${alias}/${m.id}`, type: m.type })),
...hardcodedModels.map((m) => ({ id: m.id, name: m.name, value: `${alias}/${m.id}`, kind: mKind(m) })),
...customAliasModels,
...customRegisteredModels,
];