mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 04:40:38 +08:00
feat: Add line link generation in Bitbucket provider and improve markdown formatting in pr_code_suggestions.py and IMRPOVE.md
This commit is contained in:
@ -33,6 +33,14 @@ Under the section 'pr_code_suggestions', the [configuration file](./../pr_agent/
|
|||||||
- `max_number_of_calls`: maximum number of chunks. Default is 5.
|
- `max_number_of_calls`: maximum number of chunks. Default is 5.
|
||||||
- `final_clip_factor`: factor to remove suggestions with low confidence. Default is 0.9.
|
- `final_clip_factor`: factor to remove suggestions with low confidence. Default is 0.9.
|
||||||
|
|
||||||
|
#### summarize mode
|
||||||
|
- `summarize`: if set to true, the tool will summarize the PR code changes. Default is false.
|
||||||
|
In this mode, instead of presenting commitable suggestions, the different suggestions will be combined into a single compact instruction, with a significant smaller PR footprint.
|
||||||
|
For example:
|
||||||
|
`/improve --pr_code_suggestions.summarize=true`
|
||||||
|
|
||||||
|
<kbd><img src=./../pics/improved_summerize_closed.png width="512"></kbd>
|
||||||
|
<kbd><img src=./../pics/improved_summerize_open.png width="512"></kbd>
|
||||||
|
|
||||||
#### A note on code suggestions quality
|
#### A note on code suggestions quality
|
||||||
|
|
||||||
|
BIN
pics/improved_summerize_closed.png
Normal file
BIN
pics/improved_summerize_closed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 156 KiB |
BIN
pics/improved_summerize_open.png
Normal file
BIN
pics/improved_summerize_open.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 136 KiB |
@ -228,6 +228,10 @@ class BitbucketProvider(GitProvider):
|
|||||||
)
|
)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
def get_line_link(self, relevant_file: str, relevant_line_start: int, relevant_line_end: int = None) -> str:
|
||||||
|
link = f"{self.pr_url}/#L{relevant_file}T{relevant_line_start}"
|
||||||
|
return link
|
||||||
|
|
||||||
def generate_link_to_relevant_line_number(self, suggestion) -> str:
|
def generate_link_to_relevant_line_number(self, suggestion) -> str:
|
||||||
try:
|
try:
|
||||||
relevant_file = suggestion['relevant file'].strip('`').strip("'")
|
relevant_file = suggestion['relevant file'].strip('`').strip("'")
|
||||||
|
@ -501,7 +501,6 @@ class GithubProvider(GitProvider):
|
|||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def get_line_link(self, relevant_file: str, relevant_line_start: int, relevant_line_end: int = None) -> str:
|
def get_line_link(self, relevant_file: str, relevant_line_start: int, relevant_line_end: int = None) -> str:
|
||||||
sha_file = hashlib.sha256(relevant_file.encode('utf-8')).hexdigest()
|
sha_file = hashlib.sha256(relevant_file.encode('utf-8')).hexdigest()
|
||||||
if relevant_line_end:
|
if relevant_line_end:
|
||||||
|
@ -255,9 +255,9 @@ class PRCodeSuggestions:
|
|||||||
s['relevant lines end'])
|
s['relevant lines end'])
|
||||||
data_markdown += f"\n💡 Suggestion:\n\n**{s['suggestion content']}**\n\n"
|
data_markdown += f"\n💡 Suggestion:\n\n**{s['suggestion content']}**\n\n"
|
||||||
if code_snippet_link:
|
if code_snippet_link:
|
||||||
data_markdown += f" File: [{s['relevant file']} ({s['relevant lines start']}-{s['relevant lines end']})]({code_snippet_link})\n"
|
data_markdown += f" File: [{s['relevant file']} ({s['relevant lines start']}-{s['relevant lines end']})]({code_snippet_link})\n\n"
|
||||||
else:
|
else:
|
||||||
data_markdown += f"File: {s['relevant file']} ({s['relevant lines start']}-{s['relevant lines end']})\n"
|
data_markdown += f"File: {s['relevant file']} ({s['relevant lines start']}-{s['relevant lines end']})\n\n"
|
||||||
if self.git_provider.is_supported("gfm_markdown"):
|
if self.git_provider.is_supported("gfm_markdown"):
|
||||||
data_markdown += "<details> <summary> Example code:</summary>\n\n"
|
data_markdown += "<details> <summary> Example code:</summary>\n\n"
|
||||||
data_markdown += f"___\n\n"
|
data_markdown += f"___\n\n"
|
||||||
|
Reference in New Issue
Block a user