mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
model-registry: add upstream check endpoint
This commit is contained in:
@@ -42,6 +42,34 @@ type refreshModelRegistryRequest struct {
|
||||
Ref string `json:"ref"`
|
||||
}
|
||||
|
||||
// CheckModelRegistry godoc
|
||||
// @Summary Check model registry upstream version
|
||||
// @Description Checks models.dev commit SHA for a ref and indicates whether refresh is needed (does not apply changes)
|
||||
// @Tags admin
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security AdminAuth
|
||||
// @Param body body refreshModelRegistryRequest false "optional override ref"
|
||||
// @Success 200 {object} service.ModelRegistryCheckResult
|
||||
// @Failure 400 {object} gin.H
|
||||
// @Failure 500 {object} gin.H
|
||||
// @Router /admin/model-registry/check [post]
|
||||
func (h *ModelRegistryHandler) Check(c *gin.Context) {
|
||||
if h == nil || h.reg == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "model registry not configured"})
|
||||
return
|
||||
}
|
||||
var req refreshModelRegistryRequest
|
||||
_ = c.ShouldBindJSON(&req)
|
||||
ref := strings.TrimSpace(req.Ref)
|
||||
out, err := h.reg.Check(c.Request.Context(), ref)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to check model registry", "details": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, out)
|
||||
}
|
||||
|
||||
// RefreshModelRegistry godoc
|
||||
// @Summary Refresh model registry from models.dev
|
||||
// @Description Fetches models.dev, computes per-binding capabilities, and updates Redis meta:models
|
||||
|
||||
Reference in New Issue
Block a user