From c6c97ac98aaa4dc58f2227f3048f60290e609a61 Mon Sep 17 00:00:00 2001 From: zmeir Date: Wed, 30 Aug 2023 23:33:38 +0300 Subject: [PATCH 1/4] Try to change the improve command prompt to prevent split lines range --- .../settings/pr_code_suggestions_prompts.toml | 18 ++++++++++++------ pr_agent/tools/pr_code_suggestions.py | 7 ++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pr_agent/settings/pr_code_suggestions_prompts.toml b/pr_agent/settings/pr_code_suggestions_prompts.toml index f60b9cc2..6867a883 100644 --- a/pr_agent/settings/pr_code_suggestions_prompts.toml +++ b/pr_agent/settings/pr_code_suggestions_prompts.toml @@ -68,12 +68,17 @@ Code suggestions: type: string description: |- a code snippet showing the relevant code lines from a '__new hunk__' section. - It must be continuous, correctly formatted and indented, and without line numbers. - relevant lines: - type: string + It must be contiguous, correctly formatted and indented, and without line numbers. + relevant lines start: + type: integer description: |- - the relevant lines from a '__new hunk__' section, in the format of 'start_line-end_line'. - For example: '10-15'. They should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above. + The relevant line number from a '__new hunk__' section where the suggestion starts (inclusive). + Should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above. + relevant lines end: + type: integer + description: |- + The relevant line number from a '__new hunk__' section where the suggestion ends (inclusive). + Should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above. improved code: type: string description: |- @@ -90,7 +95,8 @@ Code suggestions: Add a docstring to func1() existing code: |- def func1(): - relevant lines: '12-12' + relevant lines start: 12 + relevant lines end: 12 improved code: |- ... ``` diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index d9fb3051..ba45598e 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -113,11 +113,8 @@ class PRCodeSuggestions: if get_settings().config.verbosity_level >= 2: logging.info(f"suggestion: {d}") relevant_file = d['relevant file'].strip() - relevant_lines_str = d['relevant lines'].strip() - if ',' in relevant_lines_str: # handling 'relevant lines': '181, 190' or '178-184, 188-194' - relevant_lines_str = relevant_lines_str.split(',')[0] - relevant_lines_start = int(relevant_lines_str.split('-')[0]) # absolute position - relevant_lines_end = int(relevant_lines_str.split('-')[-1]) + relevant_lines_start = int(d['relevant lines start']) # absolute position + relevant_lines_end = int(d['relevant lines end']) content = d['suggestion content'] new_code_snippet = d['improved code'] From 5cbcef276c1a5b535e33f08c36d257034669be2d Mon Sep 17 00:00:00 2001 From: idavidov Date: Thu, 31 Aug 2023 09:19:02 +0300 Subject: [PATCH 2/4] cross link in INSTALL for GitAPP configuration overwrite --- INSTALL.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index ba2547b1..1b0f5bc4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -251,7 +251,10 @@ docker push codiumai/pr-agent:github_app # Push to your Docker repository 9. Install the app by navigating to the "Install App" tab and selecting your desired repositories. ---- +> **Note:** When running PR-Agent from GitHub App, the default configuration file (configuration.toml) will be loaded.
+> However, you can override the default tool parameters by uploading a local configuration file
+> For more information please check out [CONFIGURATION.md](CONFIGURATION.md#working-from-github-app-pre-built-repo) + ### Method 6 - Deploy as a Lambda Function From 8823d8c0e962d4465e5a7b46671559336b948705 Mon Sep 17 00:00:00 2001 From: idavidov Date: Thu, 31 Aug 2023 09:21:40 +0300 Subject: [PATCH 3/4] small format change --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 1b0f5bc4..e778e266 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -254,7 +254,7 @@ docker push codiumai/pr-agent:github_app # Push to your Docker repository > **Note:** When running PR-Agent from GitHub App, the default configuration file (configuration.toml) will be loaded.
> However, you can override the default tool parameters by uploading a local configuration file
> For more information please check out [CONFIGURATION.md](CONFIGURATION.md#working-from-github-app-pre-built-repo) - +--- ### Method 6 - Deploy as a Lambda Function From 8263bf5f9cf4a3c8bb6ec098ee446afefc84e0cb Mon Sep 17 00:00:00 2001 From: Ori Kotek Date: Thu, 31 Aug 2023 09:26:16 +0300 Subject: [PATCH 4/4] small refactor of azure devops --- Dockerfile.github_action | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile.github_action b/Dockerfile.github_action index d6763f0a..dd1ae750 100644 --- a/Dockerfile.github_action +++ b/Dockerfile.github_action @@ -2,7 +2,8 @@ FROM python:3.10 as base WORKDIR /app ADD pyproject.toml . -RUN pip install . && rm pyproject.toml +ADD requirements.txt . +RUN pip install . && rm pyproject.toml requirements.txt ENV PYTHONPATH=/app ADD pr_agent pr_agent ADD github_action/entrypoint.sh /