Stop model before deletion if loaded (fixed #6957) (#7050)

This commit is contained in:
Alex Mavrogiannis
2024-10-01 15:45:43 -07:00
committed by GitHub
parent 79d3b1e2bd
commit f40bb398f6
4 changed files with 310 additions and 58 deletions

View File

@@ -693,7 +693,12 @@ func (s *Server) DeleteHandler(c *gin.Context) {
m, err := ParseNamedManifest(n)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
switch {
case os.IsNotExist(err):
c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found", cmp.Or(r.Model, r.Name))})
default:
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
}
return
}