Record token usage
(self, token_id: int, is_video: bool = False)
| 951 | raise ValueError(f"Failed to prepare project pool: {str(e)}") |
| 952 | |
| 953 | async def record_usage(self, token_id: int, is_video: bool = False): |
| 954 | """Record token usage""" |
| 955 | await self.db.update_token(token_id, use_count=1, last_used_at=datetime.now()) |
| 956 | |
| 957 | if is_video: |
| 958 | await self.db.increment_token_stats(token_id, "video") |
| 959 | else: |
| 960 | await self.db.increment_token_stats(token_id, "image") |
| 961 | |
| 962 | async def record_error(self, token_id: int): |
| 963 | """Record token error and auto-disable if threshold reached""" |
no test coverage detected