* Check if a model is currently rate-limited (in cooldown period).
(modelId: string)
| 495 | * Check if a model is currently rate-limited (in cooldown period). |
| 496 | */ |
| 497 | function isRateLimited(modelId: string): boolean { |
| 498 | const hitTime = rateLimitedModels.get(modelId); |
| 499 | if (!hitTime) return false; |
| 500 | |
| 501 | const elapsed = Date.now() - hitTime; |
| 502 | if (elapsed >= RATE_LIMIT_COOLDOWN_MS) { |
| 503 | rateLimitedModels.delete(modelId); |
| 504 | return false; |
| 505 | } |
| 506 | return true; |
| 507 | } |
| 508 | |
| 509 | /** |
| 510 | * Mark a model as rate-limited. |
no test coverage detected