-
Notifications
You must be signed in to change notification settings - Fork 884
Open
Description
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.
`;
}Metadata
Metadata
Assignees
Labels
No labels