mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 11:11:26 -03:00
fix(download): align location-step root selection with backend diffusion routing
The download modal's location step decided between checkpoint and unet roots using only the CivitAI file-type signal, while the backend also falls back to DIFFUSION_MODEL_BASE_MODELS. Models like Anima (file type "Model") were offered checkpoint roots in the UI even though use_default_paths would route them to the unet root. - Extract the two-tier decision into py/services/download_routing.py and reuse it in DownloadManager._execute_download - Add POST /api/lm/download/routing so the UI asks the backend for the routing decision; fall back to the local file-type check on failure - ModelVersionsTab: search both checkpoint and unet roots when resolving an existing version's download path
This commit is contained in:
@@ -1390,8 +1390,22 @@ export function initVersionsTab({
|
||||
|
||||
try {
|
||||
const client = ensureClient();
|
||||
const rootsData = await client.fetchModelRoots();
|
||||
const roots = rootsData?.roots;
|
||||
// On the checkpoints page a diffusion model lives under the unet
|
||||
// roots, so both root sets are needed to locate the current file.
|
||||
let roots;
|
||||
if (modelType === 'checkpoints') {
|
||||
const [checkpointRoots, unetRoots] = await Promise.all([
|
||||
client.fetchModelRoots(),
|
||||
client.fetchModelRoots('diffusion_model'),
|
||||
]);
|
||||
roots = [
|
||||
...(checkpointRoots?.roots || []),
|
||||
...(unetRoots?.roots || []),
|
||||
];
|
||||
} else {
|
||||
const rootsData = await client.fetchModelRoots();
|
||||
roots = rootsData?.roots;
|
||||
}
|
||||
if (!Array.isArray(roots) || roots.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user