|
@@ -31,6 +31,10 @@ type Local struct {
|
|
// Fallback, if set, is used to handle requests that are not handled by
|
|
// Fallback, if set, is used to handle requests that are not handled by
|
|
// this handler.
|
|
// this handler.
|
|
Fallback http.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
|
|
// 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 {
|
|
if !ok {
|
|
return &serverError{404, "not_found", "model not found"}
|
|
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) {
|
|
func decodeUserJSON[T any](r io.Reader) (T, error) {
|