Added default model type on initial load in settings.
This commit is contained in:
@@ -178,6 +178,7 @@ def ui_rules():
|
|||||||
Rule("sidebar-default-width", 0.5, float, 0.0, 1.0),
|
Rule("sidebar-default-width", 0.5, float, 0.0, 1.0),
|
||||||
Rule("sidebar-control-always-compact", False, bool),
|
Rule("sidebar-control-always-compact", False, bool),
|
||||||
Rule("model-search-always-append", "", str),
|
Rule("model-search-always-append", "", str),
|
||||||
|
Rule("model-default-browser-model-type", "checkpoints", str),
|
||||||
Rule("model-real-time-search", True, bool),
|
Rule("model-real-time-search", True, bool),
|
||||||
Rule("model-persistent-search", True, bool),
|
Rule("model-persistent-search", True, bool),
|
||||||
Rule("model-show-label-extensions", False, bool),
|
Rule("model-show-label-extensions", False, bool),
|
||||||
|
|||||||
@@ -1909,7 +1909,10 @@ class ModelGrid {
|
|||||||
const models = modelData.models;
|
const models = modelData.models;
|
||||||
let modelType = modelSelect.value;
|
let modelType = modelSelect.value;
|
||||||
if (models[modelType] === undefined) {
|
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) {
|
if (modelType !== previousModelType.value) {
|
||||||
@@ -3607,6 +3610,7 @@ class SettingsView {
|
|||||||
/** @type {HTMLInputElement} */ "sidebar-control-always-compact": null,
|
/** @type {HTMLInputElement} */ "sidebar-control-always-compact": null,
|
||||||
|
|
||||||
/** @type {HTMLTextAreaElement} */ "model-search-always-append": 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-real-time-search": null,
|
||||||
/** @type {HTMLInputElement} */ "model-persistent-search": null,
|
/** @type {HTMLInputElement} */ "model-persistent-search": null,
|
||||||
/** @type {HTMLInputElement} */ "model-show-label-extensions": 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({
|
$checkbox({
|
||||||
$: (el) => (settings["model-real-time-search"] = el),
|
$: (el) => (settings["model-real-time-search"] = el),
|
||||||
textContent: "Real-time search",
|
textContent: "Real-time search",
|
||||||
@@ -4258,9 +4267,9 @@ class ModelManager extends ComfyDialog {
|
|||||||
this.#init();
|
this.#init();
|
||||||
}
|
}
|
||||||
|
|
||||||
#init() {
|
async #init() {
|
||||||
this.#settingsView.reload(false);
|
await this.#settingsView.reload(false);
|
||||||
this.#refreshModels();
|
await this.#refreshModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
#resetManagerContentsScroll = () => {
|
#resetManagerContentsScroll = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user