Add API endpoint and frontend integration for fetching example image files

This commit is contained in:
Will Miao
2025-06-07 20:22:54 +08:00
parent c1e93d23f3
commit 647bda2160
6 changed files with 401 additions and 48 deletions

View File

@@ -936,4 +936,26 @@ export function scrollToTop(button) {
behavior: 'smooth'
});
}
}
/**
* Get example image files for a specific model from the backend
* @param {string} modelHash - The model's hash
* @returns {Promise<Array>} Array of file objects with path and metadata
*/
export async function getExampleImageFiles(modelHash) {
try {
const response = await fetch(`/api/example-image-files?model_hash=${modelHash}`);
const result = await response.json();
if (result.success) {
return result.files;
} else {
console.error('Failed to get example image files:', result.error);
return [];
}
} catch (error) {
console.error('Error fetching example image files:', error);
return [];
}
}