MCPcopy
hub / github.com/mudler/LocalAI / FindGalleryElement

Function FindGalleryElement

core/gallery/gallery.go:223–245  ·  view source on GitHub ↗
(models []T, name string)

Source from the content-addressed store, hash-verified

221}
222
223func FindGalleryElement[T GalleryElement](models []T, name string) T {
224 var model T
225 name = strings.ReplaceAll(name, string(os.PathSeparator), "__")
226
227 if !strings.Contains(name, "@") {
228 for _, m := range models {
229 if strings.EqualFold(strings.ToLower(m.GetName()), strings.ToLower(name)) {
230 model = m
231 break
232 }
233 }
234
235 } else {
236 for _, m := range models {
237 if strings.EqualFold(strings.ToLower(name), strings.ToLower(fmt.Sprintf("%s@%s", m.GetGallery().Name, m.GetName()))) {
238 model = m
239 break
240 }
241 }
242 }
243
244 return model
245}
246
247// List available models
248// Models galleries are a list of yaml files that are hosted on a remote server (for example github).

Callers 8

RegisterUIAPIRoutesFunction · 0.92
installModelFunction · 0.92
RunMethod · 0.92
InstallModelFromGalleryFunction · 0.85
gallery_test.goFile · 0.85
CheckUpgradesAgainstFunction · 0.85
UpgradeBackendFunction · 0.85

Calls 3

ContainsMethod · 0.80
GetNameMethod · 0.65
GetGalleryMethod · 0.65

Tested by

no test coverage detected