mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 04:40:38 +08:00
patch_extension_skip_types
Add validation for latest_comment and cast suggestions_score_threshold to int
This commit is contained in:
@ -80,6 +80,8 @@ async def polling_loop():
|
|||||||
if 'subject' in notification and notification['subject']['type'] == 'PullRequest':
|
if 'subject' in notification and notification['subject']['type'] == 'PullRequest':
|
||||||
pr_url = notification['subject']['url']
|
pr_url = notification['subject']['url']
|
||||||
latest_comment = notification['subject']['latest_comment_url']
|
latest_comment = notification['subject']['latest_comment_url']
|
||||||
|
if not latest_comment or not isinstance(latest_comment, str):
|
||||||
|
continue
|
||||||
async with session.get(latest_comment, headers=headers) as comment_response:
|
async with session.get(latest_comment, headers=headers) as comment_response:
|
||||||
if comment_response.status == 200:
|
if comment_response.status == 200:
|
||||||
comment = await comment_response.json()
|
comment = await comment_response.json()
|
||||||
|
@ -522,7 +522,7 @@ class PRCodeSuggestions:
|
|||||||
data = {"code_suggestions": []}
|
data = {"code_suggestions": []}
|
||||||
for j, predictions in enumerate(prediction_list): # each call adds an element to the list
|
for j, predictions in enumerate(prediction_list): # each call adds an element to the list
|
||||||
if "code_suggestions" in predictions:
|
if "code_suggestions" in predictions:
|
||||||
score_threshold = max(1, get_settings().pr_code_suggestions.suggestions_score_threshold)
|
score_threshold = max(1, int(get_settings().pr_code_suggestions.suggestions_score_threshold))
|
||||||
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:
|
||||||
|
Reference in New Issue
Block a user