diff --git a/docs/ASK.md b/docs/ASK.md index 72dd0bb0..5e410e4a 100644 --- a/docs/ASK.md +++ b/docs/ASK.md @@ -1,11 +1,15 @@ # ASK Tool -The `ask` tool answers questions about the PR, based on the PR code changes. +The `ask` tool answers questions about the PR, based on the PR code changes. Make sure to be specific and clear in your questions. It can be invoked manually by commenting on any PR: ``` /ask "..." ``` For example: - +___ - \ No newline at end of file +___ + +___ + +Note that the tool does not have "memory" of previous questions, and answers each question independently. \ No newline at end of file diff --git a/pr_agent/servers/help.py b/pr_agent/servers/help.py index 633c3281..d1ece194 100644 --- a/pr_agent/servers/help.py +++ b/pr_agent/servers/help.py @@ -75,7 +75,7 @@ Edit this field to enable/disable the tool, or to change the used configurations output += "
About the 'Code feedback' section
\n\n" output+="""\ The `review` tool provides several type of feedbacks, one of them is code suggestions. -If you are interested **only** in the code suggestions, it is recommended to use the [`improve`](./IMPROVE.md) feature instead, since it dedicated only to code suggestions, and usually gives better results. +If you are interested **only** in the code suggestions, it is recommended to use the [`improve`](https://github.com/Codium-ai/pr-agent/blob/main/docs/IMPROVE.md) feature instead, since it dedicated only to code suggestions, and usually gives better results. Use the `review` tool if you want to get a more comprehensive feedback, which includes code suggestions as well. """ output += "\n\n
\n\n" @@ -184,3 +184,28 @@ Make sure to provide proper title, and a detailed and well-phrased description f output += f"\n\nSee the [describe usage](https://github.com/Codium-ai/pr-agent/blob/main/docs/DESCRIBE.md) page for a comprehensive guide on using this tool.\n\n" return output + + @staticmethod + def get_ask_usage_guide(): + output = "**Overview:**\n" + output += """\ +The `ask` tool answers questions about the PR, based on the PR code changes. +It can be invoked manually by commenting on any PR: +``` +/ask "..." +``` + +Note that the tool does not have "memory" of previous questions, and answers each question independently. + """ + output += "\n\n" + + # general + output += "\n\n\n\n" + + output += "
More PR-Agent commands
\n\n" + output += HelpMessage.get_general_bot_help_text() + output += "\n\n
" + + output += f"\n\nSee the [ask usage](https://github.com/Codium-ai/pr-agent/blob/main/docs/ASK.md) page for a comprehensive guide on using this tool.\n\n" + + return output diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 89912e46..b0e9c295 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -63,6 +63,8 @@ include_generated_by_header=true #custom_labels = ['Bug fix', 'Tests', 'Bug fix with tests', 'Enhancement', 'Documentation', 'Other'] [pr_questions] # /ask # +enable_help_text=true + [pr_code_suggestions] # /improve # num_code_suggestions=4 diff --git a/pr_agent/settings/pr_questions_prompts.toml b/pr_agent/settings/pr_questions_prompts.toml index e466d9a1..08dd769e 100644 --- a/pr_agent/settings/pr_questions_prompts.toml +++ b/pr_agent/settings/pr_questions_prompts.toml @@ -1,7 +1,7 @@ [pr_questions_prompt] -system="""You are PR-Reviewer, a language model designed to review a Git Pull Request (PR). +system="""You are PR-Reviewer, a language model designed to answer questions about a Git Pull Request (PR). -Your goal is to answer questions\\tasks about the new PR code (lines starting with '+'), and provide feedback. +Your goal is to answer questions\\tasks about the new code introduced in the PR (lines starting with '+' in the 'PR Git Diff' section), and provide feedback. Be informative, constructive, and give examples. Try to be as specific as possible. Don't avoid answering the questions. You must answer the questions, as best as you can, without adding any unrelated content. """ diff --git a/pr_agent/tools/pr_questions.py b/pr_agent/tools/pr_questions.py index 4d499598..5514d7fa 100644 --- a/pr_agent/tools/pr_questions.py +++ b/pr_agent/tools/pr_questions.py @@ -11,6 +11,7 @@ from pr_agent.config_loader import get_settings from pr_agent.git_providers import get_git_provider from pr_agent.git_providers.git_provider import get_main_pr_language from pr_agent.log import get_logger +from pr_agent.servers.help import HelpMessage class PRQuestions: @@ -52,6 +53,11 @@ class PRQuestions: await retry_with_fallback_models(self._prepare_prediction) 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 += HelpMessage.get_ask_usage_guide() + pr_comment += "\n
\n" + if get_settings().config.publish_output: get_logger().info('Pushing answer...') self.git_provider.publish_comment(pr_comment)