Update BossAI workflow and workspace experience
This commit is contained in:
@@ -21,8 +21,17 @@ pub async fn enforce_key_request_limit(
|
||||
return Err(AppError::Forbidden("API key is disabled".into()));
|
||||
}
|
||||
if let Some(max_requests) = max_requests {
|
||||
if max_requests <= 0 {
|
||||
return Err(AppError::RateLimitedWithRetry {
|
||||
message: "下游密钥请求额度已用完".into(),
|
||||
retry_after_secs: 60,
|
||||
});
|
||||
}
|
||||
if used_requests.unwrap_or(0) + increment > max_requests {
|
||||
return Err(AppError::RateLimited);
|
||||
return Err(AppError::RateLimitedWithRetry {
|
||||
message: "下游密钥请求额度已用完".into(),
|
||||
retry_after_secs: 60,
|
||||
});
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user