fix: 错误计数统计

This commit is contained in:
TheSmallHanCat
2025-12-02 23:39:26 +08:00
parent 83f2ed9468
commit 0ca2a44885
3 changed files with 26 additions and 8 deletions

View File

@@ -913,12 +913,12 @@ class TokenManager:
async def record_error(self, token_id: int):
"""Record token error"""
await self.db.increment_error_count(token_id)
# Check if should ban
stats = await self.db.get_token_stats(token_id)
admin_config = await self.db.get_admin_config()
if stats and stats.error_count >= admin_config.error_ban_threshold:
if stats and stats.consecutive_error_count >= admin_config.error_ban_threshold:
await self.db.update_token_status(token_id, False)
async def record_success(self, token_id: int, is_video: bool = False):