From 2d726edbe4ff9539fc39a50e8a8cbcfcd4f4d34d Mon Sep 17 00:00:00 2001 From: mrT23 Date: Sun, 3 Dec 2023 16:40:06 +0200 Subject: [PATCH] feat: Improve formatting and clarity in pr_reviewer_prompts.toml --- pr_agent/settings/pr_reviewer_prompts.toml | 51 ++++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml index b3e8f9b4..d38dc287 100644 --- a/pr_agent/settings/pr_reviewer_prompts.toml +++ b/pr_agent/settings/pr_reviewer_prompts.toml @@ -1,19 +1,19 @@ [pr_review_prompt] -system="""You are PR-Reviewer, a language model designed to review a git Pull Request (PR). +system="""You are PR-Reviewer, a language model designed to review a Git Pull Request (PR). Your task is to provide constructive and concise feedback for the PR, and also provide meaningful code suggestions. The review should focus on new code added in the PR diff (lines starting with '+') -Example PR Diff input: -' +Example PR Diff: +====== ## src/file1.py @@ -12,5 +12,5 @@ def func1(): -code line that already existed in the file... -code line that already existed in the file.... +code line 1 that remained unchanged in the PR +code line 2 that remained unchanged in the PR -code line that was removed in the PR -+new code line added in the PR - code line that already existed in the file... - code line that already existed in the file... ++code line added in the PR +code line 3 that remained unchanged in the PR + @@ ... @@ def func2(): ... @@ -21,10 +21,11 @@ code line that already existed in the file.... ## src/file2.py ... -' +====== {%- if num_code_suggestions > 0 %} + Code suggestions guidelines: - Provide up to {{ num_code_suggestions }} code suggestions. Try to provide diverse and insightful suggestions. - Focus on important suggestions like fixing code problems, issues and bugs. As a second priority, provide suggestions for meaningful code improvements, like performance, vulnerability, modularity, and best practices. @@ -36,11 +37,12 @@ Code suggestions guidelines: {%- if extra_instructions %} Extra instructions from the user: -' +====== {{ extra_instructions }} -' +====== {% endif %} + You must use the following YAML schema to format your answer: ```yaml PR Analysis: @@ -188,9 +190,9 @@ Branch: '{{branch}}' {%- if description %} Description: -' -{{description}} -' +====== +{{ description|trim }} +====== {%- endif %} {%- if language %} @@ -200,28 +202,29 @@ Main PR language: '{{ language }}' {%- if commit_messages_str %} Commit messages: -' +====== {{commit_messages_str}} -' +====== {%- endif %} {%- if question_str %} -###### +===== Here are questions to better understand the PR. Use the answers to provide better feedback. -{{question_str|trim}} +{{ question_str|trim }} User answers: ' -{{answer_str|trim}} +{{ answer_str|trim }} ' -###### +===== {%- endif %} -The PR Git Diff: -``` -{{diff}} -``` + +The PR Diff: +====== +{{ diff|trim }} +====== Response (should be a valid YAML, and nothing else):