| package management |
|
|
| import ( |
| "net/http" |
| "strings" |
|
|
| "github.com/gin-gonic/gin" |
| "github.com/router-for-me/CLIProxyAPI/v6/internal/registry" |
| ) |
|
|
| |
| |
| 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, |
| }) |
| } |
|
|