Add functionality to open example images folder for models

This commit is contained in:
Will Miao
2025-05-30 09:42:36 +08:00
parent bf8e121a10
commit 09832141d0
8 changed files with 138 additions and 18 deletions

View File

@@ -419,4 +419,36 @@ export async function sendLoraToWorkflow(loraSyntax, replaceMode = false, syntax
showToast(`Failed to send ${syntaxType === 'recipe' ? 'recipe' : 'LoRA'} to workflow`, 'error');
return false;
}
}
/**
* Opens the example images folder for a specific model
* @param {string} modelHash - The SHA256 hash of the model
*/
export async function openExampleImagesFolder(modelHash) {
try {
const response = await fetch('/api/open-example-images-folder', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_hash: modelHash
})
});
const result = await response.json();
if (result.success) {
showToast('Opening example images folder', 'success');
return true;
} else {
showToast(result.error || 'Failed to open example images folder', 'error');
return false;
}
} catch (error) {
console.error('Failed to open example images folder:', error);
showToast('Failed to open example images folder', 'error');
return false;
}
}