diff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx index a20e14d2e1..2bdb4c71c6 100644 --- a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx +++ b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx @@ -1553,7 +1553,19 @@ export default function ProviderDetailPage() { { method: "DELETE" } ); if (res.ok) { + // Also delete all aliases that belong to this provider + const aliasEntries = Object.entries(modelAliases).filter(([, model]) => + (model as string).startsWith(`${providerStorageAlias}/`) + ); + await Promise.all( + aliasEntries.map(([alias]) => + fetch(`/api/models/alias?alias=${encodeURIComponent(alias)}`, { + method: "DELETE", + }).catch(() => {}) + ) + ); await fetchProviderModelMeta(); + await fetchAliases(); notify.success(t("clearAllModelsSuccess")); } else { notify.error(t("clearAllModelsFailed"));