mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 04:40:38 +08:00
Compare commits
2 Commits
v0.30
...
tr/main_lo
Author | SHA1 | Date | |
---|---|---|---|
6e7cf35761 | |||
7273c9c0c1 |
@ -104,6 +104,7 @@ enable_pr_type=true
|
|||||||
final_update_message = true
|
final_update_message = true
|
||||||
enable_help_text=false
|
enable_help_text=false
|
||||||
enable_help_comment=true
|
enable_help_comment=true
|
||||||
|
enable_pr_diagram=false # adds a section with a diagram of the PR changes
|
||||||
# describe as comment
|
# describe as comment
|
||||||
publish_description_as_comment=false
|
publish_description_as_comment=false
|
||||||
publish_description_as_comment_persistent=true
|
publish_description_as_comment_persistent=true
|
||||||
|
@ -49,6 +49,9 @@ class PRDescription(BaseModel):
|
|||||||
{%- if enable_semantic_files_types %}
|
{%- if enable_semantic_files_types %}
|
||||||
pr_files: List[FileDescription] = Field(max_items=20, description="a list of all the files that were changed in the PR, and summary of their changes. Each file must be analyzed regardless of change size.")
|
pr_files: List[FileDescription] = Field(max_items=20, description="a list of all the files that were changed in the PR, and summary of their changes. Each file must be analyzed regardless of change size.")
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if enable_pr_diagram %}
|
||||||
|
changes_diagram: str = Field(description="a horizontal diagram that represents the main PR changes, in the format of a mermaid flowchart. The diagram should be concise and easy to read. Leave empty if no diagram is relevant.")
|
||||||
|
{%- endif %}
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
|
||||||
@ -76,6 +79,12 @@ pr_files:
|
|||||||
label_key_1
|
label_key_1
|
||||||
...
|
...
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if enable_pr_diagram %}
|
||||||
|
changes_diagram: |
|
||||||
|
```mermaid
|
||||||
|
...
|
||||||
|
```
|
||||||
|
{%- endif %}
|
||||||
```
|
```
|
||||||
|
|
||||||
Answer should be a valid YAML, and nothing else. Each YAML output MUST be after a newline, with proper indent, and block scalar indicator ('|')
|
Answer should be a valid YAML, and nothing else. Each YAML output MUST be after a newline, with proper indent, and block scalar indicator ('|')
|
||||||
@ -157,6 +166,12 @@ pr_files:
|
|||||||
label_key_1
|
label_key_1
|
||||||
...
|
...
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if enable_pr_diagram %}
|
||||||
|
changes_diagram: |
|
||||||
|
```mermaid
|
||||||
|
...
|
||||||
|
```
|
||||||
|
{%- endif %}
|
||||||
```
|
```
|
||||||
(replace '...' with the actual values)
|
(replace '...' with the actual values)
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -73,6 +73,7 @@ class PRDescription:
|
|||||||
"related_tickets": "",
|
"related_tickets": "",
|
||||||
"include_file_summary_changes": len(self.git_provider.get_diff_files()) <= self.COLLAPSIBLE_FILE_LIST_THRESHOLD,
|
"include_file_summary_changes": len(self.git_provider.get_diff_files()) <= self.COLLAPSIBLE_FILE_LIST_THRESHOLD,
|
||||||
'duplicate_prompt_examples': get_settings().config.get('duplicate_prompt_examples', False),
|
'duplicate_prompt_examples': get_settings().config.get('duplicate_prompt_examples', False),
|
||||||
|
'enable_pr_diagram': get_settings().pr_description.get('enable_pr_diagram', False),
|
||||||
}
|
}
|
||||||
|
|
||||||
self.user_description = self.git_provider.get_user_description()
|
self.user_description = self.git_provider.get_user_description()
|
||||||
@ -257,6 +258,7 @@ class PRDescription:
|
|||||||
tasks.append(task)
|
tasks.append(task)
|
||||||
# Wait for all tasks to complete
|
# Wait for all tasks to complete
|
||||||
results = await asyncio.gather(*tasks)
|
results = await asyncio.gather(*tasks)
|
||||||
|
|
||||||
file_description_str_list = []
|
file_description_str_list = []
|
||||||
for i, result in enumerate(results):
|
for i, result in enumerate(results):
|
||||||
prediction_files = result.strip().removeprefix('```yaml').strip('`').strip()
|
prediction_files = result.strip().removeprefix('```yaml').strip('`').strip()
|
||||||
@ -456,6 +458,10 @@ class PRDescription:
|
|||||||
self.data['labels'] = self.data.pop('labels')
|
self.data['labels'] = self.data.pop('labels')
|
||||||
if 'description' in self.data:
|
if 'description' in self.data:
|
||||||
self.data['description'] = self.data.pop('description')
|
self.data['description'] = self.data.pop('description')
|
||||||
|
if 'changes_diagram' in self.data:
|
||||||
|
changes_diagram = self.data.pop('changes_diagram')
|
||||||
|
if changes_diagram.strip():
|
||||||
|
self.data['changes_diagram'] = changes_diagram
|
||||||
if 'pr_files' in self.data:
|
if 'pr_files' in self.data:
|
||||||
self.data['pr_files'] = self.data.pop('pr_files')
|
self.data['pr_files'] = self.data.pop('pr_files')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user