mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-15 02:00:39 +08:00
Add /generate_labels function + fix issues
This commit is contained in:
@ -37,23 +37,7 @@ extra_instructions = ""
|
||||
# markers
|
||||
use_description_markers=false
|
||||
include_generated_by_header=true
|
||||
|
||||
[custom_labels."Bug fix"]
|
||||
description = "Fixes a bug in the code"
|
||||
[custom_labels."Tests"]
|
||||
description = "Adds or modifies tests"
|
||||
[custom_labels."Bug fix with tests"]
|
||||
description = "Fixes a bug in the code and adds or modifies tests"
|
||||
[custom_labels."Refactoring"]
|
||||
description = "Refactors the code without changing its functionality"
|
||||
[custom_labels."Enhancement"]
|
||||
description = "Adds new features or functionality"
|
||||
[custom_labels."Documentation"]
|
||||
description = "Adds or modifies documentation"
|
||||
[custom_labels."SQL modifications"]
|
||||
description = "Adds or modifies SQL queries"
|
||||
[custom_labels."Other"]
|
||||
description = "Other changes that do not fit in any of the above categories"
|
||||
enable_custom_labels=true
|
||||
|
||||
#custom_labels = ['Bug fix', 'Tests', 'Bug fix with tests', 'Refactoring', 'Enhancement', 'Documentation', 'Other']
|
||||
|
||||
|
14
pr_agent/settings/custom_labels.toml
Normal file
14
pr_agent/settings/custom_labels.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[custom_labels."Bug fix"]
|
||||
description = "Fixes a bug in the code"
|
||||
[custom_labels."Tests"]
|
||||
description = "Adds or modifies tests"
|
||||
[custom_labels."Bug fix with tests"]
|
||||
description = "Fixes a bug in the code and adds or modifies tests"
|
||||
[custom_labels."Refactoring"]
|
||||
description = "Code refactoring without changing functionality"
|
||||
[custom_labels."Enhancement"]
|
||||
description = "Adds new features or functionality"
|
||||
[custom_labels."Documentation"]
|
||||
description = "Adds or modifies documentation"
|
||||
[custom_labels."Other"]
|
||||
description = "Other changes that do not fit in any of the above categories"
|
72
pr_agent/settings/pr_custom_labels.toml
Normal file
72
pr_agent/settings/pr_custom_labels.toml
Normal file
@ -0,0 +1,72 @@
|
||||
[pr_custom_labels_prompt]
|
||||
system="""You are CodiumAI-PR-Reviewer, a language model designed to review git pull requests.
|
||||
Your task is to label the type of the PR content.
|
||||
- Make sure not to focus the new PR code (the '+' lines).
|
||||
- If needed, each YAML output should be in block scalar format ('|-')
|
||||
{%- if extra_instructions %}
|
||||
|
||||
Extra instructions from the user:
|
||||
'
|
||||
{{ extra_instructions }}
|
||||
'
|
||||
{% endif %}
|
||||
|
||||
You must use the following YAML schema to format your answer:
|
||||
```yaml
|
||||
PR Type:
|
||||
type: array
|
||||
{%- if enable_custom_labels %}
|
||||
description: One or more labels that describe the PR type. Don't output the description in the parentheses.
|
||||
{%- endif %}
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
{%- if enable_custom_labels %}
|
||||
{{ custom_labels }}
|
||||
{%- else %}
|
||||
- Bug fix
|
||||
- Tests
|
||||
- Refactoring
|
||||
- Enhancement
|
||||
- Documentation
|
||||
- Other
|
||||
{%- endif %}
|
||||
|
||||
Example output:
|
||||
```yaml
|
||||
PR Labels:
|
||||
{%- if enable_custom_labels %}
|
||||
{{ custom_labels_examples }}
|
||||
{%- else %}
|
||||
- Bug fix
|
||||
- Tests
|
||||
{%- endif %}
|
||||
```
|
||||
|
||||
Make sure to output a valid YAML. Don't repeat the prompt in the answer, and avoid outputting the 'type' and 'description' fields.
|
||||
"""
|
||||
|
||||
user="""PR Info:
|
||||
Previous title: '{{title}}'
|
||||
Previous description: '{{description}}'
|
||||
Branch: '{{branch}}'
|
||||
{%- if language %}
|
||||
|
||||
Main language: {{language}}
|
||||
{%- endif %}
|
||||
{%- if commit_messages_str %}
|
||||
|
||||
Commit messages:
|
||||
{{commit_messages_str}}
|
||||
{%- endif %}
|
||||
|
||||
|
||||
The PR Git 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.
|
||||
|
||||
Response (should be a valid YAML, and nothing else):
|
||||
```yaml
|
||||
"""
|
@ -19,11 +19,22 @@ PR Title:
|
||||
description: an informative title for the PR, describing its main theme
|
||||
PR Type:
|
||||
type: array
|
||||
{%- if enable_custom_labels %}
|
||||
description: One or more labels that describe the PR type. Don't output the description in the parentheses.
|
||||
{%- endif %}
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
{%- if enable_custom_labels %}
|
||||
{{ custom_labels }}
|
||||
{%- else %}
|
||||
- Bug fix
|
||||
- Tests
|
||||
- Refactoring
|
||||
- Enhancement
|
||||
- Documentation
|
||||
- Other
|
||||
{%- endif %}
|
||||
PR Description:
|
||||
type: string
|
||||
description: an informative and concise description of the PR.
|
||||
@ -47,7 +58,11 @@ Example output:
|
||||
PR Title: |-
|
||||
...
|
||||
PR Type:
|
||||
{%- if enable_custom_labels %}
|
||||
{{ custom_labels_examples }}
|
||||
{%- else %}
|
||||
- Bug fix
|
||||
{%- endif %}
|
||||
PR Description: |-
|
||||
...
|
||||
PR Main Files Walkthrough:
|
||||
|
@ -51,8 +51,22 @@ PR Analysis:
|
||||
description: summary of the PR in 2-3 sentences.
|
||||
Type of PR:
|
||||
type: string
|
||||
{%- if enable_custom_labels %}
|
||||
description: One or more labels that describe the PR type. Don't output the description in the parentheses.
|
||||
{%- endif %}
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
{%- if enable_custom_labels %}
|
||||
{{ custom_labels }}
|
||||
{%- else %}
|
||||
- Bug fix
|
||||
- Tests
|
||||
- Refactoring
|
||||
- Enhancement
|
||||
- Documentation
|
||||
- Other
|
||||
{%- endif %}
|
||||
{%- if require_score %}
|
||||
Score:
|
||||
type: int
|
||||
|
Reference in New Issue
Block a user