Download internal/api/handlers/management/model_definitions.go from shimen/API: direct link, hf CLI and curl.
- Browser
- Download file 893 Bytes
-
https://huggingface.co/spaces/shimen/API/resolve/main/internal/api/handlers/management/model_definitions.go
- Command line
-
hf download hf://spaces/shimen/API/internal/api/handlers/management/model_definitions.go
-
curl -L -o model_definitions.go https://huggingface.co/spaces/shimen/API/resolve/main/internal/api/handlers/management/model_definitions.go
893 Bytes
| package management | |
| import ( | |
| "net/http" | |
| "strings" | |
| "github.com/gin-gonic/gin" | |
| "github.com/router-for-me/CLIProxyAPI/v6/internal/registry" | |
| ) | |
| // GetStaticModelDefinitions returns static model metadata for a given channel. | |
| // Channel is provided via path param (:channel) or query param (?channel=...). | |
| func (h *Handler) GetStaticModelDefinitions(c *gin.Context) { | |
| channel := strings.TrimSpace(c.Param("channel")) | |
| if channel == "" { | |
| channel = strings.TrimSpace(c.Query("channel")) | |
| } | |
| if channel == "" { | |
| c.JSON(http.StatusBadRequest, gin.H{"error": "channel is required"}) | |
| return | |
| } | |
| models := registry.GetStaticModelDefinitionsByChannel(channel) | |
| if models == nil { | |
| c.JSON(http.StatusBadRequest, gin.H{"error": "unknown channel", "channel": channel}) | |
| return | |
| } | |
| c.JSON(http.StatusOK, gin.H{ | |
| "channel": strings.ToLower(strings.TrimSpace(channel)), | |
| "models": models, | |
| }) | |
| } | |