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

Improve the ai output #5

Merged
merged 4 commits into from
Mar 28, 2023
Merged

Improve the ai output #5

merged 4 commits into from
Mar 28, 2023

Conversation

villesau
Copy link
Contributor

This change should make the reviewer to mostly comment on the exactly correct lines and give less complinents.

@@ -12,7 +12,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Code Review
uses: freeedcom/ai-codereviewer@main
uses: freeedcom/ai-codereviewer@improve-the-AI-output

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a specific version or commit hash instead of the branch name improve-the-AI-output to ensure stability and reproducibility of the workflow.

@@ -80,12 +80,12 @@ async function analyzeCode(

function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
return `- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
- Do not give positive comments or compliments.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rephrasing this line to: - Avoid providing positive comments or compliments. for better clarity.

src/main.ts Outdated
@@ -80,12 +80,12 @@ async function analyzeCode(

function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
return `- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
- Do not give positive comments or compliments.
- Do not suggest commenting on the code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rephrasing this line to: - Refrain from suggesting to comment on the code. for better clarity.

- Provide comments and suggestions ONLY if there is something to improve, otherwise return an empty array.
- Write the comment in GitHub markdown.
- Don't give positive comments.
- Use the given description only for the overall context and only comment the code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems to be removed, but it contains important information about calculating line numbers. Consider adding it back or incorporating the information into another part of the instructions.

src/main.ts Outdated
${chunk.changes.map((c) => c.content).join("\n")}
${chunk.changes
// @ts-expect-error - ln and ln2 exists where needed
.map((c) => `${c.ln ? `${c.ln} ` : `${c.ln2} `}${c.content}`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment to explain the purpose of the @ts-expect-error directive and why it's necessary in this case.

@@ -12,7 +12,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Code Review
uses: freeedcom/ai-codereviewer@main
uses: freeedcom/ai-codereviewer@improve-the-AI-output

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider pinning the action version to a specific release or commit instead of using the branch name improve-the-AI-output. This ensures stability and prevents unexpected behavior changes in the future.

@@ -80,12 +80,12 @@ async function analyzeCode(

function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
return `- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
- Do not give positive comments or compliments.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rephrasing this line to: - Avoid giving positive comments or compliments. for better clarity.

@@ -80,12 +80,12 @@ async function analyzeCode(

function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
return `- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
- Do not give positive comments or compliments.
- Refrain from suggesting to comment on the code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rephrasing this line to: - Avoid suggesting to comment on the code. for better clarity.

- Provide comments and suggestions ONLY if there is something to improve, otherwise return an empty array.
- Write the comment in GitHub markdown.
- Don't give positive comments.
- Use the given description only for the overall context and only comment the code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems to be removed, but it contains important information about calculating the line number. Consider adding it back or incorporating the information in another part of the instructions.

src/main.ts Outdated
${chunk.changes.map((c) => c.content).join("\n")}
${chunk.changes
// @ts-expect-error - ln and ln2 exists where needed
.map((c) => `${c.ln ? `${c.ln} ` : `${c.ln2} `}${c.content}`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a ternary operator instead of two separate string templates for better readability: ${c.ln ? c.ln : c.ln2} ${c.content}.

@@ -80,12 +80,12 @@ async function analyzeCode(

function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
return `- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
- Do not give positive comments or compliments.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rephrasing the sentence to avoid using a double negative: 'Avoid giving positive comments or compliments.'

@@ -80,12 +80,12 @@ async function analyzeCode(

function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
return `- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]
- Do not give positive comments or compliments.
- Refrain from suggesting to comment on the code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrase the sentence to make it clearer: 'Avoid suggesting to add comments to the code.'

- Provide comments and suggestions ONLY if there is something to improve, otherwise return an empty array.
- Write the comment in GitHub markdown.
- Don't give positive comments.
- Use the given description only for the overall context and only comment the code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems to be removed, but it contains important information about calculating line numbers. Consider keeping this instruction or incorporating it into another part of the prompt.

${chunk.changes.map((c) => c.content).join("\n")}
${chunk.changes
// @ts-expect-error - ln and ln2 exists where needed
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment to explain the purpose of this line and why the @ts-expect-error is necessary.

@villesau villesau merged commit 9f3b507 into main Mar 28, 2023
@villesau villesau deleted the improve-the-AI-output branch March 28, 2023 08:51
DematteisGiacomo pushed a commit to DematteisGiacomo/ai-codereviewer that referenced this pull request Jan 16, 2025
DematteisGiacomo pushed a commit to DematteisGiacomo/ai-codereviewer that referenced this pull request Jan 16, 2025
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

Successfully merging this pull request may close these issues.

1 participant