This commit is contained in:
Timothy J. Baek
2024-05-24 20:29:13 -07:00
parent e316abcfc8
commit ca3108a54d
8 changed files with 356 additions and 171 deletions
+17 -1
View File
@@ -27,7 +27,23 @@ export const getModels = async (token: string = '') => {
let models = res?.data ?? [];
models = models.filter((models) => models).sort((a, b) => (a.name > b.name ? 1 : -1));
models = models
.filter((models) => models)
.sort((a, b) => {
// Compare case-insensitively
const lowerA = a.name.toLowerCase();
const lowerB = b.name.toLowerCase();
if (lowerA < lowerB) return -1;
if (lowerA > lowerB) return 1;
// If same case-insensitively, sort by original strings,
// lowercase will come before uppercase due to ASCII values
if (a < b) return -1;
if (a > b) return 1;
return 0; // They are equal
});
console.log(models);
return models;