feat: extend client affinity support to Antigravity and Anthropic APIKey accounts

Made-with: Cursor
This commit is contained in:
erio committed 2026-03-06 17:31:18 +08:00
1 parent af5d5dbcbc
commit 6b31b34672
4 files changed
+24 -14

No files matched your search

+1 -1
View File
@@ -250,7 +250,7 @@ func AccountFromServiceShallow(a *service.Account) *Account {
}
}
// 客户端亲和调度(仅 Anthropic OAuth/SetupToken 账号)
// 客户端亲和调度(Anthropic 和 Antigravity 账号)
if a.IsClientAffinityEnabled() {
enabled := true
out.ClientAffinityEnabled = &enabled
+1 -1
View File
@@ -188,7 +188,7 @@ type Account struct {
CacheTTLOverrideEnabled *bool `json:"cache_ttl_override_enabled,omitempty"`
CacheTTLOverrideTarget *string `json:"cache_ttl_override_target,omitempty"`
// 客户端亲和调度(仅 Anthropic OAuth/SetupToken 账号有效)
// 客户端亲和调度(Anthropic 和 Antigravity 账号有效)
// 启用后新会话会优先调度到客户端之前使用过的账号
ClientAffinityEnabled *bool `json:"client_affinity_enabled,omitempty"`
+2 -2
View File
@@ -1100,10 +1100,10 @@ func (a *Account) IsSessionIDMaskingEnabled() bool {
}
// IsClientAffinityEnabled 检查是否启用客户端亲和调度
// 仅适用于 Anthropic OAuth/SetupToken 账号(Claude Code)
// 适用于 Anthropic 和 Antigravity 账号
// 启用后,新会话会优先调度到之前使用过的账号
func (a *Account) IsClientAffinityEnabled() bool {
if !a.IsAnthropicOAuthOrSetupToken() {
if a.Platform != PlatformAnthropic && a.Platform != PlatformAntigravity {
return false
}
if a.Extra == nil {