mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-08-18 01:31:06 +02:00
Support lora models in subfolders when scanning the <lora> tag (#1521)
* Recursive lora search * Support lora models in subfolders when scanning the <lora> tag
This commit is contained in:
@@ -678,6 +678,29 @@ function getAllModelNames(type) {
|
||||
return f(modelsOptions[type])
|
||||
}
|
||||
|
||||
// gets a flattened list of all models of a certain type. e.g. "path/subpath/modelname"
|
||||
// use the filter to search for all models having a certain name.
|
||||
function getAllModelPathes(type,filter="") {
|
||||
function f(tree, prefix) {
|
||||
if (tree == undefined) {
|
||||
return []
|
||||
}
|
||||
let result = []
|
||||
tree.forEach((e) => {
|
||||
if (typeof e == "object") {
|
||||
result = result.concat(f(e[1], prefix + e[0] + "/"))
|
||||
} else {
|
||||
if (filter=="" || e==filter) {
|
||||
result.push(prefix + e)
|
||||
}
|
||||
}
|
||||
})
|
||||
return result
|
||||
}
|
||||
return f(modelsOptions[type], "")
|
||||
}
|
||||
|
||||
|
||||
function onUseAsThumbnailClick(req, img) {
|
||||
let scale = 1
|
||||
let targetWidth = img.naturalWidth
|
||||
|
Reference in New Issue
Block a user