Commit graph

11 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
19818db68b
refactor: update test cases to use unique flow names with UUIDs (#3708)
Refactor test cases to use unique flow names with UUIDs
2024-09-06 14:04:21 -07:00
Jordan Frazier
3643d962b9
fix: deepcopy component output to avoid overriding previous outputs (#3698)
* 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>
2024-09-06 05:23:13 -07:00
Nicolò Boschi
1c87a804bf
chore: improve db session access (#3138)
* chore: improve db session access

* chore: improve db session access

* fix

* [autofix.ci] apply automated fixes

* Refactor session management in test_sqlite_pragmas to use with_session method

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-08-30 14:03:29 -07:00
Gabriel Luiz Freitas Almeida
e42b6bdb94
fix: change ValueError into Warning to allow disconnected flows to run and other small fixes (#3249)
* fix: add task to end all traces on asyncio.CancelledError in build_flow function for better cleanup handling

* fix: replace ValueError with warnings in Graph class when vertices exist without edges for better logging and handling

* chore: add type annotations to test_vector_store_rag_add function

* feat: Fix assertion in test_create_flows to check for substring in name field

The assertion in the test_create_flows function was modified to check if the name field contains the substring "Flow 1" instead of an exact match. This change allows for more flexibility in the test and ensures that the test passes even if there are additional characters in the name field.
2024-08-08 20:21:21 +00:00
Gabriel Luiz Freitas Almeida
919073a0db
feat: import Graph without position information (#3203)
* refactor: Add utility functions for getting handle IDs in CustomNodes

- Added `getRightHandleId` function to generate the right handle ID for source handles.
- Added `getLeftHandleId` function to generate the left handle ID for target handles.
- These functions improve code readability and maintainability by encapsulating the logic for generating handle IDs.

* refactor: Add type for escaped handle IDs in edges to improve type safety in reactflowUtils

* feat: Add function to escape handle IDs in edges, enhancing edge management in reactflowUtils

* feat: Add function to check edges without escaped handle IDs, improving edge validation in reactflowUtils

* feat: Enhance edge processing in reactflowUtils to handle edges without escaped handle IDs more effectively

* feat: Add layoutUtils module for handling node layout using elkjs

* feat: update processDataFromFlow to add layout to nodes if needed

* Refactor import paths to use 'initialize' module in 'base.py'

* feat: Add method to set class source code and integrate it with frontend node input field

* refactor: Update sourceHandle dataType to use custom component class name

* fix: Raise error for unknown vertex types instead of returning default Vertex class

* refactor: Remove redundant call to _import_vertex_types() in VertexTypesDict initialization

* refactor: Simplify add_code_field by removing unnecessary field_config parameter from function signature

* feat: Add elkjs dependency to package.json and package-lock.json for enhanced functionality in the frontend

* refactor: Update fields type in Template class to use InputTypes for improved type safety

* refactor: Reorganize imports in __init__.py for better structure and consistency across the inputs module

* refactor: Clean up imports in types.py for better organization and consistency in the graph vertex module

* refactor: Change vertex type annotations to strings for better compatibility and consistency in the graph module methods

* refactor: Update component instantiation to include _code parameter and fix input type annotations for improved type handling

* refactor: Remove unused CustomComponent import from __init__.py for cleaner module structure and improved organization

* refactor: Modify custom_component instantiation to include _code argument for enhanced functionality and clarity in CodeParser class

* refactor: Update CustomComponent import in __init__.py for improved module structure and organization

* refactor: Update launch.json to include correct path for backend source files

* refactor: Update dependencies in poetry.lock to latest versions and resolve merge conflicts in backend files

* refactor: Update dataType assignment in Component class to use component name if available, or fallback to class name

* refactor: Correct flow_id reference in MemoryComponent to improve clarity and consistency in memory handling

* refactor: Update import path for DefaultPromptField to improve code organization and maintainability in api_utils.py

* refactor: Add loading module to __init__.py for improved organization of interface package

* refactor: Clean up imports in base.py and enforce edge validation in Graph class for improved maintainability and error handling

* refactor: Remove edge component additions in test_base.py to streamline graph tests and emphasize error handling for unprepared graphs

* refactor: Mark @clack/prompts is-unicode-supported as extraneous in package-lock.json for better dependency management

* refactor: Update dataType assignment in Component class to use component name if available, or fallback to class name

* refactor: Fix edge existence check in Graph class to use correct variable, ensuring accurate validation of graph structure

* refactor: Add test for graph with edge and improve graph preparation logic

* refactor: Set default node type to "genericNode" in getLayoutedNodes for consistent layout structure

* create consts for node widht and height

* refactor: Catch and log errors when processing flow data in flowsManagerStore and reactflowUtils

* [autofix.ci] apply automated fixes

* fix: Validate custom components for source and target vertices in Graph edges

* test: Add fixture for client and raise TypeError for invalid class parsing in CodeParser tests

* test: Add unit test for listing flows as Flow objects in custom component with client

* test: Update assertions for memory chatbot component types in unit tests

* test: Refactor assertions to use updated component names in vector store RAG unit tests

* fix: Change error handling to return default Vertex for unknown node types in graph class

* [autofix.ci] apply automated fixes

* test: Add pytest fixture for CustomComponent in unit tests to enhance test structure and readability

* chore: Update component names in vector store RAG unit tests

* test: Refactor imports and make flow name generation unique in database unit tests

* chore: Remove unused upload and flow management functions from flowsManagerStore for cleaner codebase

* chore: Await processDataFromFlow in useAddFlow hook

* chore: Correct NODE_HEIGHT calculation to use NODE_WIDTH constant for consistency in constants file

* chore: Remove extraneous flag for is-unicode-supported in package-lock.json for cleaner dependency management

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-07 07:04:48 -07:00
ming
1dd840c526
feat: set sqlite pragma by env variable (#3136)
* set sqlite pragma by env variable

* configurable

* [autofix.ci] apply automated fixes

* fix circular dep

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Nicolò Boschi <boschi1997@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-01 12:48:00 +00:00
Cristhian Zanforlin Lousa
c2b5b98b64
bugfix: add steps to delete flows caused by new constraints (#3045)
* 📝 (flows.py): refactor delete_multiple_flows function to improve readability and efficiency
 (use-delete-flows.ts): add useDeleteFlows hook to handle deletion of multiple flows in frontend
♻️ (index.tsx): refactor handleDeleteMultiple function to use useDeleteFlows hook for deleting multiple flows
🔧 (actionsMainPage-shard-1.spec.ts): add test for selecting and deleting a flow in end-to-end tests

* 📝 (flows.py): Remove unused imports and variables to clean up the code and improve readability
♻️ (flows.py): Refactor code to remove unnecessary import and variable declarations, making the code more concise and maintainable

* add unit tests to delete multiple flows with transactions and build

* format

* add assert on tests
2024-07-30 13:41:54 +00:00
Nicolò Boschi
c7575b18df
feat: migrate vertex_builds to sql database (#2978)
* feat: migrate vertex_builds to sql database

* [autofix.ci] apply automated fixes

* name

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-29 14:58:19 +00:00
Nicolò Boschi
9ac861da2f
feat: migrate transactions to sql database (#2915)
* feat: migrate transactions to sql database

* feat: migrate transactions to sql database

* feat: migrate transactions to sql database

* feat: migrate transactions to sql database

* feat: migrate transactions to sql database

* feat: migrate transactions to sql database

* [autofix.ci] apply automated fixes

* remove useless

* remove useless

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-26 14:57:38 +00:00
Cristhian Zanforlin Lousa
61265cc327
feat: change download flows to download as .zip file (#2870)
* 📝 (flows.py): Add endpoint to download multiple flows as a zip file
📝 (constants.ts): Add FLOWS constant for API endpoint
📝 (index.ts): Add use-post-download-multiple-flows query function
📝 (use-post-download-multiple-flows.ts): Implement function to download multiple flows as a zip file
📝 (index.tsx): Import usePostDownloadMultipleFlows in componentsComponent
📝 (index.tsx): Implement handleExport function to download multiple flows as a zip file
📝 (index.tsx): Update handleExport function to handle downloading and saving the zip file
📝 (headerComponent.tsx): Add shouldSelectAll state and setShouldSelectAll function to manage select all functionality

* formatting file

* 📝 (flows.py): Remove download_file endpoint and refactor download_multiple_file to support downloading multiple flows as a zip file
📝 (index.tsx): Refactor export functionality to handle exporting multiple flows as a zip file or a single flow as a JSON file
🔧 (use-post-download-multiple-flows.ts): Update API endpoint for downloading flows
🔧 (index.tsx): Remove unused imports and functions related to exporting flows
🔧 (reactflowUtils.ts): Remove unused downloadFlows function and related imports

* [autofix.ci] apply automated fixes

* 📝 (flows.py): remove unnecessary whitespace and improve code readability by aligning function parameters in download_multiple_file function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-23 14:41:55 +00:00
Gabriel Luiz Freitas Almeida
0122a50a35
refactor: move tests folder structure and update pytest commands (#2785)
* refactor: move tests folder to src/backend

* chore(Makefile): update pytest commands to run tests from the correct directory paths for unit and integration tests

* refactor: update file path in test_custom_component.py

The file path in the test_custom_component.py file has been updated to use the correct relative path to the component_multiple_outputs.py file. This change ensures that the test code can access the correct file and improves the reliability of the test.
2024-07-18 15:19:43 +00:00
Renamed from tests/unit/test_database.py (Browse further)