Skip to content

Commit

Permalink
Merge pull request #863 from DalgoT4D/opt-in-for-llm-analysis
Browse files Browse the repository at this point in the history
added a field to check llm optin
  • Loading branch information
fatchat authored Sep 25, 2024
2 parents 20776a0 + 17ec3db commit 2fb5d60
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ddpui/api/user_org_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def get_current_user_v2(request):
is_demo=(
curr_orguser.org.type == OrgType.DEMO if curr_orguser.org else False
),
llm_optin=curr_orguser.llm_optin,
)
)

Expand Down Expand Up @@ -284,7 +285,6 @@ def put_organization_user_self(request, payload: OrgUserUpdate):
response=OrgUserResponse,
auth=auth.CustomAuthMiddleware(),
)
@has_permission(["can_edit_orguser"])
def put_organization_user_self_v1(request, payload: OrgUserUpdatev1):
"""update the requestor's OrgUser"""
orguser: OrgUser = request.orguser
Expand Down
2 changes: 2 additions & 0 deletions ddpui/core/orguserfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def update_orguser_v1(orguser: OrgUser, payload: OrgUserUpdatev1):
orguser.user.is_active = payload.active
if payload.role_uuid:
orguser.new_role = Role.objects.filter(uuid=payload.role_uuid).first()
if payload.llm_optin is not None:
orguser.llm_optin = payload.llm_optin
orguser.user.save()
orguser.save()

Expand Down
17 changes: 17 additions & 0 deletions ddpui/migrations/0102_orguser_llm_optin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2 on 2024-09-25 08:53

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("ddpui", "0101_llmsession_updated_by"),
]

operations = [
migrations.AddField(
model_name="orguser",
name="llm_optin",
field=models.BooleanField(default=False),
),
]
3 changes: 3 additions & 0 deletions ddpui/models/org_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class OrgUser(models.Model):
)
new_role = models.ForeignKey(Role, on_delete=models.SET_NULL, null=True)
email_verified = models.BooleanField(default=False)
llm_optin = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_created=True, default=timezone.now)
updated_at = models.DateTimeField(auto_now=True)

Expand Down Expand Up @@ -104,6 +105,7 @@ class OrgUserUpdatev1(Schema):
role_uuid: uuid.UUID = None
email: str = None
active: bool = None
llm_optin: bool = False


class OrgUserUpdateNewRole(Schema):
Expand Down Expand Up @@ -131,6 +133,7 @@ class OrgUserResponse(Schema):
is_demo: bool = False
new_role_slug: str | None
permissions: list[dict]
llm_optin: bool = None


class Invitation(models.Model):
Expand Down

0 comments on commit 2fb5d60

Please sign in to comment.