refactor: simplify prefill handling and enhance resource configuratio…#146
refactor: simplify prefill handling and enhance resource configuratio…#146
Conversation
…n in model service creation
Summary of ChangesHello, 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 refactors the model service creation process by simplifying the handling of prefill configurations and enhancing how resources are configured. It introduces dynamic resource allocation logic for decode and prefill steps, centralizes environment variable settings for the engine, and cleans up the UI schema for resource inputs, leading to a more robust and maintainable service creation workflow. Highlights
Using Gemini Code AssistThe 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
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 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the model service creation form by simplifying how prefill data is handled and centralizing resource configuration logic in transformers. The changes are generally good, but I've found an issue with a side effect in one of the new transformer functions that could lead to incorrect state management. My feedback includes a suggestion to fix this.
| } else { | ||
| lodash.set(values, 'spec.prefill.resources', {}); | ||
| } |
There was a problem hiding this comment.
The transformer function should be a pure function that only operates on the value it receives (here, formValue). Modifying the external component-level values state directly is a side effect that can lead to unpredictable behavior and bugs.
The handleSubmit hook for this step already handles clearing the prefill data when the mode is not 'Disaggregation'. To prevent stale data from being present in the form's state when switching modes, you should clean up formValue within the transformer instead of modifying values.
I suggest unsetting the prefill property from formValue.
} else {
lodash.unset(formValue, 'prefill');
}
…n in model service creation