nsfw mark api
This commit is contained in:
@@ -131,6 +131,16 @@ class GenerationRepo:
|
||||
)
|
||||
return True
|
||||
|
||||
async def mark_nsfw(self, generation_id: str, is_nsfw: bool) -> bool:
|
||||
if not ObjectId.is_valid(generation_id):
|
||||
return False
|
||||
|
||||
res = await self.collection.update_one(
|
||||
{"_id": ObjectId(generation_id)},
|
||||
{"$set": {"nsfw": is_nsfw}}
|
||||
)
|
||||
return res.modified_count > 0
|
||||
|
||||
async def get_usage_stats(self, created_by: Optional[str] = None, project_id: Optional[str] = None) -> dict:
|
||||
"""
|
||||
Calculates usage statistics (runs, tokens, cost) using MongoDB aggregation.
|
||||
|
||||
Reference in New Issue
Block a user