diff --git a/api/app/services/app_statistics_service.py b/api/app/services/app_statistics_service.py index c2af9c72..9eefd343 100644 --- a/api/app/services/app_statistics_service.py +++ b/api/app/services/app_statistics_service.py @@ -203,7 +203,7 @@ class AppStatisticsService: end_date: 结束时间戳(毫秒) Returns: - 统计数据字典 + 每日统计数据列表 """ # 将毫秒时间戳转换为 datetime start_time = datetime.fromtimestamp(start_date / 1000) diff --git a/api/app/services/model_service.py b/api/app/services/model_service.py index f41fc593..d0152573 100644 --- a/api/app/services/model_service.py +++ b/api/app/services/model_service.py @@ -652,10 +652,12 @@ class ModelApiKeyService: @staticmethod def record_api_key_usage(db: Session, api_key_id: uuid.UUID | None) -> bool: """记录API Key使用""" - success = ModelApiKeyRepository.update_usage(db, api_key_id) - if success: - db.commit() - return success + if not api_key_id: + success = ModelApiKeyRepository.update_usage(db, api_key_id) + if success: + db.commit() + return success + return False @staticmethod def get_a_api_key(db: Session, model_config_id: uuid.UUID) -> ModelApiKey: