mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 04:40:38 +08:00
Bug fixes
This commit is contained in:
@ -31,6 +31,7 @@ class PRAgent:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
async def handle_request(self, pr_url, request) -> bool:
|
async def handle_request(self, pr_url, request) -> bool:
|
||||||
|
request = request.replace("'", "\\'")
|
||||||
lexer = shlex.shlex(request, posix=True)
|
lexer = shlex.shlex(request, posix=True)
|
||||||
lexer.whitespace_split = True
|
lexer.whitespace_split = True
|
||||||
action, *args = list(lexer)
|
action, *args = list(lexer)
|
||||||
|
@ -65,6 +65,8 @@ async def handle_request(body: Dict[str, Any]):
|
|||||||
body: The request body.
|
body: The request body.
|
||||||
"""
|
"""
|
||||||
action = body.get("action")
|
action = body.get("action")
|
||||||
|
if not action:
|
||||||
|
return {}
|
||||||
agent = PRAgent()
|
agent = PRAgent()
|
||||||
|
|
||||||
if action == 'created':
|
if action == 'created':
|
||||||
@ -80,7 +82,7 @@ async def handle_request(body: Dict[str, Any]):
|
|||||||
api_url = pull_request.get("url")
|
api_url = pull_request.get("url")
|
||||||
await agent.handle_request(api_url, comment_body)
|
await agent.handle_request(api_url, comment_body)
|
||||||
|
|
||||||
elif action in ["opened"] or 'reopened' in action:
|
elif action == "opened" or 'reopened' in action:
|
||||||
pull_request = body.get("pull_request")
|
pull_request = body.get("pull_request")
|
||||||
if not pull_request:
|
if not pull_request:
|
||||||
return {}
|
return {}
|
||||||
|
@ -32,7 +32,7 @@ class PRInformationFromUser:
|
|||||||
self.patches_diff = None
|
self.patches_diff = None
|
||||||
self.prediction = None
|
self.prediction = None
|
||||||
|
|
||||||
async def generate_questions(self):
|
async def run(self):
|
||||||
logging.info('Generating question to the user...')
|
logging.info('Generating question to the user...')
|
||||||
if get_settings().config.publish_output:
|
if get_settings().config.publish_output:
|
||||||
self.git_provider.publish_comment("Preparing questions...", is_temporary=True)
|
self.git_provider.publish_comment("Preparing questions...", is_temporary=True)
|
||||||
|
@ -194,7 +194,7 @@ class PRReviewer:
|
|||||||
user = self.git_provider.get_user_id()
|
user = self.git_provider.get_user_id()
|
||||||
|
|
||||||
# Add help text if not in CLI mode
|
# Add help text if not in CLI mode
|
||||||
if get_settings().get("CONFIG.CLI_MODE", False):
|
if not get_settings().get("CONFIG.CLI_MODE", False):
|
||||||
markdown_text += "\n### How to use\n"
|
markdown_text += "\n### How to use\n"
|
||||||
if user and '[bot]' not in user:
|
if user and '[bot]' not in user:
|
||||||
markdown_text += bot_help_text(user)
|
markdown_text += bot_help_text(user)
|
||||||
|
Reference in New Issue
Block a user