Skip to content

Commit

Permalink
fix: improve bullet point formatting and file path display in PR desc…
Browse files Browse the repository at this point in the history
…ription
  • Loading branch information
mrT23 committed Dec 31, 2024
1 parent 6fbd95e commit 4a1b042
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pr_agent/algo/pr_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,11 @@ def pr_generate_extended_diff(pr_languages: list,
if not extended_patch:
get_logger().warning(f"Failed to extend patch for file: {file.filename}")
continue
full_extended_patch = f"\n\n## {file.filename}\n{extended_patch.rstrip()}\n"

if add_line_numbers_to_hunks:
full_extended_patch = convert_to_hunks_with_lines_numbers(extended_patch, file)
else:
full_extended_patch = f"\n\n## File: '{file.filename.strip()}'\n{extended_patch.rstrip()}\n"

# add AI-summary metadata to the patch
if file.ai_file_summary and get_settings().get("config.enable_ai_metadata", False):
Expand Down
2 changes: 1 addition & 1 deletion pr_agent/settings/pr_description_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PRDescription(BaseModel):
{%- if enable_semantic_files_types %}
pr_files: List[FileDescription] = Field(max_items=20, description="a list of all the files that were changed in the PR, and summary of their changes. Each file must be analyzed regardless of change size.")
{%- endif %}
description: str = Field(description="a clear and concise description of the PR using short bullet points (with sub-bullets if needed). Prioritize the most significant changes first")
description: str = Field(description="summarize the PR changes in up to four bullet points, each up to 8 words. Add sub-bullets if needed. Order bullets by importance, with each bullet highlighting a key change group.")
title: str = Field(description="a concise and descriptive title that captures the PR's main theme")
=====
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/tools/pr_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,11 @@ def _prepare_pr_answer(self) -> Tuple[str, str, str, List[dict]]:
elif 'pr_files' in key.lower() and get_settings().pr_description.enable_semantic_files_types:
changes_walkthrough, pr_file_changes = self.process_pr_files_prediction(changes_walkthrough, value)
changes_walkthrough = f"{PRDescriptionHeader.CHANGES_WALKTHROUGH.value}\n{changes_walkthrough}"
elif key.lower().strip() == 'description':
if isinstance(value, list):
value = ', '.join(v.rstrip() for v in value)
value = value.replace('\n-', '\n\n-').strip() # makes the bullet points more readable by adding double space
pr_body += f"{value}\n"
else:
# if the value is a list, join its items by comma
if isinstance(value, list):
Expand Down

0 comments on commit 4a1b042

Please sign in to comment.