mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-02 08:40:53 +03:00
feat: Add max_files attribute to MinimalUserBrainEntity and BrainsUsers repository (#2229)
This pull request adds a new attribute, max_files, to the MinimalUserBrainEntity class in the BrainsUsers repository. The max_files attribute represents the maximum number of files allowed for a brain integration.
This commit is contained in:
parent
2a8014d3a2
commit
7212e62859
@ -78,3 +78,4 @@ class MinimalUserBrainEntity(BaseModel):
|
||||
brain_type: BrainType
|
||||
description: str
|
||||
integration_logo_url: str
|
||||
max_files: int
|
||||
|
@ -36,7 +36,7 @@ class BrainsUsers(BrainsUsersInterface):
|
||||
response = (
|
||||
self.db.from_("brains_users")
|
||||
.select(
|
||||
"id:brain_id, rights, brains (brain_id, name, status, brain_type, description, meaning, integrations_user (brain_id, integration_id, integrations (id, integration_name, integration_logo_url)))"
|
||||
"id:brain_id, rights, brains (brain_id, name, status, brain_type, description, meaning, integrations_user (brain_id, integration_id, integrations (id, integration_name, integration_logo_url, max_files)))"
|
||||
)
|
||||
.filter("user_id", "eq", user_id)
|
||||
.execute()
|
||||
@ -44,6 +44,7 @@ class BrainsUsers(BrainsUsersInterface):
|
||||
user_brains: list[MinimalUserBrainEntity] = []
|
||||
for item in response.data:
|
||||
integration_logo_url = ""
|
||||
max_files = 5000
|
||||
if item["brains"]["brain_type"] == "integration":
|
||||
if "integrations_user" in item["brains"]:
|
||||
for integration_user in item["brains"]["integrations_user"]:
|
||||
@ -51,6 +52,7 @@ class BrainsUsers(BrainsUsersInterface):
|
||||
integration_logo_url = integration_user["integrations"][
|
||||
"integration_logo_url"
|
||||
]
|
||||
max_files = integration_user["integrations"]["max_files"]
|
||||
|
||||
user_brains.append(
|
||||
MinimalUserBrainEntity(
|
||||
@ -65,6 +67,7 @@ class BrainsUsers(BrainsUsersInterface):
|
||||
else ""
|
||||
),
|
||||
integration_logo_url=str(integration_logo_url),
|
||||
max_files=max_files,
|
||||
)
|
||||
)
|
||||
user_brains[-1].rights = item["rights"]
|
||||
@ -99,6 +102,7 @@ class BrainsUsers(BrainsUsersInterface):
|
||||
else ""
|
||||
),
|
||||
integration_logo_url="",
|
||||
max_files=100,
|
||||
)
|
||||
|
||||
def delete_brain_user_by_id(
|
||||
|
Loading…
Reference in New Issue
Block a user