From f3a712683ad30b10e3e93c0fabce66f0d7b4f793 Mon Sep 17 00:00:00 2001 From: KennyDizi Date: Sat, 24 Feb 2024 16:53:18 +0700 Subject: [PATCH] Use constant in stead of hard code number for collapsible file list threadhold --- pr_agent/tools/pr_description.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 72005209..4de595a0 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -41,6 +41,7 @@ class PRDescription: # Initialize the AI handler self.ai_handler = ai_handler() + # Initialize the variables dictionary self.vars = { @@ -57,6 +58,7 @@ class PRDescription: } self.user_description = self.git_provider.get_user_description() + # Initialize the token handler self.token_handler = TokenHandler( @@ -65,10 +67,12 @@ class PRDescription: get_settings().pr_description_prompt.system, get_settings().pr_description_prompt.user, ) + # Initialize patches_diff and prediction attributes self.patches_diff = None self.prediction = None + COLLAPSIBLE_FILE_LIST_THRESHOLD = 8 async def run(self): """ @@ -359,7 +363,7 @@ class PRDescription: for semantic_label in value.keys(): num_files += len(value[semantic_label]) if use_collapsible_file_list == "adaptive": - use_collapsible_file_list = num_files > 8 + use_collapsible_file_list = num_files > COLLAPSIBLE_FILE_LIST_THRESHOLD if not self.git_provider.is_supported("gfm_markdown"): get_logger().info(f"Disabling semantic files types for {self.pr_id} since gfm_markdown is not supported")