Skip to content

Commit

Permalink
fix(gallery): show a fake image if no there is no icon (#2111)
Browse files Browse the repository at this point in the history
Signed-off-by: Ettore Di Giacinto <[email protected]>
  • Loading branch information
mudler authored Apr 23, 2024
1 parent 34c3f56 commit ac56ac2
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions core/http/elements/gallery.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (
"github.com/go-skynet/LocalAI/pkg/gallery"
)

const (
NoImage = "https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg"
)

func DoneProgress(uid string) string {
return elem.Div(
attrs.Props{},
Expand Down Expand Up @@ -197,24 +201,26 @@ func ListModels(models []*gallery.GalleryModel) string {

elems := []elem.Node{}

if m.Icon != "" {
elems = append(elems,
if m.Icon == "" {
m.Icon = NoImage
}

elems = append(elems,

elem.Div(attrs.Props{
"class": "flex justify-center items-center",
elem.Div(attrs.Props{
"class": "flex justify-center items-center",
},
elem.A(attrs.Props{
"href": "#!",
// "class": "justify-center items-center",
},
elem.A(attrs.Props{
"href": "#!",
// "class": "justify-center items-center",
},
elem.Img(attrs.Props{
// "class": "rounded-t-lg object-fit object-center h-96",
"class": "rounded-t-lg max-h-48 max-w-96 object-cover mt-3",
"src": m.Icon,
}),
),
))
}
elem.Img(attrs.Props{
// "class": "rounded-t-lg object-fit object-center h-96",
"class": "rounded-t-lg max-h-48 max-w-96 object-cover mt-3",
"src": m.Icon,
}),
),
))

elems = append(elems, descriptionDiv(m), actionDiv(m))
modelsElements = append(modelsElements,
Expand Down

0 comments on commit ac56ac2

Please sign in to comment.