mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-27 05:04:59 +00:00
feat(ui): paginate model gallery
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
8cfd712428
commit
dcc1da57dd
4 changed files with 117 additions and 3 deletions
|
@ -62,3 +62,15 @@ func (gm GalleryModels) FindByName(name string) *GalleryModel {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gm GalleryModels) Paginate(pageNum int, itemsNum int) GalleryModels {
|
||||
start := (pageNum - 1) * itemsNum
|
||||
end := start + itemsNum
|
||||
if start > len(gm) {
|
||||
start = len(gm)
|
||||
}
|
||||
if end > len(gm) {
|
||||
end = len(gm)
|
||||
}
|
||||
return gm[start:end]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue