mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-16 18:02:58 +08:00
feat: unload models
This commit is contained in:
parent
dc5b2f14af
commit
c83fd0ed94
@ -27,7 +27,7 @@ except:
|
||||
print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.")
|
||||
|
||||
|
||||
version = [1, 24]
|
||||
version = [1, 25]
|
||||
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
|
||||
print(f"### Loading: ComfyUI-Manager ({version_str})")
|
||||
|
||||
|
||||
@ -7,13 +7,13 @@ import { CustomNodesInstaller } from "./custom-nodes-downloader.js";
|
||||
import { AlternativesInstaller } from "./a1111-alter-downloader.js";
|
||||
import { SnapshotManager } from "./snapshot.js";
|
||||
import { ModelInstaller } from "./model-downloader.js";
|
||||
import { manager_instance, setManagerInstance, install_via_git_url, install_pip, rebootAPI } from "./common.js";
|
||||
import { manager_instance, setManagerInstance, install_via_git_url, install_pip, rebootAPI, free_models } from "./common.js";
|
||||
|
||||
var docStyle = document.createElement('style');
|
||||
docStyle.innerHTML = `
|
||||
#cm-manager-dialog {
|
||||
width: 1000px;
|
||||
height: 450px;
|
||||
height: 460px;
|
||||
box-sizing: content-box;
|
||||
z-index: 10000;
|
||||
}
|
||||
@ -66,7 +66,7 @@ docStyle.innerHTML = `
|
||||
.cm-notice-board {
|
||||
width: 310px;
|
||||
padding: 0px !important;
|
||||
height: 190px;
|
||||
height: 250px;
|
||||
overflow: auto;
|
||||
color: var(--input-text);
|
||||
border: 1px solid var(--descrip-text);
|
||||
@ -812,6 +812,11 @@ class ManagerMenuDialog extends ComfyDialog {
|
||||
install_pip(url, self);
|
||||
}
|
||||
}
|
||||
}),
|
||||
$el("button.cm-experimental-button", {
|
||||
type: "button",
|
||||
textContent: "Unload models",
|
||||
onclick: () => { free_models(); }
|
||||
})
|
||||
]),
|
||||
];
|
||||
|
||||
16
js/common.js
16
js/common.js
@ -145,3 +145,19 @@ export async function install_via_git_url(url, manager_dialog) {
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
}
|
||||
}
|
||||
|
||||
export async function free_models() {
|
||||
let res = await api.fetchApi(`/free`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: '{}'
|
||||
});
|
||||
|
||||
if(res.status == 200) {
|
||||
app.ui.dialog.show('Models have been unloaded.')
|
||||
}
|
||||
else {
|
||||
app.ui.dialog.show('Unloading of models failed.<BR><BR>Installed ComfyUI may be an outdated version.')
|
||||
}
|
||||
app.ui.dialog.element.style.zIndex = 10010;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user