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
co-authored by Cursor
parent dd1e0f9bcc
commit c5c9061eac
3 changed files with 10 additions and 10 deletions
@@ -914,7 +914,7 @@ export default function ProviderDetailPage() {
const allModels = [
...models,
...kiloFreeModels.filter((fm) => !models.some((m) => m.id === fm.id)),
].filter((m) => !m.type || m.type === "llm");
].filter((m) => { const k = m.kind || m.type; return !k || k === "llm"; });
const disabledSet = new Set(disabledModelIds);
const displayModels = allModels.filter((m) => !disabledSet.has(m.id));
const disabledDisplayModels = allModels.filter((m) => disabledSet.has(m.id));
@@ -1449,7 +1449,7 @@ export default function ProviderDetailPage() {
const allIds = [
...models,
...kiloFreeModels.filter((fm) => !models.some((m) => m.id === fm.id)),
].filter((m) => !m.type || m.type === "llm").map((m) => m.id);
].filter((m) => { const k = m.kind || m.type; return !k || k === "llm"; }).map((m) => m.id);
const activeIds = allIds.filter((id) => !disabledModelIds.includes(id));
return (
<div className="flex gap-2">
+1 -1
View File
@@ -316,7 +316,7 @@ export async function buildModelsList(kindFilter) {
const customModelIds = customModels
.filter((m) => {
if (!m?.id || (m.type && m.type !== "llm")) return false;
if (!m?.id || ((m.kind || m.type) && (m.kind || m.type) !== "llm")) return false;
const alias = m.providerAlias;
return alias === staticAlias || alias === outputAlias || alias === providerId;
})
+7 -7
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,
];