Increase rate limits and add Retry-After header on /api/analyze
Made-with: Cursor
This commit is contained in:
parent
c70c03c637
commit
7ca59120dc
2 changed files with 4 additions and 3 deletions
3
app.py
3
app.py
|
|
@ -776,7 +776,8 @@ async def _analyzeDocument(
|
||||||
if not allowed:
|
if not allowed:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=429,
|
status_code=429,
|
||||||
detail=f"Rate limit exceeded. Retry after {info['retryAfter']} seconds."
|
detail=f"Rate limit exceeded. Retry after {info['retryAfter']} seconds.",
|
||||||
|
headers={"Retry-After": str(int(info["retryAfter"]) + 1)},
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
# Get internal model name
|
# Get internal model name
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,5 @@ AUTH_PASSWORD = poweron
|
||||||
SECRET_KEY = c8bc1cede035171dedf01f220623e185aa8b83670ef607e97d928d271ac94200
|
SECRET_KEY = c8bc1cede035171dedf01f220623e185aa8b83670ef607e97d928d271ac94200
|
||||||
|
|
||||||
# Rate Limiting
|
# Rate Limiting
|
||||||
RATE_LIMIT_REQUESTS_PER_MINUTE = 60
|
RATE_LIMIT_REQUESTS_PER_MINUTE = 120
|
||||||
RATE_LIMIT_BURST_SIZE = 10
|
RATE_LIMIT_BURST_SIZE = 30
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue