-
Notifications
You must be signed in to change notification settings - Fork 946
Fix multiple input issue and more_params for web-ui #5739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @slin000111, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request addresses critical argument parsing issues within the web UI components, specifically for handling multiple inputs and additional parameters. The changes ensure that command-line arguments are correctly formatted and passed to underlying processes, resolving functional errors related to data input and custom parameter usage.
Highlights
- Corrected Argument Parsing for List Inputs: Modified the command construction logic across several UI modules to correctly handle list-type arguments, ensuring each item in a list is passed as a separate argument rather than a single space-separated string.
- Resolved more_params Parsing Error: Fixed an issue where the more_params command-line argument was not being parsed correctly, specifically addressing the problem reported in #issue 5551 by ensuring additional parameters are split and extended as individual arguments.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly fixes an issue with handling multiple input arguments and parsing more_params in the web UI command generation logic. The changes ensure that list-like arguments are passed as separate command-line arguments, which is the expected behavior. My review includes several suggestions to simplify the code by removing redundant list comprehensions. These changes will improve code conciseness and readability across the modified files.
swift/ui/llm_eval/llm_eval.py
Outdated
| if isinstance(kwargs[e], list): | ||
| params += f'--{e} {cls.quote}{sep.join(kwargs[e])}{cls.quote} ' | ||
| command.extend([f'--{e}', f'{" ".join(kwargs[e])}']) | ||
| command.extend([f'--{e}'] + [arg for arg in kwargs[e]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swift/ui/llm_eval/llm_eval.py
Outdated
| more_params_cmd = [param.split(' ') for param in more_params_cmd if param] | ||
| for param in more_params_cmd: | ||
| command.extend([f'--{param[0]}', ' '.join(param[1:])]) | ||
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list comprehension [arg for arg in param[1:]] is redundant as it just creates a copy of the list slice param[1:]. You can use the slice directly to make the code more concise.
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) | |
| command.extend([f'--{param[0]}'] + param[1:]) |
swift/ui/llm_export/llm_export.py
Outdated
| if isinstance(kwargs[e], list): | ||
| params += f'--{e} {cls.quote}{sep.join(kwargs[e])}{cls.quote} ' | ||
| command.extend([f'--{e}', f'{" ".join(kwargs[e])}']) | ||
| command.extend([f'--{e}'] + [arg for arg in kwargs[e]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swift/ui/llm_export/llm_export.py
Outdated
| more_params_cmd = [param.split(' ') for param in more_params_cmd if param] | ||
| for param in more_params_cmd: | ||
| command.extend([f'--{param[0]}', ' '.join(param[1:])]) | ||
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list comprehension [arg for arg in param[1:]] is redundant as it just creates a copy of the list slice param[1:]. You can use the slice directly to make the code more concise.
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) | |
| command.extend([f'--{param[0]}'] + param[1:]) |
| if isinstance(kwargs[e], list): | ||
| params += f'--{e} {cls.quote}{sep.join(kwargs[e])}{cls.quote} ' | ||
| command.extend([f'--{e}', f'{" ".join(kwargs[e])}']) | ||
| command.extend([f'--{e}'] + [arg for arg in kwargs[e]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swift/ui/llm_infer/llm_infer.py
Outdated
| more_params_cmd = [param.split(' ') for param in more_params_cmd if param] | ||
| for param in more_params_cmd: | ||
| command.extend([f'--{param[0]}', ' '.join(param[1:])]) | ||
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list comprehension [arg for arg in param[1:]] is redundant as it just creates a copy of the list slice param[1:]. You can use the slice directly to make the code more concise.
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) | |
| command.extend([f'--{param[0]}'] + param[1:]) |
swift/ui/llm_sample/llm_sample.py
Outdated
| if isinstance(kwargs[e], list): | ||
| params += f'--{e} {cls.quote}{sep.join(kwargs[e])}{cls.quote} ' | ||
| command.extend([f'--{e}', f'{" ".join(kwargs[e])}']) | ||
| command.extend([f'--{e}'] + [arg for arg in kwargs[e]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swift/ui/llm_sample/llm_sample.py
Outdated
| more_params_cmd = [param.split(' ') for param in more_params_cmd if param] | ||
| for param in more_params_cmd: | ||
| command.extend([f'--{param[0]}', ' '.join(param[1:])]) | ||
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list comprehension [arg for arg in param[1:]] is redundant as it just creates a copy of the list slice param[1:]. You can use the slice directly to make the code more concise.
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) | |
| command.extend([f'--{param[0]}'] + param[1:]) |
swift/ui/llm_train/llm_train.py
Outdated
| if isinstance(kwargs[e], list): | ||
| params += f'--{e} {cls.quote}{sep.join(kwargs[e])}{cls.quote} ' | ||
| command.extend([f'--{e}', f'{" ".join(kwargs[e])}']) | ||
| command.extend([f'--{e}'] + [arg for arg in kwargs[e]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swift/ui/llm_train/llm_train.py
Outdated
| more_params_cmd = [param.split(' ') for param in more_params_cmd if param] | ||
| for param in more_params_cmd: | ||
| command.extend([f'--{param[0]}', ' '.join(param[1:])]) | ||
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list comprehension [arg for arg in param[1:]] is redundant as it just creates a copy of the list slice param[1:]. You can use the slice directly to make the code more concise.
| command.extend([f'--{param[0]}'] + [arg for arg in param[1:]]) | |
| command.extend([f'--{param[0]}'] + param[1:]) |
Remove unnecessary list comprehensions
* fix multiple input issues and more_params for web-ui * remove unnecessary list comprehensions
PR type
PR information
Write the detail information belongs to this PR.
Experiment results
Paste your experiment result here(if needed).