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

feat: testing differents prompts #23

Closed
wants to merge 1 commit into from
Closed

feat: testing differents prompts #23

wants to merge 1 commit into from

Conversation

emanuel-braz
Copy link
Owner

No description provided.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Based on the provided code diff, I have the following suggestions:

  1. Line 97: The order of concatenation seems to be incorrect. The instructionJsonFormat should be appended after contentSystemMessage, not before. Consider changing it to:
-    contentSystemMessage = `${contentSystemMessage}\n${instructionJsonFormat}`;
+    contentSystemMessage = `${contentSystemMessage}\n\n${instructionJsonFormat}`;
  1. Line 110: There is an unnecessary indentation in this line. Remove the extra spaces before contentSystemMessage:
-          contentSystemMessage = overridePrompt;
+      contentSystemMessage = overridePrompt;
  1. Line 113: There are two consecutive newlines after instructionJsonFormat. Consider removing one of them to maintain consistency:
-    contentSystemMessage = `${instructionJsonFormat}\n\n${contentSystemMessage}`;
+    contentSystemMessage = `${instructionJsonFormat}\n${contentSystemMessage}`;
  1. Line 116: There are two consecutive newlines before appendPrompt. Consider removing one of them to maintain consistency:
-    contentSystemMessage = `${contentSystemMessage}\n\n${appendPrompt}`;
+    contentSystemMessage = `${contentSystemMessage}\n${appendPrompt}`;

Please review and make the necessary changes accordingly.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Based on the provided code diff, I have the following suggestions:

  1. Line 144: The temperature value has been changed from 0 to 0.1. Please ensure that this change is intentional and aligns with the desired behavior.

  2. Line 157: The indentation of this line seems to be incorrect. Please make sure it is properly aligned with the surrounding code.

  3. Line 161: The max_tokens value is being parsed as an integer. Please ensure that the maxTokens variable is a valid integer value before parsing it.

  4. Line 163: The frequency_penalty value is set to 0. Please verify if this value is intended and aligns with the desired behavior.

Please review these suggestions and make any necessary changes.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Based on the provided code diff, I have the following suggestions:

  1. Line 169: The variable response is accessed without checking if it is defined. It is recommended to add a nullish coalescing operator (??) to provide a default value in case response is null or undefined. This will ensure that the code does not throw an error. Here's the updated code:
- const result = response?.trim() || "[]";
+ const result = response?.trim() ?? "[]";
  1. Line 156: The code is returning result without parsing it as JSON. Since the variable result is expected to be a JSON string, it should be parsed using JSON.parse() before returning. Here's the updated code:
- return result;
+ return JSON.parse(result);
  1. Line 173: The console.error() statement is not necessary and can be removed. Since the error is already caught and handled, logging the error to the console is redundant. Here's the updated code:
- console.error("Error:", error);
  1. Line 174: The return null; statement is not necessary and can be removed. Since the error is caught and handled, returning null does not provide any additional information. Here's the updated code:
- return null;

Please consider these suggestions for improving the code.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Based on the provided code diff, here are my suggestions:

  1. Line 182: There is an unnecessary empty line. Please remove it.

  2. Line 183: The variable aiResponses is being reassigned without any need. Please remove this line.

  3. Line 185: The arrow function passed to flatMap is missing curly braces. Please add curly braces to improve code readability.

  4. Line 186: The condition !file.to seems to be incomplete or incorrect. Please review and update the condition accordingly.

Please make the necessary changes and resubmit the pull request.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Based on the provided code diff, I have the following suggestions:

  1. Line 177: The function name createReviewComment has been changed to createReviewOnPr. Please make sure to update all the references to this function throughout the codebase.

  2. Line 193: There is an unnecessary empty line. Please remove it to keep the code clean and concise.

  3. Line 194: There is an unnecessary empty line. Please remove it to keep the code clean and concise.

  4. Line 196: The function createReviewOnPr has been added. Please make sure to update all the references to this function throughout the codebase.

Please make the necessary changes based on the suggestions above.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Based on the provided code diff, I have the following suggestions:

  1. Line 203: The function createCommentOnPr is defined but not being used. Consider removing this unused function to keep the codebase clean and avoid confusion.

  2. Line 207: The octokit.pulls.createReview function is called without awaiting its completion. This may lead to unexpected behavior or race conditions. Consider adding the await keyword before the function call to ensure proper execution.

  3. Line 213: The event property is set to "COMMENT" in the octokit.pulls.createReview function call. However, this property is not supported in the GitHub API. Please review the API documentation and update the event property accordingly.

  4. Line 215: The main function is defined but not being called. Make sure to call the main function to execute the desired functionality.

Please address these suggestions in the code.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Based on the provided code diff, here are my suggestions:

  1. Line 236: The code is calling the createReviewComment function, but it seems like it should be calling createReviewOnPr instead. Please update the function name to createReviewOnPr to ensure consistency.

  2. Line 263: There is a typo in the comment. It says "analyzeCode" instead of "analyzeDiff". Please update the comment to say "analyzeDiff" to accurately reflect the function being called.

  3. Line 264: There is an unnecessary empty line. Please remove this empty line to keep the code clean and concise.

  4. Line 267: There is a trailing whitespace at the end of the line. Please remove this whitespace to maintain consistent code formatting.

Please make the necessary changes based on the suggestions above.


for (const file of parsedDiff) {
if (file.to === "/dev/null") continue; // Ignore deleted files
for (const chunk of file.chunks) {

const messages = createMessages(file, chunk, prDetails);
const messages = generateMessages(file, chunk, prDetails);

Choose a reason for hiding this comment

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

The function name 'generateMessages' does not match the function name used in the code 'createMessages'. Please update the function name to 'createMessages' to maintain consistency.

const newComments = createComment(file, chunk, aiResponse);
if (newComments) {
comments.push(...newComments);
if (!isJSON(aiResponse)) {

Choose a reason for hiding this comment

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

The variable name 'allReviews' does not accurately describe its purpose. Consider renaming it to 'comments' to match the variable used in the code.

if (newComments) {
comments.push(...newComments);
if (!isJSON(aiResponse)) {
logger.log(`AI response is not in JSON format: ${aiResponse}`);

Choose a reason for hiding this comment

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

The condition '!isJSON(aiResponse)' is not clear. Please add a comment explaining the purpose of this condition.

comments.push(...newComments);
if (!isJSON(aiResponse)) {
logger.log(`AI response is not in JSON format: ${aiResponse}`);
createCommentOnPr(aiResponse, prDetails.owner, prDetails.repo, prDetails.pull_number, file.to);

Choose a reason for hiding this comment

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

The function 'createCommentOnPr' is called inside the loop. Consider moving it outside the loop to avoid unnecessary function calls.

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