Skip to content

Commit

Permalink
fix: sanitize Ask tool answers to prevent markdown formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mrT23 committed Dec 30, 2024
1 parent bd95220 commit 16dc29a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pr_agent/tools/pr_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ async def _get_prediction(self, model: str):
return response

def _prepare_pr_answer(self) -> str:
model_answer = self.prediction.strip()
# sanitize the answer so that no line will start with "/"
model_answer_sanitized = model_answer.replace("\n/", "\n /")

answer_str = f"### **Ask**❓\n{self.question_str}\n\n"
answer_str += f"### **Answer:**\n{self.prediction.strip()}\n\n"
answer_str += f"### **Answer:**\n{model_answer_sanitized}\n\n"
return answer_str

0 comments on commit 16dc29a

Please sign in to comment.