Added default model type on initial load in settings.

This commit is contained in:
Christian Bastian
2024-07-25 04:13:02 -04:00
parent d1c5bae3f8
commit 6e43b2fb4c
2 changed files with 14 additions and 4 deletions

View File

@@ -178,6 +178,7 @@ def ui_rules():
Rule("sidebar-default-width", 0.5, float, 0.0, 1.0),
Rule("sidebar-control-always-compact", False, bool),
Rule("model-search-always-append", "", str),
Rule("model-default-browser-model-type", "checkpoints", str),
Rule("model-real-time-search", True, bool),
Rule("model-persistent-search", True, bool),
Rule("model-show-label-extensions", False, bool),

View File

@@ -1909,7 +1909,10 @@ class ModelGrid {
const models = modelData.models;
let modelType = modelSelect.value;
if (models[modelType] === undefined) {
modelType = "checkpoints"; // TODO: magic value
modelType = settings["model-default-browser-model-type"].value;
}
if (models[modelType] === undefined) {
modelType = "checkpoints"; // panic fallback
}
if (modelType !== previousModelType.value) {
@@ -3607,6 +3610,7 @@ class SettingsView {
/** @type {HTMLInputElement} */ "sidebar-control-always-compact": null,
/** @type {HTMLTextAreaElement} */ "model-search-always-append": null,
/** @type {HTMLInputElement} */ "model-default-browser-model-type": null,
/** @type {HTMLInputElement} */ "model-real-time-search": null,
/** @type {HTMLInputElement} */ "model-persistent-search": null,
/** @type {HTMLInputElement} */ "model-show-label-extensions": null,
@@ -3798,6 +3802,11 @@ class SettingsView {
}),
]),
]),
$select({
$: (el) => (settings["model-default-browser-model-type"] = el),
textContent: "Default search model type on startup",
options: ["checkpoints", "clip", "clip_vision", "controlnet", "diffusers", "embeddings", "gligen", "hypernetworks", "loras", "photomaker", "style_models", "unet", "vae", "vae_approx"],
}),
$checkbox({
$: (el) => (settings["model-real-time-search"] = el),
textContent: "Real-time search",
@@ -4258,9 +4267,9 @@ class ModelManager extends ComfyDialog {
this.#init();
}
#init() {
this.#settingsView.reload(false);
this.#refreshModels();
async #init() {
await this.#settingsView.reload(false);
await this.#refreshModels();
}
#resetManagerContentsScroll = () => {