-
Notifications
You must be signed in to change notification settings - Fork 743
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
Improve the ai output #5
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ jobs: | |
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Code Review | ||
uses: freeedcom/ai-codereviewer@main | ||
uses: freeedcom/ai-codereviewer@improve-the-AI-output | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider pinning the action version to a specific release or commit instead of using the branch name |
||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,12 +80,12 @@ async function analyzeCode( | |
|
||
function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string { | ||
return `- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}] | ||
- Do not give positive comments or compliments. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider rephrasing this line to: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider rephrasing this line to: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider rephrasing the sentence to avoid using a double negative: 'Avoid giving positive comments or compliments.' |
||
- Do not suggest commenting on the code. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider rephrasing this line to: |
||
- Provide comments and suggestions ONLY if there is something to improve, otherwise return an empty array. | ||
- Write the comment in GitHub markdown. | ||
- Don't give positive comments. | ||
- Use the given description only for the overall context and only comment the code. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line seems to be removed, but it contains important information about calculating line numbers. Consider adding it back or incorporating the information into another part of the instructions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line seems to be removed, but it contains important information about calculating the line number. Consider adding it back or incorporating the information in another part of the instructions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line seems to be removed, but it contains important information about calculating line numbers. Consider keeping this instruction or incorporating it into another part of the prompt. |
||
- Calculate the line number from \`@@ -WW,XX +YY,ZZ @@\` using following formula: \`YY + L = line_number\`, where \`YY\` is the starting line number from the diff hunk, and \`L\` is the number of lines (including unchanged lines) from the starting line until the line you want to comment on. Pay special attention to this instruction and ensure that you count lines accurately. | ||
|
||
|
||
Review the following code diff in the file "${ | ||
file.to | ||
}" and take the pull request title and description into account when writing the response. | ||
|
@@ -101,7 +101,10 @@ Git diff to review: | |
|
||
\`\`\`diff | ||
${chunk.content} | ||
${chunk.changes.map((c) => c.content).join("\n")} | ||
${chunk.changes | ||
// @ts-expect-error - ln and ln2 exists where needed | ||
.map((c) => `${c.ln ? `${c.ln} ` : `${c.ln2} `}${c.content}`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a comment to explain the purpose of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using a ternary operator instead of two separate string templates for better readability: |
||
.join("\n")} | ||
\`\`\` | ||
`; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a specific version or commit hash instead of the branch name
improve-the-AI-output
to ensure stability and reproducibility of the workflow.