From 240e0374e77f812a4ff857afdb4c804ee6202396 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Wed, 31 Jul 2024 13:32:42 +0300 Subject: [PATCH] fixed extra call bug --- pr_agent/algo/pr_processing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index b167026c..b7c21a75 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -80,7 +80,7 @@ def get_pr_diff(git_provider: GitProvider, token_handler: TokenHandler, if large_pr_handling and len(patches_compressed_list) > 1: get_logger().info(f"Large PR handling mode, and found {len(patches_compressed_list)} patches with original diff.") - return "" # return empty string, as we generate multiple patches with a different prompt + return "" # return empty string, as we want to generate multiple patches with a different prompt # return the first patch patches_compressed = patches_compressed_list[0] @@ -462,6 +462,10 @@ def get_pr_multi_diffs(git_provider: GitProvider, patches = [] total_tokens = token_handler.prompt_tokens call_number += 1 + if call_number > max_calls: # avoid creating new patches + if get_settings().config.verbosity_level >= 2: + get_logger().info(f"Reached max calls ({max_calls})") + break if get_settings().config.verbosity_level >= 2: get_logger().info(f"Call number: {call_number}")