From 1b0b90e51d5d875c63bb0b99a7dcb067758b6cce Mon Sep 17 00:00:00 2001 From: mrT23 Date: Wed, 9 Aug 2023 14:11:58 +0300 Subject: [PATCH 1/5] block scalar --- pr_agent/settings/pr_reviewer_prompts.toml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml index e649bf2d..8f7f03b3 100644 --- a/pr_agent/settings/pr_reviewer_prompts.toml +++ b/pr_agent/settings/pr_reviewer_prompts.toml @@ -78,18 +78,20 @@ PR Feedback: description: the relevant file full path suggestion: type: string - description: >- + description: | a concrete suggestion for meaningfully improving the new PR code. Also describe how, specifically, the suggestion can be applied to new PR code. Add tags with importance measure that matches each suggestion ('important' or 'medium'). Do not make suggestions for updating or adding docstrings, renaming PR title and description, or linter like. + YAML output should be in block scalar format ('|') relevant line: type: string - description: >- - a single code line taken from the relevant file, to which the - suggestion applies. The line should be a '+' line. Make sure to output - the line exactly as it appears in the relevant file + description: | + a single code line taken from the relevant file, to which the suggestion applies. + The line should be a '+' line. + Make sure to output the line exactly as it appears in the relevant file + YAML output should be in block scalar format ('|') {%- endif %} {%- if require_security %} Security concerns: From 273a9e35d994d79878a4c808f9d6d59749860111 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 11 Aug 2023 18:35:34 +0300 Subject: [PATCH 2/5] block scalar --- pr_agent/algo/utils.py | 2 +- pr_agent/settings/pr_description_prompts.toml | 10 ++++++---- pr_agent/tools/pr_reviewer.py | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index 595ac6a9..725d75ec 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -261,7 +261,7 @@ def update_settings_from_args(args: List[str]) -> List[str]: def load_yaml(review_text: str) -> dict: - review_text = review_text.lstrip('```yaml').rstrip('`') + review_text = review_text.removeprefix('```yaml').rstrip('`') try: data = yaml.load(review_text, Loader=yaml.SafeLoader) except Exception as e: diff --git a/pr_agent/settings/pr_description_prompts.toml b/pr_agent/settings/pr_description_prompts.toml index 1fab0bdc..e9d4cbe7 100644 --- a/pr_agent/settings/pr_description_prompts.toml +++ b/pr_agent/settings/pr_description_prompts.toml @@ -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. - 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. - +- YAML output should be in block scalar format ('|') {%- if extra_instructions %} Extra instructions from the user: @@ -33,7 +33,7 @@ PR Description: PR Main Files Walkthrough: type: array 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). items: filename: @@ -46,10 +46,12 @@ PR Main Files Walkthrough: Example output: ```yaml -PR Title: ... +PR Title: |- + ... PR Type: - Bug fix -PR Description: ... +PR Description: |- + ... PR Main Files Walkthrough: - ... - ... diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index afbc3bae..7fdf6429 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -237,7 +237,7 @@ class PRReviewer: return review_text = self.prediction.strip() - review_text = review_text.lstrip('```yaml').rstrip('`') + review_text = review_text.removeprefix('```yaml').rstrip('`') try: data = yaml.load(review_text, Loader=SafeLoader) except Exception as e: From abb754b16bd699b296267cea1fda079be9dedb3a Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 11 Aug 2023 18:37:55 +0300 Subject: [PATCH 3/5] block scalar --- pr_agent/settings/pr_reviewer_prompts.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml index 8f7f03b3..13485931 100644 --- a/pr_agent/settings/pr_reviewer_prompts.toml +++ b/pr_agent/settings/pr_reviewer_prompts.toml @@ -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. - Make sure not to provide suggestions repeating modifications already implemented in the new PR code (the '+' lines). {%- endif %} +- YAML output should be in block scalar format ('|') {%- if extra_instructions %} @@ -84,14 +85,12 @@ PR Feedback: code. Add tags with importance measure that matches each suggestion ('important' or 'medium'). Do not make suggestions for updating or adding docstrings, renaming PR title and description, or linter like. - YAML output should be in block scalar format ('|') relevant line: type: string description: | a single code line taken from the relevant file, to which the suggestion applies. The line should be a '+' line. Make sure to output the line exactly as it appears in the relevant file - YAML output should be in block scalar format ('|') {%- endif %} {%- if require_security %} Security concerns: From dd87df49f5fc46f96ff678148f1eee3d44b5dcf3 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 11 Aug 2023 18:43:46 +0300 Subject: [PATCH 4/5] block scalar --- pr_agent/settings/pr_description_prompts.toml | 2 +- pr_agent/settings/pr_reviewer_prompts.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pr_agent/settings/pr_description_prompts.toml b/pr_agent/settings/pr_description_prompts.toml index e9d4cbe7..43dd8e3b 100644 --- a/pr_agent/settings/pr_description_prompts.toml +++ b/pr_agent/settings/pr_description_prompts.toml @@ -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. - 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. -- YAML output should be in block scalar format ('|') +- If needed, each YAML output should be in block scalar format ('|-') {%- if extra_instructions %} Extra instructions from the user: diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml index 13485931..cdf7f731 100644 --- a/pr_agent/settings/pr_reviewer_prompts.toml +++ b/pr_agent/settings/pr_reviewer_prompts.toml @@ -7,7 +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. - Make sure not to provide suggestions repeating modifications already implemented in the new PR code (the '+' lines). {%- endif %} -- YAML output should be in block scalar format ('|') +- If needed, each YAML output should be in block scalar format ('|-') {%- if extra_instructions %} From d3a5aea89e3dc7fa841f67b5ae1b25860c799f33 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Fri, 11 Aug 2023 18:50:56 +0300 Subject: [PATCH 5/5] update_changelog --- pr_agent/servers/help.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pr_agent/servers/help.py b/pr_agent/servers/help.py index 838645f5..1c8e1c3f 100644 --- a/pr_agent/servers/help.py +++ b/pr_agent/servers/help.py @@ -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" \ "> **/improve**: Suggest improvements to the code in the PR. \n" \ "> **/ask \\**: 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" \ ">To list the possible configuration parameters, use the **/config** command.\n" \