diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index 94b40c92..ef7210ee 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -173,11 +173,15 @@ class GitLabProvider(GitProvider): 'position': pos_obj}) def get_relevant_diff(self, relevant_file, relevant_line_in_file): - for d in self.mr.diffs.list(get_all=True): - changes = self.mr.changes() # Retrieve the changes for the merge request + changes = self.mr.changes() # Retrieve the changes for the merge request once + all_diffs = self.mr.diffs.list(get_all=True) + + for d in all_diffs: for change in changes['changes']: if change['new_path'] == relevant_file and relevant_line_in_file in change['diff']: return d + logging.debug( + f'No relevant diff found for {relevant_file} {relevant_line_in_file}. Falling back to last diff.') return self.last_diff # fallback to last_diff if no relevant diff is found def publish_code_suggestions(self, code_suggestions: list): diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 0c502df9..777d7209 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -1,7 +1,7 @@ [config] -model="gpt-4" +model="gpt-3.5-turbo-16k" fallback_models=["gpt-3.5-turbo-16k"] -git_provider="github" +git_provider="gitlab" publish_output=true publish_output_progress=true verbosity_level=0 # 0,1,2