diff --git a/docs/docs/tools/describe.md b/docs/docs/tools/describe.md index 25b3c6fc..d8d074a6 100644 --- a/docs/docs/tools/describe.md +++ b/docs/docs/tools/describe.md @@ -59,17 +59,23 @@ Everything below this marker is treated as previously auto-generated content and ### Sequence Diagram Support When the `enable_pr_diagram` option is enabled in your configuration, the `/describe` tool will include a `Mermaid` sequence diagram in the PR description. -This diagram represents interactions between components/functions based on the diff content. +This diagram represents interactions between components/functions based on the PR content. -### How to enable +[//]: # (### How to enable\disable) -In your configuration: +[//]: # () +[//]: # (In your configuration:) -``` -toml -[pr_description] -enable_pr_diagram = true -``` +[//]: # () +[//]: # (```) + +[//]: # (toml) + +[//]: # ([pr_description]) + +[//]: # (enable_pr_diagram = true) + +[//]: # (```) ## Configuration options @@ -126,7 +132,7 @@ enable_pr_diagram = true enable_pr_diagram - If set to true, the tool will generate a horizontal Mermaid flowchart summarizing the main pull request changes. This field remains empty if not applicable. Default is false. + If set to true, the tool will generate a horizontal Mermaid flowchart summarizing the main pull request changes. This field remains empty if not applicable. Default is true. diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index f028c9f0..e3648fcc 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -106,7 +106,7 @@ enable_pr_type=true final_update_message = true enable_help_text=false enable_help_comment=true -enable_pr_diagram=false # adds a section with a diagram of the PR changes +enable_pr_diagram=true # adds a section with a diagram of the PR changes # describe as comment publish_description_as_comment=false publish_description_as_comment_persistent=true diff --git a/pr_agent/settings/pr_description_prompts.toml b/pr_agent/settings/pr_description_prompts.toml index 126fe771..d8954052 100644 --- a/pr_agent/settings/pr_description_prompts.toml +++ b/pr_agent/settings/pr_description_prompts.toml @@ -48,7 +48,7 @@ class PRDescription(BaseModel): 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") {%- if enable_pr_diagram %} - changes_diagram: str = Field(description="a horizontal diagram that represents the main PR changes, in the format of a valid mermaid LR flowchart. The diagram should be concise and easy to read. Leave empty if no diagram is relevant. To create robust Mermaid diagrams, follow this two-step process: (1) Declare the nodes: nodeID["node description"]. (2) Then define the links: nodeID1 -- "link text" --> nodeID2 ") + changes_diagram: str = Field(description="a horizontal diagram that represents the main PR changes, in the format of a valid mermaid LR flowchart. The diagram should be concise and easy to read. Leave empty if no diagram is relevant. To create robust Mermaid diagrams, follow this two-step process: (1) Declare the nodes: nodeID["node description"]. (2) Then define the links: nodeID1 -- "link text" --> nodeID2. Node description must always be surrounded with quotation marks.") {%- 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.") diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 663c5a2d..c4595140 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -59,6 +59,7 @@ class PRDescription: # Initialize the variables dictionary self.COLLAPSIBLE_FILE_LIST_THRESHOLD = get_settings().pr_description.get("collapsible_file_list_threshold", 8) + enable_pr_diagram = get_settings().pr_description.get("enable_pr_diagram", False) and self.git_provider.is_supported("gfm_markdown") # github and gitlab support gfm_markdown self.vars = { "title": self.git_provider.pr.title, "branch": self.git_provider.get_pr_branch(), @@ -73,7 +74,7 @@ class PRDescription: "related_tickets": "", "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), - "enable_pr_diagram": get_settings().pr_description.get("enable_pr_diagram", False), + "enable_pr_diagram": enable_pr_diagram, } self.user_description = self.git_provider.get_user_description()