mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 12:50:38 +08:00
@ -1,11 +1,15 @@
|
|||||||
# ASK Tool
|
# 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:
|
It can be invoked manually by commenting on any PR:
|
||||||
```
|
```
|
||||||
/ask "..."
|
/ask "..."
|
||||||
```
|
```
|
||||||
For example:
|
For example:
|
||||||
|
___
|
||||||
<kbd><img src=https://codium.ai/images/pr_agent/ask_comment.png width="768"></kbd>
|
<kbd><img src=https://codium.ai/images/pr_agent/ask_comment.png width="768"></kbd>
|
||||||
|
___
|
||||||
<kbd><img src=https://codium.ai/images/pr_agent/ask.png width="768"></kbd>
|
<kbd><img src=https://codium.ai/images/pr_agent/ask.png width="768"></kbd>
|
||||||
|
___
|
||||||
|
|
||||||
|
Note that the tool does not have "memory" of previous questions, and answers each question independently.
|
@ -75,7 +75,7 @@ Edit this field to enable/disable the tool, or to change the used configurations
|
|||||||
output += "<tr><td><details> <summary><strong> About the 'Code feedback' section</strong></summary><hr>\n\n"
|
output += "<tr><td><details> <summary><strong> About the 'Code feedback' section</strong></summary><hr>\n\n"
|
||||||
output+="""\
|
output+="""\
|
||||||
The `review` tool provides several type of feedbacks, one of them is code suggestions.
|
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.
|
Use the `review` tool if you want to get a more comprehensive feedback, which includes code suggestions as well.
|
||||||
"""
|
"""
|
||||||
output += "\n\n</details></td></tr>\n\n"
|
output += "\n\n</details></td></tr>\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"
|
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
|
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<table>"
|
||||||
|
|
||||||
|
# general
|
||||||
|
output += "\n\n<tr><td><details> <summary><strong> More PR-Agent commands</strong></summary><hr> \n\n"
|
||||||
|
output += HelpMessage.get_general_bot_help_text()
|
||||||
|
output += "\n\n</details></td></tr>\n\n"
|
||||||
|
|
||||||
|
output += "</table>"
|
||||||
|
|
||||||
|
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
|
||||||
|
@ -63,6 +63,8 @@ include_generated_by_header=true
|
|||||||
#custom_labels = ['Bug fix', 'Tests', 'Bug fix with tests', 'Enhancement', 'Documentation', 'Other']
|
#custom_labels = ['Bug fix', 'Tests', 'Bug fix with tests', 'Enhancement', 'Documentation', 'Other']
|
||||||
|
|
||||||
[pr_questions] # /ask #
|
[pr_questions] # /ask #
|
||||||
|
enable_help_text=true
|
||||||
|
|
||||||
|
|
||||||
[pr_code_suggestions] # /improve #
|
[pr_code_suggestions] # /improve #
|
||||||
num_code_suggestions=4
|
num_code_suggestions=4
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[pr_questions_prompt]
|
[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.
|
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.
|
Don't avoid answering the questions. You must answer the questions, as best as you can, without adding any unrelated content.
|
||||||
"""
|
"""
|
||||||
|
@ -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 import get_git_provider
|
||||||
from pr_agent.git_providers.git_provider import get_main_pr_language
|
from pr_agent.git_providers.git_provider import get_main_pr_language
|
||||||
from pr_agent.log import get_logger
|
from pr_agent.log import get_logger
|
||||||
|
from pr_agent.servers.help import HelpMessage
|
||||||
|
|
||||||
|
|
||||||
class PRQuestions:
|
class PRQuestions:
|
||||||
@ -52,6 +53,11 @@ class PRQuestions:
|
|||||||
await retry_with_fallback_models(self._prepare_prediction)
|
await retry_with_fallback_models(self._prepare_prediction)
|
||||||
get_logger().info('Preparing answer...')
|
get_logger().info('Preparing answer...')
|
||||||
pr_comment = self._prepare_pr_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 += "<hr>\n\n<details> <summary><strong>✨ Usage guide:</strong></summary><hr> \n\n"
|
||||||
|
pr_comment += HelpMessage.get_ask_usage_guide()
|
||||||
|
pr_comment += "\n</details>\n"
|
||||||
|
|
||||||
if get_settings().config.publish_output:
|
if get_settings().config.publish_output:
|
||||||
get_logger().info('Pushing answer...')
|
get_logger().info('Pushing answer...')
|
||||||
self.git_provider.publish_comment(pr_comment)
|
self.git_provider.publish_comment(pr_comment)
|
||||||
|
Reference in New Issue
Block a user