From 5f1b53e41cb5a0334d90f9164e397881dce8b8da Mon Sep 17 00:00:00 2001 From: Dariusz L Date: Mon, 29 Jun 2026 20:54:54 +0200 Subject: [PATCH] Add option to show/hide auto-download capable models in missing browser --- web/resolver/resolver_dialog.js | 9 ++++ web/resolver/views/missing_browser_methods.js | 54 +++++++++++++++++-- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/web/resolver/resolver_dialog.js b/web/resolver/resolver_dialog.js index e003ffb..a7a8436 100644 --- a/web/resolver/resolver_dialog.js +++ b/web/resolver/resolver_dialog.js @@ -71,12 +71,21 @@ export class ResolverManagerDialog extends ComfyDialog { this.sidebarOpenModeStorageKey = "model_resolver_sidebar_open_mode"; this.missingBrowserSplitStorageKey = "model_resolver_missing_browser_detail_w"; this.showResolvedModelsStorageKey = "model_resolver_show_resolved_models"; + this.showAutoDownloadModelsStorageKey = "model_resolver_show_auto_download_models"; this.localMatchAlternativesCollapsedStorageKey = "model_resolver_local_match_alternatives_collapsed"; try { this.showResolvedModels = localStorage.getItem(this.showResolvedModelsStorageKey) === '1'; } catch (e) { this.showResolvedModels = false; } + try { + const storedShowAutoDownload = localStorage.getItem(this.showAutoDownloadModelsStorageKey); + this.showAutoDownloadModels = storedShowAutoDownload === null + ? true + : storedShowAutoDownload === '1'; + } catch (e) { + this.showAutoDownloadModels = true; + } try { this.localMatchAlternativesCollapsed = localStorage.getItem(this.localMatchAlternativesCollapsedStorageKey) === '1'; } catch (e) { diff --git a/web/resolver/views/missing_browser_methods.js b/web/resolver/views/missing_browser_methods.js index 1494972..68e6532 100644 --- a/web/resolver/views/missing_browser_methods.js +++ b/web/resolver/views/missing_browser_methods.js @@ -455,8 +455,16 @@ export const missingBrowserMethods = { }, getVisibleMissingModels(missingModels = []) { - if (this.showResolvedModels) return missingModels; - return missingModels.filter(missing => !this.isMissingModelResolved(missing)); + const resolvedFilteredModels = this.showResolvedModels + ? missingModels + : missingModels.filter(missing => !this.isMissingModelResolved(missing)); + + if (this.showAutoDownloadModels) return resolvedFilteredModels; + return resolvedFilteredModels.filter(missing => !this.isAutoDownloadModel(missing)); + }, + + isAutoDownloadModel(missing = {}) { + return Boolean(missing?.auto_download_capable || missing?.auto_download_candidate); }, getResolvedMissingCount(missingModels = []) { @@ -498,10 +506,13 @@ export const missingBrowserMethods = { renderMissingModelsBrowser(missingModels, selectedKey, totalMissing, activeCount, hasAny100Match, options = {}) { const hiddenResolvedCount = Number(options.hiddenResolvedCount || 0); + const hiddenAutoDownloadCount = Number(options.hiddenAutoDownloadCount || 0); + const autoDownloadCount = Number(options.autoDownloadCount || 0); const resolvedCount = Number(options.resolvedCount || 0); const rawMissingCount = Number(options.rawMissingCount ?? totalMissing); const missingCount = Number(options.missingCount ?? rawMissingCount); const resolvedToggleCount = this.showResolvedModels ? resolvedCount : hiddenResolvedCount; + const autoDownloadToggleCount = this.showAutoDownloadModels ? autoDownloadCount : hiddenAutoDownloadCount; const stats = this.getMissingModelSummaryStats(missingModels); const detailIndex = missingModels.findIndex(missing => this.getMissingModelKey(missing) === selectedKey); const detailMissing = detailIndex >= 0 ? missingModels[detailIndex] : null; @@ -509,6 +520,8 @@ export const missingBrowserMethods = { ? `${activeCount} downloading` : hiddenResolvedCount > 0 ? `${hiddenResolvedCount} resolved hidden` + : hiddenAutoDownloadCount > 0 + ? `${hiddenAutoDownloadCount} auto-download hidden` : (hasAny100Match ? 'Auto-link ready for exact matches' : 'Review matches or search online'); const listLayout = this.getMissingModelsListLayout(missingModels); let savedDetailWidth = null; @@ -542,6 +555,11 @@ export const missingBrowserMethods = { Show resolved ${resolvedToggleCount > 0 ? `${resolvedToggleCount}` : ''} + @@ -640,6 +658,18 @@ export const missingBrowserMethods = { }); } + const showAutoDownloadToggle = container.querySelector('#mr-show-auto-download-models'); + if (showAutoDownloadToggle && showAutoDownloadToggle.dataset.mlAutoDownloadBound !== 'true') { + showAutoDownloadToggle.dataset.mlAutoDownloadBound = 'true'; + showAutoDownloadToggle.addEventListener('change', () => { + this.showAutoDownloadModels = Boolean(showAutoDownloadToggle.checked); + try { + localStorage.setItem(this.showAutoDownloadModelsStorageKey, this.showAutoDownloadModels ? '1' : '0'); + } catch (e) {} + this.displayMissingModels(container, data); + }); + } + const selectRow = (row) => { const key = row.dataset.missingKey; if (!key || key === this.selectedMissingModelKey) return; @@ -1447,7 +1477,16 @@ export const missingBrowserMethods = { const resolvedCount = resolvedMissingCount + resolvedModels.length; const unresolvedMissingCount = Math.max(0, rawMissingCount - resolvedMissingCount); const hiddenResolvedCount = this.showResolvedModels ? 0 : resolvedCount; - const visibleMissingModels = this.getVisibleMissingModels(allModelsForDisplay); + const resolvedFilteredModels = this.showResolvedModels + ? allModelsForDisplay + : allModelsForDisplay.filter(missing => !this.isMissingModelResolved(missing)); + const autoDownloadCount = resolvedFilteredModels.reduce((count, missing) => ( + count + (this.isAutoDownloadModel(missing) ? 1 : 0) + ), 0); + const hiddenAutoDownloadCount = this.showAutoDownloadModels ? 0 : autoDownloadCount; + const visibleMissingModels = this.showAutoDownloadModels + ? resolvedFilteredModels + : resolvedFilteredModels.filter(missing => !this.isAutoDownloadModel(missing)); this.missingModels = visibleMissingModels; this.syncBatchSelectionForMissingModels(visibleMissingModels); @@ -1556,7 +1595,14 @@ export const missingBrowserMethods = { sortedMissingModels.length, activeCount, hasAny100Match, - { hiddenResolvedCount, resolvedCount, rawMissingCount, missingCount: unresolvedMissingCount } + { + hiddenResolvedCount, + hiddenAutoDownloadCount, + autoDownloadCount, + resolvedCount, + rawMissingCount, + missingCount: unresolvedMissingCount, + } ); this.wireMissingModelsBrowser(container, data, sortedMissingModels); this.restoreMissingListScroll(container, listScrollSnapshot);