fix: preserve model_url fallback and add search download button icons with tooltips

This commit is contained in:
Dariusz L
2026-06-16 19:19:45 +02:00
parent 4c1424f8bf
commit d533cda5e8
4 changed files with 48 additions and 12 deletions
+3 -3
View File
@@ -6,12 +6,12 @@
> **WIP (Work in Progress) — Download and use at your own risk!**
> This project is still under active development and some features may be unfinished or contain bugs.
<p align="center">
<img alt="ComfyUI" src="https://img.shields.io/badge/ComfyUI-1a1a1a?style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAASFBMVEVHcEwYLtsYLtkXLtkXLdkYLtkWLdcFIdoAD95uerfI1XLR3mq3xIP8/yj0/zvw/0FSYMP5/zKMmKQtPNOuuozj8FOhrZW7x4FMWFFbAAAABnRSTlMAUrPX87KxijklAAAA00lEQVR4AX3SBw6DMAxA0UzbrIzO+9+02GkEpoWP9hPZZs06Hw75aI3k4W/+wkQtnGZNhF1I34BzalQcxkmasY0b9raklNcvLYU1GNiiOeVWauOa/XS526gRyzpV/7HeUOG9Jp6vcsvUrCPeKg/3KBKBQhoTD1dQggPWzPVfFOIgo85/kR4y6oB/8SlIEh7wvmTuKd3wgLVW1sTfRBoR7oWVqy/U2NcrWDYMINE7NUuJuoV+2fhaWmnbjzcOWnRv7XbiLh/Y9dNUqk2y0QcNwTu7wgf+/BhsPUhf4QAAAABJRU5ErkJggg==" />
<a href="https://github.com/Azornes/comfyui-model-resolver">
<img alt="License" src="https://img.shields.io/github/license/Azornes/comfyui-model-resolver?style=for-the-badge&color=2F80ED" />
</a>
<img alt="License" src="https://img.shields.io/github/license/Azornes/comfyui-model-resolver?style=for-the-badge&color=2F80ED" /> </a>
<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2FAzornes%2FComfyui-Resolution-Master">
<img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fgithub.com%2FAzornes%2FComfyui-Model-Resolver&countColor=%2337d67a&style=for-the-badge&labelStyle=none" /> </a>
<img alt="Python 3.10+" src="https://img.shields.io/badge/-Python_3.10+-4B8BBE?logo=python&logoColor=FFFFFF&style=for-the-badge&logoWidth=20">
<img alt="JavaScript" src="https://img.shields.io/badge/-JavaScript-000000?logo=javascript&logoColor=F7DF1E&style=for-the-badge&logoWidth=20">
</p>
+2 -1
View File
@@ -2060,7 +2060,8 @@
justify-content: flex-end;
gap: 8px;
min-height: 24px;
min-width: 96px;
min-width: 0;
width: 100%;
}
#model-resolver-modal .mr-search-result-action-btn {
display: inline-flex;
@@ -296,13 +296,14 @@ export const resolveDownloadMethods = {
const result = candidate.result;
const url = result?.[candidate.urlKey];
if (!url) continue;
const rawModelUrl = result.model_url || result.url || url;
return {
source: candidate.source,
url,
filename: result[candidate.filenameKey] || missing.civitai_info?.expected_filename || filename,
directory: result[candidate.categoryKey] || result.directory || result.category || missing.category || 'checkpoints',
model_url: result.url || result.model_url || this.getModelCardUrl(url),
model_url: this.getModelCardUrl(rawModelUrl) || rawModelUrl,
name: result.name || result.repo_id || result.repo || result.filename || filename,
size: result.size,
type: result.type || missing.category
@@ -696,15 +697,34 @@ export const resolveDownloadMethods = {
const percent = Number(progress.progress);
downloadBtn.disabled = true;
downloadBtn.classList.remove('mr-is-success-action', 'mr-btn-primary');
downloadBtn.textContent = Number.isFinite(percent) && percent > 0 ? `${Math.round(percent)}%` : 'Starting...';
const label = Number.isFinite(percent) && percent > 0 ? `Downloading ${Math.round(percent)}%` : 'Starting download...';
if (downloadBtn.classList.contains('search-download-btn')) {
downloadBtn.innerHTML = getSvgIcon('download');
downloadBtn.setAttribute('data-tooltip', label);
downloadBtn.setAttribute('aria-label', label);
} else {
downloadBtn.textContent = Number.isFinite(percent) && percent > 0 ? `${Math.round(percent)}%` : 'Starting...';
}
} else if (status === 'cancelling') {
downloadBtn.disabled = true;
downloadBtn.classList.remove('mr-is-success-action', 'mr-btn-primary');
downloadBtn.textContent = 'Cancelling...';
if (downloadBtn.classList.contains('search-download-btn')) {
downloadBtn.innerHTML = getSvgIcon('download');
downloadBtn.setAttribute('data-tooltip', 'Cancelling download...');
downloadBtn.setAttribute('aria-label', 'Cancelling download');
} else {
downloadBtn.textContent = 'Cancelling...';
}
} else if (status === 'error' || status === 'refresh_error') {
downloadBtn.disabled = false;
downloadBtn.classList.remove('mr-is-success-action', 'mr-btn-primary');
downloadBtn.textContent = 'Retry';
if (downloadBtn.classList.contains('search-download-btn')) {
downloadBtn.innerHTML = getSvgIcon('download');
downloadBtn.setAttribute('data-tooltip', 'Retry download');
downloadBtn.setAttribute('aria-label', 'Retry download');
} else {
downloadBtn.textContent = 'Retry';
}
} else {
this.restoreDownloadButtonReadyState(downloadBtn);
}
@@ -1151,6 +1171,8 @@ export const resolveDownloadMethods = {
downloadBtn.classList.remove('mr-is-success-action', 'mr-btn-primary');
if (downloadBtn.classList.contains('search-download-btn')) {
downloadBtn.innerHTML = getSvgIcon('download');
downloadBtn.setAttribute('data-tooltip', 'Download');
downloadBtn.setAttribute('aria-label', 'Download');
return;
}
downloadBtn.innerHTML = '<span class="mr-btn-icon">☁</span> Download';
@@ -1976,7 +1998,13 @@ export const resolveDownloadMethods = {
btn.disabled = true;
btn.classList.remove('mr-is-success-action', 'mr-btn-primary');
btn.textContent = 'Starting...';
if (btn.classList.contains('search-download-btn')) {
btn.innerHTML = getSvgIcon('download');
btn.setAttribute('data-tooltip', 'Starting download...');
btn.setAttribute('aria-label', 'Starting download');
} else {
btn.textContent = 'Starting...';
}
if (progressDiv) {
progressDiv.classList.remove('mr-is-hidden');
@@ -2069,7 +2097,13 @@ export const resolveDownloadMethods = {
}
btn.disabled = false;
btn.classList.remove('mr-is-success-action', 'mr-btn-primary');
btn.textContent = 'Retry';
if (btn.classList.contains('search-download-btn')) {
btn.innerHTML = getSvgIcon('download');
btn.setAttribute('data-tooltip', 'Retry download');
btn.setAttribute('aria-label', 'Retry download');
} else {
btn.textContent = 'Retry';
}
this.updateQueuePanel?.();
this.showNotification('Download failed: ' + error.message, 'error');
}
+3 -2
View File
@@ -1104,9 +1104,10 @@ export const searchPanelMethods = {
const sourceSecondary = isFromWorkflow && sourceLabels[source] && source !== 'workflow'
? sourceLabels[source]
: '';
const modelUrl = downloadSource.model_url
const rawModelUrl = downloadSource.model_url
|| downloadSource.workflow_model_url
|| this.getModelCardUrl(downloadSource.url);
|| downloadSource.url;
const modelUrl = this.getModelCardUrl(rawModelUrl) || rawModelUrl;
const versionName = downloadSource.version_name || missing.civitai_info?.version_name || '';
const modelParts = this.getModelVersionParts(
downloadSource.name || missing.civitai_info?.model_name || '',