diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py
index 019e41b4..908bce3a 100644
--- a/pr_agent/tools/pr_code_suggestions.py
+++ b/pr_agent/tools/pr_code_suggestions.py
@@ -328,22 +328,20 @@ class PRCodeSuggestions:
data = {"code_suggestions": []}
- for i, prediction in enumerate(prediction_list):
- try:
- if "code_suggestions" in prediction:
- if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
- score = int(prediction["code_suggestions"][0]["score"])
- if score > 0:
- data["code_suggestions"].extend(prediction["code_suggestions"])
+ for i, predictions in enumerate(prediction_list):
+ if "code_suggestions" in predictions:
+ for prediction in predictions["code_suggestions"]:
+ try:
+ if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
+ score = int(prediction["score"])
+ if score > 0:
+ data["code_suggestions"].append(prediction)
+ else:
+ get_logger().info(f"Skipping suggestions from call {i + 1}, because score is {score}")
else:
- get_logger().info(f"Skipping suggestions from call {i + 1}, because score is {score}")
- else:
- data["code_suggestions"].extend(prediction["code_suggestions"])
- else:
- get_logger().error(f"Error getting PR diff, no code suggestions found in call {i + 1}")
- except Exception as e:
- get_logger().error(f"Error getting PR diff, error: {e}")
- data = None
+ get_logger().error(f"Error getting PR diff, no code suggestions found in call {i + 1}")
+ except Exception as e:
+ get_logger().error(f"Error getting PR diff, error: {e}")
self.data = data
else:
get_logger().error(f"Error getting PR diff")
@@ -428,7 +426,7 @@ class PRCodeSuggestions:
delta = 68
header += " " * delta
if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
- pr_body += f""" """
+ pr_body += f"""Category {header} Score """
else:
pr_body += f"""Category {header} Importance """
pr_body += """Category {header}