mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-20 01:26:47 +00:00
model param and make file
This commit is contained in:
parent
67d43e592a
commit
3f4c1312a5
3 changed files with 22 additions and 13 deletions
13
dist/index.js
vendored
13
dist/index.js
vendored
|
@ -16686,13 +16686,13 @@ function getBaseAndHeadShas(owner, repo, pull_number) {
|
|||
}
|
||||
function createPrompt(file, chunk, prDetails) {
|
||||
return `Your task is to review pull requests. Instructions:
|
||||
- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
|
||||
- Provide the response in the following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
|
||||
- Do not give positive comments or compliments.
|
||||
- Provide comments and suggestions ONLY if there is something to improve, otherwise return an empty array.
|
||||
- Provide comments and suggestions ONLY if there is something to improve; otherwise, return an empty array.
|
||||
- Write the comment in GitHub Markdown format.
|
||||
- Use the given description only for the overall context and only comment the code.
|
||||
- Use the given description only for the overall context and only comment on the code.
|
||||
- IMPORTANT: NEVER suggest adding comments to the code.
|
||||
- If you don't have anything to say just say I don't have anything to say
|
||||
- If you don't have anything to say, just say "I don't have anything to say."
|
||||
Review the following code diff in the file "${file.to}" and take the pull request title and description into account when writing the response.
|
||||
|
||||
Pull request title: ${prDetails.title}
|
||||
|
@ -16707,7 +16707,7 @@ Git diff to review:
|
|||
\`\`\`diff
|
||||
${chunk.content}
|
||||
${chunk.changes
|
||||
// @ts-expect-error - ln and ln2 exists where needed
|
||||
// @ts-expect-error - ln and ln2 exist where needed
|
||||
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
|
||||
.join('\n')}
|
||||
\`\`\`
|
||||
|
@ -16812,7 +16812,8 @@ function main() {
|
|||
console.log(`Review comment created with ${comments.length} comment(s).`);
|
||||
}
|
||||
else {
|
||||
console.log('No comments to create.');
|
||||
yield createReviewComment(prDetails.owner, prDetails.repo, prDetails.pull_number, [{ body: 'No comments to create', path: '', line: 0 }]);
|
||||
console.log("No comments to create. Added a comment saying 'No comments to create'.");
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
20
src/main.ts
20
src/main.ts
|
@ -98,13 +98,13 @@ async function getBaseAndHeadShas(
|
|||
|
||||
function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
|
||||
return `Your task is to review pull requests. Instructions:
|
||||
- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
|
||||
- Provide the response in the following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
|
||||
- Do not give positive comments or compliments.
|
||||
- Provide comments and suggestions ONLY if there is something to improve, otherwise return an empty array.
|
||||
- Provide comments and suggestions ONLY if there is something to improve; otherwise, return an empty array.
|
||||
- Write the comment in GitHub Markdown format.
|
||||
- Use the given description only for the overall context and only comment the code.
|
||||
- Use the given description only for the overall context and only comment on the code.
|
||||
- IMPORTANT: NEVER suggest adding comments to the code.
|
||||
- If you don't have anything to say just say I don't have anything to say
|
||||
- If you don't have anything to say, just say "I don't have anything to say."
|
||||
Review the following code diff in the file "${
|
||||
file.to
|
||||
}" and take the pull request title and description into account when writing the response.
|
||||
|
@ -121,7 +121,7 @@ Git diff to review:
|
|||
\`\`\`diff
|
||||
${chunk.content}
|
||||
${chunk.changes
|
||||
// @ts-expect-error - ln and ln2 exists where needed
|
||||
// @ts-expect-error - ln and ln2 exist where needed
|
||||
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
|
||||
.join('\n')}
|
||||
\`\`\`
|
||||
|
@ -257,7 +257,15 @@ async function main() {
|
|||
)
|
||||
console.log(`Review comment created with ${comments.length} comment(s).`)
|
||||
} else {
|
||||
console.log('No comments to create.')
|
||||
await createReviewComment(
|
||||
prDetails.owner,
|
||||
prDetails.repo,
|
||||
prDetails.pull_number,
|
||||
[{ body: 'No comments to create', path: '', line: 0 }]
|
||||
)
|
||||
console.log(
|
||||
"No comments to create. Added a comment saying 'No comments to create'."
|
||||
)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue