From 7bd0fefee43610b9a6e64c73743dc2fefbaf30c1 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Sat, 29 Mar 2025 19:53:46 +0300 Subject: [PATCH] Fix GitLab protections function and return value in PR questions --- pr_agent/tools/pr_questions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pr_agent/tools/pr_questions.py b/pr_agent/tools/pr_questions.py index 3333fb3a..7cdb7984 100644 --- a/pr_agent/tools/pr_questions.py +++ b/pr_agent/tools/pr_questions.py @@ -116,13 +116,14 @@ class PRQuestions: model=model, temperature=get_settings().config.temperature, system=system_prompt, user=user_prompt) return response - def gitlab_protctions(self, model_answer: str) -> str: + def gitlab_protections(self, model_answer: str) -> str: github_quick_actions_MR = ["/approve", "/close", "/merge", "/reopen", "/unapprove", "/title", "/assign", "/copy_metadata", "/target_branch"] if any(action in model_answer for action in github_quick_actions_MR): str_err = "Model answer contains GitHub quick actions, which are not supported in GitLab" get_logger().error(str_err) return str_err + return model_answer def _prepare_pr_answer(self) -> str: model_answer = self.prediction.strip() @@ -130,7 +131,7 @@ class PRQuestions: model_answer_sanitized = model_answer.replace("\n/", "\n /") model_answer_sanitized = model_answer_sanitized.replace("\r/", "\r /") if isinstance(self.git_provider, GitLabProvider): - model_answer_sanitized = self.gitlab_protctions(model_answer_sanitized) + model_answer_sanitized = self.gitlab_protections(model_answer_sanitized) if model_answer_sanitized.startswith("/"): model_answer_sanitized = " " + model_answer_sanitized if model_answer_sanitized != model_answer: