From a41f2f6864e3d6a79bba4db3df5ebbfb18e815ab Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Fri, 26 Jan 2024 18:33:34 +0100 Subject: [PATCH] fix(paths): automatically create paths Especially useful when running inside a container. Signed-off-by: Ettore Di Giacinto --- api/api.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/api.go b/api/api.go index fed962db616b..82e0f69be1ea 100644 --- a/api/api.go +++ b/api/api.go @@ -216,6 +216,11 @@ func App(opts ...options.AppOption) (*fiber.App, error) { }{Version: internal.PrintableVersion()}) }) + // Make sure directories exists + os.MkdirAll(options.ImageDir, 0755) + os.MkdirAll(options.AudioDir, 0755) + os.MkdirAll(options.Loader.ModelPath, 0755) + modelGalleryService := localai.CreateModelGalleryService(options.Galleries, options.Loader.ModelPath, galleryService) app.Post("/models/apply", auth, modelGalleryService.ApplyModelGalleryEndpoint()) app.Get("/models/available", auth, modelGalleryService.ListModelFromGalleryEndpoint())