* feat: add MockLanguageModel for testing language model interactions
- Introduced a new mock implementation of BaseLanguageModel to facilitate unit testing.
- Implemented methods to simulate responses and handle message processing.
- Added functionality to generate mock responses based on input messages.
- Ensured compatibility with existing language model interfaces for seamless integration in tests.
* refactor: simplify test_structured_output_component by replacing MagicMock with MockLanguageModel
- Removed extensive mock implementations of BaseLanguageModel in tests.
- Replaced instances of MagicMock with a new MockLanguageModel for better clarity and maintainability.
- Streamlined test cases for structured output generation and error handling.
- Ensured compatibility with existing test structure while enhancing readability.
* fix: rename utils.py to useful.py to avoid namespace conflict
---------
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
* fix(tests): update supported versions in constants.py to include new releases
- Updated SUPPORTED_VERSIONS to reflect the latest versions: 1.0.19, 1.1.0, and 1.1.1.
- This change ensures that tests are aligned with the most current versioning.
* refactor(tests): update file_names_mapping for input, output, and prompt components
- Removed outdated version entries (1.0.15 to 1.0.18) and added new versions (1.1.0 and 1.1.1) for ChatInput, TextInput, ChatOutput, and Prompt components.
- Ensures test cases are aligned with the latest component versions for improved accuracy and reliability.
* fix(tests): update file_names_mapping in TestTextOutputComponent to reflect new versioning
- Removed outdated version entries (1.0.17, 1.0.18) and added new versions (1.1.0, 1.1.1) for TextOutput component.
- Ensures test cases are aligned with the latest component versions for improved accuracy and reliability.
fix(tests): update ComponentTestBase to skip tests when file_names_mapping is empty
- Modified the test method to skip the test instead of raising an AssertionError when no file names mapping is provided.
- Improved user feedback by providing a clear message indicating the reason for skipping the test.
* feat: improve gitloader component
* [autofix.ci] apply automated fixes
* feat(git.py): refactor GitLoaderComponent to support asynchronous operations and improve temporary directory management
- Convert methods to async to enhance performance with file operations.
- Implement async context manager for handling temporary clone directories.
- Update binary file check and content filtering to be asynchronous.
* fix(git.py): enhance GitLoaderComponent with improved file filtering and binary check
- Refactor file filtering logic to utilize fnmatch for pattern matching.
- Introduce a new method to check for binary files based on null byte detection.
- Update content filtering to handle exceptions more gracefully.
- Modify temporary directory cleanup to use rmdir instead of remove for better directory management.
- Adjust load_documents method to utilize asyncio.to_thread for lazy loading of documents.
* refactor(git.py): enhance GitLoaderComponent with improved file filtering and binary check
- Refactor binary file check to be synchronous and handle exceptions more gracefully.
- Introduce new methods for checking file patterns and content patterns, allowing for more flexible filtering.
- Consolidate filtering logic into a single method for better maintainability.
- Update load_documents method to run lazy loading in a separate thread for improved performance.
* feat(tests): add unit tests for GitLoaderComponent file filtering and binary detection
- Introduced new test suite for GitLoaderComponent, including tests for binary file detection and file pattern matching.
- Implemented temporary file creation for testing various file types and permissions.
- Added tests for combined filtering functionality, ensuring robust handling of file and content patterns.
* refactor(git.py): improve pattern handling and content filtering in GitLoaderComponent
- Refactored pattern handling to use a more descriptive variable name `pattern_list` for clarity.
- Enhanced content filtering by ensuring proper encoding when reading file content.
- Updated regex validation to include a test string check for better error handling.
- Removed unnecessary comments to streamline the code and improve readability.
* fix: exception TypeError
TypeError: object async_generator can't be used in 'await' expression
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
* Added Minimized field to backend to make component start as minimized
* Added minimized as true to chat components
* Added showNode default value as the opposite of minimized
* Changed starter projects to new components
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* Fixed Freeze and DecisionFlow tests
* Fixed other tests that involved chatoutput and chatinput
* Restored tests that didnt fail
* Fixed stop playground test
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix: update pre-commit configuration for ruff formatting args
* fix: update variable type constant from GENERIC_TYPE to CREDENTIAL_TYPE
* feat: enhance variable service to handle decryption for generic type and update default variable type to CREDENTIAL_TYPE
* feat: add abstract method to retrieve all variables for a user in VariableService
* feat: implement get_all method in KubernetesSecretService to retrieve and decrypt user variables
* refactor: update variable tests to use fixtures for generic and credential types
- Renamed and refactored test fixtures for better clarity and reusability.
- Updated tests to utilize `generic_variable` and `credential_variable` fixtures instead of hardcoded values.
- Enhanced assertions to ensure correct handling of variable types, including encryption for credential variables and decryption for generic variables.
- Improved test structure for creating, reading, updating, and deleting variables, ensuring consistency across test cases.
* refactor: update get_all method signatures in variable services to return VariableRead
- Changed return type of the get_all method in VariableService, KubernetesSecretService, and DatabaseVariableService from list[Variable | None] to list[VariableRead].
- This update enhances type consistency across variable services and aligns with the new VariableRead model for improved data handling.
* fix: update variable type assertion in test_update_variable to CREDENTIAL_TYPE
- Changed the assertion in the `test_update_variable` test to verify that the result type is now `CREDENTIAL_TYPE` instead of `GENERIC_TYPE`.
- This update aligns the test with recent changes in variable type handling, ensuring accurate validation of variable updates.
* fix: update variable type assertion in test_create_variable to CREDENTIAL_TYPE
- Changed the assertion in the `test_create_variable` test to verify that the result type is now `CREDENTIAL_TYPE` instead of `GENERIC_TYPE`.
- This update ensures consistency with recent changes in variable type handling and improves the accuracy of the test validation.
* add dataframe operations component
* populate entire new column with value
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* [autofix.ci] apply automated fixes
* Add unit tests for DataFrame operations in `test_dataframe_operations.py`
* **Import modules**
- Import `pytest` and `pandas` for testing DataFrame operations
* **Define test cases**
- Define test cases for edge cases like empty DataFrames and invalid column names
- Include tests for operations like "Head", "Tail", and "Replace Value"
- Use `pytest.mark.parametrize` to test multiple operations with different inputs
- Add detailed assertions to verify the correctness of DataFrame operations
* [autofix.ci] apply automated fixes
* Remove test cases for DataFrame operations from `test_dataframe_operations.py`. This deletion includes all unit tests related to various DataFrame operations such as adding, dropping, filtering, and renaming columns, as well as handling edge cases like empty DataFrames and invalid operations. The removal streamlines the test suite by eliminating outdated or redundant tests.
* Add unit tests for DataFrame operations in
- Introduced a new test file for organizing test components.
- Updated import paths for to reflect the new module structure.
- Refactored test cases to use for better readability and maintainability.
- Enhanced assertions in tests for various DataFrame operations, including handling of empty DataFrames and invalid operations.
- Improved code formatting for consistency and clarity.
* Refactor DataFrameOperationsComponent for improved readability and maintainability
- Consolidated import statements for clarity.
- Renamed variable `df` to `dataframe_copy` for better understanding.
- Streamlined the `perform_operation` method by replacing `elif` with `if` statements for clearer logic flow.
- Enhanced error message for unsupported operations to improve debugging.
These changes aim to enhance the code structure and make future modifications easier.
* Update unit tests for DataFrame operations in `test_dataframe_operations.py`
- Modified expected values in parameterized tests for various DataFrame operations, including "Add Column", "Filter", "Sort", "Head", "Tail", and "Replace Value" to reflect new test scenarios.
- Adjusted assertions to ensure they correctly validate the output of operations, particularly for lists of expected values.
- Enhanced error handling in the test for invalid operations to provide clearer feedback on unsupported operation types.
These changes improve the accuracy and robustness of the unit tests for DataFrame operations.
* Refactor DataFrameOperationsComponent methods to return DataFrame instances consistently
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* refactor: improve type checking and initialization in BaseComponent class
- Moved UUID import to TYPE_CHECKING for better type hinting without runtime overhead.
- Reorganized the initialization of class attributes within the __init__ method for clarity and consistency.
- Enhanced the __setattr__ method to handle potential KeyError and AttributeError when checking immutability of _user_id.
* refactor: streamline CustomComponent initialization and enhance attribute management
- Introduced ClassVar constants for better clarity and organization.
- Removed redundant class attributes and restructured instance attribute initialization for improved readability.
- Ensured that instance-specific attributes are initialized before calling the parent class's constructor.
- Enhanced the overall structure of the CustomComponent class to facilitate future maintenance and development.
* refactor: enhance Component initialization and attribute management
- Reorganized the __init__ method to initialize instance-specific attributes before calling the parent class constructor.
- Introduced new instance attributes for better management of inputs, outputs, and internal state.
- Improved clarity by processing input kwargs and ensuring unique ID assignment for components.
- Streamlined the setup process for inputs and outputs, enhancing overall structure and maintainability.
* test: Add unit tests for ChatInput component to verify attribute independence
* add style for message feedback
* add backend suprot to new feature
* update frontend interface and add handle function
* [autofix.ci] apply automated fixes
* Update tooltip content for bot messages
* Update evaluation icons styling
* Add custom thumb icons for thumbs up and thumbs down
* Add custom thumb icons for thumbs up and thumbs down
* Update thumb icons based on evaluation value
* [autofix.ci] apply automated fixes
* Update property name for positive feedback
* Update property name for positive feedback
* feat: Add data-testid attributes to helpful and not helpful buttons and update test of playground to include new functionality
* update test to include new message features
* test: add unit test for database url validation
* feat: add function to validate database urls
* refactor: use new database url validation function
* fix: ruff errors
* refactor: validate database urls using sqlalchemy
* test: add more cases for database url validation
* Update sqlmodel dependency to version 0.0.20 in pyproject.toml
* Handle UUID conversion for message IDs in memory update logic
* Refactor Alembic migrations to use `sa.inspect` and update GUID to Uuid type
* refactor: Change flow_id parameter type from str to uuid.UUID in graph building functions
* refactor: Ensure UUID handling for flow_id and user_id across various services and models
* refactor: improve UUID handling and graph caching for compatibility with sqlmodel 0.0.20
* fix: update message assertion in component events test
* chore: update sqlmodel dependency to version 0.0.22 in uv.lock and pyproject.toml
* fix: enhance flow_id validation to ensure valid UUID format in MessageBase model
* fix: add error handling for cache directory cleanup
* refactor: improve flow_id type handling in message storage
* refactor: enhance flow_id handling in message functions to support UUID type
* refactor: integrate Properties into message creation in component event tests
* update test durations
* fix: correct flow_id parameter in database query
* refactor: update session_id and flow_id parameters to support UUID type across message handling functions and models
* fix: handle message data update in SQLModel update method
* refactor: improve flow_id assignment in message update method to enhance UUID handling