Files
ez-api/internal/dto/model_registry.go
zenfun 2098bc4abe refactor(api): standardize DTOs and update swagger
Decouple API contract from internal models by introducing dedicated DTOs for requests and responses.
- Add Response DTOs for all resources (API Keys, Bindings, Models, Namespaces, etc.)
- Update Swagger annotations to use DTOs with field examples instead of internal models
- Refactor handlers to bind and return DTO structures
- Consolidate request/response definitions in the dto package
2026-01-10 02:05:55 +08:00

33 lines
1.6 KiB
Go

package dto
// ModelRegistryStatusResponse represents the model registry status in API responses.
// @Description Model registry status response
type ModelRegistryStatusResponse struct {
Enabled bool `json:"enabled" example:"true"`
ModelsDevRef string `json:"models_dev_ref" example:"main"`
ModelsDevURL string `json:"models_dev_url" example:"https://models.dev/v1/models.json"`
LastRefreshAt int64 `json:"last_refresh_at,omitempty" example:"1704067200"`
LastError string `json:"last_error,omitempty"`
RedisMeta map[string]string `json:"redis_meta,omitempty"`
CacheCurrent *ModelCacheFile `json:"cache_current,omitempty"`
CachePrev *ModelCacheFile `json:"cache_prev,omitempty"`
}
// ModelCacheFile represents a cached model registry file.
// @Description Cached model registry file
type ModelCacheFile struct {
Version string `json:"version,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
}
// ModelRegistryCheckResponse represents the result of checking model registry upstream.
// @Description Model registry check result
type ModelRegistryCheckResponse struct {
Enabled bool `json:"enabled" example:"true"`
UpstreamRef string `json:"upstream_ref" example:"main"`
CurrentVersion string `json:"current_version,omitempty" example:"abc123"`
LatestVersion string `json:"latest_version,omitempty" example:"def456"`
NeedsRefresh bool `json:"needs_refresh" example:"true"`
CurrentUpstreamRef string `json:"current_upstream_ref,omitempty" example:"main"`
}