MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / getAllModelNames

Function getAllModelNames

ui/media/js/main.js:697–713  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

695
696// gets a flat list of all models of a certain type, ignoring directories
697function getAllModelNames(type) {
698 function f(tree) {
699 if (tree == undefined) {
700 return []
701 }
702 let result = []
703 tree.forEach((e) => {
704 if (typeof e == "object") {
705 result = result.concat(f(e[1]))
706 } else {
707 result.push(e)
708 }
709 })
710 return result
711 }
712 return f(modelsOptions[type])
713}
714
715// gets a flattened list of all models of a certain type. e.g. "path/subpath/modelname"
716// use the filter to search for all models having a certain name.

Callers 1

Calls 1

fFunction · 0.70

Tested by

no test coverage detected