Skip to content

Commit

Permalink
Adding print to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiefHolland committed May 31, 2024
1 parent 8cd3a0d commit c25379f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,15 @@ def submit_to_gpt(code: str, ai_client: OpenAI) -> dict:
log.debug(f"Completion message content: {content}")

# Strip triple backticks if they exist
if content.startswith("```json") and content.endswith("```"):
content = content.strip("```json").strip("```").strip()
if content.startswith("```") and content.endswith("```"):
content = content.strip("```").strip()
log.debug(f"Stripped content: {content}")

# Remove the `json` identifier if it exists
if content.startswith("json"):
content = content[4:].strip()
log.debug(f"Stripped content (json identifier): {content}")

try:
review = json.loads(content)
except json.JSONDecodeError as e:
Expand Down

0 comments on commit c25379f

Please sign in to comment.