Escape HTML tags in suggestion summaries in pr_code_suggestions.py and update pr_code_suggestions_prompts.toml for backtick usage

This commit is contained in:
mrT23
2024-08-06 12:16:58 +03:00
parent a98d972041
commit cb10ceadd7
2 changed files with 9 additions and 3 deletions

View File

@ -656,6 +656,11 @@ class PRCodeSuggestions:
else:
pr_body += f"""<tr><td>\n\n"""
suggestion_summary = suggestion['one_sentence_summary'].strip().rstrip('.')
if "'<" in suggestion_summary and ">'" in suggestion_summary:
# escape the '<' and '>' characters, otherwise they are interpreted as html tags
get_logger().info(f"Escaped suggestion summary: {suggestion_summary}")
suggestion_summary = suggestion_summary.replace("'<", "`<")
suggestion_summary = suggestion_summary.replace(">'", ">`")
if '`' in suggestion_summary:
suggestion_summary = replace_code_tags(suggestion_summary)