This commit updates the GenericNode component and its related hooks to handle the component type. The code changes in the index.tsx file of the GenericNode directory include modifying the updateNodeCode function to accept an additional "type" parameter. The handleNodeClass function in the use-handle-node-class.tsx file has also been updated to handle the "type" parameter. These changes ensure that the GenericNode component can correctly handle different types of components and update the node code accordingly.
This commit adds the CustomComponentResponse model to the schemas.py file, allowing the custom_component endpoint to return a structured response. The custom_component endpoint in the endpoints.py file has been updated to include the response_model parameter, specifying the CustomComponentResponse model. This ensures that the endpoint returns the built_frontend_node along with the type of the component_instance. These changes improve the consistency and clarity of the API response.
The build_config parameter in the update_build_config method of the AgentComponent class has been updated to accept a field_name parameter of type str instead of Text | None. This change improves the clarity and consistency of the code.
The code changes in `directory_reader.py` introduce a check to skip files that are located in the `deactivated` folder. This improves the efficiency of the directory reading process by excluding unnecessary files.
* 🐛 (folders.py): fix folder name update logic to ensure name changes are saved correctly
* ✨ (folders.py): add custom_sort function to prioritize "My Projects" folder
♻️ (folders.py): refactor read_folders to return sorted folders using custom_sort
🐛 (folders.py): fix update_folder to refresh session after updating folder name
🐛 (folders.py): correct update statement to exclude flows not in the provided list
* Apply Ruff formatting
* ♻️ (folders.py): remove custom_sort function and replace with inline lambda for sorting folders
🐛 (folders.py): fix update statement to correctly update flows with excluded folder IDs
♻️ (folders.py): refactor folder update logic to use session.add for better clarity and consistency
---------
Co-authored-by: Cristhianzl <Cristhianzl@users.noreply.github.com>
Simplify the getJsApiCode utility function in the get-js-api-code.tsx file. The unnecessary replacement of JavaScript boolean literals has been removed, improving code readability and maintainability.
This commit updates the CodeTabsComponent to handle an additional tab in the code tabs display. The previous implementation had a condition that checked if the active tab index was less than 4, but it has been updated to check if the active tab index is less than 5. This change ensures that the component can handle the new tab and display the corresponding content correctly. The code has been modified in the index.tsx file of the CodeTabsComponent directory.
This commit adds a new utility function called getJsApiCode to the apiModal/utils/get-js-api-code.tsx file. The function generates JavaScript code for interfacing with an API using the LangflowClient class. It takes several parameters including the flowId, isAuth, tweaksBuildedObject, and endpointName. The function constructs a LangflowClient instance and defines methods for making API requests, handling streams, and running flows. It also includes a main function that demonstrates how to use the LangflowClient to initiate a session and handle stream updates. This utility function improves code organization and reusability.
The create_or_update_starter_projects function in setup.py has been refactored to improve code organization. This change separates the function definition from the rest of the code, making it easier to read and maintain.
The Retriever class in constants.py has been refactored to improve code organization. This change separates the class definition from the rest of the code, making it easier to read and maintain.
The post_process_raw function in artifact.py has been updated to set the raw value to "Built Successfully ✨" when the artifact type is unknown. This change improves the clarity of the code and provides a more meaningful message for unknown artifact types.
Refactor the post_code_processing method in the CustomComponent class to improve code readability and maintainability. The changes include:
- Import the update_frontend_node_with_template_values function from langflow.template.utils.
- Update the function signature to accept new_build_config and current_build_config as parameters.
- Call the update_frontend_node_with_template_values function to update the frontend_node with any values set in the current_build_config.
- Remove unnecessary comments and whitespace.
These changes enhance the overall quality of the code and make it easier to understand and maintain.
The Makefile has been updated to ignore the integration tests when running the unit_tests target. This change improves the efficiency of the unit testing process by excluding unnecessary tests.
Refactor the post_code_processing method in the PromptComponent class to improve code readability and maintainability. The changes include:
- Import the process_prompt_template function from langflow.base.prompts.api_utils.
- Import the update_template_values function from langflow.template.utils.
- Call the process_prompt_template function to update the template value.
- Update the frontend_node with any values set in the current_build_config.
- Remove unnecessary comments and whitespace.
These changes enhance the overall quality of the code and make it easier to understand and maintain.
The post_code_validation method in the Component class has been renamed to post_code_processing to better reflect its purpose. This change improves code clarity and maintainability.
Update the return type of the build_custom_component_template function in utils.py to include the possibility of returning a Component object. This change ensures that the function can handle both CustomComponent and Component objects, improving flexibility and compatibility.
Refactor the post_code_validation method in the Component class to improve code readability and maintainability. The changes include:
- Rename the parameters to better reflect their purpose.
- Update the function documentation to provide a clear explanation of the method's purpose.
- Remove unnecessary comments and whitespace.
- Improve variable naming for better clarity.
These changes enhance the overall quality of the code and make it easier to understand and maintain.
When updating the Component code in GenericNode, handle any errors that occur. If an error occurs, display an error message with instructions to report the issue on Discord or GitHub. This improves the error handling and user experience when updating the Component code.