mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-06 13:50:44 +08:00
update_settings_from_args
This commit is contained in:
@ -222,9 +222,15 @@ def update_settings_from_args(args):
|
|||||||
d = settings
|
d = settings
|
||||||
for i, v in enumerate(vals[:-1]):
|
for i, v in enumerate(vals[:-1]):
|
||||||
if i == len(vals) - 2:
|
if i == len(vals) - 2:
|
||||||
d[v] = vals[-1]
|
if v in d:
|
||||||
|
if type(d[v]) == bool:
|
||||||
|
d[v] = vals[-1].lower() in ("yes", "true", "t", "1")
|
||||||
|
else:
|
||||||
|
d[v] = type(d[v])(vals[-1])
|
||||||
logging.info(f'Updated setting {vals[:-1]} to: "{vals[-1]}"')
|
logging.info(f'Updated setting {vals[:-1]} to: "{vals[-1]}"')
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
logging.error(f'Invalid setting {vals[:-1]}')
|
||||||
else:
|
else:
|
||||||
d = d[v]
|
d = d[v]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -31,7 +31,7 @@ reflect - Ask the PR author questions about the PR.
|
|||||||
update_changelog - Update the changelog based on the PR's contents.
|
update_changelog - Update the changelog based on the PR's contents.
|
||||||
|
|
||||||
To edit any configuration parameter from 'configuration.toml', just add -config_path=<value>.
|
To edit any configuration parameter from 'configuration.toml', just add -config_path=<value>.
|
||||||
For example: '- cli.py --pr-url=... review --pr_reviewer.extra_instructions="focus on the file: ...'
|
For example: '- cli.py --pr-url=... review --pr_reviewer.extra_instructions="focus on the file: ..."'
|
||||||
""")
|
""")
|
||||||
parser.add_argument('--pr_url', type=str, help='The URL of the PR to review', required=True)
|
parser.add_argument('--pr_url', type=str, help='The URL of the PR to review', required=True)
|
||||||
parser.add_argument('command', type=str, help='The', choices=['review', 'review_pr',
|
parser.add_argument('command', type=str, help='The', choices=['review', 'review_pr',
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
commands_text = "> **/review [-i]**: Request a review of your Pull Request. For an incremental review, which only " \
|
commands_text = "> **/review [-i]**: Request a review of your Pull Request. For an incremental review, which only " \
|
||||||
"considers changes since the last review, include the '-i' option.\n" \
|
"considers changes since the last review, include the '-i' option.\n" \
|
||||||
"> **/describe**: Modify the PR title and description based on the contents of the PR.\n" \
|
"> **/describe**: Modify the PR title and description based on the contents of the PR.\n" \
|
||||||
"> **/improve**: Suggest improvements to the code in the PR. " \
|
"> **/improve**: Suggest improvements to the code in the PR. \n" \
|
||||||
"These will be provided as pull request comments, ready to commit.\n" \
|
|
||||||
"> **/ask \\<QUESTION\\>**: Pose a question about the PR.\n\n" \
|
"> **/ask \\<QUESTION\\>**: Pose a question about the PR.\n\n" \
|
||||||
"To edit any configuration parameter from 'configuration.toml', just add -config_path=<value>. " \
|
"To edit any configuration parameter from 'configuration.toml', just add -config_path=<value>. " \
|
||||||
"For example: '/review --pr_reviewer.extra_instructions=focus on the file: ...'" \
|
"For example: '/review --pr_reviewer.extra_instructions=\"focus on the file: ...\"'" \
|
||||||
|
|
||||||
|
|
||||||
def bot_help_text(user: str):
|
def bot_help_text(user: str):
|
||||||
|
@ -55,22 +55,6 @@ class PRDescription:
|
|||||||
self.patches_diff = None
|
self.patches_diff = None
|
||||||
self.prediction = None
|
self.prediction = None
|
||||||
|
|
||||||
def parse_args(self, args: List[str]) -> None:
|
|
||||||
"""
|
|
||||||
Parse the arguments passed to the PRDescription class and set the 'publish_description_as_comment' attribute accordingly.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
args: A list of arguments passed to the PRReviewer class.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
None
|
|
||||||
"""
|
|
||||||
self.publish_description_as_comment = settings.pr_description.publish_description_as_comment
|
|
||||||
if args and len(args) >= 1:
|
|
||||||
arg = args[0]
|
|
||||||
if arg == "-c":
|
|
||||||
self.publish_description_as_comment = True
|
|
||||||
|
|
||||||
async def describe(self):
|
async def describe(self):
|
||||||
"""
|
"""
|
||||||
Generates a PR description using an AI model and publishes it to the PR.
|
Generates a PR description using an AI model and publishes it to the PR.
|
||||||
@ -86,7 +70,7 @@ class PRDescription:
|
|||||||
|
|
||||||
if settings.config.publish_output:
|
if settings.config.publish_output:
|
||||||
logging.info('Pushing answer...')
|
logging.info('Pushing answer...')
|
||||||
if self.publish_description_as_comment:
|
if settings.pr_description.publish_description_as_comment:
|
||||||
self.git_provider.publish_comment(markdown_text)
|
self.git_provider.publish_comment(markdown_text)
|
||||||
else:
|
else:
|
||||||
self.git_provider.publish_description(pr_title, pr_body)
|
self.git_provider.publish_description(pr_title, pr_body)
|
||||||
|
Reference in New Issue
Block a user