Commit graph

11,619 commits

Author SHA1 Message Date
Lucas Oliveira
16ed5f67aa
Fix characters passing through password icon (#622)
Fix password input style
2023-07-07 14:43:01 -03:00
Lucas Oliveira
54f7cfb821 🔥 refactor(cardComponent/index.tsx): remove unnecessary dialog component and simplify delete button implementation 2023-07-07 14:41:48 -03:00
Cristhian Zanforlin Lousa
dcb8de5335 🐛 fix(index.css): increase right padding of .search-icon class to improve alignment with other elements 2023-07-07 14:24:17 -03:00
Cristhian Zanforlin Lousa
f770347c0a Merge branch 'form_io' of https://github.com/logspace-ai/langflow into form_io 2023-07-07 14:12:10 -03:00
Cristhian Zanforlin Lousa
2262e8e0bd 🐛 fix(index.css): increase right padding of .search-icon class to improve alignment with other elements 2023-07-07 14:12:04 -03:00
Gabriel Luiz Freitas Almeida
e422ed9c78 🐛 fix(constants.tsx): fix indentation issue in getPythonApiCode function
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.
2023-07-07 13:55:15 -03:00
Gabriel Luiz Freitas Almeida
512b499915 feat(constants.tsx): add support for dynamic inputs in getPythonApiCode and getCurlCode functions
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
2023-07-07 13:51:16 -03:00
Igor Carvalho
d718b153da refactor(chatTrigger): Add new chatTrigger tailwind constants classes 2023-07-07 13:31:35 -03:00
Lucas Oliveira
bb362bd4ff 🐛 fix(chatMessage/index.tsx): fix CSS class name and position of the hidden message icon 2023-07-07 12:54:44 -03:00
Lucas Oliveira
dc415e22f5 🐛 fix(chatMessage/index.tsx): remove unnecessary class name "bg-border" to fix styling issue
 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
2023-07-07 12:46:56 -03:00
Lucas Oliveira
fde865f9ca 🔀 chore(constants.tsx): refactor buildFlowScript function to use template literals for better readability and maintainability 2023-07-07 12:30:20 -03:00
Lucas Oliveira
9ea667aa64 🔥 refactor(utils.ts): remove console.log statement in buildInputs function to improve code cleanliness and remove unnecessary logging 2023-07-07 12:27:53 -03:00
Lucas Oliveira
a6e44c43e6 🔨 refactor(constants.tsx): add support for tabsState parameter in getPythonApiCode, getCurlCode, and getPythonCode functions to build inputs dynamically
🔨 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
2023-07-07 12:27:21 -03:00
Lucas Oliveira
dc8cee8f49 Merge branch 'form_io' of github.com:logspace-ai/langflow into form_io 2023-07-07 12:05:26 -03:00
Lucas Oliveira
be7d9c93fe Formatting changes 2023-07-07 12:05:01 -03:00
Lucas Oliveira
1020539ae6 Changed chat message button to show entire prompt instead of chat input 2023-07-07 12:03:54 -03:00
Cristhian Zanforlin Lousa
f7f08cc97d 🔥 refactor(chatMessage): remove unused code and simplify the ChatMessage component 2023-07-07 11:54:16 -03:00
Cristhian Zanforlin Lousa
17c80a26f2 merge fix 2023-07-07 11:47:05 -03:00
Cristhian Zanforlin Lousa
fbc9eb6d1b merge fix 2023-07-07 11:46:13 -03:00
Lucas Oliveira
3842b90907 🐛 fix(GenericNode): improve readability of tooltip title by formatting the JSX code
🐛 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
2023-07-07 11:36:34 -03:00
Lucas Oliveira
07276523a3 🐛 fix(chatMessage/index.tsx): remove unnecessary div wrapper around matched text in AccordionContent
🔨 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]
2023-07-07 11:35:50 -03:00
Cristhian Zanforlin Lousa
5b2cc6f68a 🎨 style(inputFileComponent): add margin-left to FileSearch2 component to improve spacing
🎨 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
2023-07-07 06:53:04 -03:00
Gabriel Luiz Freitas Almeida
320989870e Merge branch 'form_io' into python_custom_node_component 2023-07-07 01:36:18 -03:00
Gabriel Luiz Freitas Almeida
c49b764fc0 🔧 fix(utils.py): import CustomComponent class and add import_custom_component function
🔧 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.
2023-07-07 01:34:51 -03:00
Gabriel Luiz Freitas Almeida
99bc9f01ba 🐛 fix(custom.py): evaluate items in split_item list using ast.literal_eval to handle cases where items are not strings
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.
2023-07-07 01:34:37 -03:00
Gabriel Luiz Freitas Almeida
92217155e4 🔨 refactor(loading.py): reorganize code and remove duplicate import_by_type function
🐛 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.
2023-07-07 01:34:26 -03:00
Gabriel Luiz Freitas Almeida
93892df805 🔧 chore(validate.py): remove unnecessary contextlib.suppress block
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.
2023-07-07 01:34:14 -03:00
Gabriel Luiz Freitas Almeida
2815f5a139 🚀 feat(langflow): add Prompt class to types module
The Prompt class is added to the types module in the langflow package. This class will be used for defining prompts in the language flow processing.
2023-07-07 01:33:36 -03:00
Gabriel Luiz Freitas Almeida
34be9577c2 🔀 refactor(constants.py): refactor YourComponent class to improve readability and remove unused imports
🔀 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.
2023-07-07 01:33:15 -03:00
Gabriel Luiz Freitas Almeida
1f4e947516 🔧 fix(base.py): remove unused import statement
🔧 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.
2023-07-07 00:42:36 -03:00
Gabriel Luiz Freitas Almeida
daad3bb4e7 🐛 fix(custom.py): add support for parsing annotated assignments in CustomComponent class
🐛 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.
2023-07-07 00:42:16 -03:00
Gabriel Luiz Freitas Almeida
ae59104b3a 🔨 refactor(formatter/base.py): make FieldFormatter inherit from pydantic.BaseModel for improved type checking
🔥 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.
2023-07-07 00:41:35 -03:00
Rodrigo Nader
7a0ab93357 refactor: Remove unused function and fix code formatting
- 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.
2023-07-07 00:10:41 -03:00
Gabriel Luiz Freitas Almeida
961c3d94c8
General UI Fixes (#624) 2023-07-07 00:03:28 -03:00
Gabriel Luiz Freitas Almeida
790d8b5669 feat(custom_components.py): add CustomComponentFrontendNode class to create a custom component
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.
2023-07-06 23:57:57 -03:00
Gabriel Luiz Freitas Almeida
93dbf552f0 feat(frontend_node): add custom_components to the list of exported modules
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.
2023-07-06 23:57:47 -03:00
Gabriel Luiz Freitas Almeida
2775789ccb 🔥 refactor(custom.py): remove unused imports and commented out code
🚀 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.
2023-07-06 23:57:28 -03:00
Gabriel Luiz Freitas Almeida
97572bea25 🔥 refactor(constants.py): remove unused import and unused CustomComponent from CUSTOM_TOOLS dictionary
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.
2023-07-06 23:57:17 -03:00
Gabriel Luiz Freitas Almeida
97399632e2 feat(custom.py): add CustomComponent class to handle custom code components
🐛 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.
2023-07-06 23:57:04 -03:00
Gabriel Luiz Freitas Almeida
692994f100 feat(custom): add custom component interface and base classes
🔧 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.
2023-07-06 23:56:49 -03:00
Gabriel Luiz Freitas Almeida
5e4507852c feat(constants.py): add constants file for langflow interface custom types
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.
2023-07-06 23:56:21 -03:00
Gabriel Luiz Freitas Almeida
024cd3398a 🔧 fix(types.py): import correct module for custom component creator
🔧 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.
2023-07-06 23:56:04 -03:00
Gabriel Luiz Freitas Almeida
f41cd1905f 🚀 feat(listing.py): add support for custom components in the type dictionary
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.
2023-07-06 23:53:38 -03:00
Gabriel Luiz Freitas Almeida
fc615bf319 🔥 refactor(customs.py): remove unused "CustomComponent" node from CUSTOM_NODES dictionary
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.
2023-07-06 23:53:27 -03:00
Gabriel Luiz Freitas Almeida
bed962e513 🔀 refactor(endpoints.py): fix import statement for CustomComponent
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.
2023-07-06 23:52:59 -03:00
Gabriel Luiz Freitas Almeida
a29b83e4fa 🔧 chore(settings.py): add support for custom components in the settings
 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.
2023-07-06 23:52:43 -03:00
Gabriel Luiz Freitas Almeida
a06b47c9a8 🐛 fix(GenericNode/index.tsx): remove unnecessary console.log statement
🔧 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.
2023-07-06 23:51:07 -03:00
Cristhian Zanforlin Lousa
4595d51e62 🐛 fix(parameterComponent): set disabled prop to false in TextAreaComponent to enable editing
 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
2023-07-06 21:38:42 -03:00
Igor Carvalho
d010a2f515 style: Fix characters passing through password icon 2023-07-06 20:05:20 -03:00
anovazzi1
0733b56b8f refactor(codeAreaModal/v2.tsx): improve code readability and error display in CodeAreaModal component
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.
2023-07-06 19:30:37 -03:00