diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 5c7a35eb..7ab2f8cb 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -9,11 +9,11 @@ verbosity_level=0 # 0,1,2 use_extra_bad_extensions=false use_repo_settings_file=true use_global_settings_file=true -ai_timeout=180 +ai_timeout=90 max_description_tokens = 500 max_commits_tokens = 500 max_model_tokens = 32000 # Limits the maximum number of tokens that can be used by any model, regardless of the model's default capabilities. -patch_extra_lines = 3 +patch_extra_lines = 1 secret_provider="google_cloud_storage" cli_mode=false diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index bbe53fca..4916de48 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -9,7 +9,7 @@ from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler from pr_agent.algo.ai_handlers.litellm_ai_handler import LiteLLMAIHandler from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler -from pr_agent.algo.utils import load_yaml, set_custom_labels, get_user_labels +from pr_agent.algo.utils import load_yaml, set_custom_labels, get_user_labels, ModelType from pr_agent.config_loader import get_settings from pr_agent.git_providers import get_git_provider from pr_agent.git_providers.git_provider import get_main_pr_language @@ -80,7 +80,7 @@ class PRDescription: if get_settings().config.publish_output: self.git_provider.publish_comment("Preparing PR description...", is_temporary=True) - await retry_with_fallback_models(self._prepare_prediction) + await retry_with_fallback_models(self._prepare_prediction, ModelType.TURBO) # turbo model because larger context get_logger().info(f"Preparing answer {self.pr_id}") if self.prediction: @@ -455,6 +455,8 @@ def insert_br_after_x_chars(text, x=70): words[-1] += "
" def count_chars_without_html(string): + if '<' not in string: + return len(string) no_html_string = re.sub('<[^>]+>', '', string) return len(no_html_string)