Skip to content

Commit

Permalink
fix: skip the draft pr task and set fixed replies for specific issues (
Browse files Browse the repository at this point in the history
…#605)

* chore: set fixed replies for specific issues

* fix: skip the draft pr task
  • Loading branch information
xingwanying authored Dec 23, 2024
1 parent 6b31767 commit 1ffe83c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions server/agent/prompts/issue_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
- Propose a code modification:
- Locate the relevant file.
- Retrieve its content and generate a *diff* showing the proposed changes.
- Inform users if their request is a new feature and ask them to wait.
- If the issue is a feature request, inform the user that the request has been noted and will be considered.
- Respect the language of the issue's title and content. Ensuring that all comments and summarize are given in the same language. e.g., English or Chinese.
- Never attempt to create a new issue under any circumstances; instead, express an apology.
- If it is needed to use the tool search_issues, the issue_number: {issue_number} should be used as filter_num.
- If you don’t have any useful conclusions, use your own knowledge to assist the user as much as possible, but do not fabricate facts.
- Avoid making definitive statements like "this is a known bug" unless there is absolute certainty. Such irresponsible assumptions can be misleading.
- If the issue involves market approval or website deployment applications, inform the user that their application will be reviewed by the team and ask them to wait patiently.
- At the end of the conversation, be sure to include the following wording and adhere to the language used in previous conversations:
<details>
<summary>🪧 Tips</summary>
Expand All @@ -20,6 +21,7 @@
repo_name: {repo_name}
issue_url: {issue_url}
issue_number: {issue_number}
issue_title: {issue_title}
issue_content: {issue_content}
"""
Expand All @@ -44,13 +46,18 @@


def generate_issue_prompt(
repo_name: str, issue_url: str, issue_number: str, issue_content: str
repo_name: str,
issue_url: str,
issue_number: str,
issue_title: str,
issue_content: str,
):
return ISSUE_PROMPT.format(
repo_name=repo_name,
issue_url=issue_url,
issue_number=issue_number,
issue_content=issue_content,
issue_title=issue_title,
)


Expand Down
7 changes: 6 additions & 1 deletion server/agent/prompts/pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
pull_number: {pull_number}
title: {title}
description: {description}
draft: {draft}
```
## Task 1: Summarize the Pull Request
Expand Down Expand Up @@ -58,6 +59,7 @@
# Skip Task Whitelist
**SKIP_KEYWORDS**: A list of keywords. If any of these keywords are present in the PR title or description, the corresponding task will be skipped.
- Examples: "skip", "ignore", "wip", "merge", "[skip ci]"
- If the draft flag is set to true, the task should be skipped.
# Constraints
- Strictly avoid commenting on minor style inconsistencies, formatting issues, or changes that do not impact functionality.
Expand Down Expand Up @@ -119,12 +121,15 @@
"""


def get_role_prompt(repo_name: str, pull_number: int, title: str, description: str):
def get_role_prompt(
repo_name: str, pull_number: int, title: str, description: str, draft: bool
):
return PULL_REQUEST_ROLE.format(
repo_name=repo_name,
pull_number=pull_number,
title=title,
description=description,
draft=draft,
)


Expand Down
1 change: 1 addition & 0 deletions server/event_handler/discussion.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ async def handle_discussion_event(self, action: str):
repo_name=repo_name,
issue_url=discussion["html_url"],
issue_number=discussion["number"],
issue_title=title,
issue_content=discussion["body"],
)

Expand Down
1 change: 1 addition & 0 deletions server/event_handler/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async def execute(self):
repo_name=repo.full_name,
issue_url=issue.url,
issue_number=issue.number,
issue_title=issue.title,
issue_content=issue.body,
)
issue_content = f"{issue.title}: {issue.body}"
Expand Down
2 changes: 1 addition & 1 deletion server/event_handler/pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async def execute(self):

file_diff = self.get_file_diff(diff)
role_prompt = get_role_prompt(
repo.full_name, pr.number, pr.title, pr.body
repo.full_name, pr.number, pr.title, pr.body, pr.draft
)

pr_content = f"""
Expand Down

0 comments on commit 1ffe83c

Please sign in to comment.