diff --git a/core/http/endpoints/localai/gallery.go b/core/http/endpoints/localai/gallery.go index e75e74b7d..9fa00521f 100644 --- a/core/http/endpoints/localai/gallery.go +++ b/core/http/endpoints/localai/gallery.go @@ -15,9 +15,10 @@ import ( ) type ModelGalleryEndpointService struct { - galleries []config.Gallery - modelPath string - galleryApplier *services.GalleryService + galleries []config.Gallery + backendGalleries []config.Gallery + modelPath string + galleryApplier *services.GalleryService } type GalleryModel struct { @@ -25,11 +26,12 @@ type GalleryModel struct { gallery.GalleryModel } -func CreateModelGalleryEndpointService(galleries []config.Gallery, modelPath string, galleryApplier *services.GalleryService) ModelGalleryEndpointService { +func CreateModelGalleryEndpointService(galleries []config.Gallery, backendGalleries []config.Gallery, modelPath string, galleryApplier *services.GalleryService) ModelGalleryEndpointService { return ModelGalleryEndpointService{ - galleries: galleries, - modelPath: modelPath, - galleryApplier: galleryApplier, + galleries: galleries, + backendGalleries: backendGalleries, + modelPath: modelPath, + galleryApplier: galleryApplier, } } @@ -79,6 +81,7 @@ func (mgs *ModelGalleryEndpointService) ApplyModelGalleryEndpoint() func(c *fibe ID: uuid.String(), GalleryElementName: input.ID, Galleries: mgs.galleries, + BackendGalleries: mgs.backendGalleries, } return c.JSON(schema.GalleryResponse{ID: uuid.String(), StatusURL: fmt.Sprintf("%smodels/jobs/%s", utils.BaseURL(c), uuid.String())}) diff --git a/core/http/routes/localai.go b/core/http/routes/localai.go index 39f22ca61..8abadfcb9 100644 --- a/core/http/routes/localai.go +++ b/core/http/routes/localai.go @@ -23,7 +23,7 @@ func RegisterLocalAIRoutes(router *fiber.App, // LocalAI API endpoints if !appConfig.DisableGalleryEndpoint { - modelGalleryEndpointService := localai.CreateModelGalleryEndpointService(appConfig.Galleries, appConfig.ModelPath, galleryService) + modelGalleryEndpointService := localai.CreateModelGalleryEndpointService(appConfig.Galleries, appConfig.BackendGalleries, appConfig.ModelPath, galleryService) router.Post("/models/apply", modelGalleryEndpointService.ApplyModelGalleryEndpoint()) router.Post("/models/delete/:name", modelGalleryEndpointService.DeleteModelGalleryEndpoint()) diff --git a/core/http/routes/ui_gallery.go b/core/http/routes/ui_gallery.go index 6a0e1d7dd..54de40d5e 100644 --- a/core/http/routes/ui_gallery.go +++ b/core/http/routes/ui_gallery.go @@ -180,6 +180,7 @@ func registerGalleryRoutes(app *fiber.App, cl *config.BackendConfigLoader, appCo ID: uid, GalleryElementName: galleryID, Galleries: appConfig.Galleries, + BackendGalleries: appConfig.BackendGalleries, } go func() { galleryService.ModelGalleryChannel <- op @@ -219,6 +220,7 @@ func registerGalleryRoutes(app *fiber.App, cl *config.BackendConfigLoader, appCo Delete: true, GalleryElementName: galleryName, Galleries: appConfig.Galleries, + BackendGalleries: appConfig.BackendGalleries, } go func() { galleryService.ModelGalleryChannel <- op