From 4204d78d7e342ad65bf9befe86bf589e6e3cac9c Mon Sep 17 00:00:00 2001 From: mrT23 Date: Thu, 4 Jan 2024 09:59:44 +0200 Subject: [PATCH] feat: Remove file walkthrough feature from PR agent --- pr_agent/tools/pr_description.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 85fd89a4..61b40eb8 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -246,16 +246,15 @@ class PRDescription: summary = f"{ai_header}{ai_summary}" body = body.replace('pr_agent:summary', summary) - if not re.search(r'', 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'', 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