mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-26 07:35:44 -03:00
feat: enhance model root fetching and moving functionality across various components
This commit is contained in:
@@ -555,6 +555,12 @@ export class BaseModelApiClient {
|
||||
|
||||
async fetchModelRoots() {
|
||||
try {
|
||||
// For checkpoints, use the specific method that considers modelType
|
||||
// if (this.modelType === 'checkpoints') {
|
||||
// const pageState = this.getPageState();
|
||||
// return await this.fetchModelRoots(pageState.modelType || 'checkpoint');
|
||||
// }
|
||||
|
||||
const response = await fetch(this.apiConfig.endpoints.roots);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch ${this.apiConfig.config.displayName} roots`);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user