MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / getSystemInfo

Function getSystemInfo

ui/media/js/parameters.js:703–777  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

701}
702
703async function getSystemInfo() {
704 try {
705 const res = await SD.getSystemInfo()
706 let devices = res["devices"]
707
708 let allDeviceIds = Object.keys(devices["all"]).filter((d) => d !== "cpu")
709 let activeDeviceIds = Object.keys(devices["active"]).filter((d) => d !== "cpu")
710
711 if (activeDeviceIds.length === 0) {
712 useCPUField.checked = true
713 }
714
715 if (allDeviceIds.length < MIN_GPUS_TO_SHOW_SELECTION || useCPUField.checked) {
716 let gpuSettingEntry = getParameterSettingsEntry("use_gpus")
717 gpuSettingEntry.style.display = "none"
718 let autoPickGPUSettingEntry = getParameterSettingsEntry("auto_pick_gpus")
719 autoPickGPUSettingEntry.style.display = "none"
720 }
721
722 if (allDeviceIds.length === 0) {
723 useCPUField.checked = true
724 useCPUField.disabled = true // no compatible GPUs, so make the CPU mandatory
725
726 getParameterSettingsEntry("use_cpu").addEventListener("click", function () {
727 alert(
728 "Sorry, we could not find a compatible graphics card! Easy Diffusion supports graphics cards with minimum 2 GB of RAM. " +
729 "Only NVIDIA cards are supported on Windows. NVIDIA and AMD cards are supported on Linux.<br/><br/>" +
730 "If you have a compatible graphics card, please try updating to the latest drivers.<br/><br/>" +
731 "Only the CPU can be used for generating images, without a compatible graphics card.",
732 "No compatible graphics card found!"
733 )
734 })
735 }
736
737 autoPickGPUsField.checked = devices["config"] === "auto"
738
739 useGPUsField.innerHTML = ""
740 allDeviceIds.forEach((device) => {
741 let deviceName = devices["all"][device]["name"]
742 let deviceOption = `<option value="${device}">${deviceName} (${device})</option>`
743 useGPUsField.insertAdjacentHTML("beforeend", deviceOption)
744 })
745
746 if (autoPickGPUsField.checked) {
747 let gpuSettingEntry = getParameterSettingsEntry("use_gpus")
748 gpuSettingEntry.style.display = "none"
749 } else {
750 $("#use_gpus").val(activeDeviceIds)
751 }
752
753 document.dispatchEvent(new CustomEvent("system_info_update", { detail: devices }))
754 setHostInfo(res["hosts"])
755 let force = false
756 if (res["enforce_output_dir"] !== undefined) {
757 force = res["enforce_output_dir"]
758 if (force == true) {
759 saveToDiskField.checked = true
760 metadataOutputFormatField.disabled = res["enforce_output_metadata"]

Callers 2

getDevicesFunction · 0.85
getHostsFunction · 0.85

Calls 7

alertFunction · 0.85
setHostInfoFunction · 0.85
setDiskPathFunction · 0.85
$Function · 0.70
addEventListenerMethod · 0.45
dispatchEventMethod · 0.45

Tested by

no test coverage detected