mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
Refactor file name update in Lora card
- Updated the setupFileNameEditing function to pass the new file name in the updates object when calling updateLoraCard. - Removed the page reload after file name change to improve user experience. - Enhanced the updateLoraCard function to handle the 'file_name' update, ensuring the dataset reflects the new file name correctly.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -452,12 +452,8 @@ export function setupFileNameEditing(filePath) {
|
||||
|
||||
// Get the new file path and update the card
|
||||
const newFilePath = filePath.replace(originalValue, newFileName);
|
||||
updateLoraCard(filePath, {}, newFilePath);
|
||||
|
||||
// Reload the page after a short delay to reflect changes
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 1500);
|
||||
// Pass the new file_name in the updates object for proper card update
|
||||
updateLoraCard(filePath, { file_name: newFileName }, newFilePath);
|
||||
} else {
|
||||
throw new Error(result.error || 'Unknown error');
|
||||
}
|
||||
|
||||
@@ -86,6 +86,11 @@ export function updateLoraCard(filePath, updates, newFilePath) {
|
||||
if (modelNameElement) modelNameElement.textContent = value;
|
||||
break;
|
||||
|
||||
case 'file_name':
|
||||
// Update the file_name in the dataset
|
||||
loraCard.dataset.file_name = value;
|
||||
break;
|
||||
|
||||
case 'base_model':
|
||||
// Update the base model label in the card header if it exists
|
||||
const baseModelLabel = loraCard.querySelector('.base-model-label');
|
||||
|
||||
Reference in New Issue
Block a user