mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
Merge pull request #664 from rdself/fix/clear-all-models-button
fix: Clear All Models button now also removes aliases
This commit is contained in:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user