mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-20 15:06:36 +00:00
feat: add affinity scheduling controls
This commit is contained in:
1 parent
338e3df8d9
commit
44ec2626cf
44 files changed
+3711
-496
No files matched your search
@@ -266,9 +266,14 @@ func AccountFromServiceShallow(a *service.Account) *Account {
|
||||
}
|
||||
|
||||
// 客户端亲和调度(Anthropic 和 Antigravity 账号)
|
||||
if a.IsClientAffinityEnabled() {
|
||||
if a.IsAffinityEnabled() {
|
||||
enabled := true
|
||||
out.ClientAffinityEnabled = &enabled
|
||||
allow := a.IsAffinityAllowSwitch()
|
||||
out.AffinityAllowSwitch = &allow
|
||||
if pinnedUsers := a.GetPinnedUsers(); len(pinnedUsers) > 0 {
|
||||
out.PinnedUserIDs = pinnedUsers
|
||||
}
|
||||
}
|
||||
|
||||
// 提取账号配额限制(apikey / bedrock 类型有效)
|
||||
|
||||
@@ -201,6 +201,15 @@ type Account struct {
|
||||
// 启用后新会话会优先调度到客户端之前使用过的账号
|
||||
ClientAffinityEnabled *bool `json:"client_affinity_enabled,omitempty"`
|
||||
|
||||
// 亲和允许切换(默认 true)
|
||||
AffinityAllowSwitch *bool `json:"affinity_allow_switch,omitempty"`
|
||||
|
||||
// 亲和用户数量(admin 列表端点注入)
|
||||
AffinityUserCount *int64 `json:"affinity_user_count,omitempty"`
|
||||
|
||||
// 指定亲和用户 ID 列表
|
||||
PinnedUserIDs []int64 `json:"pinned_user_ids,omitempty"`
|
||||
|
||||
// 亲和客户端数据(仅 admin 列表端点注入,不由 mapper 填充)
|
||||
AffinityClientCount *int64 `json:"affinity_client_count,omitempty"`
|
||||
AffinityClients []string `json:"affinity_clients,omitempty"`
|
||||
|
||||
Reference in new issue
Block a user