Merge remote-tracking branch 'origin/main' into tr/github_app

This commit is contained in:
mrT23
2023-08-31 20:36:56 +03:00
4 changed files with 19 additions and 12 deletions

View File

@ -2,7 +2,8 @@ FROM python:3.10 as base
WORKDIR /app WORKDIR /app
ADD pyproject.toml . ADD pyproject.toml .
RUN pip install . && rm pyproject.toml ADD requirements.txt .
RUN pip install . && rm pyproject.toml requirements.txt
ENV PYTHONPATH=/app ENV PYTHONPATH=/app
ADD pr_agent pr_agent ADD pr_agent pr_agent
ADD github_action/entrypoint.sh / ADD github_action/entrypoint.sh /

View File

@ -251,6 +251,9 @@ 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. 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.<br>
> However, you can override the default tool parameters by uploading a local configuration file<br>
> For more information please check out [CONFIGURATION.md](CONFIGURATION.md#working-from-github-app-pre-built-repo)
--- ---
### Method 6 - Deploy as a Lambda Function ### Method 6 - Deploy as a Lambda Function

View File

@ -68,12 +68,17 @@ Code suggestions:
type: string type: string
description: |- description: |-
a code snippet showing the relevant code lines from a '__new hunk__' section. 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. It must be contiguous, correctly formatted and indented, and without line numbers.
relevant lines: relevant lines start:
type: string type: integer
description: |- description: |-
the relevant lines from a '__new hunk__' section, in the format of 'start_line-end_line'. The relevant line number from a '__new hunk__' section where the suggestion starts (inclusive).
For example: '10-15'. They should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above. 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: improved code:
type: string type: string
description: |- description: |-
@ -90,7 +95,8 @@ Code suggestions:
Add a docstring to func1() Add a docstring to func1()
existing code: |- existing code: |-
def func1(): def func1():
relevant lines: '12-12' relevant lines start: 12
relevant lines end: 12
improved code: |- improved code: |-
... ...
``` ```

View File

@ -113,11 +113,8 @@ class PRCodeSuggestions:
if get_settings().config.verbosity_level >= 2: if get_settings().config.verbosity_level >= 2:
logging.info(f"suggestion: {d}") logging.info(f"suggestion: {d}")
relevant_file = d['relevant file'].strip() relevant_file = d['relevant file'].strip()
relevant_lines_str = d['relevant lines'].strip() relevant_lines_start = int(d['relevant lines start']) # absolute position
if ',' in relevant_lines_str: # handling 'relevant lines': '181, 190' or '178-184, 188-194' relevant_lines_end = int(d['relevant lines end'])
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])
content = d['suggestion content'] content = d['suggestion content']
new_code_snippet = d['improved code'] new_code_snippet = d['improved code']