From 81212388727afa27d89fcb3f3042003e55144a87 Mon Sep 17 00:00:00 2001 From: "R.D." Date: Fri, 27 Mar 2026 01:07:03 -0400 Subject: [PATCH] fix: Clear All Models button now also removes associated aliases The Clear All Models button was only deleting custom models from the database but leaving their aliases intact, so the UI didn't reflect the deletion. Now it also deletes all aliases belonging to the provider and refreshes the alias state. Co-Authored-By: Claude Opus 4.6 --- .../(dashboard)/dashboard/providers/[id]/page.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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"));