mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 21:30:40 +08:00
feat: Update user description extraction and placement in PR description
This commit is contained in:
@ -81,8 +81,13 @@ class GitProvider(ABC):
|
||||
# return nothing (empty string) because it means there is no user description
|
||||
if "## User Description:" not in description:
|
||||
return ""
|
||||
# otherwise, extract the original user description from the existing pr-agent description and return it
|
||||
return description.split("## User Description:", 1)[1].strip()
|
||||
|
||||
# # otherwise, extract the original user description from the existing pr-agent description and return it
|
||||
# return description.split("## User Description:", 1)[1].strip()
|
||||
|
||||
# the 'user description' is in the beginning. extract it
|
||||
return description.split("\n\n___", 1)[0].strip()
|
||||
|
||||
|
||||
@abstractmethod
|
||||
def get_repo_settings(self):
|
||||
|
@ -186,7 +186,12 @@ class PRDescription:
|
||||
# Load the AI prediction data into a dictionary
|
||||
self.data = load_yaml(self.prediction.strip())
|
||||
|
||||
if get_settings().pr_description.add_original_user_description and self.user_description:
|
||||
self.data["User Description"] = self.user_description + "\n\n___\n\n"
|
||||
|
||||
# re-order keys
|
||||
if 'User Description' in self.data:
|
||||
self.data['User Description'] = self.data.pop('User Description')
|
||||
if 'title' in self.data:
|
||||
self.data['title'] = self.data.pop('title')
|
||||
if 'type' in self.data:
|
||||
@ -198,8 +203,7 @@ class PRDescription:
|
||||
if 'pr_files' in self.data:
|
||||
self.data['pr_files'] = self.data.pop('pr_files')
|
||||
|
||||
if get_settings().pr_description.add_original_user_description and self.user_description:
|
||||
self.data["User Description"] = self.user_description
|
||||
|
||||
|
||||
|
||||
def _prepare_labels(self) -> List[str]:
|
||||
|
Reference in New Issue
Block a user