mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-07-03 14:05:26 +02:00
Revert "added messaging app rate limiter params"
This reverts commit 8ee1da7140.
This commit is contained in:
+2
-3
@@ -51,8 +51,7 @@ NVIDIA_NIM_INCLUDE_REASONING=true
|
||||
TELEGRAM_API_ID="123456"
|
||||
TELEGRAM_API_HASH="abcdef123456..."
|
||||
ALLOWED_TELEGRAM_USER_ID="YOUR_TELEGRAM_USER_ID"
|
||||
TELEGRAM_RATE_LIMIT=20
|
||||
TELEGRAM_RATE_WINDOW=60
|
||||
CLAUDE_WORKSPACE="./agent_workspace"
|
||||
ALLOWED_DIR="C:/Users/YourName/projects/myproject"
|
||||
MAX_CLI_SESSIONS=10 # Maximum parallel Claude CLI instances
|
||||
MAX_CLI_SESSIONS=10 # Maximum parallel Claude CLI instances
|
||||
WRAPPER_WS_URL="ws://localhost:8083/ws"
|
||||
+1
-3
@@ -77,9 +77,7 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
# Wrap with rate limiter
|
||||
messaging_platform = RateLimitedPlatform(
|
||||
raw_platform,
|
||||
rate_limit=settings.telegram_rate_limit,
|
||||
rate_window=settings.telegram_rate_window,
|
||||
raw_platform, rps=settings.telegram_rps
|
||||
)
|
||||
|
||||
# Create and register message handler
|
||||
|
||||
+1
-2
@@ -64,8 +64,7 @@ class Settings(BaseSettings):
|
||||
telegram_api_id: Optional[str] = None
|
||||
telegram_api_hash: Optional[str] = None
|
||||
allowed_telegram_user_id: Optional[str] = None
|
||||
telegram_rate_limit: int = 20
|
||||
telegram_rate_window: float = 60
|
||||
telegram_rps: float = 1.0
|
||||
claude_workspace: str = "./agent_workspace"
|
||||
allowed_dir: str = ""
|
||||
max_cli_sessions: int = 10
|
||||
|
||||
@@ -14,18 +14,17 @@ class RateLimitedPlatform(MessagingPlatform):
|
||||
are sent according to the global rate limit.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
platform: MessagingPlatform,
|
||||
rate_limit: int = 1,
|
||||
rate_window: float = 1.0,
|
||||
):
|
||||
def __init__(self, platform: MessagingPlatform, rps: float = 1.0):
|
||||
self._platform = platform
|
||||
self._limiter = GlobalRateLimiter(calls=rate_limit, period=rate_window)
|
||||
# RateLimitQueue expects calls and period (per).
|
||||
# For simplicity, we use 1 call per (1/rps) window if rps < 1,
|
||||
# or int(rps) calls per 1.0s window.
|
||||
if rps >= 1.0:
|
||||
self._limiter = GlobalRateLimiter(calls=int(rps), period=1.0)
|
||||
else:
|
||||
self._limiter = GlobalRateLimiter(calls=1, period=1.0 / rps)
|
||||
|
||||
logger.info(
|
||||
f"RateLimitedPlatform initialized with {rate_limit} calls per {rate_window}s"
|
||||
)
|
||||
logger.info(f"RateLimitedPlatform initialized with RPS={rps}")
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
|
||||
Reference in New Issue
Block a user