mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-06 22:00:40 +08:00
Implement edit comment
This commit is contained in:
@ -187,6 +187,13 @@ class BitbucketProvider(GitProvider):
|
|||||||
comment = self.pr.comment(pr_comment)
|
comment = self.pr.comment(pr_comment)
|
||||||
if is_temporary:
|
if is_temporary:
|
||||||
self.temp_comments.append(comment["id"])
|
self.temp_comments.append(comment["id"])
|
||||||
|
return comment
|
||||||
|
|
||||||
|
def edit_comment(self, comment, body: str):
|
||||||
|
try:
|
||||||
|
comment.update(body)
|
||||||
|
except Exception as e:
|
||||||
|
get_logger().exception(f"Failed to update comment, error: {e}")
|
||||||
|
|
||||||
def remove_initial_comment(self):
|
def remove_initial_comment(self):
|
||||||
try:
|
try:
|
||||||
|
@ -41,6 +41,9 @@ class GitProvider(ABC):
|
|||||||
def get_pr_description_full(self) -> str:
|
def get_pr_description_full(self) -> str:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def edit_comment(self, comment, body: str):
|
||||||
|
pass
|
||||||
|
|
||||||
def get_pr_description(self, *, full: bool = True) -> str:
|
def get_pr_description(self, *, full: bool = True) -> str:
|
||||||
from pr_agent.config_loader import get_settings
|
from pr_agent.config_loader import get_settings
|
||||||
from pr_agent.algo.utils import clip_tokens
|
from pr_agent.algo.utils import clip_tokens
|
||||||
|
@ -395,6 +395,9 @@ class GithubProvider(GitProvider):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
get_logger().exception(f"Failed to remove comment, error: {e}")
|
get_logger().exception(f"Failed to remove comment, error: {e}")
|
||||||
|
|
||||||
|
def edit_comment(self, comment, body: str):
|
||||||
|
comment.edit(body=body)
|
||||||
|
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
return self.pr.title
|
return self.pr.title
|
||||||
|
|
||||||
|
@ -176,6 +176,14 @@ class GitLabProvider(GitProvider):
|
|||||||
comment = self.mr.notes.create({'body': mr_comment})
|
comment = self.mr.notes.create({'body': mr_comment})
|
||||||
if is_temporary:
|
if is_temporary:
|
||||||
self.temp_comments.append(comment)
|
self.temp_comments.append(comment)
|
||||||
|
return comment
|
||||||
|
|
||||||
|
def edit_comment(self, comment, body: str):
|
||||||
|
try:
|
||||||
|
comment.body = body
|
||||||
|
comment.save()
|
||||||
|
except Exception as e:
|
||||||
|
get_logger().exception(f"Failed to edit comment, error: {e}")
|
||||||
|
|
||||||
def publish_inline_comment(self, body: str, relevant_file: str, relevant_line_in_file: str):
|
def publish_inline_comment(self, body: str, relevant_file: str, relevant_line_in_file: str):
|
||||||
edit_type, found, source_line_no, target_file, target_line_no = self.search_line(relevant_file,
|
edit_type, found, source_line_no, target_file, target_line_no = self.search_line(relevant_file,
|
||||||
|
Reference in New Issue
Block a user