|
@@ -142,7 +142,7 @@ func (s *Server) GenerateHandler(c *gin.Context) {
|
|
switch {
|
|
switch {
|
|
case errors.Is(err, fs.ErrNotExist):
|
|
case errors.Is(err, fs.ErrNotExist):
|
|
c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found", req.Model)})
|
|
c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found", req.Model)})
|
|
- case err.Error() == "invalid model name":
|
|
|
|
|
|
+ case err.Error() == errtypes.InvalidModelNameErrMsg:
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
default:
|
|
default:
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
@@ -568,7 +568,7 @@ func (s *Server) PullHandler(c *gin.Context) {
|
|
|
|
|
|
name := model.ParseName(cmp.Or(req.Model, req.Name))
|
|
name := model.ParseName(cmp.Or(req.Model, req.Name))
|
|
if !name.IsValid() {
|
|
if !name.IsValid() {
|
|
- c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": "invalid model name"})
|
|
|
|
|
|
+ c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": errtypes.InvalidModelNameErrMsg})
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -829,7 +829,7 @@ func (s *Server) ShowHandler(c *gin.Context) {
|
|
switch {
|
|
switch {
|
|
case os.IsNotExist(err):
|
|
case os.IsNotExist(err):
|
|
c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found", req.Model)})
|
|
c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found", req.Model)})
|
|
- case err.Error() == "invalid model name":
|
|
|
|
|
|
+ case err.Error() == errtypes.InvalidModelNameErrMsg:
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
default:
|
|
default:
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
@@ -1470,7 +1470,7 @@ func (s *Server) ChatHandler(c *gin.Context) {
|
|
switch {
|
|
switch {
|
|
case os.IsNotExist(err):
|
|
case os.IsNotExist(err):
|
|
c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found", req.Model)})
|
|
c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found", req.Model)})
|
|
- case err.Error() == "invalid model name":
|
|
|
|
|
|
+ case err.Error() == errtypes.InvalidModelNameErrMsg:
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
default:
|
|
default:
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|