|
|
@@ -453,7 +453,7 @@ bool ModelManager::scanModelsDirectory() {
|
|
|
std::map<std::string, ModelInfo> tempModels;
|
|
|
|
|
|
if (pImpl->legacyMode) {
|
|
|
- // Legacy mode: scan the models directory itself and its subdirectories
|
|
|
+ // Legacy mode: recursively scan the entire models directory and auto-detect all subdirectories
|
|
|
fs::path modelsPath(pImpl->modelsDirectory);
|
|
|
|
|
|
if (!fs::exists(modelsPath) || !fs::is_directory(modelsPath)) {
|
|
|
@@ -461,32 +461,12 @@ bool ModelManager::scanModelsDirectory() {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // First, scan the main models directory itself for any model files
|
|
|
- // This handles the case where models are directly in the specified directory
|
|
|
+ // Scan the entire models directory recursively
|
|
|
+ // Model type will be determined by file extension and directory structure
|
|
|
+ // Model names will include the full relative path from the base models directory
|
|
|
if (!pImpl->scanDirectory(modelsPath, ModelType::NONE, tempModels)) {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
- // Then scan known subdirectories for organized models
|
|
|
- std::vector<std::pair<fs::path, ModelType>> directoriesToScan = {
|
|
|
- {modelsPath / "stable-diffusion", ModelType::CHECKPOINT},
|
|
|
- {modelsPath / "controlnet", ModelType::CONTROLNET},
|
|
|
- {modelsPath / "lora", ModelType::LORA},
|
|
|
- {modelsPath / "vae", ModelType::VAE},
|
|
|
- {modelsPath / "taesd", ModelType::TAESD},
|
|
|
- {modelsPath / "esrgan", ModelType::ESRGAN},
|
|
|
- {modelsPath / "upscaler", ModelType::ESRGAN},
|
|
|
- {modelsPath / "embeddings", ModelType::EMBEDDING},
|
|
|
- {modelsPath / "textual-inversion", ModelType::EMBEDDING},
|
|
|
- {modelsPath / "checkpoints", ModelType::CHECKPOINT}, // Also scan checkpoints subdirectory
|
|
|
- {modelsPath / "other", ModelType::NONE} // Scan for any type
|
|
|
- };
|
|
|
-
|
|
|
- for (const auto& [dirPath, type] : directoriesToScan) {
|
|
|
- if (!pImpl->scanDirectory(dirPath, type, tempModels)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
} else {
|
|
|
// Explicit mode: scan configured directories for each model type
|
|
|
std::vector<std::pair<ModelType, std::string>> directoriesToScan = {
|