mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-06 13:50:44 +08:00
s
This commit is contained in:
@ -328,22 +328,20 @@ class PRCodeSuggestions:
|
|||||||
|
|
||||||
|
|
||||||
data = {"code_suggestions": []}
|
data = {"code_suggestions": []}
|
||||||
for i, prediction in enumerate(prediction_list):
|
for i, predictions in enumerate(prediction_list):
|
||||||
|
if "code_suggestions" in predictions:
|
||||||
|
for prediction in predictions["code_suggestions"]:
|
||||||
try:
|
try:
|
||||||
if "code_suggestions" in prediction:
|
|
||||||
if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
|
if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
|
||||||
score = int(prediction["code_suggestions"][0]["score"])
|
score = int(prediction["score"])
|
||||||
if score > 0:
|
if score > 0:
|
||||||
data["code_suggestions"].extend(prediction["code_suggestions"])
|
data["code_suggestions"].append(prediction)
|
||||||
else:
|
else:
|
||||||
get_logger().info(f"Skipping suggestions from call {i + 1}, because score is {score}")
|
get_logger().info(f"Skipping suggestions from call {i + 1}, because score is {score}")
|
||||||
else:
|
|
||||||
data["code_suggestions"].extend(prediction["code_suggestions"])
|
|
||||||
else:
|
else:
|
||||||
get_logger().error(f"Error getting PR diff, no code suggestions found in call {i + 1}")
|
get_logger().error(f"Error getting PR diff, no code suggestions found in call {i + 1}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
get_logger().error(f"Error getting PR diff, error: {e}")
|
get_logger().error(f"Error getting PR diff, error: {e}")
|
||||||
data = None
|
|
||||||
self.data = data
|
self.data = data
|
||||||
else:
|
else:
|
||||||
get_logger().error(f"Error getting PR diff")
|
get_logger().error(f"Error getting PR diff")
|
||||||
@ -428,7 +426,7 @@ class PRCodeSuggestions:
|
|||||||
delta = 68
|
delta = 68
|
||||||
header += " " * delta
|
header += " " * delta
|
||||||
if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
|
if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
|
||||||
pr_body += f"""<thead><tr><td>Category</td><td align=left>{header}</td><td align=center>Score</td></tr>"""
|
pr_body += f"""<thead><tr><td>Category</td><td align=left>{header}</td><td align=center>Importance</td></tr>"""
|
||||||
else:
|
else:
|
||||||
pr_body += f"""<thead><tr><td>Category</td><td align=left>{header}</td></tr>"""
|
pr_body += f"""<thead><tr><td>Category</td><td align=left>{header}</td></tr>"""
|
||||||
pr_body += """<tbody>"""
|
pr_body += """<tbody>"""
|
||||||
|
Reference in New Issue
Block a user