feat: 模型列表按名称排序,同名称按大小升序
This commit is contained in:
@@ -54,7 +54,13 @@ export async function loadModels() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.models.forEach(m => {
|
data.models
|
||||||
|
.sort((a, b) => {
|
||||||
|
const nameA = a.name.toLowerCase(), nameB = b.name.toLowerCase();
|
||||||
|
if (nameA !== nameB) return nameA.localeCompare(nameB);
|
||||||
|
return (a.size || 0) - (b.size || 0);
|
||||||
|
})
|
||||||
|
.forEach(m => {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = m.name;
|
opt.value = m.name;
|
||||||
const diskSize = formatSize(m.size);
|
const diskSize = formatSize(m.size);
|
||||||
|
|||||||
Reference in New Issue
Block a user