wip: admin models setting

This commit is contained in:
Timothy Jaeryang Baek
2024-11-15 18:53:50 -08:00
parent 9dae7d0572
commit 7f8c70b04a
7 changed files with 310 additions and 25 deletions
-15
View File
@@ -31,21 +31,6 @@ export const getModels = async (token: string = '') => {
.filter((models) => models)
// Sort the models
.sort((a, b) => {
// Check if models have position property
const aHasPosition = a.info?.meta?.position !== undefined;
const bHasPosition = b.info?.meta?.position !== undefined;
// If both a and b have the position property
if (aHasPosition && bHasPosition) {
return a.info.meta.position - b.info.meta.position;
}
// If only a has the position property, it should come first
if (aHasPosition) return -1;
// If only b has the position property, it should come first
if (bHasPosition) return 1;
// Compare case-insensitively by name for models without position property
const lowerA = a.name.toLowerCase();
const lowerB = b.name.toLowerCase();