Skip to content

Commit 040cbc1

Browse files
balogh.adam@icloud.combalogh.adam@icloud.com
authored andcommitted
limit
1 parent ad00372 commit 040cbc1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/fastapi_server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,12 @@ async def run_suggestions(
332332
# if not await verify_captcha_token(agent_request.captchaToken):
333333
# raise HTTPException(status_code=429, detail="Invalid captcha token")
334334

335+
# Check if user has reached daily message limit (without incrementing)
336+
stats = await activity_tracker.get_activity_stats(agent_request.context.address)
337+
if stats.daily_message_count >= stats.daily_message_limit:
338+
statsd.increment("agent.suggestions.daily_limit_reached")
339+
raise HTTPException(status_code=429, detail="Daily message limit reached")
340+
335341
portfolio = await portfolio_fetcher.get_portfolio(
336342
wallet_address=agent_request.context.address
337343
)

0 commit comments

Comments
 (0)