mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 06:32:12 -03:00
feat: refactor model API structure to support specific model types with dedicated API clients for Checkpoints, LoRAs, and Embeddings
refactor: consolidate model API client creation into a factory function for better maintainability feat: implement move operations for LoRAs and handle unsupported operations for Checkpoints and Embeddings
This commit is contained in:
47
static/js/api/checkpointApi.js
Normal file
47
static/js/api/checkpointApi.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import { BaseModelApiClient } from './baseModelApi.js';
|
||||
import { showToast } from '../utils/uiHelpers.js';
|
||||
|
||||
/**
|
||||
* Checkpoint-specific API client
|
||||
*/
|
||||
export class CheckpointApiClient extends BaseModelApiClient {
|
||||
/**
|
||||
* Checkpoints don't support move operations
|
||||
*/
|
||||
async moveSingleModel(filePath, targetPath) {
|
||||
showToast('Moving checkpoints is not supported', 'warning');
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checkpoints don't support bulk move operations
|
||||
*/
|
||||
async moveBulkModels(filePaths, targetPath) {
|
||||
showToast('Moving checkpoints is not supported', 'warning');
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get checkpoint information
|
||||
*/
|
||||
async getCheckpointInfo(filePath) {
|
||||
try {
|
||||
const response = await fetch(this.apiConfig.endpoints.specific.info, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ file_path: filePath })
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch checkpoint info');
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error('Error fetching checkpoint info:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user