diff --git a/static/js/api/apiConfig.js b/static/js/api/apiConfig.js index 14c9a04f..87704cd6 100644 --- a/static/js/api/apiConfig.js +++ b/static/js/api/apiConfig.js @@ -109,6 +109,8 @@ export const MODEL_SPECIFIC_ENDPOINTS = { }, [MODEL_TYPES.CHECKPOINT]: { info: `/api/${MODEL_TYPES.CHECKPOINT}/info`, + checkpoints_roots: `/api/${MODEL_TYPES.CHECKPOINT}/checkpoints_roots`, + unet_roots: `/api/${MODEL_TYPES.CHECKPOINT}/unet_roots`, }, [MODEL_TYPES.EMBEDDING]: { } diff --git a/static/js/api/checkpointApi.js b/static/js/api/checkpointApi.js index b7e32542..6fdf8b58 100644 --- a/static/js/api/checkpointApi.js +++ b/static/js/api/checkpointApi.js @@ -28,4 +28,40 @@ export class CheckpointApiClient extends BaseModelApiClient { throw error; } } + + /** + * Get checkpoint roots + */ + async getCheckpointsRoots() { + try { + const response = await fetch(this.apiConfig.endpoints.specific.checkpoints_roots, { + method: 'GET' + }); + if (!response.ok) { + throw new Error('Failed to fetch checkpoints roots'); + } + return await response.json(); + } catch (error) { + console.error('Error fetching checkpoints roots:', error); + throw error; + } + } + + /** + * Get unet roots + */ + async getUnetRoots() { + try { + const response = await fetch(this.apiConfig.endpoints.specific.unet_roots, { + method: 'GET' + }); + if (!response.ok) { + throw new Error('Failed to fetch unet roots'); + } + return await response.json(); + } catch (error) { + console.error('Error fetching unet roots:', error); + throw error; + } + } }