feat: enhance model root fetching and moving functionality across various components

This commit is contained in:
Will Miao
2025-08-04 23:37:27 +08:00
parent 92daadb92c
commit 31223f0526
11 changed files with 158 additions and 60 deletions

View File

@@ -64,4 +64,30 @@ export class CheckpointApiClient extends BaseModelApiClient {
throw error;
}
}
/**
* Get appropriate roots based on model type
*/
async fetchModelRoots(modelType = 'checkpoint') {
try {
let response;
if (modelType === 'diffusion_model') {
response = await fetch(this.apiConfig.endpoints.specific.unet_roots, {
method: 'GET'
});
} else {
response = await fetch(this.apiConfig.endpoints.specific.checkpoints_roots, {
method: 'GET'
});
}
if (!response.ok) {
throw new Error(`Failed to fetch ${modelType} roots`);
}
return await response.json();
} catch (error) {
console.error(`Error fetching ${modelType} roots:`, error);
throw error;
}
}
}