mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 20:00:41 +08:00
feat: Add custom labels and extra instructions sections to help.py, summarize mode to pr_code_suggestions.py, and summarize mode condition to pr_code_suggestions_prompts.toml
This commit is contained in:
@ -156,6 +156,7 @@ Note that when markers are enabled, if the original PR description does not cont
|
||||
"""
|
||||
output += "\n\n</details></td></tr>\n\n"
|
||||
|
||||
# custom labels
|
||||
output += "<tr><td><details> <summary><strong> Custom labels </strong></summary><hr>\n\n"
|
||||
output += """\
|
||||
The default labels of the `describe` tool are quite generic: [`Bug fix`, `Tests`, `Enhancement`, `Documentation`, `Other`].
|
||||
@ -174,6 +175,25 @@ Make sure to provide proper title, and a detailed and well-phrased description f
|
||||
"""
|
||||
output += "\n\n</details></td></tr>\n\n"
|
||||
|
||||
# extra instructions
|
||||
output += "<tr><td><details> <summary><strong> Utilizing extra instructions</strong></summary><hr>\n\n"
|
||||
output += '''\
|
||||
The `describe` tool can be configured with extra instructions, which can be used to guide the model to a produce a description with the relevant content or style.
|
||||
|
||||
Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Notice that the general structure of the description is already defined by the tool, and cannot be changed.
|
||||
What you can change is the content content or style of each sub-section of the description.
|
||||
|
||||
Examples for extra instructions:
|
||||
```
|
||||
[pr_description]
|
||||
extra_instructions="""
|
||||
- the title section should be in the following format: <PR type>: <PR summary>
|
||||
- ...
|
||||
"""
|
||||
```
|
||||
Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.
|
||||
'''
|
||||
|
||||
# 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()
|
||||
|
@ -39,6 +39,9 @@ Specific instructions:
|
||||
- Provide the exact line numbers range (inclusive) for each suggestion.
|
||||
- Assume there is additional relevant code, that is not included in the diff.
|
||||
- When quoting variables or names from the code, use backticks (`) instead of single quote (').
|
||||
{%- if summarize_mode %}
|
||||
- If needed, use abbreviations for the 'existing code' and 'improved code' snippets, to keep the output short.
|
||||
{%- endif %}
|
||||
|
||||
|
||||
{%- if extra_instructions %}
|
||||
|
@ -45,6 +45,7 @@ class PRCodeSuggestions:
|
||||
"language": self.main_language,
|
||||
"diff": "", # empty diff for initial calculation
|
||||
"num_code_suggestions": num_code_suggestions,
|
||||
"summarize_mode": get_settings().pr_code_suggestions.summarize,
|
||||
"extra_instructions": get_settings().pr_code_suggestions.extra_instructions,
|
||||
"commit_messages_str": self.git_provider.get_commit_messages(),
|
||||
}
|
||||
|
Reference in New Issue
Block a user