* Fix flaky tests in `test_schema.py` by using sets for type comparisons
- Updated `post_process_type` function assertions to use sets for more reliable type comparisons.
- Adjusted imports for better code organization.
* Fix import order in test_database.py
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* 📝 (constants.ts): increase maxSizeFilesInBytes constant value from 10MB to 100MB to allow larger file uploads
* 🐛 (inputFileComponent): fix bug in setting the maximum file size alert message to display the correct file size limit of 100 bytes instead of 10 bytes
* 📝 (schemas.py): Add a new field_serializer method to serialize data in VertexBuildResponse class
📝 (schemas.py): Add a new truncate_text helper function to safely truncate text in nested dictionaries
📝 (model.py): Add a new field_serializer method to serialize outputs in TransactionBase class
📝 (model.py): Add a new truncate_text helper function to safely truncate text in nested dictionaries
📝 (model.py): Add a new field_serializer method to serialize data and artifacts in VertexBuildBase class
📝 (model.py): Add a new truncate_text helper function to safely truncate text in nested dictionaries
* 🐛 (schemas.py): fix truncation length of text fields to 10 characters instead of 99999
🐛 (model.py): fix truncation length of text fields to 10 characters instead of 99999
🐛 (model.py): fix truncation length of text fields to 10 characters instead of 99999
🐛 (index.tsx): truncate resultMessage to 99999 characters and add message if text is too long
* 🔧 (switchOutputView/index.tsx): Use useMemo to memoize resultMessage transformations for performance optimization
* 🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (index.tsx): Fix logic to correctly handle resultMessageMemoized when it is an object
* 📝 (model.py): refactor truncate_text function to truncate_long_strings for better clarity and consistency
📝 (model.py): update serialize_outputs and serialize_artifacts functions to use truncate_long_strings for string truncation
📝 (model.py): introduce MAX_TEXT_LENGTH constant for defining the maximum length of text to truncate in the models
* 📝 (schemas.py): refactor serialize_data method in VertexBuildResponse class to use a new helper function truncate_long_strings for better code readability and maintainability
* 🔧 (schemas.py): Move the `truncate_long_strings` function to a separate module to improve code organization and reusability
🔧 (model.py): Import the `truncate_long_strings` function from the correct module to fix the reference error
🔧 (model.py): Import the `truncate_long_strings` function from the correct module to fix the reference error
* 📝 (util.py): add function truncate_long_strings to recursively truncate long strings in dictionaries and lists to prevent exceeding the maximum text length.
* 📝 (constants.py): add constant MAX_TEXT_LENGTH with value 99999 for defining maximum text length allowed in the application
* 📝 (model.py): update import path for truncate_long_strings function to match new location in util module
* ✨ (test_truncate_long_strings_on_objects.py): Add unit tests for the function truncate_long_strings to ensure correct behavior when truncating long strings in various data structures
🐛 (switchOutputView/index.tsx): Fix truncation logic to correctly truncate long strings by adding ellipsis at the end instead of displaying additional text about truncation.
* [autofix.ci] apply automated fixes
* ✨ (test_truncate_long_strings_on_objects.py): Update import path for truncate_long_strings function
📝 (test_truncate_long_strings_on_objects.py): Add additional tests for handling negative, zero, and small max_length values in truncate_long_strings function
* ♻️ (schemas.py): refactor import statement to use the updated module name util_strings instead of util for better clarity and consistency.
* 📝 (model.py): Update import path for util_strings module to fix module import error
📝 (util.py): Remove redundant code for truncating long strings and move it to a separate util_strings module for better organization and separation of concerns.
* 📝 (schemas.py): refactor serialize_data method to handle both BaseModel and non-BaseModel data inputs in VertexBuildResponse class
* 📝 (util_strings.py): Update util_strings.py to improve string truncation function for dictionaries and lists
🔧 (test_truncate_long_strings_on_objects.py): Update test cases for string truncation function to cover additional scenarios and edge cases
* Update src/backend/base/langflow/utils/util_strings.py
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* 📝 (vite.config.mts): update environment variable MAX_FILE_SIZE to be defined in vite config for frontend to use in the application.
* 📝 (constants.ts): update maxSizeFilesInBytes constant to use process.env.MAX_FILE_SIZE environment variable for configurable file size limit
📝 (constants.ts): add MAX_TEXT_LENGTH constant with a value of 99999 for maximum text length limit
* 📝 (switchOutputView/index.tsx): import MAX_TEXT_LENGTH constant from shared constants file to improve code organization and reusability
* ✨ (langflow/__main__.py): add support for defining maximum file size for upload in MB to improve user experience and prevent large file uploads
* 🐛 (files.py): add validation to check if uploaded file size exceeds the maximum allowed size before processing it
* ✨ (schemas.py): add max_file_size_upload field to ConfigResponse schema to handle maximum file size allowed for upload
* 🔧 (vite.config.mts): remove MAX_FILE_SIZE environment variable configuration as it is no longer needed
* ✨ (base.py): introduce max_file_size_upload setting to limit the file size for uploads in MB
* 🐛 (util.py): add support for setting max_file_size_upload in update_settings function to allow configuring maximum file size for uploads
* 📝 (inputFileComponent/index.tsx): add support for retrieving max file size upload from utility store to improve code modularity and reusability
🐛 (inputFileComponent/index.tsx): fix error handling logic to display error message when uploading a file fails
* 📝 (constants.ts): remove maxSizeFilesInBytes constant as it is no longer used and update MAX_TEXT_LENGTH constant to a higher value
* ✨ (use-get-config.ts): add functionality to set max file size upload value from config response
* ✨ (utilityStore.ts): introduce maxFileSizeUpload property and setMaxFileSizeUpload function to handle maximum file size upload in bytes
* ✨ (frontend): introduce maxFileSizeUpload property and setMaxFileSizeUpload method to handle maximum file size upload functionality in the UtilityStoreType
* ♻️ (util_strings.py): refactor truncate_long_strings function to improve code readability and consistency by removing unnecessary whitespace and aligning assignment operators.
* 🐛 (files.py): fix formatting issue in the raise statement to improve code readability and maintain consistency
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* Fix: Handle group nodes in graph sorting
- Added `get_root_of_group_node` function to identify the root of a group node.
- Updated `sort_up_to_vertex` to use `get_root_of_group_node` for handling group nodes.
- Modified `__filter_vertices` to pass `parent_node_map` to `sort_up_to_vertex`.
* Refactor: Update NodeStatus component to handle group nodes and improve build status handling
* [autofix.ci] apply automated fixes
* Update type hint for parent_node_map in sort_up_to_vertex function
---------
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* chore: drop duckdb usage and migrations
* [autofix.ci] apply automated fixes
* Add DefaultModel and MessageResponse classes with custom JSON serialization and validation
- Introduced `DefaultModel` class with custom JSON encoders and serialization methods.
- Added `MessageResponse` class inheriting from `DefaultModel` with fields for message details and custom validators/serializers.
- Enhanced file handling and timestamp formatting in `MessageResponse`.
* Refactor: Replace `MessageModelResponse` with `MessageResponse` in monitor API
- Updated import statements to use `MessageResponse` from `langflow.schema.message`.
- Modified `/messages` endpoint to return `list[MessageResponse]` instead of `list[MessageModelResponse]`.
- Adjusted response model validation to use `MessageResponse`.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* refactor: Refactor file path rewriting logic
This commit refactors the logic for rewriting file paths in the `rewrite_file_path` function. The function now splits the file path by "/" and checks if it has at least two parts. If it does, it creates a consistent file path by concatenating the last two parts. If not, it returns the original file path. This change improves the consistency of file paths in the codebase.
Refactor the file path rewriting logic in the `rewrite_file_path` function.
* refactor: Refactor file path rewriting logic and treat file paths in InterfaceVertex
* Refactor file path rewriting logic and treat file paths in InterfaceVertex
* Refactor file path rewriting logic and treat file paths in InterfaceVertex
* Refactor file path rewriting logic and treat file paths in InterfaceVertex
* ✨ (general-bugs-shard-3836.spec.ts): update test description to be more specific about the tool used for sending images on chat
📝 (general-bugs-shard-3836.spec.ts): remove unused import of readFileSync from fs module
* ✅ (test_rewrite_file_path.py): add unit tests for the rewrite_file_path function to ensure correct behavior with various file path scenarios
* ♻️ (utils.py): refactor file_path function to handle both forward and backward slashes and extract file path after drive letter if present
* style: fix single quotes, commas, and spaces
---------
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
## Changes Overview
This PR introduces several enhancements to our data handling components and removes some legacy code:
1. **CreateData and UpdateData Components**:
- Added text key name validation
- Enhanced UpdateData to support updating and appending multiple data points
- Implemented optional text key validator for dynamically loaded data
- Updated component names, descriptions, and default values
2. **New SelectData Component**:
- Implemented SelectDataComponent for data selection from a list
- Added inputs for data list and index selection
- Implemented error handling for out-of-range index selection
3. **Code Cleanup**:
- Removed legacy post_code_processing methods from CreateDataComponent and UpdateDataComponent
- Removed corresponding test cases
4. **Testing**:
- Added unit tests for CreateData and UpdateData components
- Updated test file names for consistency
* refactor: Add cascade delete functionality for flows
This commit adds a new function `cascade_delete_flow` to the `utils.py` file in the `langflow.api` module. This function is responsible for deleting related records when a flow is deleted. It uses the `delete` method from SQLAlchemy to delete records from the `TransactionTable` and `VertexBuildTable` tables based on the flow ID. Finally, it deletes the flow record itself from the `Flow` table.
The function is wrapped in a try-except block to handle any exceptions that may occur during the deletion process. If an exception is raised, a `RuntimeError` is raised with an appropriate error message.
This refactor improves the code by encapsulating the cascade delete logic in a separate function, making it more modular and easier to maintain.
* refactor: Add cascade delete functionality for flows
* refactor: Add cascade delete functionality for flows and folders
* refactor: Remove unused delete_flow_by_id function
* refactor: Add cascade delete functionality for flows and folders
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* update templates
* update to include global variables
* Refactor code to include global variables
* update PythonREPLTool.py
* [autofix.ci] apply automated fixes
* update pythonREPL and example
* Refactor code to handle decoding chat messages and handle decoding errors
* ✨ (Simple Agent.spec.ts): Add test case to fill textarea with specific text for testing purposes
📝 (Simple Agent.spec.ts): Update test case descriptions for better clarity and accuracy
✅ (Simple Agent.spec.ts): Update test assertions to match the expected behavior of the test case
* [autofix.ci] apply automated fixes
* 🐛 (Dynamic Agent.spec.ts): fix environment variable name from BRAVE_SEARCH_API_KEY to SEARCH_API_KEY for consistency and clarity
💡 (Dynamic Agent.spec.ts): add additional test cases to improve test coverage and ensure specific text is not present in the chat output
* 🔧 (.github/workflows/typescript_test.yml): update environment variable name from BRAVE_SEARCH_API_KEY to SEARCH_API_KEY for consistency
🐛 (Travel Planning Agent.spec.ts): fix test to skip if SEARCH_API_KEY is not available in the environment variables
* ✅ (Simple Agent.spec.ts): update expected count of python words to 3 for accurate test validation
* updating search tools
* [autofix.ci] apply automated fixes
* change examples
* update travel planning to include global variable
* Refactor search API component to include result limiting
* 📝 (Travel Planning Agent.spec.ts): remove unnecessary empty line to improve code readability and consistency
* test: adjusts asserts to make the test pass successfully
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
* Fix textarea with password visual bug
* Changed password field to default to none
* updated sanitizedHTMLWrapper to receive ref
* fixed sanitizedhtmlwrapper type
* Added back to scroll position and cursor position on Chrome
* [autofix.ci] apply automated fixes
* Fix position of password
* Fixed tests
* Fixed examples
* Fixed test schema
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
* Refactor YfinanceToolComponent to inherit from LCToolComponent and remove unused outputs
* Refactor `PythonREPLToolComponent` to use new input configuration and update method signatures
* Add functions to handle dict values in ATTR_FUNC_MAPPING for '_outputs_maps' and '_inputs'
* Handle '_outputs_maps' argument in frontend node creation
* Add unit test for custom component subclassing from LCToolComponent
* Add input and output handling to PythonREPLToolComponent
- Introduced `input_value` to `inputs` for capturing user input.
- Added `outputs` to define the output structure, including `api_run_model` and `tool` for backward compatibility.
- Implemented `run_model` method to execute the tool and return results as `Data`.
* Add input and output handling to YfinanceToolComponent
- Introduced `MessageTextInput` for user queries.
- Added `Output` definitions for `api_run_model` and `tool` methods.
- Implemented `run_model` method to execute tool with user input.
* Add input and output definitions to YfinanceTool for better data handling
* Update error message to use display_name instead of vertex_type in edge validation
* Add unit test for YfinanceToolComponent template output validation
* Refactor tool components to include 'Data' output and update input types
- Added 'Data' output type to 'Agent Flow', 'Sequential Agent', and 'Complex Agent' starter projects.
- Updated input types to use 'MessageTextInput' and 'MultiselectInput' for better input handling.
- Refactored code to align with new input and output structures, ensuring backward compatibility.
* Add unit test for PythonREPLToolComponent template validation
* test: disblable test
---------
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
* first attempt to edit variables on the data table
* refactor: Rename AddNewVariableButton to GlobalVariableModal and update its usage
The component AddNewVariableButton has been renamed to GlobalVariableModal to better reflect its purpose. The component is now used in multiple places, including the GlobalVariablesPage and InputGlobalComponent. This change improves code clarity and consistency.
* fix: fix apply to fields on table edit option
* refactor: Trim field names before checking for availability in GlobalVariableModal and GlobalVariablesPage
Trim field names before checking for availability in GlobalVariableModal and GlobalVariablesPage to ensure consistent comparison and avoid any potential issues with leading or trailing spaces.
* Refactor GlobalVariablesPage to remove unused cellRenderer in the "value" field
* [autofix.ci] apply automated fixes
* Add validation for 'value' field in VariableRead model and import CREDENTIAL_TYPE
- Introduced a field validator for the 'value' field in the VariableRead model to handle cases where the variable type is CREDENTIAL_TYPE.
- Added necessary import for CREDENTIAL_TYPE.
- Removed an unnecessary blank line in the variable API.
* Add constants for credential and generic types in variable service
* Refactor import statements in `kubernetes.py` to improve module organization
* Refactor imports in test_service.py for better organization
* refactor: Update import statements in variable.py for better organization
* Refactor import and reorder fields in VariableRead model
- Changed import of `CREDENTIAL_TYPE` from `service` to `constants` module.
- Reordered fields in `VariableRead` model to place `type` before `value`.
* ✨ (userSettings.spec.ts): Add additional randomName variables for testing purposes
📝 (userSettings.spec.ts): Update test to interact with global variables and improve readability and maintainability of the code
* test: fix test_create_variable
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
* Refactor test fixtures and imports for optimization
- Reordered and optimized imports in `conftest.py`.
- Changed return statements to yield in `basic_graph` and `create_webhook` fixtures for better resource management.
- Added cleanup step to `create_webhook` fixture to delete created webhook after test completion.
* Refactor imports and add placeholder client fixture in test_ChatOllama_component.py
* Add pytest fixture 'client' to test_graph.py
* Add pytest fixture 'client' to test_callback_graph.py for test optimization
* Add 'unit_tests_looponfail' target to Makefile for running unit tests with loop-on-fail option
* Optimize test durations and update test cases in various modules
* Fixes copy of component outputs
* Fix issue with copying outputs in custom components
- Update loop to iterate over `_outputs.values()` instead of `outputs` to ensure correct attribute setting.
* Refactor output handling in custom component to use dictionary values
- Updated methods to iterate over `_outputs.values()` instead of `outputs`.
- Ensured consistent access to output values across various methods.
- Fixed potential issues with output value resetting and state model building.
* Fix incorrect attribute reference in set_output_value method
* Add missing import for CustomComponent in test_custom_component.py
* Refactor `test_read_flow` to generate unique flow names for each test run
* Refactor: Rename `_outputs` to `_outputs_map` in custom component
- Updated all references of `_outputs` to `_outputs_map` in `component.py` to improve clarity and consistency.
- Adjusted related methods and attributes in `base.py` to align with the new naming convention.
* Fix output handling in custom component
- Moved `_reset_all_output_values` call to ensure outputs are reset after initialization.
- Updated attribute access to use `_outputs_map` instead of `_outputs` for consistency.
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* refactor: update deprecated call to get_actions
* Update composio-langchain dependency to version 0.5.13 in pyproject.toml
* Downgrade `composio-langchain` dependency to version `0.5.9` in `pyproject.toml`
* Add missing import for CustomComponent in test_custom_component.py
* refactor: Update MessageBase text attribute based on isinstance check.
* feat: Add update_message function to update a message in the database.
* refactor(chat): Update imports and remove unnecessary config method in ChatComponent.
* refactor: Add stream_message method to ChatComponent.
* refactor: Update method call in ChatOutput component.
* feat: Add callback function to custom component and update build_results signature.
* feat: Add callback parameter to instantiate_class function.
* feat(graph): Add callback functions for sync and async operations.
* feat: Add callback function support to vertex build process.
* feat: Add handling for added message in InterfaceVertex class.
* feat: Add callback support to Graph methods.
* feat(chat): Add callback function to build_vertices function.
* refactor: Simplify update_message function and use session_scope for session management.
* fix: Call set_callback method if available on custom component.
* refactor(chat): Update chat message chunk handling and ID conversion.
* feat: Add null check before setting cache in build_vertex_stream function.
* refactor: Fix send_event_wrapper function and add callback parameter to _build_vertex function.
* refactor: Simplify conditional statement and import order in ChatOutput.
* refactor: move log method to Component class.
* refactor: Simplify CallbackFunction definition.
* feat: Initialize _current_output attribute in Component class.
* feat: store current output name in custom component during processing.
* feat: Add current output and component ID to log data.
* fix: Add condition to check current output before invoking callback.
* refactor: Update callback to log_callback in graph methods.
* feat: Add test for callback graph execution with log messages.
* update projects
* fix(chat.py): fix condition to check if message text is a string before updating message text in the database
* refactor(ChatOutput.py): update ChatOutput class to correctly store and assign the message value to ensure consistency and avoid potential bugs
* refactor(chat.py): update return type of store_message method to return a single Message object instead of a list of Messages
refactor(chat.py): update logic to correctly handle updating and returning a single stored message object instead of a list of messages
* update starter projects
* refactor(component.py): update type hint for name parameter in log method to be more explicit
* feat: Add EventManager class for managing events and event registration
* refactor: Update log_callback to event_manager in custom component classes
* refactor(component.py): rename _log_callback to _event_manager and update method call to on_log for better clarity and consistency
* refactor(chat.py): rename _log_callback method to _event_manager.on_token for clarity and consistency in method naming
* refactor: Rename log_callback to event_manager for clarity and consistency
* refactor: Update Vertex class to use EventManager instead of log_callback for better clarity and consistency
* refactor: update build_flow to use EventManager
* refactor: Update EventManager class to use Protocol for event callbacks
* if event_type is not passed, it uses the default send_event
* Add method to register event functions in EventManager
- Introduced `register_event_function` method to allow passing custom event functions.
- Updated `noop` method to accept `event_type` parameter.
- Adjusted `__getattr__` to return `EventCallback` type.
* update test_callback_graph
* Add unit tests for EventManager in test_event_manager.py
- Added tests for event registration, including default event type, empty string names, and specific event types.
- Added tests for custom event functions and unregistered event access.
- Added tests for event sending, including JSON formatting, empty data, and large payloads.
- Added tests for handling JSON serialization errors and the noop function.
* revert chatOutput change
* Add validation for event function in EventManager
- Introduced `_validate_event_function` method to ensure event functions are callable and have the correct parameters.
- Updated `register_event_function` to use the new validation method.
* Add tests for EventManager's event function validation logic
- Introduce `TestValidateEventFunction` class to test various scenarios for `_validate_event_function`.
- Add tests for valid event functions, non-callable event functions, invalid parameter counts, and parameter type validation.
- Include tests for handling unannotated parameters, flexible arguments, and keyword-only parameters.
- Ensure proper warnings and exceptions are raised for invalid event functions.
* Add type ignore comment to lambda function in test_event_manager.py
* refactor: Update EventManager class to use Protocol for event callbacks
* refactor(event_manager.py): simplify event registration and validation logic to enhance readability and maintainability
feat(event_manager.py): enforce event name conventions and improve callback handling for better error management
* refactor(chat.py): standardize event_manager method calls by using keyword arguments for better clarity and consistency
refactor(chat.py): extract message processing logic into separate methods for improved readability and maintainability
fix(chat.py): ensure proper handling of async iterators in message streaming
refactor(component.py): simplify event logging by removing unnecessary event name parameter in on_log method call
* update event manager tests
* Add callback validation and manager parameter in EventManager
- Introduced `_validate_callback` method to ensure callbacks are callable and have the correct parameters.
- Updated `register_event` to include `manager` parameter in the callback.
* Add support for passing callback through the Graph in test_callback_graph
* fix(event_manager.py): update EventCallback signature to include manager parameter for better context in event handling
* feat: Add NoteDraggableComponent to extraSidebarComponent
This commit adds the NoteDraggableComponent to the extraSidebarComponent in the FlowPage. The NoteDraggableComponent allows users to drag and drop sticky note icons onto the page. When a note is dragged, its data is set as "note" in the dataTransfer object. The note has a default text value of null and a noteColor of "yellow". This component enhances the user experience by providing a convenient way to add notes to the page.
* feat: Add NoteNode component for displaying and editing notes
This commit adds the NoteNode component, which is responsible for displaying and editing notes in the FlowPage. The NoteNode component includes functionality for resizing, selecting, and editing the note text. It enhances the user experience by providing a convenient way to add and manage notes on the page.
* feat: Add NoteNode and NoteDraggableComponent for managing notes in FlowPage
This commit adds the NoteNode component, responsible for displaying and editing notes in the FlowPage. It also introduces the NoteDraggableComponent, allowing users to drag and drop sticky note icons onto the page. These components enhance the user experience by providing a convenient way to add and manage notes on the page.
* feat: Add DRAG_EVENTS_CUSTOM_TYPESS constant for custom drag event types
This commit adds the DRAG_EVENTS_CUSTOM_TYPESS constant to the constants file. It defines custom drag event types for the generic node and note node components. This constant enhances the code by providing a centralized place to manage and reference the custom drag event types.
* feat: Add support functions for custom drag event types
* feat: Add support for custom drag event types in PageComponent
This commit adds support for custom drag event types in the PageComponent of the FlowPage. It imports the necessary functions from the utils file and uses them to check if the dragged data has supported node types. This enhancement improves the drag and drop functionality by allowing only supported node types to be dropped on the page.
* feat: Add NoteDataType for managing note data in FlowPage
* refactor: create new types for noteNode
* feat: Update NoteNode component to use new NoteDataType
The NoteNode component in the NoteNode/index.tsx file has been updated to use the new NoteDataType for managing note data in the FlowPage. This change ensures consistency and improves the codebase.
* node with title and description
* feat: Add "note" alias for StickyNote in nodeIconsLucide
This commit adds the "note" alias for the StickyNote icon in the nodeIconsLucide object in the styleUtils.ts file. This alias allows for more intuitive usage of the StickyNote icon by providing an alternative name. It improves code readability and maintainability.
* refactor: Update NodeDescription component to use emptyPlaceholder prop
The NodeDescription component in the GenericNode/components/NodeDescription/index.tsx file has been updated to use the emptyPlaceholder prop. This change allows for more flexibility in customizing the placeholder text when the description is empty. It improves code reusability and enhances the user experience.
* refactor: Remove unused Textarea import in NoteNode component
* add initial resize to note component
* [autofix.ci] apply automated fixes
* refactor: add code validation functionality on tanstack mutation (#3469)
* Added Validate endpoint
* Added API Code Validate type
* Added post validate code hook
* Used mutation instead of API call to validate code
* Removed validate code api call
* refactor: Update NodeName component to use full width in GenericNode
The NodeName component in the GenericNode module has been updated to use the full width of the parent container. This change ensures that the input field or tooltip for the node name occupies the entire available space, improving the visual consistency and user experience.
* refactor: Update NodeDescription component to use full height in GenericNode
The NodeDescription component in the GenericNode module has been updated to use the full height of the parent container. This change ensures that the description text area occupies the entire available space, improving the visual consistency and user experience.
* refactor: Update NodeDescription component to use full height in GenericNode
* refactor: Update NodeDescription component to use full height in GenericNode
* increase size control on note node
* refactor: Update NoteNode component to use constants for min and max dimensions
The NoteNode component in the CustomNodes module has been updated to use the constants for the minimum and maximum dimensions. This change improves code readability and maintainability by centralizing the values in the constants file. The component now uses the NOTE_NODE_MIN_WIDTH, NOTE_NODE_MIN_HEIGHT, NOTE_NODE_MAX_HEIGHT, and NOTE_NODE_MAX_WIDTH constants for setting the dimensions of the NodeResizer and the inline styles. This ensures consistency across the application and makes it easier to adjust the dimensions in the future.
* fix overflow issue
* refactor: update NoteDraggableComponent
The NoteDraggableComponent in the extraSidebarComponent module has been updated to remove unused code and improve functionality. The code for adding a note has been removed as it is no longer needed. Additionally, the component has been updated to use a new design and layout for better user experience. This refactor improves the overall code cleanliness and removes unnecessary clutter.
* refactor: Update NoteNode component to use constants for min and max dimensions
* update component to accept multiple colors
* update note colors
* update min width
* refactor: Update NodeDescription component to accept additional styling options
The NodeDescription component in the GenericNode module has been updated to accept additional styling options. The component now includes the inputClassName, mdClassName, and style props, allowing for more customization of the input and markdown elements. This refactor improves the flexibility and extensibility of the component, making it easier to adapt to different design requirements.
* fix bug on description size
* [autofix.ci] apply automated fixes
* feat: skip note nodes when building vertices"
add check to skip nodes of type NoteNode when building vertices in the graph
this prevents unnecessary processing of note nodes which are not part of the actual graph logic
* fix: update serialization and improve error handling (#3516)
* feat(utils): add support for V1BaseModel in serialize_field
Add support for V1BaseModel instances in the serialize_field function by
checking for a "to_json" method. If the method is not present, return the
attribute values as a dictionary.
* refactor: Update field serializer function and error handling in build_flow function
* fix: no module named 'psycopg2' (#3526)
* fix: add dependecy to Dockerfile
* fix: revert quick fix
* fix: update poetry.lock
* feat: add compression support to frontend and backend (#3484)
* Added compression lib to frontend
* Added compression handling to backend
* Added compression to body requests on frontend
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* refactor: add code validation functionality on tanstack mutation (#3469)
* Added Validate endpoint
* Added API Code Validate type
* Added post validate code hook
* Used mutation instead of API call to validate code
* Removed validate code api call
* refactor: Update NodeName component to use full width in GenericNode
The NodeName component in the GenericNode module has been updated to use the full width of the parent container. This change ensures that the input field or tooltip for the node name occupies the entire available space, improving the visual consistency and user experience.
* fix imports
* refactor: remove unused import in styleUtils.ts
* refactor: update checkOldNodesOutput to include only generic nodes
The checkOldNodesOutput function in reactflowUtils.ts has been updated to include only generic nodes when checking for nodes without outputs. This change ensures that only nodes of type "genericNode" are considered, improving the accuracy of the check and preventing false positives.
* refactor: improve checkOldNodesOutput to include only generic nodes
* [autofix.ci] apply automated fixes
* 📝 (frontend): Add data-testid attribute to elements for testing purposes in NodeDescription, NoteToolbarComponent, NoteNode, and Textarea components
✨ (frontend): Create end-to-end test for interacting with sticky notes including creating, editing, duplicating, and deleting notes
* ✨ (stop-building.spec.ts): Add a 1-second delay after clicking the stop building button to improve user experience
✨ (sticky-notes.spec.ts): Add a new end-to-end test for interacting with sticky notes on the main page to ensure functionality and user interaction with sticky notes.
* refactor: update NodeName and GenericNode components to improve UI and code readability
* [autofix.ci] apply automated fixes
* chore: Update NodeDescription component to use dark mode placeholder color
* chore: Update sidebar note component icon to use StickyNote instead of SquarePen
* refactor(main.py): remove unused imports and middleware related to GZip to simplify code and improve readability
feat(main.py): add middleware for configuring logger to improve logging functionality and centralize logging configuration
* add center postion in the flow
* chore: Update NoteNode icon to use SquarePen instead of StickyNote
* [autofix.ci] apply automated fixes
* chore: Update API base URL
* [autofix.ci] apply automated fixes
* chore: add feature flag for MVPs
* code format
* ✨ (NoteNode/index.tsx): Wrap IconComponent in a div with data-testid "note_icon" for better accessibility and testing
✨ (PageComponent/index.tsx): Add data-testid "add_note" to ControlButton for easier testing and identification
🔧 (sticky-notes.spec.ts): Update test selectors to use new data-testid "note_icon" and "add_note" for improved test reliability
* chore: Update types-markdown to version 3.7.0.20240822
* feat: Add lazy loading for images in sticky-notes.spec.ts
* [autofix.ci] apply automated fixes
* update poetry lock
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes
* Refactor feature flag import for ENABLE_MVPS across components and tests
* Add skip marker to unimplemented test in test_graph_state_model.py
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Ítalo Johnny <italojohnnydosanjos@gmail.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
* Add cycle detection and handling in graph edge building process
- Introduced `cycles` property to detect cycles in the graph.
- Modified `_build_edges` and `build_edge` methods to differentiate between `CycleEdge` and `Edge`.
- Updated imports and type hints to support new functionality.
* Add cycle detection and handling in graph processing
- Introduced `is_cyclic` property to check for cycles in the graph.
- Added `_snapshot` method for capturing the current state of the graph.
- Modified `layered_topological_sort` to handle cyclic graphs by starting from a specified start component.
- Updated imports and type hints for better code clarity and functionality.
* Refactor tests and components for improved caching and data handling
- Updated `test_vector_store_rag.py` to use `set_on_output` with `cache=True` and simplified assertions.
- Enhanced `test_memory_chatbot.py` with additional assertions for graph structure and caching.
- Simplified `to_data` method in `base.py` to directly return `_data` without JSON serialization.
* Add unit tests for detecting cycles in graph
- Introduce `test_cycle_in_graph` to verify cyclic behavior in the graph.
- Add `test_cycle_in_graph_max_iterations` to ensure max iterations limit is respected.
- Implement `Concatenate` component for testing purposes.
* Disable output cache in graph tests to allow loops to work
* Refactor: Update VertexStates enum values to uppercase and optimize imports in base.py
* Refactor type hints and improve error handling in `Vertex` class
- Replace `ValueError` with `NoComponentInstance` exception for missing component instances.
- Add `target_handle_name` parameter to `_get_result` method for better result retrieval.
- Refactor type hints to use `collections.abc` for `AsyncIterator`, `Generator`, and `Iterator`.
- Update type hints for `extract_messages_from_artifacts` and `successors_ids` methods to use generic `dict` and `list`.
* refactor(log_router.py): change variable type annotation from List to list for better consistency
refactor(utils.py): change variable type annotation from Dict to dict for better consistency
refactor(base.py): change variable type annotation from Optional to Union for better clarity
refactor(callback.py): change variable type annotation from Dict to dict for better consistency
refactor(chat.py): change variable type annotation from Optional to Union for better clarity
refactor(endpoints.py): change variable type annotation from Optional to Union for better clarity
refactor(flows.py): change variable type annotation from List to list for better consistency
refactor(api): update response_model annotations to use lowercase list for consistency and improve readability
refactor(store.py): update type annotations for query parameters in get_components endpoint to improve code readability and maintainability
feat(store.py): add support for type hinting Union and list types in query parameters for better data validation and documentation
* run make format
* refactor(input_mixin.py): update typing annotations for variables to use union types for better clarity and compatibility with Python 3.10
refactor(inputs.py): update typing annotations for variables to use union types and import necessary modules for compatibility with Python 3.10
* refactor(base.py): remove unnecessary imports and update typing for fields in Input and Output classes
feat(base.py): add support for specifying field types more explicitly in Input and Output classes
feat(frontend_node/base.py): enhance typing and field definitions in FrontendNode class
feat(frontend_node/custom_components.py): improve typing and field definitions in CustomComponentFrontendNode and ComponentFrontendNode classes
feat(template/base.py): update typing for fields in Template class and remove unnecessary imports
* refactor(inputs): remove unnecessary Optional import from typing in input_mixin.py and inputs.py files to improve code readability and maintainability
* refactor(schema.py): change 'Type' to 'type' for consistency in type annotations
refactor(schema.py): change 'list' to 'List' and 'Literal' to 'literal' for correct type hinting in create_input_schema function
* refactor(utils.py): change typing annotations from List and Union to list and type to follow PEP 585 standards
refactor(test_schema.py): change typing annotations from List and List to list and list to follow PEP 585 standards
refactor(test_graph.py): change typing annotations from Type and Union to type and Vertex | None to follow PEP 585 standards
refactor(test_io_schema.py): change typing annotations from List and List to list and list to follow PEP 585 standards
refactor(test_custom_component.py): update file reading method to remove unnecessary "r" mode
refactor(test_helper_components.py): update file reading method to remove unnecessary "r" mode
refactor(test_kubernetes_secrets.py): update b64encode method argument to bytes type
refactor(test_template.py): change typing annotations from Optional, List, and Dict to list, dict, and None to follow PEP 585 standards
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* refactor(input_mixin.py): update typing annotations for variables to use union types for better clarity and compatibility with Python 3.10
refactor(inputs.py): update typing annotations for variables to use union types and import necessary modules for compatibility with Python 3.10
* refactor(base.py): remove unnecessary imports and update typing for fields in Input and Output classes
feat(base.py): add support for specifying field types more explicitly in Input and Output classes
feat(frontend_node/base.py): enhance typing and field definitions in FrontendNode class
feat(frontend_node/custom_components.py): improve typing and field definitions in CustomComponentFrontendNode and ComponentFrontendNode classes
feat(template/base.py): update typing for fields in Template class and remove unnecessary imports
* refactor(inputs): remove unnecessary Optional import from typing in input_mixin.py and inputs.py files to improve code readability and maintainability
* refactor(schema.py): change 'Type' to 'type' for consistency in type annotations
refactor(schema.py): change 'list' to 'List' and 'Literal' to 'literal' for correct type hinting in create_input_schema function
* test: fix tests
---------
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
* refactor: Add _find_matching_output_method to Component class
* feat: allow components to be passed in set method
* fix: Add test for graph set method with valid component
* set value variable to the output callable
* refactor: Update test_component.py to use set_component method
This commit refactors the test_component.py file in the custom_component directory. The test_set_invalid_input() function has been renamed to test_set_component() to better reflect its purpose. Additionally, the test_set_component() function now sets the agent parameter using the set_component() method instead of raising a ValueError. This change improves the readability and maintainability of the code.
* refactor: Fix formatting issue in _build_error_string_from_matching_pairs
The _build_error_string_from_matching_pairs method in the Component class had a formatting issue when input types were empty. This commit fixes the issue by adding a check for empty input types and providing an empty list as a fallback. This improves the accuracy and readability of the error string generated by the method.
* fix(component.py): add validation to ensure output method is a string to prevent potential runtime errors
* refactor(tests): update import statements in conftest.py to use collections.abc module for better compatibility and maintainability
* run pyupgrade on graph module
* [autofix.ci] apply automated fixes
* refactor(attributes.py): change import statement from 'typing.Callable' to 'collections.abc.Callable' for better compatibility
refactor(code_parser.py): update type annotations to use '|' for Union types for better readability
refactor(base_component.py): update type annotations to use '|' for Union types for better readability
refactor(component.py): change import statement from 'typing.Callable' to 'collections.abc.Callable' for better compatibility
refactor(component.py): update type annotations to use '|' for Union types for better readability
refactor(component.py): update type annotations to use 'list' instead of 'List' for consistency
refactor(custom_component.py): update typing imports and annotations for better readability and consistency
refactor(utils.py): change type hint 'List' to 'list' for consistency and compatibility with Python 3.9
* run make format
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* Commit to solve Model not loading issue
The issue was that the url of the models: api/tags was not parsed correctly.
It was having a // hence used urlencode to parse it properly.
Th e correct apporach works only if the base_url is correct,i.e a valid ollama URL:
for DS LF this must be a public ollama Server URL.
* updated the component Ollama Component
changed the get model to take in base url and the function will make the expected url for the model names. This makes the function better, than providing the model url as paramter.
Added Pytest, 7 tests, 1 test excluded for future implememtstion: test_build_model_failure
Make lint and Make format had touched multiple files
* removed unwanted print statements
removed unwanted print statements.
make format, formatted a lot of .tsx files also
* removed skipped tests
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix: improve file name generation in upload_file function to prevent files with the same name
* [autofix.ci] apply automated fixes
* fix: improve file name generation in upload_file function
* [autofix.ci] apply automated fixes
* fix: improve file name generation in upload_file function
* fix: improve file path generation in test_upload_file function
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* refactor: Improve post-processing of return type in type extraction.
* feat: Add support for Union[int, Sequence[str]] in post_process_type.
* refactor(langflow): Simplify return type extraction in CustomComponent.
* Refactor: Remove 'Sequence' and 'list' type options in starter projects.
* test: fix assertion
---------
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
* feat(api): Add endpoint to get list of starter projects with error handling.
* feat: Add test for getting starter projects with valid API key.
* [autofix.ci] apply automated fixes
* refactor(langflow): Update function name from get_all_graphs_dump to get_starter_projects_dump.
* bug: fixes route collision
* bug: fixes serialization
* chore: move endpoint to new file
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
* feat: Add ComponentTool to convert a Component to a Tool
* test(component): add unit test for ComponentTool with ChatInput input.
* feat: Add method to convert Component to ComponentTool.
* feat: Add unit test for ChatInput to Tool conversion.
* chore: add comment
* test: fix assertion
---------
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
* feat: Add function to create input schema from list of input types.
* feat: Add unit tests for creating input schemas.
* refactor(io): Improve input schema creation logic.
* refactor(schema): Simplify eval call in create_input_schema function.
* fix: Change ValueError to TypeError in create_input_schema to reflect correct exception.
* refactor: refactor create_input_schema to accept a list of input instances.
* feat: Add basic prompting graph function.
* feat: Add blog writer starter project function.
* feat(langflow): Add document QA starter project.
* feat: Add memory chatbot graph function to create chatbot with memory component.
* feat: Add hierarchical tasks agent graph to handle sequential tasks.
* feat: Add a function to create a sequential tasks agent with specific tasks.
* feat: Add vector_store_rag module with ingestion and RAG graphs.
* Refactor: Update the hierarchical task agent to use builder methods for agents and models.
* feat: Refactor sequential tasks agent to utilize build_model and build_output methods.
* refactor: Rename functions in blog_writer, document_qa, and vector_store_rag to end with "_graph".
* feat: Add new graphs to starter projects __init__.py.
* feat: Add complex agent graph setup with prompts, tools, and agents.
* refactor: Add complex agent graph to starter projects.
* feat: Add starter project graphs and dump retrieval functions.
* test: Refactor test_directory_without_mocks method with temporary directory for testing purposes.
* refactor: Extract method to set params from normal edge in Vertex class.
* feat: Add method to retrieve value from template dict in Vertex class.
* feat: Add handling for cycle and contract edge targets in ComponentVertex build method.
* refactor: Update result retrieval logic in ComponentVertex class.
* refactor: Add condition to check flow_id before creating log transactions.
* refactor: Add missing `Edge` import and cast `cast` in types.py for better typing.
* refactor: improve function structure in _build_results
* fix: remove function call that overrides Component.outputs
* refactor: Add handling for outputs in __getattr__ method.
* feat: Add functions to detect cycles in directed graphs.
* test: Add new test cases for cycle detection in graph utils.
* test: temporarily disable test
---------
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>