bahi-bh commited on
Commit
d2ff439
Β·
verified Β·
1 Parent(s): ae324e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -10,8 +10,6 @@ import os
10
  import sys
11
  import time
12
  import uuid
13
- from contextlib import asynccontextmanager
14
- from dataclasses import dataclass, field
15
  from typing import Any, Dict, List, Optional, Tuple
16
 
17
  import aiosqlite
@@ -409,16 +407,17 @@ async def deepseek_chat_complete(messages: list, body: ChatCompletionRequest) ->
409
 
410
  return "".join(text_parts), "".join(thinking_parts) or None
411
 
412
- # ─── Services ─────────────────────────────────────────────────────────────────
413
  class RateLimitEntry:
414
- timestamps: List[float] = field(default_factory=list)
415
- last_cleanup: float = field(default_factory=time.time)
 
416
 
417
  class Services:
418
  def __init__(self):
419
- self._rate_limits: Dict[str, RateLimitEntry] = {}
420
  self._lock = asyncio.Lock()
421
- self._cleanup_task: Optional[asyncio.Task] = None
422
 
423
  async def init_db(self):
424
  async with aiosqlite.connect(CONFIG["db_path"]) as db:
 
10
  import sys
11
  import time
12
  import uuid
 
 
13
  from typing import Any, Dict, List, Optional, Tuple
14
 
15
  import aiosqlite
 
407
 
408
  return "".join(text_parts), "".join(thinking_parts) or None
409
 
410
+ # ─── Rate Limiting (Ω…ΨΉΨ―Ω„ Ψ¨Ψ―ΩˆΩ† dataclasses) ─────────────────────────────────
411
  class RateLimitEntry:
412
+ def __init__(self):
413
+ self.timestamps = []
414
+ self.last_cleanup = time.time()
415
 
416
  class Services:
417
  def __init__(self):
418
+ self._rate_limits = {}
419
  self._lock = asyncio.Lock()
420
+ self._cleanup_task = None
421
 
422
  async def init_db(self):
423
  async with aiosqlite.connect(CONFIG["db_path"]) as db: