Skip to content

Commit

Permalink
feat: Remove file walkthrough feature from PR agent
Browse files Browse the repository at this point in the history
  • Loading branch information
mrT23 committed Jan 4, 2024
1 parent 3c2ed8b commit 4204d78
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pr_agent/tools/pr_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,15 @@ def _prepare_pr_answer_with_markers(self) -> Tuple[str, str]:
summary = f"{ai_header}{ai_summary}"
body = body.replace('pr_agent:summary', summary)

if not re.search(r'<!--\s*pr_agent:walkthrough\s*-->', body):
ai_walkthrough = self.data.get('PR changes walkthrough')
if ai_walkthrough:
walkthrough = str(ai_header)
for file in ai_walkthrough:
filename = file['filename'].replace("'", "`")
description = file['changes_summary'].replace("'", "`")
walkthrough += f'- `{filename}`: {description}\n'

body = body.replace('pr_agent:walkthrough', walkthrough)
ai_walkthrough = self.data.get('pr_files')
if ai_walkthrough and not re.search(r'<!--\s*pr_agent:walkthrough\s*-->', body):
try:
walkthrough_gfm = ""
walkthrough_gfm = self.process_pr_files_prediction(walkthrough_gfm, self.file_label_dict)
body = body.replace('pr_agent:walkthrough', walkthrough_gfm)
except Exception as e:
get_logger().error(f"Failing to process walkthrough {self.pr_id}: {e}")
body = body.replace('pr_agent:walkthrough', "")

return title, body

Expand Down

0 comments on commit 4204d78

Please sign in to comment.