diff --git a/README.md b/README.md index dcd6e583..78eff3bd 100644 --- a/README.md +++ b/README.md @@ -74,11 +74,11 @@ CodiumAI PR-Agent is an open-source tool to help efficiently review and handle p | | Ask | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | ⮑ [Ask on code lines](./docs/ASK.md#ask-lines) | :white_check_mark: | :white_check_mark: | | | | | [Custom Suggestions](https://github.com/Codium-ai/pr-agent/blob/main/docs/CUSTOM_SUGGESTIONS.md) 💎 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| | [Test](https://github.com/Codium-ai/pr-agent/blob/main/docs/TEST.md) 💎 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | [Test](https://github.com/Codium-ai/pr-agent/blob/main/docs/TEST.md) 💎 | :white_check_mark: | :white_check_mark: | | :white_check_mark: | | | Reflect and Review | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | Update CHANGELOG.md | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | Find Similar Issue | :white_check_mark: | | | | -| | [Add PR Documentation](https://github.com/Codium-ai/pr-agent/blob/main/docs/ADD_DOCUMENTATION.md) 💎 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| | [Add PR Documentation](https://github.com/Codium-ai/pr-agent/blob/main/docs/ADD_DOCUMENTATION.md) 💎 | :white_check_mark: | :white_check_mark: | | :white_check_mark: | | | [Custom Labels](https://github.com/Codium-ai/pr-agent/blob/main/docs/DESCRIBE.md#handle-custom-labels-from-the-repos-labels-page-gem) 💎 | :white_check_mark: | :white_check_mark: | | :white_check_mark: | | | [Analyze](https://github.com/Codium-ai/pr-agent/blob/main/docs/Analyze.md) 💎 | :white_check_mark: | :white_check_mark: | | :white_check_mark: | | | [CI Feedback](https://github.com/Codium-ai/pr-agent/blob/main/docs/CI_FEEDBACK.md) 💎 | :white_check_mark: | | | | diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index a6a12a3a..b10f1367 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -124,6 +124,12 @@ class PRCodeSuggestions: get_logger().error(f"Failed to generate code suggestions for PR, error: {e}") if self.progress_response: self.progress_response.delete() + else: + try: + self.git_provider.remove_initial_comment() + self.git_provider.publish_comment(f"Failed to generate code suggestions for PR") + except Exception as e: + pass async def _prepare_prediction(self, model: str): self.patches_diff = get_pr_diff(self.git_provider, diff --git a/pr_agent/tools/pr_generate_labels.py b/pr_agent/tools/pr_generate_labels.py index a606ab4a..1d91d5e0 100644 --- a/pr_agent/tools/pr_generate_labels.py +++ b/pr_agent/tools/pr_generate_labels.py @@ -139,10 +139,6 @@ class PRGenerateLabels: system_prompt = environment.from_string(get_settings().pr_custom_labels_prompt.system).render(variables) user_prompt = environment.from_string(get_settings().pr_custom_labels_prompt.user).render(variables) - if get_settings().config.verbosity_level >= 2: - get_logger().info(f"\nSystem prompt:\n{system_prompt}") - get_logger().info(f"\nUser prompt:\n{user_prompt}") - response, finish_reason = await self.ai_handler.chat_completion( model=model, temperature=0.2, @@ -150,9 +146,6 @@ class PRGenerateLabels: user=user_prompt ) - if get_settings().config.verbosity_level >= 2: - get_logger().info(f"\nAI response:\n{response}") - return response def _prepare_data(self): diff --git a/pr_agent/tools/pr_help_message.py b/pr_agent/tools/pr_help_message.py index 9095a8f1..357a9112 100644 --- a/pr_agent/tools/pr_help_message.py +++ b/pr_agent/tools/pr_help_message.py @@ -9,6 +9,11 @@ class PRHelpMessage: async def run(self): try: + if not self.git_provider.is_supported("gfm_markdown"): + self.git_provider.publish_comment( + "The `Help` tool requires gfm markdown, which is not supported by your code platform.") + return + get_logger().info('Getting PR Help Message...') relevant_configs = {'pr_help': dict(get_settings().pr_help), 'config': dict(get_settings().config)} diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index 960b0149..0eabc59b 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -170,7 +170,6 @@ class PRReviewer: user=user_prompt ) - get_logger().debug(f"\nAI response:\n{response}") return response def _prepare_pr_review(self) -> str: diff --git a/pr_agent/tools/pr_update_changelog.py b/pr_agent/tools/pr_update_changelog.py index dc9d72e4..3d2ad2c7 100644 --- a/pr_agent/tools/pr_update_changelog.py +++ b/pr_agent/tools/pr_update_changelog.py @@ -9,7 +9,7 @@ from pr_agent.algo.ai_handlers.litellm_ai_handler import LiteLLMAIHandler from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler from pr_agent.config_loader import get_settings -from pr_agent.git_providers import get_git_provider +from pr_agent.git_providers import get_git_provider, GithubProvider from pr_agent.git_providers.git_provider import get_main_pr_language from pr_agent.log import get_logger @@ -46,12 +46,19 @@ class PRUpdateChangelog: get_settings().pr_update_changelog_prompt.user) async def run(self): - # assert type(self.git_provider) == GithubProvider, "Currently only Github is supported" - get_logger().info('Updating the changelog...') relevant_configs = {'pr_update_changelog': dict(get_settings().pr_update_changelog), 'config': dict(get_settings().config)} get_logger().debug("Relevant configs", artifacts=relevant_configs) + + # currently only GitHub is supported for pushing changelog changes + if get_settings().pr_update_changelog.push_changelog_changes and type(self.git_provider) != GithubProvider: + get_logger().error("Pushing changelog changes is not currently supported for this code platform") + if get_settings().config.publish_output: + self.git_provider.publish_comment( + "Pushing changelog changes is not currently supported for this code platform") + return + if get_settings().config.publish_output: self.git_provider.publish_comment("Preparing changelog updates...", is_temporary=True)