diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py
index c583b087..7b11ef54 100644
--- a/pr_agent/git_providers/gitlab_provider.py
+++ b/pr_agent/git_providers/gitlab_provider.py
@@ -115,12 +115,20 @@ class GitLabProvider(GitProvider):
if not patch:
patch = load_large_diff(filename, new_file_content_str, original_file_content_str)
+
+ # count number of lines added and removed
+ patch_lines = patch.splitlines(keepends=True)
+ num_plus_lines = len([line for line in patch_lines if line.startswith('+')])
+ num_minus_lines = len([line for line in patch_lines if line.startswith('-')])
diff_files.append(
FilePatchInfo(original_file_content_str, new_file_content_str,
patch=patch,
filename=filename,
edit_type=edit_type,
- old_filename=None if diff['old_path'] == diff['new_path'] else diff['old_path']))
+ old_filename=None if diff['old_path'] == diff['new_path'] else diff['old_path'],
+ num_plus_lines=num_plus_lines,
+ num_minus_lines=num_minus_lines, ))
+
self.diff_files = diff_files
return diff_files
diff --git a/pr_agent/settings/pr_description_prompts.toml b/pr_agent/settings/pr_description_prompts.toml
index 2225088d..cf418834 100644
--- a/pr_agent/settings/pr_description_prompts.toml
+++ b/pr_agent/settings/pr_description_prompts.toml
@@ -33,13 +33,13 @@ class PRType(str, Enum):
{%- if enable_file_walkthrough %}
class FileWalkthrough(BaseModel):
filename: str = Field(description="the relevant file full path")
- changes_in_file: str = Field(description="minimal and concise description of the changes in the relevant file")
+ changes_in_file: str = Field(description="minimal and concise summary of the changes in the relevant file")
{%- endif %}
{%- if enable_semantic_files_types %}
Class FileDescription(BaseModel):
filename: str = Field(description="the relevant file full path")
- changes_summary: str = Field(description="minimal and concise description of the important changes in the relevant file")
+ changes_summary: str = Field(description="minimal and concise summary of the changes in the relevant file")
label: str = Field(description="a single semantic label that represents a type of code changes that occurred in the File. Possible values (partial list): 'bug fix', 'tests', 'enhancement', 'documentation', 'error handling', 'configuration changes', 'dependencies', 'formating', 'miscellaneous', ...")
{%- endif %}
diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py
index 5a074390..950b4f37 100644
--- a/pr_agent/tools/pr_description.py
+++ b/pr_agent/tools/pr_description.py
@@ -30,6 +30,11 @@ class PRDescription:
)
self.pr_id = self.git_provider.get_pr_id()
+ if get_settings().pr_description.enable_semantic_files_types and not self.git_provider.is_supported(
+ "gfm_markdown"):
+ get_logger().debug(f"Disabling semantic files types for {self.pr_id}")
+ get_settings().pr_description.enable_semantic_files_types = False
+
# Initialize the AI handler
self.ai_handler = AiHandler()
@@ -313,10 +318,11 @@ class PRDescription:
filename_publish += diff_plus_minus
if self.git_provider.is_supported("gfm_markdown"):
pr_body += f"{filename_publish}
"
+ file_change_description= self._insert_br_after_x_chars(file_change_description)
if diff_plus_minus:
- pr_body += f"Change summary:
**{file_change_description}**