Add delete model

This commit is contained in:
Will Miao
2025-01-26 16:32:19 +08:00
parent 0e4a9ab6d4
commit 72e121c145
2 changed files with 12 additions and 9 deletions

View File

@@ -52,16 +52,16 @@ function openCivitai(modelName) {
}
}
async function deleteModel(modelName) {
async function deleteModel(fileName) {
// Prevent event bubbling
event.stopPropagation();
// Get the folder from the card's data attributes
const card = document.querySelector(`.lora-card[data-file_name="${modelName}"]`);
const card = document.querySelector(`.lora-card[data-file_name="${fileName}"]`);
const folder = card ? card.dataset.folder : null;
// Show confirmation dialog
const confirmed = confirm(`Are you sure you want to delete "${modelName}" and all associated files?`);
const confirmed = confirm(`Are you sure you want to delete "${fileName}" and all associated files?`);
if (confirmed) {
try {
@@ -71,7 +71,7 @@ async function deleteModel(modelName) {
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_name: modelName,
file_name: fileName,
folder: folder
})
});