From a3369df62f173b663cd6c8fe2c1bb4e65c376b69 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Sun, 15 Mar 2026 08:44:05 -0300 Subject: [PATCH] fix: include provider aliases in active provider filter (#353) --- src/app/api/models/route.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/api/models/route.ts b/src/app/api/models/route.ts index d0153ac6..6c317100 100644 --- a/src/app/api/models/route.ts +++ b/src/app/api/models/route.ts @@ -1,6 +1,6 @@ import { NextResponse } from "next/server"; import { getModelAliases, setModelAlias, getProviderConnections } from "@/models"; -import { AI_MODELS } from "@/shared/constants/config"; +import { AI_MODELS, PROVIDER_ID_TO_ALIAS } from "@/shared/constants/models"; import { updateModelAliasSchema } from "@/shared/validation/schemas"; import { isValidationFailure, validateBody } from "@/shared/validation/helpers"; @@ -18,7 +18,17 @@ export async function GET(request: Request) { try { const connections = await getProviderConnections(); const active = connections.filter((c: any) => c.isActive !== false); - activeProviders = new Set(active.map((c: any) => c.provider)); + // Include both provider IDs and their aliases in the active set. + // PROVIDER_MODELS keys are aliases (e.g. 'cc' for 'claude', 'gh' for 'github'). + // DB connections are stored under provider IDs ('claude', 'github'). + // Without this, models for aliased providers always appear unconfigured. + activeProviders = new Set(); + for (const c of active) { + const pId = String((c as any).provider); + activeProviders.add(pId); + const alias = PROVIDER_ID_TO_ALIAS[pId]; + if (alias) activeProviders.add(alias); + } } catch { // If DB unavailable, show all models }