mirror of
https://github.com/mudler/LocalAI.git
synced 2026-09-12 22:33:54 -04:00
feat: do also text match (#6891)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
1 parent
a6c9789a54
commit
b8f40dde1e
1 file changed
+4
-1
@@ -61,12 +61,15 @@ func (gm GalleryElements[T]) Search(term string) GalleryElements[T] {
|
||||
term = strings.ToLower(term)
|
||||
for _, m := range gm {
|
||||
if fuzzy.Match(term, strings.ToLower(m.GetName())) ||
|
||||
fuzzy.Match(term, strings.ToLower(m.GetDescription())) ||
|
||||
fuzzy.Match(term, strings.ToLower(m.GetGallery().Name)) ||
|
||||
strings.Contains(strings.ToLower(m.GetName()), term) ||
|
||||
strings.Contains(strings.ToLower(m.GetDescription()), term) ||
|
||||
strings.Contains(strings.ToLower(m.GetGallery().Name), term) ||
|
||||
strings.Contains(strings.ToLower(strings.Join(m.GetTags(), ",")), term) {
|
||||
filteredModels = append(filteredModels, m)
|
||||
}
|
||||
}
|
||||
|
||||
return filteredModels
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user