From 86103c65e8be7ff8889cb85e1cff6639717f70c3 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Sun, 8 Sep 2024 17:24:13 +0300 Subject: [PATCH] pattern_back --- pr_agent/algo/utils.py | 6 ++++-- pr_agent/tools/pr_code_suggestions.py | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index ba7d5a00..0e699ac1 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -967,9 +967,11 @@ def process_description(description_full: str): try: if isinstance(file_data, tuple): file_data = file_data[0] - # pattern = r'
\s*(.*?)
(.*?).*?
\s*
\s*(.*?)\s*((?:\*.*\s*)*)
' - pattern = r'
\s*(.*?)
(.*?).*?
\s*
\s*(.*?)\n\n\s*(.*?)
' + pattern = r'
\s*(.*?)\s*
(.*?).*?
\s*
\s*(.*?)\s*
  • (.*?)
  • ' res = re.search(pattern, file_data, re.DOTALL) + if not res or res.lastindex != 4: + pattern_back = r'
    \s*(.*?)
    (.*?).*?
    \s*
    \s*(.*?)\n\n\s*(.*?)
    ' + res = re.search(pattern_back, file_data, re.DOTALL) if res and res.lastindex == 4: short_filename = res.group(1).strip() short_summary = res.group(2).strip() diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index 2e6eb892..18791919 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -517,8 +517,7 @@ class PRCodeSuggestions: async def _prepare_prediction_extended(self, model: str) -> dict: self.patches_diff_list = get_pr_multi_diffs(self.git_provider, self.token_handler, model, - max_calls=get_settings().pr_code_suggestions.max_number_of_calls, - pr_description_files =self.pr_description_files) + max_calls=get_settings().pr_code_suggestions.max_number_of_calls) if self.patches_diff_list: get_logger().info(f"Number of PR chunk calls: {len(self.patches_diff_list)}") get_logger().debug(f"PR diff:", artifact=self.patches_diff_list)