From aac9ab4db756b999c6c95b1159fc357a3b7c44b3 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Thu, 18 Jan 2024 15:36:50 -0800 Subject: [PATCH] fix show handler --- server/routes.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/routes.go b/server/routes.go index 86a9c545..0c145ae6 100644 --- a/server/routes.go +++ b/server/routes.go @@ -630,11 +630,10 @@ func ShowModelHandler(c *gin.Context) { return } - var model string if req.Model != "" { - model = req.Model + // noop } else if req.Name != "" { - model = req.Name + req.Model = req.Name } else { c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": "model is required"}) return @@ -643,7 +642,7 @@ func ShowModelHandler(c *gin.Context) { resp, err := GetModelInfo(req) if err != nil { if os.IsNotExist(err) { - c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found", model)}) + c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found", req.Model)}) } else { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) }