mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-14 01:30:37 +08:00
Merge branch 'ok/gitlab_webhook' into 'ok/gitlab_polling_server'
Ok/gitlab webhook See merge request codiumai/pr-agent!1
This commit is contained in:
14
README.md
14
README.md
@ -30,31 +30,31 @@ CodiumAI `PR-Agent` is an open-source tool aiming to help developers review pull
|
|||||||
<h4>/describe:</h4>
|
<h4>/describe:</h4>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<p float="center">
|
<p float="center">
|
||||||
<img src="https://www.codium.ai/wp-content/uploads/2023/07/describe.gif" width="800">
|
<img src="https://www.codium.ai/images/describe-2.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<h4>/review:</h4>
|
<h4>/review:</h4>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<p float="center">
|
<p float="center">
|
||||||
<img src="https://www.codium.ai/wp-content/uploads/2023/07/review.gif" width="800">
|
<img src="https://www.codium.ai/images/review-2.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<h4>/reflect and review:</h4>
|
<h4>/reflect_and_review:</h4>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<p float="center">
|
<p float="center">
|
||||||
<img src="https://www.codium.ai/wp-content/uploads/2023/07/reflect_and_review.gif" width="800">
|
<img src="https://www.codium.ai/images/reflect_and_review.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<h4>/ask:</h4>
|
<h4>/ask:</h4>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<p float="center">
|
<p float="center">
|
||||||
<img src="https://www.codium.ai/wp-content/uploads/2023/07/ask.gif" width="800">
|
<img src="https://www.codium.ai/images/ask-2.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<h4>/improve:</h4>
|
<h4>/improve:</h4>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<p float="center">
|
<p float="center">
|
||||||
<img src="https://www.codium.ai/wp-content/uploads/2023/07/improve-1.gif" width="800">
|
<img src="https://www.codium.ai/images/improve-2.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div align="left">
|
<div align="left">
|
||||||
@ -106,7 +106,7 @@ In the [configuration](./CONFIGURATION.md) file you can select your git provider
|
|||||||
|
|
||||||
Try GPT-4 powered PR-Agent on your public GitHub repository for free. Just mention `@CodiumAI-Agent` and add the desired command in any PR comment! The agent will generate a response based on your command.
|
Try GPT-4 powered PR-Agent on your public GitHub repository for free. Just mention `@CodiumAI-Agent` and add the desired command in any PR comment! The agent will generate a response based on your command.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
To set up your own PR-Agent, see the [Installation](#installation) section
|
To set up your own PR-Agent, see the [Installation](#installation) section
|
||||||
|
|
||||||
|
@ -152,10 +152,8 @@ class GithubProvider(GitProvider):
|
|||||||
def publish_code_suggestions(self, code_suggestions: list):
|
def publish_code_suggestions(self, code_suggestions: list):
|
||||||
"""
|
"""
|
||||||
Publishes code suggestions as comments on the PR.
|
Publishes code suggestions as comments on the PR.
|
||||||
In practice current APU enables to send only one code suggestion per comment. Might change in the future.
|
|
||||||
"""
|
"""
|
||||||
post_parameters_list = []
|
post_parameters_list = []
|
||||||
import github.PullRequestComment
|
|
||||||
for suggestion in code_suggestions:
|
for suggestion in code_suggestions:
|
||||||
body = suggestion['body']
|
body = suggestion['body']
|
||||||
relevant_file = suggestion['relevant_file']
|
relevant_file = suggestion['relevant_file']
|
||||||
@ -178,7 +176,6 @@ class GithubProvider(GitProvider):
|
|||||||
if relevant_lines_end > relevant_lines_start:
|
if relevant_lines_end > relevant_lines_start:
|
||||||
post_parameters = {
|
post_parameters = {
|
||||||
"body": body,
|
"body": body,
|
||||||
"commit_id": self.last_commit_id._identity,
|
|
||||||
"path": relevant_file,
|
"path": relevant_file,
|
||||||
"line": relevant_lines_end,
|
"line": relevant_lines_end,
|
||||||
"start_line": relevant_lines_start,
|
"start_line": relevant_lines_start,
|
||||||
@ -187,24 +184,19 @@ class GithubProvider(GitProvider):
|
|||||||
else: # API is different for single line comments
|
else: # API is different for single line comments
|
||||||
post_parameters = {
|
post_parameters = {
|
||||||
"body": body,
|
"body": body,
|
||||||
"commit_id": self.last_commit_id._identity,
|
|
||||||
"path": relevant_file,
|
"path": relevant_file,
|
||||||
"line": relevant_lines_start,
|
"line": relevant_lines_start,
|
||||||
"side": "RIGHT",
|
"side": "RIGHT",
|
||||||
}
|
}
|
||||||
|
post_parameters_list.append(post_parameters)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
headers, data = self.pr._requester.requestJsonAndCheck(
|
self.pr.create_review(commit=self.last_commit_id, comments=post_parameters_list)
|
||||||
"POST", f"{self.pr.url}/comments", input=post_parameters
|
return True
|
||||||
)
|
except Exception as e:
|
||||||
github.PullRequestComment.PullRequestComment(
|
if settings.config.verbosity_level >= 2:
|
||||||
self.pr._requester, headers, data, completed=True
|
logging.error(f"Failed to publish code suggestion, error: {e}")
|
||||||
)
|
return False
|
||||||
return True
|
|
||||||
except Exception as e:
|
|
||||||
if settings.config.verbosity_level >= 2:
|
|
||||||
logging.error(f"Failed to publish code suggestion, error: {e}")
|
|
||||||
return False
|
|
||||||
|
|
||||||
def remove_initial_comment(self):
|
def remove_initial_comment(self):
|
||||||
try:
|
try:
|
||||||
|
Reference in New Issue
Block a user