mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-20 18:51:26 -03:00
feat(frontend): enable downloads on Other page and default_other_roots settings UI
This commit is contained in:
@@ -146,6 +146,7 @@ export const MODEL_SPECIFIC_ENDPOINTS = {
|
||||
},
|
||||
[MODEL_TYPES.OTHER]: {
|
||||
metadata: `/api/lm/${MODEL_TYPES.OTHER}/metadata`,
|
||||
roots_by_subtype: `/api/lm/${MODEL_TYPES.OTHER}/roots_by_subtype`,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,4 +4,42 @@ import { BaseModelApiClient } from './baseModelApi.js';
|
||||
* Other-models-specific API client (VAE, upscalers, text encoders, etc.)
|
||||
*/
|
||||
export class OtherApiClient extends BaseModelApiClient {
|
||||
/**
|
||||
* Get other-model roots, optionally narrowed to one sub_type
|
||||
* (vae/upscaler/text_encoder/clip_vision/controlnet).
|
||||
*
|
||||
* Without a sub_type this falls back to the merged roots list
|
||||
* (GET /api/lm/other/roots); with one it reads the grouped
|
||||
* roots_by_subtype map and extracts the matching list.
|
||||
*/
|
||||
async fetchModelRoots(subType = null) {
|
||||
if (!subType) {
|
||||
return super.fetchModelRoots();
|
||||
}
|
||||
|
||||
const data = await this.fetchRootsBySubType();
|
||||
const groupedRoots = data.roots_by_subtype || {};
|
||||
return {
|
||||
success: data.success !== false,
|
||||
roots: groupedRoots[subType] || [],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get other-model roots grouped by sub_type.
|
||||
* GET /api/lm/other/roots_by_subtype
|
||||
* -> { success, roots_by_subtype: {sub_type: [...]} }
|
||||
*/
|
||||
async fetchRootsBySubType() {
|
||||
try {
|
||||
const response = await fetch(this.apiConfig.endpoints.specific.roots_by_subtype);
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch other-model roots by sub_type');
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error('Error fetching other-model roots by sub_type:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user