Proposal: Batch AI Requests for Multiple Diffs in a Single File
@villesau @lfsevergnini
Proposal
Batch AI Requests for Multiple Diffs in a Single File
Description
I’ve developed code that allows us to send a single AI request for multiple diffs occurring within the same file, instead of making a separate request to ChatGPT for each diff. This should improve efficiency and reduce the number of API calls.
If you’re interested, I can create a PR to suggest this change.
check my prompt
- all prompt is translate to korean. so write sample code instead of my actual code. Link
function createPrompt(file: File, prDetails: PRDetails): string {
return `
# Pull Request Details
### Pull Request Info
- title
> ${prDetails.title}
- description
> ${prDetails.description}
### Code for Review
- file
> ${file.to}
- changes
\`\`\`
${file.chunks.map((chunk) => chunk.content).join("\n")}
\`\`\`
- diff
${file.chunks
.map((chunk) => {
return chunk.changes
.map((change) => {
// @ts-expect-error - ln and ln2 exists where needed
return \`${change.ln ? change.ln : change.ln2} ${change.content}\`;
})
.join("\n");
})
.join("\n")}
# Reviewing Guide
### Answer Role: Reviewer
You are the team leader of a development team. Your role is to review the code written by team members.
### Requirements, Reviewing Guide, Pull Request on GitHub
- For each code review, consider the title and description of the Pull Request.
- Include only severe code smells, security risks, potential bugs, and inefficient code.
- Write comments using GitHub Markdown format.
- Include only comments related to the code.
- Clearly state the rationale for your review.
### Don't Include
- Do not include vague statements like "considerations" or "points to review."
- Do not provide code reviews with a suggestive tone.
- Do not include positive comments or compliments about the code.
- Do not suggest adding comments to the code.
### Additional Requirements
${process.env.ADDITIONAL_REQUIREMENTS}
### Output Format
- Provide the response message in the following JSON format: {"reviews": [{"lineNumber": "<line_number>", "reviewComment": "<review_comment>"}]}
- <line_number>
- <line_number> means the code line number.
- Refer to each code line number in '### Code for Review'.
- If the line numbers are consecutive, indicate as a range. Example: "1-3"
- If you cannot specify the code line number, exclude that review.
- <review_comment>
- <review_comment> means the review comment.
- If <review_comment> is ambiguous, exclude that review.
- If there are no reviews for the code, set "reviews" as an empty array.
- The content of <review_comment> should be output in Korean.
`;
}
Related issues:
https://github.com/freeedcom/ai-codereviewer/issues/70
It appears that this project is no longer being actively maintained. I’d like to help keep it alive by forking the repository and continuing development, possibly releasing it as a GitHub Action. @villesau
I will, of course, adhere to the MIT License as specified.
Please let me know if you’re okay with this.
PS. I refered to Your linkedin and freeedcom SNS.
- https://www.instagram.com/freeedcom/?locale=ko-KR&hl=cs
- https://x.com/freeedcom
Hello @drakejin,
Yes. Please check out my fork: https://github.com/lfsevergnini/ai-codereviewer.
Your change is very welcome but would be great if you could rebase to my version because it has had some updates.
Let me know that you think. Feel free to fork it too, totally fine by me.
Edit: I'm not part of the team, but as you I wanted to do some updates.
Oh, yours is much better! I’ll rebase my repository on yours and make a pull request. Was that your intention?
How about this repo? Is this project stopped maintian?
Oh, yours is much better! I’ll rebase my repository on yours and make a pull request. Was that your intention?
Yep.
How about this repo? Is this project stopped maintian?
I don't know, it hasn't been responsive for months. It's been abandoned it seems.
I'll keep maintaining mine. I intend to add support to Claude soon and also code review in a single comment instead of in-line. Another thing in my radar is to leverage the big context windows and pass the files optionally, for better reviews.
Great. I also need this. So I want to commit your ai-codereviewer project by PR. See you soon.