collab: Exempt staff from LLM usage limits (#19836)

This PR updates the usage limit check to exempt Zed staff members from
usage limits.

We previously had some affordances for the rate limits, but hadn't yet
updated it for the usage-based billing.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-10-28 11:45:18 -04:00 committed by GitHub
parent 5e9ff3e313
commit a451bcc3c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -449,6 +449,10 @@ async fn check_usage_limit(
model_name: &str,
claims: &LlmTokenClaims,
) -> Result<()> {
if claims.is_staff {
return Ok(());
}
let model = state.db.model(provider, model_name)?;
let usage = state
.db
@ -513,11 +517,6 @@ async fn check_usage_limit(
];
for (used, limit, usage_measure) in checks {
// Temporarily bypass rate-limiting for staff members.
if claims.is_staff {
continue;
}
if used > limit {
let resource = match usage_measure {
UsageMeasure::RequestsPerMinute => "requests_per_minute",