mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(api): add provider creation endpoints and weight support
- Add `POST /admin/providers/preset` for streamlined creation of official providers (OpenAI, Anthropic, Gemini) - Add `POST /admin/providers/custom` for generic OpenAI-compatible providers - Add `weight` field to provider model and DTOs to enable weighted routing - Update sync service to propagate provider weights - Add unit tests for new creation handlers
This commit is contained in:
@@ -49,6 +49,7 @@ type Provider struct {
|
||||
GoogleLocation string `gorm:"size:64" json:"google_location,omitempty"`
|
||||
Group string `gorm:"default:'default'" json:"group"` // routing group/tier
|
||||
Models string `json:"models"` // comma-separated list of supported models (e.g. "gpt-4,gpt-3.5-turbo")
|
||||
Weight int `gorm:"default:1" json:"weight"` // routing weight inside route_group
|
||||
Status string `gorm:"size:50;default:'active'" json:"status"` // active, auto_disabled, manual_disabled
|
||||
AutoBan bool `gorm:"default:true" json:"auto_ban"` // whether DP-triggered disable is allowed
|
||||
BanReason string `gorm:"size:255" json:"ban_reason"` // reason for current disable
|
||||
|
||||
Reference in New Issue
Block a user