diff --git a/pr_agent/git_providers/azuredevops_provider.py b/pr_agent/git_providers/azuredevops_provider.py index c5cdb531..3cded721 100644 --- a/pr_agent/git_providers/azuredevops_provider.py +++ b/pr_agent/git_providers/azuredevops_provider.py @@ -347,7 +347,7 @@ class AzureDevopsProvider(GitProvider): def publish_description(self, pr_title: str, pr_body: str): if len(pr_body) > MAX_PR_DESCRIPTION_AZURE_LENGTH: - usage_guide_text='
✨ Usage guide:
' + usage_guide_text='
✨ Describe tool usage guide:
' ind = pr_body.find(usage_guide_text) if ind != -1: pr_body = pr_body[:ind] diff --git a/pr_agent/git_providers/github_provider.py b/pr_agent/git_providers/github_provider.py index f7f1e529..19fee379 100644 --- a/pr_agent/git_providers/github_provider.py +++ b/pr_agent/git_providers/github_provider.py @@ -456,28 +456,27 @@ class GithubProvider(GitProvider): if disable_eyes: return None try: - reaction = self.pr.get_issue_comment(issue_comment_id).create_reaction("eyes") - return reaction.id + headers, data_patch = self.pr._requester.requestJsonAndCheck( + "POST", f"https://api.github.com/repos/{self.repo}/issues/comments/{issue_comment_id}/reactions", + input={"content": "eyes"} + ) + return data_patch.get("id", None) except Exception as e: get_logger().exception(f"Failed to add eyes reaction, error: {e}") - try: - headers, data_patch = self.pr._requester.requestJsonAndCheck( - "POST", f"https://api.github.com/repos/{self.repo}/pulls/comments/{issue_comment_id}/reactions", - input={"content": "eyes"} - ) - except: - pass return None - def remove_reaction(self, issue_comment_id: int, reaction_id: int) -> bool: + def remove_reaction(self, issue_comment_id: int, reaction_id: str) -> bool: try: - self.pr.get_issue_comment(issue_comment_id).delete_reaction(reaction_id) + # self.pr.get_issue_comment(issue_comment_id).delete_reaction(reaction_id) + headers, data_patch = self.pr._requester.requestJsonAndCheck( + "DELETE", + f"https://api.github.com/repos/{self.repo}/issues/comments/{issue_comment_id}/reactions/{reaction_id}" + ) return True except Exception as e: get_logger().exception(f"Failed to remove eyes reaction, error: {e}") return False - @staticmethod def _parse_pr_url(pr_url: str) -> Tuple[str, int]: parsed_url = urlparse(pr_url) diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index 2d4036f6..b5cdf526 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -107,7 +107,7 @@ class PRCodeSuggestions: # add usage guide if get_settings().pr_code_suggestions.enable_help_text: - pr_body += "
\n\n
✨ Usage guide:
\n\n" + pr_body += "
\n\n
✨ Improve tool usage guide:
\n\n" pr_body += HelpMessage.get_improve_usage_guide() pr_body += "\n
\n" diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 34e7216f..72005209 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -103,7 +103,7 @@ class PRDescription: # Add help text if gfm_markdown is supported if self.git_provider.is_supported("gfm_markdown") and get_settings().pr_description.enable_help_text: - pr_body += "
\n\n
✨ Usage guide:
\n\n" + pr_body += "
\n\n
✨ Describe tool usage guide:
\n\n" pr_body += HelpMessage.get_describe_usage_guide() pr_body += "\n
\n" elif get_settings().pr_description.enable_help_comment: diff --git a/pr_agent/tools/pr_questions.py b/pr_agent/tools/pr_questions.py index 5514d7fa..0f304ed6 100644 --- a/pr_agent/tools/pr_questions.py +++ b/pr_agent/tools/pr_questions.py @@ -54,7 +54,7 @@ class PRQuestions: get_logger().info('Preparing answer...') pr_comment = self._prepare_pr_answer() if self.git_provider.is_supported("gfm_markdown") and get_settings().pr_questions.enable_help_text: - pr_comment += "
\n\n
✨ Usage guide:
\n\n" + pr_comment += "
\n\n
✨ Ask tool usage guide:
\n\n" pr_comment += HelpMessage.get_ask_usage_guide() pr_comment += "\n
\n" diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index cb6ab13c..251e59af 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -238,7 +238,7 @@ class PRReviewer: # Add help text if gfm_markdown is supported if self.git_provider.is_supported("gfm_markdown") and get_settings().pr_reviewer.enable_help_text: - markdown_text += "
\n\n
✨ Usage guide:
\n\n" + markdown_text += "
\n\n
✨ Review tool usage guide:
\n\n" markdown_text += HelpMessage.get_review_usage_guide() markdown_text += "\n
\n"