mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 21:00:40 +08:00
Simpler auto-extended toggle and keep the default as false
This commit is contained in:
@ -29,10 +29,7 @@ Under the section 'pr_code_suggestions', the [configuration file](./../pr_agent/
|
|||||||
- `include_improved_code`: if set to true, the tool will include an improved code implementation in the suggestion. Default is true.
|
- `include_improved_code`: if set to true, the tool will include an improved code implementation in the suggestion. Default is true.
|
||||||
|
|
||||||
#### params for '/improve --extended' mode
|
#### params for '/improve --extended' mode
|
||||||
- `auto_extended_mode`: enable extended mode automatically for large PRs. Default is true.
|
- `auto_extended_mode`: enable extended mode automatically (no need for the `--extended` option). Default is false.
|
||||||
- `auto_extended_mode_min_files`: minimum number of files in the PR to automatically enable extended mode. Default is 1.
|
|
||||||
- `auto_extended_mode_min_additions`: minimum number of line additions in the PR to automatically enable extended mode. Default is 500.
|
|
||||||
- `auto_extended_mode_min_deletions`: minimum number of line deletions in the PR to automatically enable extended mode. Default is 0.
|
|
||||||
- `num_code_suggestions_per_chunk`: number of code suggestions provided by the 'improve' tool, per chunk. Default is 8.
|
- `num_code_suggestions_per_chunk`: number of code suggestions provided by the 'improve' tool, per chunk. Default is 8.
|
||||||
- `rank_extended_suggestions`: if set to true, the tool will rank the suggestions, based on importance. Default is true.
|
- `rank_extended_suggestions`: if set to true, the tool will rank the suggestions, based on importance. Default is true.
|
||||||
- `max_number_of_calls`: maximum number of chunks. Default is 5.
|
- `max_number_of_calls`: maximum number of chunks. Default is 5.
|
||||||
|
@ -71,10 +71,7 @@ include_improved_code = true
|
|||||||
extra_instructions = ""
|
extra_instructions = ""
|
||||||
rank_suggestions = false
|
rank_suggestions = false
|
||||||
# params for '/improve --extended' mode
|
# params for '/improve --extended' mode
|
||||||
auto_extended_mode=true
|
auto_extended_mode=false
|
||||||
auto_extended_mode_min_files=1
|
|
||||||
auto_extended_mode_min_additions=500
|
|
||||||
auto_extended_mode_min_deletions=0
|
|
||||||
num_code_suggestions_per_chunk=8
|
num_code_suggestions_per_chunk=8
|
||||||
rank_extended_suggestions = true
|
rank_extended_suggestions = true
|
||||||
max_number_of_calls = 5
|
max_number_of_calls = 5
|
||||||
|
@ -207,17 +207,12 @@ class PRCodeSuggestions:
|
|||||||
return new_code_snippet
|
return new_code_snippet
|
||||||
|
|
||||||
def _get_is_extended(self, args: list[str]) -> bool:
|
def _get_is_extended(self, args: list[str]) -> bool:
|
||||||
"""Check if extended mode should be enabled by the `--extended` flag or automatically according to the PR"""
|
"""Check if extended mode should be enabled by the `--extended` flag or automatically according to the configuration"""
|
||||||
if any(["extended" in arg for arg in args]):
|
if any(["extended" in arg for arg in args]):
|
||||||
get_logger().info("Extended mode is enabled by the `--extended` flag")
|
get_logger().info("Extended mode is enabled by the `--extended` flag")
|
||||||
return True
|
return True
|
||||||
if (
|
if get_settings().pr_code_suggestions.auto_extended_mode:
|
||||||
get_settings().pr_code_suggestions.auto_extended_mode
|
get_logger().info("Extended mode is enabled automatically based on the configuration toggle")
|
||||||
and self.git_provider.pr.changed_files >= get_settings().pr_code_suggestions.auto_extended_mode_min_files
|
|
||||||
and self.git_provider.pr.additions >= get_settings().pr_code_suggestions.auto_extended_mode_min_additions
|
|
||||||
and self.git_provider.pr.deletions >= get_settings().pr_code_suggestions.auto_extended_mode_min_deletions
|
|
||||||
):
|
|
||||||
get_logger().info("Extended mode is enabled automatically based on the PR size")
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user