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

Proposal: Batch AI Requests for Multiple Diffs in a Single File #98

Open
drakejin opened this issue Nov 4, 2024 · 7 comments
Open

Proposal: Batch AI Requests for Multiple Diffs in a Single File #98

drakejin opened this issue Nov 4, 2024 · 7 comments

Comments

@drakejin
Copy link

drakejin commented Nov 4, 2024

@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.
`;
}
@drakejin
Copy link
Author

drakejin commented Nov 5, 2024

Related issues:

#70

@drakejin
Copy link
Author

drakejin commented Nov 5, 2024

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.

@lfsevergnini
Copy link
Contributor

lfsevergnini commented Nov 6, 2024 via email

@drakejin
Copy link
Author

drakejin commented Nov 6, 2024

Oh, yours is much better! I’ll rebase my repository on yours and make a pull request. Was that your intention?

@drakejin
Copy link
Author

drakejin commented Nov 6, 2024

How about this repo? Is this project stopped maintian?

@lfsevergnini
Copy link
Contributor

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.

@drakejin
Copy link
Author

drakejin commented Nov 6, 2024

Great. I also need this. So I want to commit your ai-codereviewer project by PR. See you soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants