enh: reintroduce model order/default models
This commit is contained in:
@@ -25,26 +25,6 @@ export const getModels = async (token: string = '', base: boolean = false) => {
|
||||
}
|
||||
|
||||
let models = res?.data ?? [];
|
||||
models = models
|
||||
.filter((models) => models)
|
||||
// Sort the models
|
||||
.sort((a, b) => {
|
||||
// Compare case-insensitively by name for models without position property
|
||||
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.name < b.name) return -1;
|
||||
if (a.name > b.name) return 1;
|
||||
|
||||
return 0; // They are equal
|
||||
});
|
||||
|
||||
console.log(models);
|
||||
return models;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user