fix: rate limit

This commit is contained in:
Timothy J. Baek 2024-05-30 12:34:09 -07:00
parent f48f3ae276
commit 1f4a6502bb
2 changed files with 8 additions and 3 deletions

View File

@ -108,9 +108,10 @@ class Pipeline:
print(body)
print(user)
user_id = user["id"] if user and "id" in user else "default_user"
if self.rate_limited(user_id):
raise Exception("Rate limit exceeded. Please try again later.")
if user["role"] == "user":
user_id = user["id"] if user and "id" in user else "default_user"
if self.rate_limited(user_id):
raise Exception("Rate limit exceeded. Please try again later.")
self.log_request(user_id)
return body

View File

@ -13,8 +13,11 @@ requests==2.32.2
aiohttp==3.9.5
httpx
# AI libraries
openai
anthropic
google-generativeai
# Database
pymongo
@ -60,6 +63,7 @@ playwright
beautifulsoup4
# Misc
APScheduler
youtube_dl
twilio
streamlit