Merge pull request #464 from touwaeriol/pr/antigravity-scope-ratelimit

feat(antigravity): 支持按配额域(scope)级别限流
This commit is contained in:
Wesley Liddick
2026-02-03 15:02:15 +08:00
committed by GitHub
13 changed files with 229 additions and 26 deletions

View File

@@ -204,6 +204,17 @@ func AccountFromServiceShallow(a *service.Account) *Account {
}
}
if scopeLimits := a.GetAntigravityScopeRateLimits(); len(scopeLimits) > 0 {
out.ScopeRateLimits = make(map[string]ScopeRateLimitInfo, len(scopeLimits))
now := time.Now()
for scope, remainingSec := range scopeLimits {
out.ScopeRateLimits[scope] = ScopeRateLimitInfo{
ResetAt: now.Add(time.Duration(remainingSec) * time.Second),
RemainingSec: remainingSec,
}
}
}
return out
}