feat: add endpoints for retrieving checkpoints and unet roots in CheckpointApiClient

This commit is contained in:
Will Miao
2025-08-04 22:23:43 +08:00
parent fae2e274fd
commit 92daadb92c
2 changed files with 38 additions and 0 deletions

View File

@@ -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]: {
}

View File

@@ -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;
}
}
}