feat: Enhance readability in toml files and add verbosity level logging in pr_generate_labels.py

This commit is contained in:
mrT23
2023-11-26 08:42:04 +02:00
parent 9465b7b577
commit 8db2e3b2a0
4 changed files with 20 additions and 6 deletions

View File

@ -1,5 +1,5 @@
[pr_custom_labels_prompt] [pr_custom_labels_prompt]
system="""You are CodiumAI-PR-Reviewer, a language model designed to review git Pull Requests (PR). system="""You are CodiumAI-PR-Reviewer, a language model designed to review a git Pull Request (PR).
Your task is to provide labels that describe the PR content. Your task is to provide labels that describe the PR content.
{%- if enable_custom_labels %} {%- if enable_custom_labels %}
Thoroughly read the labels name and the provided description, and decide whether the label is relevant to the PR. Thoroughly read the labels name and the provided description, and decide whether the label is relevant to the PR.
@ -46,9 +46,13 @@ Answer should be a valid YAML, and nothing else.
""" """
user="""PR Info: user="""PR Info:
Previous title: '{{title}}' Previous title: '{{title}}'
Previous description: '{{description}}'
Branch: '{{branch}}' Branch: '{{ branch }}'
Description: '{{ description }}'
{%- if language %} {%- if language %}
Main PR language: '{{ language }}' Main PR language: '{{ language }}'

View File

@ -1,6 +1,6 @@
[pr_description_prompt] [pr_description_prompt]
system="""You are CodiumAI-PR-Reviewer, a language model designed to review git pull requests. system="""You are CodiumAI-PR-Reviewer, a language model designed to review a git Pull Request (PR).
Your task is to provide full description of a Pull Request (PR) content. Your task is to provide full description of a Pr content.
- Make sure to focus on the new PR code (the '+' lines). - Make sure to focus on the new PR code (the '+' lines).
- Keep in mind that the 'Previous title', 'Previous description' and 'Commit messages' sections may be partial, simplistic, non-informative or out of date. Hence, compare them to the PR diff code, and use them only as a reference. - Keep in mind that the 'Previous title', 'Previous description' and 'Commit messages' sections may be partial, simplistic, non-informative or out of date. Hence, compare them to the PR diff code, and use them only as a reference.
- Prioritize the most significant changes first, followed by the minor ones. - Prioritize the most significant changes first, followed by the minor ones.
@ -71,7 +71,10 @@ user="""PR Info:
Previous title: '{{title}}' Previous title: '{{title}}'
Previous description: '{{description}}' {%- if description %}
Previous description: '{{ description }}'
{%- endif %}
Branch: '{{branch}}' Branch: '{{branch}}'
{%- if language %} {%- if language %}
@ -91,6 +94,8 @@ The PR Git Diff:
``` ```
{{diff}} {{diff}}
``` ```
Note that lines in the diff body are prefixed with a symbol that represents the type of change: '-' for deletions, '+' for additions, and ' ' (a space) for unchanged lines. Note that lines in the diff body are prefixed with a symbol that represents the type of change: '-' for deletions, '+' for additions, and ' ' (a space) for unchanged lines.
Response (should be a valid YAML, and nothing else): Response (should be a valid YAML, and nothing else):

View File

@ -215,6 +215,8 @@ The PR Git Diff:
``` ```
{{diff}} {{diff}}
``` ```
Note that lines in the diff body are prefixed with a symbol that represents the type of change: '-' for deletions, '+' for additions. Focus on the '+' lines. Note that lines in the diff body are prefixed with a symbol that represents the type of change: '-' for deletions, '+' for additions. Focus on the '+' lines.
Response (should be a valid YAML, and nothing else): Response (should be a valid YAML, and nothing else):

View File

@ -147,6 +147,9 @@ class PRGenerateLabels:
user=user_prompt user=user_prompt
) )
if get_settings().config.verbosity_level >= 2:
get_logger().info(f"\nAI response:\n{response}")
return response return response
def _prepare_data(self): def _prepare_data(self):