Add configuration option for PR Code Suggestions to control publishing when no suggestions found

This commit is contained in:
mrT23
2025-03-29 09:33:31 +03:00
parent 069f5eb86f
commit ddf94c14a3
3 changed files with 7 additions and 4 deletions

View File

@ -434,6 +434,9 @@ Note: Chunking is primarily relevant for large PRs. For most PRs (up to 500 line
<td><b>enable_chat_text</b></td>
<td>If set to true, the tool will display a reference to the PR chat in the comment. Default is true.</td>
</tr>
<tr>
<td><b>publish_output_no_suggestions</b></td>
<td>If set to true, the tool will publish a comment even if no suggestions were found. Default is true.</td>
<tr>
<td><b>wiki_page_accepted_suggestions</b></td>
<td>If set to true, the tool will automatically track accepted suggestions in a dedicated wiki page called `.pr_agent_accepted_suggestions`. Default is true.</td>

View File

@ -14,7 +14,6 @@ model_token_count_estimate_factor=0.3 # factor to increase the token count estim
git_provider="github"
publish_output=true
publish_output_progress=true
publish_output_no_suggestions=true
verbosity_level=0 # 0,1,2
use_extra_bad_extensions=false
# Configurations
@ -130,9 +129,9 @@ focus_only_on_problems=true
extra_instructions = ""
enable_help_text=false
enable_chat_text=false
enable_intro_text=true
persistent_comment=true
max_history_len=4
publish_output_no_suggestions=true
# enable to apply suggestion 💎
apply_suggestions_checkbox=true
# suggestions scoring

View File

@ -217,7 +217,8 @@ class PRCodeSuggestions:
async def publish_no_suggestions(self):
pr_body = "## PR Code Suggestions ✨\n\nNo code suggestions found for the PR."
if get_settings().config.publish_output and get_settings().config.publish_output_no_suggestions:
if (get_settings().config.publish_output and
get_settings().pr_code_suggestions.get('publish_output_no_suggestions', True)):
get_logger().warning('No code suggestions found for the PR.')
get_logger().debug(f"PR output", artifact=pr_body)
if self.progress_response:
@ -784,7 +785,7 @@ class PRCodeSuggestions:
pr_body += "No suggestions found to improve this PR."
return pr_body
if get_settings().pr_code_suggestions.enable_intro_text and get_settings().config.is_auto_command:
if get_settings().config.is_auto_command:
pr_body += "Explore these optional code suggestions:\n\n"
language_extension_map_org = get_settings().language_extension_map_org