Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

Fixed the API endpoint /api/tags when the model list is empty. (#4424)

Ryo Machida798b107f19ed
diff --git a/server/routes.go b/server/routes.go
index aaa461c2e..123ef9a3a 100644
--- a/server/routes.go
+++ b/server/routes.go
@@ -725,7 +725,7 @@ func (s *Server) ListModelsHandler(c *gin.Context) {
return
}
- var models []api.ModelResponse
+ models := []api.ModelResponse{}
if err := filepath.Walk(manifests, func(path string, info os.FileInfo, _ error) error {
if !info.IsDir() {
rel, err := filepath.Rel(manifests, path)
diff --git a/server/routes_test.go b/server/routes_test.go
index 896dc27bf..e144c957f 100644
--- a/server/routes_test.go
+++ b/server/routes_test.go
@@ -95,6 +95,7 @@ func Test_Routes(t *testing.T) {
err = json.Unmarshal(body, &modelList)
assert.Nil(t, err)
+ assert.NotNil(t, modelList.Models)
assert.Equal(t, 0, len(modelList.Models))
},
},