mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-23 14:12:11 -03:00
feat: add folder tree and unified folder tree endpoints, enhance download modal with folder path input and tree navigation
This commit is contained in:
@@ -83,6 +83,8 @@ export function getApiEndpoints(modelType) {
|
||||
baseModels: `/api/${modelType}/base-models`,
|
||||
roots: `/api/${modelType}/roots`,
|
||||
folders: `/api/${modelType}/folders`,
|
||||
folderTree: `/api/${modelType}/folder-tree`,
|
||||
unifiedFolderTree: `/api/${modelType}/unified-folder-tree`,
|
||||
duplicates: `/api/${modelType}/find-duplicates`,
|
||||
conflicts: `/api/${modelType}/find-filename-conflicts`,
|
||||
verify: `/api/${modelType}/verify-duplicates`,
|
||||
|
||||
@@ -586,6 +586,33 @@ export class BaseModelApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
async fetchUnifiedFolderTree() {
|
||||
try {
|
||||
const response = await fetch(this.apiConfig.endpoints.unifiedFolderTree);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch unified folder tree`);
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error('Error fetching unified folder tree:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async fetchFolderTree(modelRoot) {
|
||||
try {
|
||||
const params = new URLSearchParams({ model_root: modelRoot });
|
||||
const response = await fetch(`${this.apiConfig.endpoints.folderTree}?${params}`);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch folder tree for root: ${modelRoot}`);
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error('Error fetching folder tree:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async downloadModel(modelId, versionId, modelRoot, relativePath, downloadId) {
|
||||
try {
|
||||
const response = await fetch(DOWNLOAD_ENDPOINTS.download, {
|
||||
|
||||
Reference in New Issue
Block a user