From feb306727e9e9bd3947171cd0da09f0737a8d654 Mon Sep 17 00:00:00 2001 From: Benedict Lee Date: Mon, 24 Feb 2025 09:15:00 +0900 Subject: [PATCH] fix : refine handling of leading '+' in response text --- pr_agent/algo/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index 15b33068..e6365c8f 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -782,7 +782,8 @@ def try_fix_yaml(response_text: str, # fifth fallback - try to remove leading '+' (sometimes added by AI for 'existing code' and 'improved code') response_text_lines_copy = response_text_lines.copy() for i in range(0, len(response_text_lines_copy)): - response_text_lines_copy[i] = ' ' + response_text_lines_copy[i][1:] + if response_text_lines_copy[i].startswith('+'): + response_text_lines_copy[i] = ' ' + response_text_lines_copy[i][1:] try: data = yaml.safe_load('\n'.join(response_text_lines_copy)) get_logger().info(f"Successfully parsed AI prediction after removing leading '+'")