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:
zenfun
2025-12-17 21:40:54 +08:00
parent 5a4e63b75d
commit 174735f152
8 changed files with 310 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ type ProviderDTO struct {
Group string `json:"group"`
Models []string `json:"models"` // List of supported model names
Status string `json:"status"`
Weight int `json:"weight,omitempty"`
AutoBan *bool `json:"auto_ban,omitempty"`
BanReason string `json:"ban_reason,omitempty"`
BanUntil time.Time `json:"ban_until,omitempty"`