Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
server/internal/registry: reintroduce pruning on model deletion (#9489)
Blake Mizerany7a01ad761439
diff --git a/server/internal/registry/server.go b/server/internal/registry/server.goindex 81085357d..4d44aa8d0 100644--- a/server/internal/registry/server.go+++ b/server/internal/registry/server.go@@ -31,6 +31,10 @@ type Local struct {// Fallback, if set, is used to handle requests that are not handled by// this handler.Fallback http.Handler++ // Prune, if set, is called to prune the local disk cache after a model+ // is deleted.+ Prune func() error // optional}// serverError is like ollama.Error, but with a Status field for the HTTP@@ -204,7 +208,10 @@ func (s *Local) handleDelete(_ http.ResponseWriter, r *http.Request) error {if !ok {return &serverError{404, "not_found", "model not found"}}- return nil+ if s.Prune == nil {+ return nil+ }+ return s.Prune()}func decodeUserJSON[T any](r io.Reader) (T, error) {diff --git a/server/routes.go b/server/routes.goindex 519f04738..f1afad6e0 100644--- a/server/routes.go+++ b/server/routes.go@@ -1199,6 +1199,8 @@ func (s *Server) GenerateRoutes(rc *ollama.Registry) (http.Handler, error) {Client: rc,Logger: slog.Default(), // TODO(bmizerany): Take a logger, do not use slog.Default()Fallback: r,++ Prune: PruneLayers,}return rs, nil