Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request aims to improve the review prompt functionality by refactoring the code to use OpenAI API for code review comments. Additionally, it adds the ability to create GitHub pull request comments based on the review results. A Review struct has been added to parse the JSON response from the OpenAI API and create GitHub comments for any issues found in the code.
Changes
cmd/review/main.go
to use OpenAI API for code review commentsassets/review.txt
for review prompt inopenai/openai.go
openai/openai.go
File: cmd/review/main.go
Description: Added functionality to generate comments on a pull request based on an AI review of the code changes. The AI review is generated using OpenAI's GPT-3 language model and checks for potential issues in the code changes. The comments are created for each file that has changes and include the line number and description of the issue. The overall review is also generated and added as a comment to the pull request.
File: openai/assets/review.txt
Description: This pull request introduces CodeReviewGPT, an AI agent that specializes in generating code reviews for software projects using advanced natural language processing and machine learning techniques. The agent's goals are to analyze structure and logic to provide comprehensive feedback on code quality, readability, maintainability, and performance, identify potential bugs, security vulnerabilities, and other issues that may impact the functionality and stability of the software, and generate a JSON report in a specific format to help developers improve their code. The agent will respond with a quality value of good, bad, or neutral, and if the quality is good, issues will be empty. The response format will be in JSON format, as described in the code patch.
File: openai/openai.go
Description: Added embedded file
assets/review.txt
for review prompt. Also set temperature to 0.1 forChatCompletion
function.