Added scan to download previews from model info files.
- Fixed bug where scan button was not getting reset. - Attempt to get full size image preview. (May not get original image.)
This commit is contained in:
@@ -4836,7 +4836,8 @@ class SettingsView {
|
||||
}).catch((err) => {
|
||||
return { success: false };
|
||||
});
|
||||
const successMessage = data['success'] ? "Scan Finished!" : "Scan Failed!";
|
||||
const success = data['success'];
|
||||
const successMessage = success ? "Scan Finished!" : "Scan Failed!";
|
||||
const infoCount = data['infoCount'];
|
||||
const notesCount = data['notesCount'];
|
||||
const urlCount = data['urlCount'];
|
||||
@@ -4849,6 +4850,37 @@ class SettingsView {
|
||||
},
|
||||
}).element;
|
||||
|
||||
const scanDownloadPreviewsButton = new ComfyButton({
|
||||
content: 'Download Missing Previews',
|
||||
tooltip: 'Downloads missing model previews from model info.\nRun model info scan first!',
|
||||
action: async (e) => {
|
||||
const confirmation = window.confirm(
|
||||
'WARNING: This may take a while and generate MANY server requests!\nUSE AT YOUR OWN RISK!',
|
||||
);
|
||||
if (!confirmation) {
|
||||
return;
|
||||
}
|
||||
|
||||
const [button, icon, span] = comfyButtonDisambiguate(e.target);
|
||||
button.disabled = true;
|
||||
const data = await comfyRequest('/model-manager/preview/scan', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({}),
|
||||
}).catch((err) => {
|
||||
return { success: false };
|
||||
});
|
||||
const success = data['success'];
|
||||
const successMessage = success ? "Scan Finished!" : "Scan Failed!";
|
||||
const count = data['count'];
|
||||
window.alert(`${successMessage}\nPreviews Downloaded: ${count}`);
|
||||
comfyButtonAlert(e.target, success);
|
||||
if (count > 0) {
|
||||
await this.reload(true);
|
||||
}
|
||||
button.disabled = false;
|
||||
},
|
||||
}).element;
|
||||
|
||||
$el(
|
||||
'div.model-manager-settings',
|
||||
{
|
||||
@@ -5011,6 +5043,7 @@ class SettingsView {
|
||||
$el('h2', ['Scan Files']),
|
||||
$el('div', [correctPreviewsButton]),
|
||||
$el('div', [scanDownloadModelInfosButton]),
|
||||
$el('div', [scanDownloadPreviewsButton]),
|
||||
$el('h2', ['Random Tag Generator']),
|
||||
$select({
|
||||
$: (el) => (settings['tag-generator-sampler-method'] = el),
|
||||
|
||||
Reference in New Issue
Block a user