mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 04:10:49 +08:00
improve tweaks
This commit is contained in:
@ -338,11 +338,13 @@ class PRCodeSuggestions:
|
||||
for ext in extensions:
|
||||
extension_to_language[ext] = language
|
||||
|
||||
pr_body = "## PR Code Suggestions\n\n"
|
||||
|
||||
pr_body += "<table>"
|
||||
header = f"Suggestions"
|
||||
delta = 75
|
||||
delta = 76
|
||||
header += " " * delta
|
||||
pr_body += f"""<thead><tr><th></th><th>{header}</th></tr></thead>"""
|
||||
pr_body += f"""<thead><tr><td>Category</td><td align=left>{header}</td></tr></thead>"""
|
||||
pr_body += """<tbody>"""
|
||||
suggestions_labels = dict()
|
||||
# add all suggestions related to each label
|
||||
@ -353,11 +355,13 @@ class PRCodeSuggestions:
|
||||
suggestions_labels[label].append(suggestion)
|
||||
|
||||
for label, suggestions in suggestions_labels.items():
|
||||
pr_body += f"""<tr><td><strong>{label}</strong></td>"""
|
||||
pr_body += f"""<td>"""
|
||||
num_suggestions=len(suggestions)
|
||||
# pr_body += f"""<tr><td><strong>{label}</strong></td>"""
|
||||
pr_body += f"""<tr><td rowspan={num_suggestions}><strong>{label}</strong></td>\n"""
|
||||
# pr_body += f"""<td>"""
|
||||
# pr_body += f"""<details><summary>{len(suggestions)} suggestions</summary>"""
|
||||
pr_body += f"""<table>"""
|
||||
for suggestion in suggestions:
|
||||
# pr_body += f"""<table>"""
|
||||
for i, suggestion in enumerate(suggestions):
|
||||
|
||||
relevant_file = suggestion['relevant_file'].strip()
|
||||
relevant_lines_start = int(suggestion['relevant_lines_start'])
|
||||
@ -385,17 +389,17 @@ class PRCodeSuggestions:
|
||||
|
||||
example_code = ""
|
||||
example_code += f"```diff\n{patch}\n```\n"
|
||||
|
||||
pr_body += f"""<tr><td>"""
|
||||
if i==0:
|
||||
pr_body += f"""<td>\n\n"""
|
||||
else:
|
||||
pr_body += f"""<tr><td>\n\n"""
|
||||
suggestion_summary = suggestion['one_sentence_summary'].strip()
|
||||
if '`' in suggestion_summary:
|
||||
suggestion_summary = replace_code_tags(suggestion_summary)
|
||||
suggestion_summary = suggestion_summary + max((77-len(suggestion_summary)), 0)*" "
|
||||
# suggestion_summary = suggestion_summary + max((77-len(suggestion_summary)), 0)*" "
|
||||
pr_body += f"""\n\n<details><summary>{suggestion_summary}</summary>\n\n___\n\n"""
|
||||
|
||||
pr_body += f"""
|
||||
|
||||
|
||||
**{suggestion_content}**
|
||||
|
||||
[{relevant_file} {range_str}]({code_snippet_link})
|
||||
@ -403,9 +407,9 @@ class PRCodeSuggestions:
|
||||
{example_code}
|
||||
"""
|
||||
pr_body += f"</details>"
|
||||
|
||||
pr_body += f"</td></tr>"
|
||||
|
||||
pr_body += """</table>"""
|
||||
# pr_body += "</details>"
|
||||
pr_body += """</td></tr>"""
|
||||
pr_body += """</tr></tbody></table>"""
|
||||
|
Reference in New Issue
Block a user