diff --git a/core/http/endpoints/localai/gallery.go b/core/http/endpoints/localai/gallery.go index 9dc99f5d..c2710991 100644 --- a/core/http/endpoints/localai/gallery.go +++ b/core/http/endpoints/localai/gallery.go @@ -120,6 +120,7 @@ func (mgs *ModelGalleryEndpointService) ListModelFromGalleryEndpoint() func(c *f models, err := gallery.AvailableGalleryModels(mgs.galleries, mgs.modelPath) if err != nil { + log.Error().Err(err).Msg("could not list models from galleries") return err } diff --git a/core/http/routes/ui.go b/core/http/routes/ui.go index 373a983b..7cfb1aa0 100644 --- a/core/http/routes/ui.go +++ b/core/http/routes/ui.go @@ -131,7 +131,17 @@ func RegisterUIRoutes(app *fiber.App, page := c.Query("page") items := c.Query("items") - models, _ := gallery.AvailableGalleryModels(appConfig.Galleries, appConfig.ModelPath) + models, err := gallery.AvailableGalleryModels(appConfig.Galleries, appConfig.ModelPath) + if err != nil { + log.Error().Err(err).Msg("could not list models from galleries") + return c.Status(fiber.StatusInternalServerError).Render("views/error", fiber.Map{ + "Title": "LocalAI - Models", + "BaseURL": utils.BaseURL(c), + "Version": internal.PrintableVersion(), + "ErrorCode": "500", + "ErrorMessage": err.Error(), + }) + } // Get all available tags allTags := map[string]struct{}{} diff --git a/core/http/views/error.html b/core/http/views/error.html new file mode 100644 index 00000000..83ce0438 --- /dev/null +++ b/core/http/views/error.html @@ -0,0 +1,56 @@ + + +{{template "views/partials/head" .}} + +
+{{if .ErrorMessage}}{{.ErrorMessage}}{{else}}An unexpected error occurred{{end}}
+ +