Skip to content

Commit 7bd0fef

Browse files
committed
Fix GitLab protections function and return value in PR questions
1 parent 02d9aed commit 7bd0fef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pr_agent/tools/pr_questions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,22 @@ async def _get_prediction(self, model: str):
116116
model=model, temperature=get_settings().config.temperature, system=system_prompt, user=user_prompt)
117117
return response
118118

119-
def gitlab_protctions(self, model_answer: str) -> str:
119+
def gitlab_protections(self, model_answer: str) -> str:
120120
github_quick_actions_MR = ["/approve", "/close", "/merge", "/reopen", "/unapprove", "/title", "/assign",
121121
"/copy_metadata", "/target_branch"]
122122
if any(action in model_answer for action in github_quick_actions_MR):
123123
str_err = "Model answer contains GitHub quick actions, which are not supported in GitLab"
124124
get_logger().error(str_err)
125125
return str_err
126+
return model_answer
126127

127128
def _prepare_pr_answer(self) -> str:
128129
model_answer = self.prediction.strip()
129130
# sanitize the answer so that no line will start with "/"
130131
model_answer_sanitized = model_answer.replace("\n/", "\n /")
131132
model_answer_sanitized = model_answer_sanitized.replace("\r/", "\r /")
132133
if isinstance(self.git_provider, GitLabProvider):
133-
model_answer_sanitized = self.gitlab_protctions(model_answer_sanitized)
134+
model_answer_sanitized = self.gitlab_protections(model_answer_sanitized)
134135
if model_answer_sanitized.startswith("/"):
135136
model_answer_sanitized = " " + model_answer_sanitized
136137
if model_answer_sanitized != model_answer:

0 commit comments

Comments
 (0)