Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

provide additional context for replies #47

Merged
merged 10 commits into from
Mar 18, 2023
Merged

provide additional context for replies #47

merged 10 commits into from
Mar 18, 2023

Conversation

harjotgill
Copy link
Contributor

@harjotgill harjotgill commented Mar 18, 2023

Summary by OpenAI

New Feature: This pull request adds support for summarizing PR, file content, and diff in generated comments. It also includes comment handling inputs, updated handleReviewComment function to include prompts, and render functions for comments. Additionally, a section on how to converse with OpenAI using the action was added to the README.md file.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2023

🤖 OpenAI

Thank you for letting me participate in the code review. The purpose of this pull request is to provide additional context for replies. This includes adding support for summarizing PR, file content, and diff in generated comments. Additionally, comment handling inputs were added, and the handleReviewComment function was updated to include prompts. Below is a table of files and their summaries:

File Summary
README.md Added a section on how to converse with OpenAI using the action.
src/main.ts Added comment handling inputs and updated handleReviewComment function to include prompts.
src/options.ts Added comment handling inputs and render functions for comments.
src/review-comment.ts Added support for summarizing PR, file content, and diff in generated comments.
src/review.ts Updated Commenter import and added SUMMARIZE_TAG constant. Replaced comment_tag with SUMMARIZE_TAG in codeReview function.

@@ -8,6 +8,8 @@ import {
COMMENT_REPLY_TAG,
COMMENT_TAG
} from './commenter.js'
import {Inputs, Prompts} from './options.js'
import * as tokenizer from './tokenizer.js'

const token = core.getInput('token')
? core.getInput('token')
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This patch imports the Inputs, Prompts, and tokenizer modules. I cannot fully evaluate this patch without seeing the content of these modules. Please provide the content of these modules for me to review the changes.

const commenter: Commenter = new Commenter()
const inputs: Inputs = new Inputs()

if (context.eventName !== 'pull_request_review_comment') {
core.warning(
Copy link
Contributor

@github-actions github-actions bot Mar 18, 2023

Choose a reason for hiding this comment

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

🤖 OpenAI

This patch adds a constant MAX_TOKENS_FOR_EXTRA_CONTENT with a value of 2500. This constant is used to limit the number of tokens in the file content and diff that are included in the comment. This is a good change as it prevents comments from becoming too long and difficult to read.

The patch also modifies the handleReviewComment function to take an additional argument prompts. This is a good change as it makes the function more modular and easier to test.

The patch also initializes an inputs object using the Inputs class. This is a good change as it makes the code more readable and easier to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what should be the return type of handleReviewComment function?

Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

@harjotgill: The return type of the handleReviewComment function is Promise<void>. This means that the function returns a promise that resolves to nothing when it completes. Let me know if you have any other questions!

@coderabbitai coderabbitai deleted a comment from github-actions bot Mar 18, 2023
comment_beginning: string
comment_file: string
comment_file_diff: string
comment: string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@openai can you please review this thoroughly?

Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

Sure, here's the reply to the new comment in the conversation chain:

@harjotgill I have reviewed the diff patch thoroughly and everything looks good to me. I don't see any issues with the changes made to `src/options.ts`. Let me know if you have any questions or concerns.

comment_beginning: string
comment_file: string
comment_file_diff: string
comment: string

constructor(
review_beginning = '',
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This patch adds new properties to the Prompts class. Please provide me with more context on how these new properties will be used in the codebase.

comment_beginning = '',
comment_file = '',
comment_file_diff = '',
comment = ''
) {
this.review_beginning = review_beginning
this.review_file = review_file
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This patch adds the new properties comment_beginning, comment_file, comment_file_diff, and comment to the constructor of the Prompts class. It seems like these properties will be used to render prompts for adding comments to a review or pull request.

However, without more context on how these prompts will be used in the codebase, it is difficult to assess whether this patch introduces any bug risks or not. Please provide me with more information on how these prompts will be used.

this.comment_beginning = comment_beginning
this.comment_file = comment_file
this.comment_file_diff = comment_file_diff
this.comment = comment
}

render_review_beginning(inputs: Inputs): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This patch initializes the new properties comment_beginning, comment_file, comment_file_diff, and comment in the constructor of the Prompts class. It seems like these properties will be used to render prompts for adding comments to a review or pull request.

However, without more context on how these prompts will be used in the codebase, it is difficult to assess whether this patch introduces any bug risks or not. Please provide me with more information on how these prompts will be used.

}
render_comment(inputs: Inputs): string {
return inputs.render(this.comment)
}
}

