feat: enhance skip metadata refresh with smart UI and subtle badges, #790

This commit is contained in:
Will Miao
2026-02-09 09:15:29 +08:00
parent 2b74b2373d
commit 765c1c42a9
23 changed files with 283 additions and 18 deletions

View File

@@ -40,7 +40,8 @@ export class BulkManager {
moveAll: true,
autoOrganize: true,
deleteAll: true,
setContentRating: true
setContentRating: true,
skipMetadataRefresh: true
},
[MODEL_TYPES.EMBEDDING]: {
addTags: true,
@@ -51,7 +52,8 @@ export class BulkManager {
moveAll: true,
autoOrganize: true,
deleteAll: true,
setContentRating: false
setContentRating: false,
skipMetadataRefresh: true
},
[MODEL_TYPES.CHECKPOINT]: {
addTags: true,
@@ -62,7 +64,8 @@ export class BulkManager {
moveAll: false,
autoOrganize: true,
deleteAll: true,
setContentRating: true
setContentRating: true,
skipMetadataRefresh: true
},
recipes: {
addTags: false,
@@ -73,7 +76,8 @@ export class BulkManager {
moveAll: true,
autoOrganize: false,
deleteAll: true,
setContentRating: false
setContentRating: false,
skipMetadataRefresh: false
}
};
@@ -1195,6 +1199,59 @@ export class BulkManager {
return successCount > 0;
}
async setSkipMetadataRefresh(value) {
if (state.selectedModels.size === 0) {
showToast('toast.models.noModelsSelected', {}, 'warning');
return;
}
const totalCount = state.selectedModels.size;
state.loadingManager.showSimpleLoading(
translate('toast.models.skipMetadataRefreshUpdating', { count: totalCount })
);
let cancelled = false;
state.loadingManager.showCancelButton(() => {
cancelled = true;
});
let successCount = 0;
let failureCount = 0;
try {
const apiClient = getModelApiClient();
for (const filePath of state.selectedModels) {
if (cancelled) {
showToast('toast.api.operationCancelled', {}, 'info');
break;
}
try {
await apiClient.saveModelMetadata(filePath, { skip_metadata_refresh: value });
successCount++;
} catch (error) {
failureCount++;
console.error(`Failed to set skip_metadata_refresh for ${filePath}:`, error);
}
}
} finally {
state.loadingManager?.hide?.();
}
if (successCount === totalCount) {
const toastKey = value
? 'toast.models.skipMetadataRefreshSet'
: 'toast.models.skipMetadataRefreshCleared';
showToast(toastKey, { count: successCount }, 'success');
} else if (successCount > 0) {
showToast('toast.models.skipMetadataRefreshPartial', {
success: successCount,
failed: failureCount
}, 'warning');
} else {
showToast('toast.models.skipMetadataRefreshFailed', {}, 'error');
}
}
/**
* Initialize bulk base model interface
*/