diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 7744b699..62c36b01 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -471,7 +471,16 @@ class PRDescription: def _prepare_pr_answer_with_markers(self) -> Tuple[str, str, str, List[dict]]: get_logger().info(f"Using description marker replacements {self.pr_id}") - title = self.vars["title"] + + # Remove the 'PR Title' key from the dictionary + ai_title = self.data.pop('title', self.vars["title"]) + if (not get_settings().pr_description.generate_ai_title): + # Assign the original PR title to the 'title' variable + title = self.vars["title"] + else: + # Assign the value of the 'PR Title' key to 'title' variable + title = ai_title + body = self.user_description if get_settings().pr_description.include_generated_by_header: ai_header = f"### 🤖 Generated by PR Agent at {self.git_provider.last_commit_id.sha}\n\n"