Skip to content

Commit

Permalink
Merge pull request #1801 from SciPhi-AI/feature/add-max-collections-l…
Browse files Browse the repository at this point in the history
…imit-to-limit-response

Add max collections to limits response
  • Loading branch information
emrgnt-cmplxty authored Jan 10, 2025
2 parents 5950cc1 + 81017bf commit 4b85255
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions py/core/main/services/management_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,14 @@ async def get_all_user_limits(self, user_id: UUID) -> dict[str, Any]:
)
)["page_info"]["total_entries"]

max_collections = await self.get_user_max_collections(user_id)
used_collections = (
await self.providers.database.collections_handler.get_collections_overview(
limit=1, offset=0, filter_user_ids=[user_id]
)
)["total_entries"]


storage_limits = {
"chunks": {
"limit": max_chunks,
Expand All @@ -1072,6 +1080,11 @@ async def get_all_user_limits(self, user_id: UUID) -> dict[str, Any]:
"used": used_documents,
"remaining": max_documents - used_documents,
},
"collections": {
"limit": max_collections,
"used": used_collections,
"remaining": max_collections - used_collections,
}
}
# 5) Return a structured response
result = {
Expand Down

0 comments on commit 4b85255

Please sign in to comment.