mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-12 10:55:17 +00:00
fix: handle missing score in code suggestions and adjust indentation in pr_code_suggestions.py
This commit is contained in:
parent
5432469ef6
commit
9e063bf48a
1 changed files with 3 additions and 3 deletions
|
|
@ -104,8 +104,8 @@ class PRCodeSuggestions:
|
||||||
if not data:
|
if not data:
|
||||||
data = {"code_suggestions": []}
|
data = {"code_suggestions": []}
|
||||||
|
|
||||||
if (data is None or 'code_suggestions' not in data or not data['code_suggestions']
|
if (data is None or 'code_suggestions' not in data or not data['code_suggestions']
|
||||||
and get_settings().config.publish_output):
|
and get_settings().config.publish_output):
|
||||||
get_logger().warning('No code suggestions found for the PR.')
|
get_logger().warning('No code suggestions found for the PR.')
|
||||||
pr_body = "## PR Code Suggestions ✨\n\nNo code suggestions found for the PR."
|
pr_body = "## PR Code Suggestions ✨\n\nNo code suggestions found for the PR."
|
||||||
get_logger().debug(f"PR output", artifact=pr_body)
|
get_logger().debug(f"PR output", artifact=pr_body)
|
||||||
|
|
@ -528,7 +528,7 @@ class PRCodeSuggestions:
|
||||||
for i, prediction in enumerate(predictions["code_suggestions"]):
|
for i, prediction in enumerate(predictions["code_suggestions"]):
|
||||||
try:
|
try:
|
||||||
if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
|
if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
|
||||||
score = int(prediction["score"])
|
score = int(prediction.get("score", 1))
|
||||||
if score >= score_threshold:
|
if score >= score_threshold:
|
||||||
data["code_suggestions"].append(prediction)
|
data["code_suggestions"].append(prediction)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue