Use standard per minute rate limits across user types

This commit is contained in:
Debanjum 2024-11-01 16:15:09 -07:00
parent ac21b10dd5
commit 9c7b36dc69
2 changed files with 3 additions and 4 deletions

View file

@ -167,7 +167,7 @@ async def text_to_speech(
common: CommonQueryParams,
text: str,
rate_limiter_per_minute=Depends(
ApiUserRateLimiter(requests=10, subscribed_requests=60, window=60, slug="chat_minute")
ApiUserRateLimiter(requests=30, subscribed_requests=30, window=60, slug="chat_minute")
),
rate_limiter_per_day=Depends(
ApiUserRateLimiter(requests=100, subscribed_requests=600, window=60 * 60 * 24, slug="chat_day")
@ -555,7 +555,7 @@ async def chat(
common: CommonQueryParams,
body: ChatRequestBody,
rate_limiter_per_minute=Depends(
ApiUserRateLimiter(requests=5, subscribed_requests=20, window=60, slug="chat_minute")
ApiUserRateLimiter(requests=20, subscribed_requests=20, window=60, slug="chat_minute")
),
rate_limiter_per_day=Depends(
ApiUserRateLimiter(requests=100, subscribed_requests=600, window=60 * 60 * 24, slug="chat_day")

View file

@ -1,12 +1,11 @@
import json
import logging
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional
from typing import Callable, Dict, List, Optional
import yaml
from fastapi import Request
from khoj.database.adapters import ConversationAdapters, EntryAdapters
from khoj.database.models import Agent, KhojUser
from khoj.processor.conversation import prompts
from khoj.processor.conversation.utils import (