The import statement for the 'typing' module was incorrectly indented, causing a syntax error. The import statement has been fixed to align with the correct indentation.
In the getPythonApiCode function, the run_flow function had an unnecessary type annotation for the message parameter. It was removed to improve code readability. Additionally, the variable name in the run_flow function was changed from inputs to payload to better reflect its purpose.
In the getCurlCode function, support for dynamic inputs was added. The inputs variable is now passed as an argument to the flow function, allowing for flexibility in providing different inputs when generating the curl code.
🐛 fix(constants.tsx): remove unnecessary type annotation and fix variable name in run_flow function
✨ feat(chatMessage/index.tsx): add labels for chatbot and user avatars to improve accessibility and user experience
🐛 fix(chatMessage/index.tsx): adjust styling of chat message content to prevent overflow and improve readability
🐛 fix(chatMessage/index.tsx): adjust button background color to match the background color of the chat message container
🔨 refactor(modals/ApiModal/index.tsx): pass tabsState parameter to getPythonApiCode, getCurlCode, and getPythonCode functions to build inputs dynamically
🔨 refactor(utils.ts): add buildInputs function to build inputs dynamically based on tabsState
🐛 fix(inputFileComponent): fix class order in className to ensure proper styling
🐛 fix(textAreaComponent): fix class order in className to ensure proper styling
🐛 fix(API): remove trailing whitespace at the end of the file
🐛 fix(ApiModal): add missing space before if statement condition
🐛 fix(genericModal): remove unnecessary whitespace and fix class order in className
🐛 fix(utils): add missing comma in INVALID_CHARACTERS array
🐛 fix(tailwind.config.js): add missing comma in custom-scroll CSS rule
🔨 refactor(chatMessage/index.tsx): simplify rendering of matched text in AccordionContent by using a span instead of a div
🔨 refactor(chatMessage/index.tsx): remove unnecessary div wrapper around chat.message[chat.chatKey]
🎨 style(genericModal): add custom-scroll class to div to enable vertical scrolling
🐛 fix(genericModal): set value of inputValue before closing modal in case 1 of switch statement
🐛 fix(genericModal): fix indentation and add missing semicolon in case 2 of switch statement
🔧 fix(types.py): process field_type to convert "Prompt" to "prompt"
The `utils.py` file was missing an import statement for the `CustomComponent` class from the `langflow.interface.custom.custom` module. This import statement has been added to the top of the file. Additionally, a new function `import_custom_component` has been added to import a custom component based on its name.
In the `types.py` file, a new function `process_type` has been added to convert the field_type "Prompt" to "prompt". This is done to ensure consistency in the field types used throughout the codebase.
The code now uses ast.literal_eval to evaluate each item in the split_item list. This is done to handle cases where the items are not strings and cannot be directly converted to their respective types. This ensures that the output_list contains correctly evaluated items.
🐛 fix(loading.py): fix instantiation of custom components and handle single document input in instantiate_textsplitter function
The code in loading.py has been reorganized to improve readability and remove duplicate import_by_type function. The instantiation of custom components has been fixed to correctly build the class object. Additionally, the instantiate_textsplitter function now handles single document input by converting it to a list before processing.
The contextlib.suppress block was suppressing import errors, but it is no longer needed as the import errors are handled elsewhere in the code. Removing this block improves code readability and removes unnecessary complexity.
🔀 refactor(constants.py): refactor build method in YourComponent class to use PromptTemplate and limit response text length
The YourComponent class in constants.py has been refactored to improve readability and remove unused imports. The build method now uses PromptTemplate to handle the template parameter and limits the length of the response text to 300 characters to avoid potential issues.
🔧 fix(constants.py): remove unused import statements
🔧 fix(types.py): refactor add_new_custom_field function to update field_config values
The import statement for `get_custom_nodes` in `base.py` is removed as it is not being used in the code. Similarly, the import statements for `requests` and `LLMChain` in `constants.py` are removed as they are not being used either.
In `types.py`, the `add_new_custom_field` function is refactored to update the values of `field_config` if any of the keys are present in it. This allows for more flexibility in customizing the field configuration for a custom component.
🐛 fix(custom_components.py): update import statement for DEFAULT_CUSTOM_COMPONENT_CODE constant
🐛 fix(tools.py): update import statement for DEFAULT_CUSTOM_COMPONENT_CODE constant
The `CustomComponent` class now supports parsing annotated assignments, allowing attributes with annotated values to be added to the `attributes` dictionary. This improves the flexibility and extensibility of the class.
The import statement for the `DEFAULT_CUSTOM_COMPONENT_CODE` constant in `custom_components.py` and `tools.py` has been updated to reflect the correct location of the constant in the `langflow.interface.custom.constants` module. This ensures that the correct value is imported and used in the code.
🔥 chore(constants.py): remove unused DEFAULT_CUSTOM_COMPONENT_CODE constant
The FieldFormatter class now inherits from pydantic.BaseModel, which allows for improved type checking and validation of the format method arguments. The unused DEFAULT_CUSTOM_COMPONENT_CODE constant has been removed to clean up the codebase.
- Removed the `postCustomComponent` function from the API controller.
- Fixed formatting issues in the `CodeAreaModal` component.
- Removed unnecessary code comments and imports.
This commit simplifies the codebase and improves readability.
The CustomComponentFrontendNode class is added to the custom_components.py file. This class represents a custom component in the frontend of the application. It has properties such as name, display_name, template, description, and base_classes. The template property defines the structure of the custom component, including a code field with default value. The to_dict() method is also implemented to convert the class instance to a dictionary. This allows the custom component to be serialized and used in other parts of the application.
The custom_components module is now included in the list of exported modules in the frontend_node package. This change allows other modules or packages to import and use the custom components provided by the frontend_node package.
🚀 feat(custom.py): refactor CustomComponent class to remove unused code and improve code organization
The changes in this commit remove unused imports and commented out code from the `custom.py` file. The `CustomComponent` class has been refactored to remove the `CustomComponent_old` class and unused methods. The code has been reorganized to improve readability and maintainability.
The import statement for CustomComponent is no longer needed as it is not used in the CUSTOM_TOOLS dictionary. Removing the unused import and the unused CustomComponent entry from the dictionary improves code cleanliness and reduces potential confusion.
🐛 fix(custom.py): fix typo in function_entrypoint_name variable assignment
The CustomComponent class is added to handle custom code components. It includes methods to handle imports, classes, and functions in the provided code. The class also has methods to extract class information, get entrypoint function arguments and return type, build a template configuration, validate the class template, and get the entrypoint function. A typo in the assignment of the function_entrypoint_name variable is fixed.
🔧 chore(custom): create a custom component creator class to handle custom component creation and loading
The commit adds two new files: `__init__.py` and `base.py` under the `src/backend/langflow/interface/custom` directory. The `__init__.py` file imports the `CustomComponentCreator` and `CustomComponent` classes from the `base.py` file. The `base.py` file defines the `CustomComponentCreator` class, which is responsible for creating and loading custom components. It also includes necessary imports and a `CustomComponentFrontendNode` class.
The addition of these files is necessary to support custom components in the application. The `CustomComponentCreator` class provides a way to create and load custom components, and the `CustomComponent` class represents a custom component. This allows for the dynamic creation and usage of custom components in the application.
This commit adds a new file `constants.py` to the `src/backend/langflow/interface/custom` directory. The file defines a dictionary `LANGCHAIN_BASE_TYPES` which maps string names to corresponding langflow interface custom types. This file will be used to store and access the custom types used in the langflow interface.
🔧 fix(types.py): fix import for CustomComponent class
🔧 fix(types.py): remove unused imports
🔧 fix(types.py): fix function signature for add_new_custom_field
🔧 fix(types.py): fix function signature for build_langchain_template_custom_component
🔧 fix(types.py): fix return type validation and error handling in build_langchain_template_custom_component
🔧 fix(types.py): fix appending base classes to frontend_node in build_langchain_template_custom_component
🔧 fix(types.py): fix return statement in build_langchain_template_custom_component
The changes in this commit fix import statements, function signatures, and error handling in the types.py file. The correct module is now imported for the custom component creator. The import for the CustomComponent class is fixed. Unused imports are removed. The function signature for add_new_custom_field is fixed to include the field_config parameter. The function signature for build_langchain_template_custom_component is fixed to include the field_config parameter. The return type validation and error handling in build_langchain_template_custom_component are fixed to handle invalid return types. The base classes are correctly appended to the frontend_node in build_langchain_template_custom_component. The return statement in build_langchain_template_custom_component is fixed to return the frontend_node.
The type dictionary now includes a new key "custom_components" which contains a list of custom components created using the custom_component_creator. This allows for better organization and management of custom components within the application.
The "CustomComponent" node was removed from the CUSTOM_NODES dictionary as it was no longer being used. This improves code cleanliness and removes unnecessary clutter.
The import statement for CustomComponent has been updated to reflect the correct module path. This ensures that the correct CustomComponent class is imported and used in the code.
✨ feat(settings.py): allow updating custom components in the settings
The `custom_components` attribute has been added to the `Settings` class to support custom components in the application. This allows users to define and use their own components in addition to the built-in ones. The `update_settings` method has been updated to include the `custom_components` attribute when updating the settings. This change improves the flexibility and extensibility of the application.
🔧 chore(GenericNode/index.tsx): optimize rendering of GenericNode component by removing unused useEffect dependency
The console.log statement was removed as it was no longer needed. The useEffect dependency was optimized by removing the unused data.node.template dependency, which improves the performance of the component rendering.
🔧 chore(utils.ts): add support for custom components in nodeColors and nodeNames
The nodeColors and nodeNames objects were updated to include support for custom components. The custom_components key was added to both objects with the corresponding color and display name. This allows for consistent styling and labeling of custom components throughout the application.
🔧 chore(utils.ts): add Sparkles icon for custom_components in nodeIconsLucide
The nodeIconsLucide object was updated to include the Sparkles icon for the custom_components key. This ensures that the custom components are visually represented with an appropriate icon in the application.
🔧 chore(utils.ts): optimize groupByFamily function in utils.ts
The groupByFamily function in utils.ts was optimized to improve performance and readability. The code was refactored to eliminate unnecessary code duplication and improve variable naming. The function now correctly groups the data based on the specified criteria and returns the desired result.
✨ feat(GenericNode): import Zap icon from lucide-react to use in validation status tooltip
🐛 fix(textAreaComponent): import classNames from utils to fix missing import error
🐛 fix(constants): update HIGHLIGH_CSS constant to add overflow-y-hidden and max-w-[75vw] classes
🐛 fix(ApiModal): add condition to check if tweak.current exists before calling startTweaks()
✨ feat(ApiModal): import Variable icon from lucide-react to use in input variables section
🐛 fix(genericModal): import Variable icon from lucide-react to use in input variables section
🐛 fix(utils): add newline character to INVALID_CHARACTERS array
🐛 fix(tailwind.config.js): set height property to "8px" for scrollbar in custom-scroll class
The changes in this commit include:
- Added `overflow-y-scroll` and `overflow-x-clip` classes to the error message container to enable vertical scrolling and prevent horizontal scrolling.
- Added `break-all` class to the error message and traceback to ensure long lines of text are broken and wrapped within the container.
- Added `whitespace-pre-wrap` class to the error message to preserve whitespace and line breaks.
These changes were made to improve the readability of the code and enhance the display of error messages in the CodeAreaModal component.