refactor: 全部代码格式化

This commit is contained in:
Rikki
2025-03-30 04:56:46 +08:00
parent 7adaa2f5a8
commit b2fc824afd
21 changed files with 491 additions and 514 deletions

View File

@@ -46,17 +46,15 @@ class LLMStatistics:
"""记录在线时间"""
current_time = datetime.now()
# 检查5分钟内是否已有记录
recent_record = db.online_time.find_one({
"timestamp": {
"$gte": current_time - timedelta(minutes=5)
}
})
recent_record = db.online_time.find_one({"timestamp": {"$gte": current_time - timedelta(minutes=5)}})
if not recent_record:
db.online_time.insert_one({
"timestamp": current_time,
"duration": 5 # 5分钟
})
db.online_time.insert_one(
{
"timestamp": current_time,
"duration": 5, # 5分钟
}
)
def _collect_statistics_for_period(self, start_time: datetime) -> Dict[str, Any]:
"""收集指定时间段的LLM请求统计数据