server: add model capabilities to the list endpoint (#10174)

This commit is contained in:
JasonHonKL
2025-06-05 02:39:48 +08:00
committed by GitHub
parent 5c42800fca
commit 0943001193
3 changed files with 37 additions and 19 deletions

View File

@@ -928,8 +928,7 @@ func (s *Server) ListHandler(c *gin.Context) {
}
}
// tag should never be masked
models = append(models, api.ListModelResponse{
r := api.ListModelResponse{
Model: n.DisplayShortest(),
Name: n.DisplayShortest(),
Size: m.Size(),
@@ -942,7 +941,16 @@ func (s *Server) ListHandler(c *gin.Context) {
ParameterSize: cf.ModelType,
QuantizationLevel: cf.FileType,
},
})
}
model, err := GetModel(n.String())
if err != nil {
slog.Warn("bad model details", "name", n, "error", err)
} else {
r.Capabilities = model.Capabilities()
}
models = append(models, r)
}
slices.SortStableFunc(models, func(i, j api.ListModelResponse) int {