From 1f8a2a16a8dea12b1c37ee216e251edfc84884c6 Mon Sep 17 00:00:00 2001 From: F-G Fernandez <26927750+frgfm@users.noreply.github.com> Date: Tue, 7 Nov 2023 15:51:59 +0100 Subject: [PATCH] feat: Adds user safeguard on compute --- src/app/api/api_v1/endpoints/compute.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/api_v1/endpoints/compute.py b/src/app/api/api_v1/endpoints/compute.py index b2cd595..831d758 100644 --- a/src/app/api/api_v1/endpoints/compute.py +++ b/src/app/api/api_v1/endpoints/compute.py @@ -31,7 +31,7 @@ async def check_code_against_repo_guidelines( # Fetch guidelines guideline_list = [elt for elt in await guidelines.fetch_all(("repo_id", repo_id))] # Run analysis - return openai_client.analyze_multi(payload.code, guideline_list, mode=ExecutionMode.MULTI) + return openai_client.analyze_multi(payload.code, guideline_list, mode=ExecutionMode.MULTI, user_id=str(user.id)) @router.post("/check/{guideline_id}", status_code=status.HTTP_200_OK) @@ -47,4 +47,4 @@ async def check_code_against_guideline( user.id, event="compute-check", properties={"repo_id": guideline.repo_id, "guideline_id": guideline_id} ) # Run analysis - return openai_client.analyze_mono(payload.code, guideline) + return openai_client.analyze_mono(payload.code, guideline, user_id=str(user.id))