Refactor metadata handling by removing direct UI updates from saveModelMetadata and related functions

This commit is contained in:
Will Miao
2025-06-17 20:25:39 +08:00
parent 8764998e8c
commit 71df8ba3e2
15 changed files with 7 additions and 111 deletions

View File

@@ -114,16 +114,6 @@ export function setupModelNameEditing(filePath) {
await saveModelMetadata(filePath, { model_name: newModelName });
// Update the corresponding checkpoint card's dataset and display
updateModelCard(filePath, { model_name: newModelName });
// BUGFIX: Directly update the card's dataset.name attribute to ensure
// it's correctly read when reopening the modal
const checkpointCard = document.querySelector(`.lora-card[data-filepath="${filePath}"]`);
if (checkpointCard) {
checkpointCard.dataset.name = newModelName;
}
showToast('Model name updated successfully', 'success');
} catch (error) {
console.error('Error updating model name:', error);
@@ -300,9 +290,6 @@ async function saveBaseModel(filePath, originalValue) {
try {
await saveModelMetadata(filePath, { base_model: newBaseModel });
// Update the card with the new base model
updateModelCard(filePath, { base_model: newBaseModel });
showToast('Base model updated successfully', 'success');
} catch (error) {
showToast('Failed to update base model', 'error');