mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
- Introduced a new API endpoint for bulk deleting loras. - Added ModelDuplicatesManager to handle duplicate models for loras and checkpoints. - Implemented UI components for displaying duplicates and managing selections. - Enhanced controls with a button for finding duplicates. - Updated templates to include a duplicates banner and associated actions.
24 lines
735 B
JavaScript
24 lines
735 B
JavaScript
/**
|
|
* Format a file size in bytes to a human-readable string
|
|
* @param {number} bytes - The size in bytes
|
|
* @returns {string} Formatted size string (e.g., "1.5 MB")
|
|
*/
|
|
export function formatFileSize(bytes) {
|
|
if (!bytes || isNaN(bytes)) return '';
|
|
|
|
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i];
|
|
}
|
|
|
|
/**
|
|
* Convert timestamp to human readable date string
|
|
* @param {number} modified - Timestamp in seconds
|
|
* @returns {string} Formatted date string
|
|
*/
|
|
export function formatDate(modified) {
|
|
if (!modified) return '';
|
|
const date = new Date(modified * 1000);
|
|
return date.toLocaleString();
|
|
}
|