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

Method installModels

comfyui_manager/js/model-manager.js:432–501  ·  view source on GitHub ↗
(list, btn)

Source from the content-addressed store, hash-verified

430 }
431
432 async installModels(list, btn) {
433 btn.classList.add("cmm-btn-loading");
434 this.showError("");
435
436 let needRefresh = false;
437 let errorMsg = "";
438
439 let target_items = [];
440
441 let batch = {};
442
443 for (const item of list) {
444 this.grid.scrollRowIntoView(item);
445 target_items.push(item);
446
447 if (!this.focusInstall(item)) {
448 this.grid.onNextUpdated(() => {
449 this.focusInstall(item);
450 });
451 }
452
453 this.showStatus(`Install ${item.name} ...`);
454
455 const data = item.originalData;
456 data.ui_id = item.hash;
457
458
459 if(batch['install_model']) {
460 batch['install_model'].push(data);
461 }
462 else {
463 batch['install_model'] = [data];
464 }
465 }
466
467 this.install_context = {btn: btn, targets: target_items};
468
469 if(errorMsg) {
470 this.showError(errorMsg);
471 show_message("[Installation Errors]\n"+errorMsg);
472
473 // reset
474 for(let k in target_items) {
475 const item = target_items[k];
476 this.grid.updateCell(item, "installed");
477 }
478 }
479 else {
480 this.batch_id = generateUUID();
481 batch['batch_id'] = this.batch_id;
482
483 const res = await api.fetchApi(`/v2/manager/queue/batch`, {
484 method: 'POST',
485 body: JSON.stringify(batch)
486 });
487
488 let failed = await res.json();
489

Callers 2

bindEventsMethod · 0.95
initGridMethod · 0.95

Calls 8

showErrorMethod · 0.95
focusInstallMethod · 0.95
showStatusMethod · 0.95
showStopMethod · 0.95
show_messageFunction · 0.90
generateUUIDFunction · 0.90
showTerminalFunction · 0.90
fetchApiMethod · 0.45

Tested by

no test coverage detected