Add file size display for models

- Show model file sizes (GB/MB) in the sidebar next to last used time
- Use ComfyUI's folder_paths for reliable model path resolution
- Support all configured model locations including extra_model_paths
- Handle GGUF models that can be in unet or clip folders
- Update README with new features
This commit is contained in:
Setmaster
2026-01-15 12:27:04 -05:00
parent daddb8d643
commit fb28135b82
4 changed files with 87 additions and 2 deletions
+17
View File
@@ -61,6 +61,21 @@ async function fetchUsageData(timeframe = "all", sortBy = "last_used") {
}
}
/**
* Format file size to human readable string (GB or MB)
*/
function formatFileSize(bytes) {
if (bytes === null || bytes === undefined) return null;
const gb = bytes / (1024 * 1024 * 1024);
if (gb >= 1) {
return `${gb.toFixed(1)} GB`;
}
const mb = bytes / (1024 * 1024);
return `${mb.toFixed(0)} MB`;
}
/**
* Format ISO date to relative time string
*/
@@ -761,12 +776,14 @@ function renderModelList(container) {
const countLabel = currentTimeframe === "all" ? "Uses" : "Uses (period)";
const count = currentTimeframe === "all" ? model.usage_count : model.timeframe_count;
const sizeStr = formatFileSize(model.file_size);
modelDiv.innerHTML = `
<div class="modelpulse-model-name" title="${model.model_id}">${model.name}</div>
<div class="modelpulse-model-stats">
<span class="modelpulse-usage">${countLabel}: ${count}</span>
<span class="modelpulse-last-used">Last: ${formatLastUsed(model.last_used)}</span>
${sizeStr ? `<span class="modelpulse-size">${sizeStr}</span>` : ""}
</div>
`;
modelsDiv.appendChild(modelDiv);