Files
ComfyUI-Lora-Manager/static/js/api/checkpointApi.js
Will Miao 342a722991 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
2025-08-04 19:37:53 +08:00

48 lines
1.3 KiB
JavaScript

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