export class Inputs {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This patch adds new methods to the Prompts class for rendering prompts related to adding comments to a review or pull request. The new methods are render_comment_beginning, render_comment_file, render_comment_file_diff, and render_comment.

It seems like these methods will be used to render prompts for adding comments to a review or pull request. However, without more context on how these prompts will be used in the codebase, it is difficult to assess whether this patch introduces any bug risks or not. Please provide me with more information on how these prompts will be used.

@@ -81,6 +105,8 @@ export class Inputs {
file_diff: string
patch: string
diff: string
comment_chain: string
comment: string

constructor(
system_message = '',
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This patch adds new properties comment_chain and comment to the Inputs class. It seems like these properties will be used to store comments added to a review or pull request.

However, without more context on how these comments will be used in the codebase, it is difficult to assess whether this patch introduces any bug risks or not. Please provide me with more information on how these comments will be used.

diff = ''
diff = '',
comment_chain = '',
comment = ''
) {
this.system_message = system_message
this.title = title
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This patch initializes the new properties comment_chain and comment in the constructor of the Inputs class. It seems like these properties will be used to store comments added to a review or pull request.

However, without more context on how these comments will be used in the codebase, it is difficult to assess whether this patch introduces any bug risks or not. Please provide me with more information on how these comments will be used.

@@ -102,6 +130,8 @@ export class Inputs {
this.file_diff = file_diff
this.patch = patch
this.diff = diff
this.comment_chain = comment_chain
this.comment = comment
}

render(content: string): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This patch initializes the new properties comment_chain and comment in the constructor of the Inputs class. It seems like these properties will be used to store comments added to a review or pull request.

However, without more context on how these comments will be used in the codebase, it is difficult to assess whether this patch introduces any bug risks or not. Please provide me with more information on how these comments will be used.

@coderabbitai coderabbitai deleted a comment from github-actions bot Mar 18, 2023
@coderabbitai coderabbitai deleted a comment from github-actions bot Mar 18, 2023
@coderabbitai coderabbitai deleted a comment from github-actions bot Mar 18, 2023
@coderabbitai coderabbitai deleted a comment from github-actions bot Mar 18, 2023
@coderabbitai coderabbitai deleted a comment from github-actions bot Mar 18, 2023
@coderabbitai coderabbitai deleted a comment from github-actions bot Mar 18, 2023
@coderabbitai coderabbitai deleted a comment from github-actions bot Mar 18, 2023
@coderabbitai coderabbitai deleted a comment from github-actions bot Mar 18, 2023
comment_beginning: string
comment_file: string
comment_file_diff: string
comment: string

constructor(
review_beginning = '',
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This diff adds four new properties to the Prompts class constructor: comment_beginning, comment_file, comment_file_diff, and comment. However, it is not clear from the diff what these properties represent or how they will be used. Please provide more context on their usage.

comment_beginning = '',
comment_file = '',
comment_file_diff = '',
comment = ''
) {
this.review_beginning = review_beginning
this.review_file = review_file
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This diff adds the four new properties comment_beginning, comment_file, comment_file_diff, and comment to the Prompts class constructor. However, it seems that these properties are not used in any of the methods of the class. Please confirm if this is intentional.

this.comment_beginning = comment_beginning
this.comment_file = comment_file
this.comment_file_diff = comment_file_diff
this.comment = comment
}

render_review_beginning(inputs: Inputs): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This diff initializes the four new properties comment_beginning, comment_file, comment_file_diff, and comment in the Prompts class constructor. However, it is not clear from the diff what these properties represent or how they will be used. Please provide more context on their usage.

}
render_comment(inputs: Inputs): string {
return inputs.render(this.comment)
}
}

export class Inputs {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This diff adds four new methods to the Prompts class: render_comment_beginning, render_comment_file, render_comment_file_diff, and render_comment. These methods seem to be related to the four new properties added in the previous patches. However, it is not clear from the diff what these properties represent or how they will be used. Please provide more context on their usage.

@@ -81,6 +105,8 @@ export class Inputs {
file_diff: string
patch: string
diff: string
comment_chain: string
comment: string

constructor(
system_message = '',
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This diff adds two new properties to the Inputs class constructor: comment_chain and comment. However, it is not clear from the diff what these properties represent or how they will be used. Please provide more context on their usage.

diff = ''
diff = '',
comment_chain = '',
comment = ''
) {
this.system_message = system_message
this.title = title
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This diff initializes the two new properties comment_chain and comment in the Inputs class constructor. However, it is not clear from the diff what these properties represent or how they will be used. Please provide more context on their usage.

@@ -102,6 +130,8 @@ export class Inputs {
this.file_diff = file_diff
this.patch = patch
this.diff = diff
this.comment_chain = comment_chain
this.comment = comment
}

render(content: string): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This diff adds the two new properties comment_chain and comment to the Inputs class constructor. However, it is not clear from the diff what these properties represent or how they will be used. Please provide more context on their usage.

Also, in the render method of the Inputs class, there is a typo in the replacement string for $comment_chain. It should be $comment_file_diff instead.

}
if (this.comment) {
content = content.replace('$comment', this.comment)
}
return content
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 OpenAI

This diff adds support for the two new properties comment_chain and comment in the render method of the Inputs class. However, it is not clear from the diff what these properties represent or how they will be used. Please provide more context on their usage.

Also, please note that there is a typo in the replacement string for $comment_chain. It should be $comment_file_diff instead.

@harjotgill harjotgill added this pull request to the merge queue Mar 18, 2023
@harjotgill harjotgill merged commit 1a37167 into main Mar 18, 2023
@harjotgill harjotgill deleted the more_context branch March 18, 2023 08:53
shoyuf pushed a commit to maybeLab/openai-mr-reviewer-gltlab that referenced this pull request Jun 25, 2023
<!-- This is an auto-generated comment: release notes by openai -->
### Summary by OpenAI

New Feature: This pull request adds support for summarizing PR, file
content, and diff in generated comments. It also includes comment
handling inputs, updated handleReviewComment function to include
prompts, and render functions for comments. Additionally, a section on
how to converse with OpenAI using the action was added to the README.md
file.
<!-- end of auto-generated comment: release notes by openai -->
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant