mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-12 19:05:18 +00:00
fix: sanitize Ask tool answers to prevent markdown formatting issues with leading slashes
This commit is contained in:
parent
16dc29a23a
commit
2f73ab6eab
1 changed files with 7 additions and 3 deletions
|
|
@ -79,13 +79,17 @@ class PR_LineQuestions:
|
|||
line_end=line_end,
|
||||
side=side)
|
||||
if self.patch_with_lines:
|
||||
response = await retry_with_fallback_models(self._get_prediction, model_type=ModelType.WEAK)
|
||||
model_answer = await retry_with_fallback_models(self._get_prediction, model_type=ModelType.WEAK)
|
||||
# sanitize the answer so that no line will start with "/"
|
||||
model_answer_sanitized = model_answer.strip().replace("\n/", "\n /")
|
||||
if model_answer_sanitized.startswith("/"):
|
||||
model_answer_sanitized = " " + model_answer_sanitized
|
||||
|
||||
get_logger().info('Preparing answer...')
|
||||
if comment_id:
|
||||
self.git_provider.reply_to_comment_from_comment_id(comment_id, response)
|
||||
self.git_provider.reply_to_comment_from_comment_id(comment_id, model_answer_sanitized)
|
||||
else:
|
||||
self.git_provider.publish_comment(response)
|
||||
self.git_provider.publish_comment(model_answer_sanitized)
|
||||
|
||||
return ""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue