MCPcopy
hub / github.com/Comfy-Org/ComfyUI-Manager / getModelList

Method getModelList

comfyui_manager/js/model-manager.js:569–631  ·  view source on GitHub ↗
(models)

Source from the content-addressed store, hash-verified

567 }
568
569 getModelList(models) {
570 const typeMap = new Map();
571 const baseMap = new Map();
572
573 models.forEach((item, i) => {
574 const { type, base, name, reference, installed } = item;
575 item.originalData = JSON.parse(JSON.stringify(item));
576 item.size = this.sizeToBytes(item.size);
577 item.hash = md5(name + reference);
578 item.id = i + 1;
579
580 if (installed === "True") {
581 item.selectable = false;
582 }
583
584 typeMap.set(type, type);
585 baseMap.set(base, base);
586
587 });
588
589 const typeList = [];
590 typeMap.forEach(type => {
591 typeList.push({
592 label: type,
593 value: type
594 });
595 });
596 typeList.sort((a,b)=> {
597 const au = a.label.toUpperCase();
598 const bu = b.label.toUpperCase();
599 if (au !== bu) {
600 return au > bu ? 1 : -1;
601 }
602 return 0;
603 });
604 this.typeList = [{
605 label: "All",
606 value: ""
607 }].concat(typeList);
608
609
610 const baseList = [];
611 baseMap.forEach(base => {
612 baseList.push({
613 label: base,
614 value: base
615 });
616 });
617 baseList.sort((a,b)=> {
618 const au = a.label.toUpperCase();
619 const bu = b.label.toUpperCase();
620 if (au !== bu) {
621 return au > bu ? 1 : -1;
622 }
623 return 0;
624 });
625 this.baseList = [{
626 label: "All",

Callers 1

loadDataMethod · 0.95

Calls 2

sizeToBytesMethod · 0.95
md5Function · 0.90

Tested by

no test coverage detected