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

Error parsing JSON response from the model: ```json #331

Open
francisbilham11 opened this issue May 2, 2024 · 0 comments
Open

Error parsing JSON response from the model: ```json #331

francisbilham11 opened this issue May 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@francisbilham11
Copy link

francisbilham11 commented May 2, 2024

Current Behavior:

Running on GitHub Actions passes and comments 👍🏼🔍🚫 on the PR even when it's riddled with errors. When looking at the logs, I can see these errors were indeed picked up but they were not output properly as json. the error message is as below:

ERROR	Error parsing JSON response from the model: ```json

Expected Behavior:

Expected that the GitHub Actions workflow produces a meaningful comment on the PR listing the errors

Steps To Reproduce:

Here is the workflow:

name: Code Review GPT

on:
  pull_request:
    branches: [main]

jobs:
  run_code_review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Code Review GPT
        uses: mattzcarey/code-review-gpt@v0.1.4-alpha
        with:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          MODEL: 'gpt-3.5-turbo'
          GITHUB_TOKEN: ${{ github.token }}

Environment:

  • OS: ubuntu-latest
  • Node: v18.20.2
  • npm: 10.5.0

Anything else:

Here's a snippet of the logs:

ERROR	Error parsing JSON response from the model: ```json
[
    {
        "fileName": "/home/runner/work/francis-pd/francis-pd/db_connect.py",
        "riskScore": 5,
        "details": "API keys and credentials are hard-coded in the code. This is a severe security risk. These should not be exposed in plain text. Consider using environment variables or a secure storage solution."
    },
    {
        "fileName": "/home/runner/work/francis-pd/francis-pd/db_connect.py",
        "riskScore": 4,
        "details": "There is a SQL injection vulnerability in the 'update_item' function. User input should not be directly interpolated into SQL queries. Use parameterized queries to prevent SQL injection attacks."
    },
    {
        "fileName": "/home/runner/work/francis-pd/francis-pd/db_connect.py",
        "riskScore": 3,
        "details": "The 'list_duplicator' function seems to be inefficient for duplicating items. Consider using list comprehension or other more efficient methods for duplicating items."
    }
]
```

SyntaxError  Unexpected token ` in JSON at position 0
error stack:
  • 	
	
  • index.js	Ge
	/node_modules/code-review-gpt/dist/index.js:16
  • index.js	maxTry
	/node_modules/code-review-gpt/dist/index.js:16
  • task_queues	process.processTicksAndRejections
	internal/process/task_queues:95
ERROR	Error in callModelJSON
@francisbilham11 francisbilham11 added the bug Something isn't working label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant