remove duplicate deletion and addition signs

This commit is contained in:
Ville Saukkonen 2023-03-23 20:40:05 +02:00
parent 6293b88dcd
commit 30597b305c
3 changed files with 19 additions and 13 deletions

19
dist/index.js vendored

@ -105,8 +105,7 @@ function analyzeCode(parsedDiff, prDetails) {
});
}
function createPrompt(file, chunk, prDetails) {
return `
Review the following code diff in the file "${file.to}" and take the pull request title and description into account when writing the response.
return `Review the following code diff in the file "${file.to}" and take the pull request title and description into account when writing the response.
Title: ${prDetails.title}
@ -120,12 +119,22 @@ Please provide comments and suggestions ONLY if there is something to improve, w
Diff to review:
---
\`\`\`diff
${chunk.content}
${chunk.changes
.map((c) => (c.type === "add" ? "+" : "-") + " " + c.content)
.map((c) => {
if (c.type === "add") {
return "+ " + c.content;
}
else if (c.type === "del") {
return "- " + c.content;
}
else {
return " " + c.content;
}
})
.join("\n")}
---
\`\`\`
Give the answer in following TSV format:
line_number\treview_comment

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

@ -80,8 +80,7 @@ async function analyzeCode(
}
function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
return `
Review the following code diff in the file "${
return `Review the following code diff in the file "${
file.to
}" and take the pull request title and description into account when writing the response.
@ -97,12 +96,10 @@ Please provide comments and suggestions ONLY if there is something to improve, w
Diff to review:
---
\`\`\`diff
${chunk.content}
${chunk.changes
.map((c) => (c.type === "add" ? "+" : "-") + " " + c.content)
.join("\n")}
---
${chunk.changes.map((c) => c.content).join("\n")}
\`\`\`
Give the answer in following TSV format:
line_number\treview_comment