fix(ui): Refresh model list on deletion (#9059)

Signed-off-by: Richard Palethorpe <io@richiejp.com>
This commit is contained in:
Richard Palethorpe
2026-03-18 13:07:45 +00:00
committed by GitHub
parent a42548e9d1
commit e832efeb9e
2 changed files with 6 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ type ModelGalleryEndpointService struct {
backendGalleries []config.Gallery
modelPath string
galleryApplier *services.GalleryService
configLoader *config.ModelConfigLoader
}
type GalleryModel struct {
@@ -27,12 +28,13 @@ type GalleryModel struct {
gallery.GalleryModel
}
func CreateModelGalleryEndpointService(galleries []config.Gallery, backendGalleries []config.Gallery, systemState *system.SystemState, galleryApplier *services.GalleryService) ModelGalleryEndpointService {
func CreateModelGalleryEndpointService(galleries []config.Gallery, backendGalleries []config.Gallery, systemState *system.SystemState, galleryApplier *services.GalleryService, configLoader *config.ModelConfigLoader) ModelGalleryEndpointService {
return ModelGalleryEndpointService{
galleries: galleries,
backendGalleries: backendGalleries,
modelPath: systemState.Model.ModelsPath,
galleryApplier: galleryApplier,
configLoader: configLoader,
}
}
@@ -103,6 +105,8 @@ func (mgs *ModelGalleryEndpointService) DeleteModelGalleryEndpoint() echo.Handle
GalleryElementName: modelName,
}
mgs.configLoader.RemoveModelConfig(modelName)
uuid, err := uuid.NewUUID()
if err != nil {
return err

View File

@@ -40,7 +40,7 @@ func RegisterLocalAIRoutes(router *echo.Echo,
// Edit model page
router.GET("/models/edit/:name", localai.GetEditModelPage(cl, appConfig))
modelGalleryEndpointService := localai.CreateModelGalleryEndpointService(appConfig.Galleries, appConfig.BackendGalleries, appConfig.SystemState, galleryService)
modelGalleryEndpointService := localai.CreateModelGalleryEndpointService(appConfig.Galleries, appConfig.BackendGalleries, appConfig.SystemState, galleryService, cl)
router.POST("/models/apply", modelGalleryEndpointService.ApplyModelGalleryEndpoint())
router.POST("/models/delete/:name", modelGalleryEndpointService.DeleteModelGalleryEndpoint())