Browse Source

When the .ollama folder is broken or there are no models return an empty list on /api/tags

Yiorgis Gozadinos 1 year ago
parent
commit
8c6c2cbc8c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      server/routes.go

+ 1 - 1
server/routes.go

@@ -481,7 +481,7 @@ func GetModelInfo(name string) (*api.ShowResponse, error) {
 }
 }
 
 
 func ListModelsHandler(c *gin.Context) {
 func ListModelsHandler(c *gin.Context) {
-	var models []api.ModelResponse
+	models := make([]api.ModelResponse, 0)
 	fp, err := GetManifestPath()
 	fp, err := GetManifestPath()
 	if err != nil {
 	if err != nil {
 		c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
 		c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})