mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-12 19:05:18 +00:00
fix: Apply suggestions_score_threshold filter to inline code suggestions in dual publishing mode
- Added score filtering to push_inline_code_suggestions - Ensured inline suggestions are properly filtered when dual publishing is enabled - High-importance suggestions appear in both table and inline; others only inline
This commit is contained in:
parent
5ec92b3535
commit
ab808fd114
1 changed files with 6 additions and 3 deletions
|
|
@ -539,7 +539,10 @@ class PRCodeSuggestions:
|
||||||
async def push_inline_code_suggestions(self, data):
|
async def push_inline_code_suggestions(self, data):
|
||||||
code_suggestions = []
|
code_suggestions = []
|
||||||
|
|
||||||
if not data['code_suggestions']:
|
score_threshold = max(1, int(get_settings().pr_code_suggestions.suggestions_score_threshold))
|
||||||
|
filtered_suggestions = [d for d in data['code_suggestions'] if int(d.get('score', 0)) >= score_threshold]
|
||||||
|
|
||||||
|
if not filtered_suggestions:
|
||||||
get_logger().info('No suggestions found to improve this PR.')
|
get_logger().info('No suggestions found to improve this PR.')
|
||||||
if self.progress_response:
|
if self.progress_response:
|
||||||
return self.git_provider.edit_comment(self.progress_response,
|
return self.git_provider.edit_comment(self.progress_response,
|
||||||
|
|
@ -547,7 +550,7 @@ class PRCodeSuggestions:
|
||||||
else:
|
else:
|
||||||
return self.git_provider.publish_comment('No suggestions found to improve this PR.')
|
return self.git_provider.publish_comment('No suggestions found to improve this PR.')
|
||||||
|
|
||||||
for d in data['code_suggestions']:
|
for d in filtered_suggestions:
|
||||||
try:
|
try:
|
||||||
if get_settings().config.verbosity_level >= 2:
|
if get_settings().config.verbosity_level >= 2:
|
||||||
get_logger().info(f"suggestion: {d}")
|
get_logger().info(f"suggestion: {d}")
|
||||||
|
|
@ -941,4 +944,4 @@ class PRCodeSuggestions:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
get_logger().info(f"Could not reflect on suggestions, error: {e}")
|
get_logger().info(f"Could not reflect on suggestions, error: {e}")
|
||||||
return ""
|
return ""
|
||||||
return response_reflect
|
return response_reflect
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue