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:
@@ -914,7 +914,7 @@ export default function ProviderDetailPage() {
|
|||||||
const allModels = [
|
const allModels = [
|
||||||
...models,
|
...models,
|
||||||
...kiloFreeModels.filter((fm) => !models.some((m) => m.id === fm.id)),
|
...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 disabledSet = new Set(disabledModelIds);
|
||||||
const displayModels = allModels.filter((m) => !disabledSet.has(m.id));
|
const displayModels = allModels.filter((m) => !disabledSet.has(m.id));
|
||||||
const disabledDisplayModels = 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 = [
|
const allIds = [
|
||||||
...models,
|
...models,
|
||||||
...kiloFreeModels.filter((fm) => !models.some((m) => m.id === fm.id)),
|
...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));
|
const activeIds = allIds.filter((id) => !disabledModelIds.includes(id));
|
||||||
return (
|
return (
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ export async function buildModelsList(kindFilter) {
|
|||||||
|
|
||||||
const customModelIds = customModels
|
const customModelIds = customModels
|
||||||
.filter((m) => {
|
.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;
|
const alias = m.providerAlias;
|
||||||
return alias === staticAlias || alias === outputAlias || alias === providerId;
|
return alias === staticAlias || alias === outputAlias || alias === providerId;
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -123,12 +123,12 @@ export default function ModelSelectModal({
|
|||||||
// For these kinds, providers without hardcoded models can still be picked (provider-as-model fallback)
|
// 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"]);
|
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) => {
|
const filterByKind = (models) => {
|
||||||
// No kindFilter → LLM context: keep only LLM models (no type or type === "llm")
|
if (!kindFilter) return models.filter((m) => m.isPlaceholder || !mKind(m) || mKind(m) === "llm");
|
||||||
if (!kindFilter) return models.filter((m) => m.isPlaceholder || !m.type || m.type === "llm");
|
|
||||||
if (!TYPED_KINDS.has(kindFilter)) return models;
|
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)
|
// Get all active provider IDs from connections (filtered by kindFilter if set)
|
||||||
@@ -181,8 +181,8 @@ export default function ModelSelectModal({
|
|||||||
let combined = aliasModels;
|
let combined = aliasModels;
|
||||||
if (kindFilter && TYPED_KINDS.has(kindFilter)) {
|
if (kindFilter && TYPED_KINDS.has(kindFilter)) {
|
||||||
combined = getModelsByProviderId(providerId)
|
combined = getModelsByProviderId(providerId)
|
||||||
.filter((m) => m.type === kindFilter)
|
.filter((m) => mKind(m) === kindFilter)
|
||||||
.map((m) => ({ id: m.id, name: m.name, value: `${alias}/${m.id}`, type: m.type }));
|
.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)
|
// Fallback: provider-as-model when no hardcoded models match (tts/image/webFetch only)
|
||||||
if (combined.length === 0 && ALLOW_PROVIDER_FALLBACK_KINDS.has(kindFilter)) {
|
if (combined.length === 0 && ALLOW_PROVIDER_FALLBACK_KINDS.has(kindFilter)) {
|
||||||
const supports = (providerInfo.serviceKinds || ["llm"]).includes(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 }));
|
.map((m) => ({ id: m.id, name: m.name || m.id, value: `${alias}/${m.id}`, isCustom: true }));
|
||||||
|
|
||||||
const merged = [
|
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,
|
...customAliasModels,
|
||||||
...customRegisteredModels,
|
...customRegisteredModels,
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user