Skip to content

Conversation

@vinci-grape
Copy link
Collaborator

Change Summary

Added code_genesis project support for WebUI, including workflow configuration updates, frontend and backend integration, and the addition of orchestrator and simple_workflow.

Related issue number

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Run pre-commit install and pre-commit run --all-files before git commit, and passed lint check.
  • Documentation reflects the changes where applicable

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @vinci-grape, 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 significantly expands the WebUI's capabilities by integrating the 'code_genesis' project, which facilitates advanced, agent-based code generation. It introduces new workflow definitions, including a master orchestrator and a simplified workflow, to manage complex code creation tasks. A key enhancement is the addition of an 'edit_file' tool, allowing agents to perform targeted code modifications within existing files using external large language models. The WebUI has been updated to provide a more intuitive user experience with dynamic workflow visualization, improved session handling, and a centralized settings dialog for LLM and tool configurations, including the new 'edit_file' tool.

Highlights

  • Code Genesis Project Integration: Introduced comprehensive support for the 'code_genesis' project within the WebUI, enabling structured code generation workflows and dynamic switching between standard and simple workflows.
  • New Orchestrator and Simple Workflow: Added 'orchestrator' and 'simple_workflow' configurations, allowing for multi-step, agent-driven code generation processes and a streamlined development path.
  • Enhanced Edit File Tool: Implemented an 'edit_file' tool, leveraging external LLMs (MorphLLM) for precise in-file code modifications, significantly enhancing agent capabilities for targeted code changes.
  • WebUI Improvements and Configuration: Refactored WebUI components to support dynamic workflow visualization, improved session management, and a centralized settings dialog for configurable LLM and tool settings, including the new 'edit_file' tool.
  • Configuration Management Refinement: Migrated privacy-sensitive configuration storage to '~/.ms_agent' for better user-specific settings and updated backend logic to dynamically pass LLM and tool configurations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 introduces significant enhancements to the WebUI, primarily focusing on integrating the code_genesis project with new workflow orchestration capabilities and an edit_file tool. Key changes include adding support for a 'simple workflow' variant, a new UI component for visualizing workflow steps, and improved error reporting for API calls. Configuration management has been refined, moving sensitive settings to a user-specific directory and providing more granular control over LLM and tool settings. The code_genesis agents' prompts have been updated for clarity and to incorporate new functionalities, such as the edit_file tool and EdgeOne Pages deployment. Overall, these changes greatly improve the functionality, user experience, and robustness of the WebUI for code generation tasks.

Comment on lines +148 to +162
# Convert temperature to float and max_tokens to int if they're numeric strings
value_to_set = extra[current_path]
if name == 'temperature' and isinstance(
value_to_set, str):
try:
value_to_set = float(value_to_set)
except (ValueError, TypeError):
pass
elif name == 'max_tokens' and isinstance(
value_to_set, str):
try:
value_to_set = int(value_to_set)
except (ValueError, TypeError):
pass
setattr(_config, name, value_to_set)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for converting temperature to float and max_tokens to int is duplicated here and in the elif block below. Consider extracting this conversion logic into a small helper function to improve maintainability and reduce redundancy.

Comment on lines +169 to +183
# Convert temperature to float and max_tokens to int if they're numeric strings
value_to_set = extra[key_match]
if name == 'temperature' and isinstance(
value_to_set, str):
try:
value_to_set = float(value_to_set)
except (ValueError, TypeError):
pass
elif name == 'max_tokens' and isinstance(
value_to_set, str):
try:
value_to_set = int(value_to_set)
except (ValueError, TypeError):
pass
setattr(_config, name, value_to_set)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block duplicates the type conversion logic for temperature and max_tokens found earlier in the if current_path in extra: block. Encapsulating this into a helper function would make the code cleaner and easier to maintain.

Comment on lines +127 to +130
edit_file_config:
diff_model: morph-v3-fast
api_key:
base_url: https://api.morphllm.com/v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The api_key and base_url for edit_file_config are currently empty. While the WebUI provides a mechanism to configure these, it's important to ensure that the default configuration here either points to a valid default or clearly indicates that these need to be set by the user for the edit_file tool to function.

Comment on lines +87 to +88
api_key:
base_url: https://api.morphllm.com/v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The api_key for edit_file_config is empty. This means the edit_file tool will be disabled by default. Ensure this is the intended behavior, or provide a placeholder/default value if it should be active out-of-the-box.

Comment on lines +216 to +243
else:
# If no API key, exclude edit_file from tools
# Read the current include list from config file and remove edit_file
try:
with open(config_file, 'r', encoding='utf-8') as f:
config_data = yaml.safe_load(f)
if config_data and 'tools' in config_data and 'file_system' in config_data[
'tools']:
include_list = config_data['tools']['file_system'].get(
'include', [])
if isinstance(include_list,
list) and 'edit_file' in include_list:
# Remove edit_file from the list
filtered_include = [
tool for tool in include_list
if tool != 'edit_file'
]
# Pass the filtered list as comma-separated string
cmd.extend([
'--tools.file_system.include',
','.join(filtered_include)
])
except Exception as e:
print(
f'[Runner] Warning: Could not read config file to exclude edit_file: {e}'
)
# Fallback: explicitly exclude edit_file
cmd.extend(['--tools.file_system.exclude', 'edit_file'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic to dynamically exclude edit_file from the file_system.include list when no API key is provided is robust. However, if the config_file cannot be read (e.g., due to permissions or malformed YAML), it falls back to explicitly excluding edit_file. This fallback is good, but ensure the print statement for the warning is sufficiently visible for debugging potential configuration issues.

Comment on lines +26 to +27
'api_key': '',
'base_url': 'https://api.morphllm.com/v1',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The api_key for edit_file_config is set to an empty string by default. This will cause the edit_file tool to be disabled unless explicitly configured by the user. This is a reasonable default for security, but users should be aware they need to set this for the tool to work.

Comment on lines +1059 to +1060
p: 1,
width: 110,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The width of the node is hardcoded to 110. This might lead to text overflow or awkward spacing if node names or config paths are very long. Consider making the width dynamic or adding text-overflow: ellipsis to the node content to handle long strings gracefully.

Comment on lines +1099 to +1101
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The whiteSpace: 'nowrap' property combined with textOverflow: 'ellipsis' is good for single-line truncation. However, if node.config contains multi-line text, this will prevent it from wrapping. Given the config field can be a path, it might be long. Consider if multi-line display with a max-height and overflow scroll might be more informative for longer config strings, or ensure node.config is always a single line.

}}
min={0}
max={2}
max={1}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The max value for the temperature slider is set to 1. While this is a common range for temperature, some LLMs might support values slightly above 1 (e.g., up to 2). Ensure this constraint aligns with the capabilities of all supported LLM providers, or adjust the maximum value if higher temperatures are desired for certain models.

Comment on lines +34 to +38
# PY_VERSION=$($PYTHON_CMD -c "import sys; print(sys.version_info[:2] >= (3, 10))")
# if [ "$PY_VERSION" != "True" ]; then
# echo -e "${RED}Error: Python 3.10+ required.${NC}"
# exit 1
# fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Python 3.10+ version check has been commented out. While this might relax the requirement, it could potentially lead to compatibility issues if ms-agent or its dependencies rely on features or syntax introduced in Python 3.10 or later. It's important to verify that the project functions correctly with older Python versions if this check is permanently removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants