Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding code reviews #178

Merged
merged 65 commits into from
May 31, 2024
Merged
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
99fc768
adding code reviews
seanctech Nov 15, 2023
7ae118c
update Pipfile.lock
seanctech Feb 22, 2024
112923c
Merge branch 'main' into feat/salacious
seanctech Feb 22, 2024
861fdc3
Adding code review call and updating prompt
ChiefHolland Feb 22, 2024
a358296
Adding dependencies
ChiefHolland Feb 22, 2024
0cf98ef
Cleaning up Dockerfile
ChiefHolland Feb 22, 2024
a5b29da
Updating code
ChiefHolland Feb 23, 2024
675e2f0
Integrating secret
ChiefHolland Feb 26, 2024
90889ac
Integrating secret
ChiefHolland Feb 26, 2024
01d8e17
Integrating secret
ChiefHolland Feb 26, 2024
f03ff6f
Integrating secret
ChiefHolland Feb 26, 2024
48af156
Integrating secret
ChiefHolland Feb 26, 2024
71bf878
Integrating secret
ChiefHolland Feb 26, 2024
49fe0bb
Integrating secret
ChiefHolland Feb 26, 2024
abada66
Integrating secret
ChiefHolland Feb 26, 2024
929aca1
Integrating secret
ChiefHolland Feb 26, 2024
2964e19
Integrating secret
ChiefHolland Feb 26, 2024
898b10b
Integrating secret
ChiefHolland Feb 26, 2024
5a65a98
Updating Dockerfile
ChiefHolland Mar 19, 2024
a844d08
Automated update to primary components (#184)
github-actions[bot] Apr 10, 2024
77705d3
Bump version: 2024.01.04 → 2024.04.01
SeisoAutomation Apr 10, 2024
984f31a
chore(deps): bump black from 23.12.1 to 24.3.0 (#185)
dependabot[bot] Apr 23, 2024
7ed5ed8
Bump version: 2024.04.01 → 2024.04.02
SeisoAutomation Apr 23, 2024
74e8dd5
fix: updating GH Actions (#188)
ChiefHolland Apr 23, 2024
7de8830
Bump version: 2024.04.02 → 2024.04.03
SeisoAutomation Apr 23, 2024
0863527
adding code reviews
seanctech Nov 15, 2023
ea48ddb
update Pipfile.lock
seanctech Feb 22, 2024
230d261
Adding dependencies
ChiefHolland Feb 22, 2024
01f55d0
Re-locking Pipfile.lock
ChiefHolland Apr 30, 2024
914ce61
updating Dockerfile
ChiefHolland May 1, 2024
83d58ed
updating Pipfile
ChiefHolland May 1, 2024
1f493b0
updating code review py
ChiefHolland May 1, 2024
ef4ae5d
updating code review py
ChiefHolland May 1, 2024
52a4a98
updating code review py
ChiefHolland May 1, 2024
b262964
feeding goat
ChiefHolland May 1, 2024
ce3d8ef
rebasing
ChiefHolland May 1, 2024
7b4d789
Merge branch 'main' into feat/salacious
ChiefHolland May 1, 2024
9e33bbb
Updating deps
ChiefHolland May 1, 2024
32b894e
Updating AI call
ChiefHolland May 1, 2024
794b95f
Updating AI call
ChiefHolland May 1, 2024
910fb8e
Updating AI call
ChiefHolland May 1, 2024
4c4ff28
Updating deps
ChiefHolland May 2, 2024
ec5a890
Adding print to debug
ChiefHolland May 8, 2024
86053f4
Adding print to debug
ChiefHolland May 8, 2024
7ed2806
Adding print to debug
ChiefHolland May 8, 2024
51715a0
Adding print to debug
ChiefHolland May 8, 2024
caa13c2
Adding print to debug
ChiefHolland May 8, 2024
6ae954f
Adding print to debug
ChiefHolland May 8, 2024
5a8cff3
Adding print to debug
ChiefHolland May 29, 2024
930085e
Adding print to debug
ChiefHolland May 29, 2024
bf51572
Adding print to debug
ChiefHolland May 29, 2024
14f6a9f
Adding print to debug
ChiefHolland May 29, 2024
1e7f49b
Adding print to debug
ChiefHolland May 29, 2024
cd2dac7
Adding print to debug
ChiefHolland May 31, 2024
25c6ab9
Adding print to debug
ChiefHolland May 31, 2024
a7626b9
Adding print to debug
ChiefHolland May 31, 2024
5dd39de
Adding print to debug
ChiefHolland May 31, 2024
8cd3a0d
Adding print to debug
ChiefHolland May 31, 2024
c25379f
Adding print to debug
ChiefHolland May 31, 2024
7b6fd47
Adding print to debug
ChiefHolland May 31, 2024
64b4f90
Adding print to debug
ChiefHolland May 31, 2024
9b2523a
Adding print to debug
ChiefHolland May 31, 2024
5e0d9c5
Adding print to debug
ChiefHolland May 31, 2024
53a4966
Adding print to debug
ChiefHolland May 31, 2024
0cadde4
Adding print to debug
ChiefHolland May 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding print to debug
  • Loading branch information
ChiefHolland committed May 31, 2024
commit cd2dac741e23ac9f6a52fee2d12f590280d40ad2
56 changes: 46 additions & 10 deletions code_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,29 @@ def submit_review(


def submit_to_gpt(code: str, ai_client: OpenAI) -> dict:
# try:
# completion = ai_client.chat.completions.create(
# model="gpt-3.5-turbo",
# messages=[
# {"role": "system", "content": "".join(constants.PROMPT)},
# {"role": "user", "content": code},
# ],
# )
# except openai.APIError as err:
# log.error(f"Salacious failed due to API error: {err}")
# except openai.RateLimitError as err:
# log.error(f"Salacious failed due to an exceeded rate limit: {err}")

# review = {}

# if completion is not None:
# try:
# review = json.loads(str(completion.choices[0].message.content))
# except Exception as e:
# log.error(f"Received malformed response from Salacious... {str(e)}")
# pass
review = {}

try:
completion = ai_client.chat.completions.create(
model="gpt-3.5-turbo",
Expand All @@ -149,20 +172,33 @@ def submit_to_gpt(code: str, ai_client: OpenAI) -> dict:
{"role": "user", "content": code},
],
)

# Log the entire completion object for debugging
log.debug(f"Completion object: {completion}")

# Ensure the structure of the response
if completion and "choices" in completion and len(completion.choices) > 0:
content = completion.choices[0].message.content
log.debug(f"Completion message content: {content}")

try:
review = json.loads(content)
except json.JSONDecodeError as e:
log.error(f"Received malformed JSON response: {content}")
log.error(f"JSONDecodeError: {str(e)}")
except Exception as e:
log.error(f"Unexpected error when parsing JSON: {str(e)}")
else:
log.error(
"Completion object does not contain expected 'choices' or 'message' structure"
)

except openai.APIError as err:
log.error(f"Salacious failed due to API error: {err}")
except openai.RateLimitError as err:
log.error(f"Salacious failed due to an exceeded rate limit: {err}")

review = {}

if completion is not None:
try:
print(json.loads(str(completion.choices[0].message.content)))
review = json.loads(str(completion.choices[0].message.content))
except Exception as e:
log.error(f"Received malformed response from Salacious... {str(e)}")
pass
except Exception as e:
log.error(f"Unexpected error during API call: {str(e)}")

return review

Expand Down