mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 13:20:39 +08:00
fix: ensure proper formatting of changes_diagram in PR description output
This commit is contained in:
@ -46,12 +46,12 @@ class PRDescription(BaseModel):
|
|||||||
type: List[PRType] = Field(description="one or more types that describe the PR content. Return the label member value (e.g. 'Bug fix', not 'bug_fix')")
|
type: List[PRType] = Field(description="one or more types that describe the PR content. Return the label member value (e.g. 'Bug fix', not 'bug_fix')")
|
||||||
description: str = Field(description="summarize the PR changes in up to four bullet points, each up to 8 words. For large PRs, add sub-bullets if needed. Order bullets by importance, with each bullet highlighting a key change group.")
|
description: str = Field(description="summarize the PR changes in up to four bullet points, each up to 8 words. For large PRs, add sub-bullets if needed. Order bullets by importance, with each bullet highlighting a key change group.")
|
||||||
title: str = Field(description="a concise and descriptive title that captures the PR's main theme")
|
title: str = Field(description="a concise and descriptive title that captures the PR's main theme")
|
||||||
{%- 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.")
|
|
||||||
{%- endif %}
|
|
||||||
{%- if enable_pr_diagram %}
|
{%- 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.")
|
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 %}
|
{%- endif %}
|
||||||
|
{%- 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.")
|
||||||
|
{%- endif %}
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
|
||||||
@ -65,6 +65,12 @@ description: |
|
|||||||
...
|
...
|
||||||
title: |
|
title: |
|
||||||
...
|
...
|
||||||
|
{%- if enable_pr_diagram %}
|
||||||
|
changes_diagram: |
|
||||||
|
```mermaid
|
||||||
|
...
|
||||||
|
```
|
||||||
|
{%- endif %}
|
||||||
{%- if enable_semantic_files_types %}
|
{%- if enable_semantic_files_types %}
|
||||||
pr_files:
|
pr_files:
|
||||||
- filename: |
|
- filename: |
|
||||||
@ -79,12 +85,6 @@ 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 ('|')
|
||||||
@ -152,6 +152,12 @@ description: |
|
|||||||
...
|
...
|
||||||
title: |
|
title: |
|
||||||
...
|
...
|
||||||
|
{%- if enable_pr_diagram %}
|
||||||
|
changes_diagram: |
|
||||||
|
```mermaid
|
||||||
|
...
|
||||||
|
```
|
||||||
|
{%- endif %}
|
||||||
{%- if enable_semantic_files_types %}
|
{%- if enable_semantic_files_types %}
|
||||||
pr_files:
|
pr_files:
|
||||||
- filename: |
|
- filename: |
|
||||||
@ -166,12 +172,6 @@ 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 %}
|
||||||
|
@ -458,9 +458,11 @@ class PRDescription:
|
|||||||
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:
|
if 'changes_diagram' in self.data:
|
||||||
changes_diagram = self.data.pop('changes_diagram')
|
changes_diagram = self.data.pop('changes_diagram').strip()
|
||||||
if changes_diagram.strip():
|
if changes_diagram.startswith('```'):
|
||||||
self.data['changes_diagram'] = changes_diagram
|
if not changes_diagram.endswith('```'): # fallback for missing closing
|
||||||
|
changes_diagram += '\n```'
|
||||||
|
self.data['changes_diagram'] = '\n'+ 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