mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 21:00:40 +08:00
Merge pull request #200 from Codium-ai/tr/block_scalar
Block scalar format
This commit is contained in:
@ -261,7 +261,7 @@ def update_settings_from_args(args: List[str]) -> List[str]:
|
|||||||
|
|
||||||
|
|
||||||
def load_yaml(review_text: str) -> dict:
|
def load_yaml(review_text: str) -> dict:
|
||||||
review_text = review_text.lstrip('```yaml').rstrip('`')
|
review_text = review_text.removeprefix('```yaml').rstrip('`')
|
||||||
try:
|
try:
|
||||||
data = yaml.load(review_text, Loader=yaml.SafeLoader)
|
data = yaml.load(review_text, Loader=yaml.SafeLoader)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -3,7 +3,8 @@ commands_text = "> **/review [-i]**: Request a review of your Pull Request. For
|
|||||||
"> **/describe**: Modify the PR title and description based on the contents of the PR.\n" \
|
"> **/describe**: Modify the PR title and description based on the contents of the PR.\n" \
|
||||||
"> **/improve**: Suggest improvements to the code in the PR. \n" \
|
"> **/improve**: Suggest improvements to the code in the PR. \n" \
|
||||||
"> **/ask \\<QUESTION\\>**: Pose a question about the PR.\n\n" \
|
"> **/ask \\<QUESTION\\>**: Pose a question about the PR.\n\n" \
|
||||||
">To edit any configuration parameter from 'configuration.toml', add --config_path=new_value\n" \
|
"> **/update_changelog**: Update the changelog based on the PR's contents.\n\n" \
|
||||||
|
">To edit any configuration parameter from **configuration.toml**, add --config_path=new_value\n" \
|
||||||
">For example: /review --pr_reviewer.extra_instructions=\"focus on the file: ...\" \n" \
|
">For example: /review --pr_reviewer.extra_instructions=\"focus on the file: ...\" \n" \
|
||||||
">To list the possible configuration parameters, use the **/config** command.\n" \
|
">To list the possible configuration parameters, use the **/config** command.\n" \
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ system="""You are CodiumAI-PR-Reviewer, a language model designed to review git
|
|||||||
Your task is to provide full description of the PR content.
|
Your task is to provide full description of the PR content.
|
||||||
- Make sure not to focus the new PR code (the '+' lines).
|
- Make sure not to focus the new PR code (the '+' lines).
|
||||||
- Notice that the 'Previous title', 'Previous description' and 'Commit messages' sections may be partial, simplistic, non-informative or not up-to-date. Hence, compare them to the PR diff code, and use them only as a reference.
|
- Notice that the 'Previous title', 'Previous description' and 'Commit messages' sections may be partial, simplistic, non-informative or not up-to-date. Hence, compare them to the PR diff code, and use them only as a reference.
|
||||||
|
- If needed, each YAML output should be in block scalar format ('|-')
|
||||||
{%- if extra_instructions %}
|
{%- if extra_instructions %}
|
||||||
|
|
||||||
Extra instructions from the user:
|
Extra instructions from the user:
|
||||||
@ -33,7 +33,7 @@ PR Description:
|
|||||||
PR Main Files Walkthrough:
|
PR Main Files Walkthrough:
|
||||||
type: array
|
type: array
|
||||||
maxItems: 10
|
maxItems: 10
|
||||||
description: >-
|
description: |-
|
||||||
a walkthrough of the PR changes. Review main files, and shortly describe the changes in each file (up to 10 most important files).
|
a walkthrough of the PR changes. Review main files, and shortly describe the changes in each file (up to 10 most important files).
|
||||||
items:
|
items:
|
||||||
filename:
|
filename:
|
||||||
@ -46,10 +46,12 @@ PR Main Files Walkthrough:
|
|||||||
|
|
||||||
Example output:
|
Example output:
|
||||||
```yaml
|
```yaml
|
||||||
PR Title: ...
|
PR Title: |-
|
||||||
|
...
|
||||||
PR Type:
|
PR Type:
|
||||||
- Bug fix
|
- Bug fix
|
||||||
PR Description: ...
|
PR Description: |-
|
||||||
|
...
|
||||||
PR Main Files Walkthrough:
|
PR Main Files Walkthrough:
|
||||||
- ...
|
- ...
|
||||||
- ...
|
- ...
|
||||||
|
@ -7,6 +7,7 @@ Your task is to provide constructive and concise feedback for the PR, and also p
|
|||||||
- Suggestions should focus on improving the new added code lines.
|
- Suggestions should focus on improving the new added code lines.
|
||||||
- Make sure not to provide suggestions repeating modifications already implemented in the new PR code (the '+' lines).
|
- Make sure not to provide suggestions repeating modifications already implemented in the new PR code (the '+' lines).
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
- If needed, each YAML output should be in block scalar format ('|-')
|
||||||
|
|
||||||
{%- if extra_instructions %}
|
{%- if extra_instructions %}
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ PR Feedback:
|
|||||||
description: the relevant file full path
|
description: the relevant file full path
|
||||||
suggestion:
|
suggestion:
|
||||||
type: string
|
type: string
|
||||||
description: >-
|
description: |
|
||||||
a concrete suggestion for meaningfully improving the new PR code. Also
|
a concrete suggestion for meaningfully improving the new PR code. Also
|
||||||
describe how, specifically, the suggestion can be applied to new PR
|
describe how, specifically, the suggestion can be applied to new PR
|
||||||
code. Add tags with importance measure that matches each suggestion
|
code. Add tags with importance measure that matches each suggestion
|
||||||
@ -86,10 +87,10 @@ PR Feedback:
|
|||||||
adding docstrings, renaming PR title and description, or linter like.
|
adding docstrings, renaming PR title and description, or linter like.
|
||||||
relevant line:
|
relevant line:
|
||||||
type: string
|
type: string
|
||||||
description: >-
|
description: |
|
||||||
a single code line taken from the relevant file, to which the
|
a single code line taken from the relevant file, to which the suggestion applies.
|
||||||
suggestion applies. The line should be a '+' line. Make sure to output
|
The line should be a '+' line.
|
||||||
the line exactly as it appears in the relevant file
|
Make sure to output the line exactly as it appears in the relevant file
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if require_security %}
|
{%- if require_security %}
|
||||||
Security concerns:
|
Security concerns:
|
||||||
|
@ -237,7 +237,7 @@ class PRReviewer:
|
|||||||
return
|
return
|
||||||
|
|
||||||
review_text = self.prediction.strip()
|
review_text = self.prediction.strip()
|
||||||
review_text = review_text.lstrip('```yaml').rstrip('`')
|
review_text = review_text.removeprefix('```yaml').rstrip('`')
|
||||||
try:
|
try:
|
||||||
data = yaml.load(review_text, Loader=SafeLoader)
|
data = yaml.load(review_text, Loader=SafeLoader)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Reference in New Issue
Block a user