Commit graph

253 commits

Author SHA1 Message Date
Lucas Oliveira
af052285ec
refactor: queries loading order and wrapper order (#3603)
* Added loading page

* Removed unused loadings and changed loading to LoadingPage

* Refactored ComponentsComponent to receive info from parent

* refactored headerTabsComponent to receive loading from parent

* Added loading of folders into MyCollectionComponent

* removed unused loading and folderSelected

* updated get config api call to update everything

* Make app wait for autoLogin to be set to execute everything else

* changed API type to not contain params if its undefined

* Updated get autologin to do all logic regarding autologin

* Updated other queries with the new useQueryFunctionType type

* Updated App.tsx with new gets and configurations and added a loader before loading the router

* Made ProtectedRoute refresh on authentication change

* Fixed order of wrappers in order for Auth and  API context to have access to router

* Made loading only exist in one place

* 📝 (folders.spec.ts): remove unused test for adding folder by drag and drop to improve test suite cleanliness and maintainability.

* Fixed flow dropping to another folder

*  (folders.spec.ts): add test for adding folder by drag and drop functionality
🔧 (auto-save-off.spec.ts): add click event for "Save And Exit" button
🔧 (dragAndDrop.spec.ts): change dispatchEvent to getByTestId and add assertions for specific text visibility
🔧 (store-shard-3.spec.ts): increase timeout for page.waitForTimeout to improve test reliability

*  (folders.spec.ts): update test description to be more descriptive and accurate

* test: improve timeout for page.waitForSelector in auto-save-off.spec.ts

* feat: add replace button functionality to main page

The code changes include adding the functionality for the replace button on the main page. This allows users to replace a flow or a component. The replace button is now visible on the page, and clicking on it triggers the appropriate action.

Recent user commits:
- test: improve timeout for page.waitForSelector in auto-save-off.spec.ts
-  (folders.spec.ts): update test description to be more descriptive and accurate
-  (folders.spec.ts): add test for adding folder by drag and drop functionality
- 🔧 (auto-save-off.spec.ts): add click event for "Save And Exit" button
- 🔧 (dragAndDrop.spec.ts): change dispatchEvent to getByTestId and add assertions for specific text visibility
- 🔧 (store-shard-3.spec.ts): increase timeout for page.waitForTimeout to improve test reliability

Recent repository commits:
- test: improve timeout for page.waitForSelector in auto-save-off.spec.ts
-  (folders.spec.ts): update test description to be more descriptive and accurate
-  (folders.spec.ts): add test for adding folder by drag and drop functionality
- 🔧 (auto-save-off.spec.ts): add click event for "Save And Exit" button
- 🔧 (dragAndDrop.spec.ts): change dispatchEvent to getByTestId and add assertions for specific text visibility
- 🔧 (store-shard-3.spec.ts): increase timeout for page.waitForTimeout to improve test reliability
- Fixed flow dropping to another folder
- 📝 (folders.spec.ts): remove unused test for adding folder by drag and drop to improve test suite cleanliness and maintainability.
- Made loading only exist in one place
- Fixed order of wrappers in order for Auth and API context to have access to router
- Made ProtectedRoute refresh on authentication change
- Updated App.tsx with new gets and configurations and added a loader before loading the router
- Updated other queries with the new useQueryFunctionType type

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-08-29 12:10:26 +00:00
Cristhian Zanforlin Lousa
7641e81ca3
fix: add retriever input_type on RetrieverToolComponent + tests (#3601)
*  (RetrieverTool.py): add "input_types" field to the configuration of the RetrieverToolComponent class

*  (generalBugs-shard-12.spec.ts): add end-to-end test for connecting RetrieverTool to other components in the application.
2024-08-28 12:02:42 -07:00
Cristhian Zanforlin Lousa
9ae4e29815
tests: improve delete rows from table message test (#3598)
🐛 (generalBugs-shard-1.spec.ts): Fix timing issues in end-to-end test by adding explicit waits for elements to be visible before interacting with them
2024-08-28 11:38:23 -07:00
Cristhian Zanforlin Lousa
b1f79a5511
tests: Add Integration with starter-projects Endpoint and Vector Store Test (#3599)
*  (App.tsx): Add useGetStarterProjectsQuery hook to fetch starter projects data
📝 (constants.ts): Add STARTER_PROJECTS constant to define the endpoint for starter projects API
📝 (use-get-starter-projects.ts): Create useGetStarterProjectsQuery hook to fetch starter projects data
📝 (index.tsx): Add AppWrapperPage test for drag and drop functionality with starter projects data
📝 (starter-projects.spec.ts): Add end-to-end test for drag and drop functionality with starter projects data

*  (starter-projects.spec.ts): update test description to be more descriptive and specific about the test scenario

* ♻️ (App.tsx): remove unused useGetStarterProjectsQuery hook to clean up code and improve readability

* 🔧 (App.tsx): remove unused import useGetStarterProjectsQuery to clean up code and improve readability
2024-08-28 11:37:50 -07:00
Lucas Oliveira
d6537b724e
refactor: routes and back button (#3600)
* Changed ProtectedRoute to handle refresh token

* Created DashboardWrapperPage to insert header into elements

* Changed routes to be contained by only one ProtectedRoute

* Removed refresh and get version query of App.tsx

* Added loading if user not authenticated in ProtectedAdminRoute

* Changed page layout to not contain header

* Changed AdminPage and FlowPage to not have headers

* Removed unused variables

* Refactored redirectToLastLocation of headerComponent

* Removed unused track last visited path

* changed viewPage to not set onFlowPage since it's used only on header

* Added flow fetching into Playground page

* Fixed back button not working between flows

* Changed duplicate requests to show which request failed

* Refactored useGetBuilds to remove duplicated request

* Re-added get version query and config query

* [autofix.ci] apply automated fixes

* Fix tests that rely on autosave delay

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-28 16:52:11 +00:00
Cristhian Zanforlin Lousa
b5116e6f68
tests: fix dropdown components test (#3504)
*  (dropdownComponent.spec.ts): add missing test case for dropdownComponent to improve test coverage and ensure functionality
🔧 (dropdownComponent.spec.ts): update test case to include additional interactions with the page to simulate user behavior and improve test robustness

*  (dropdownComponent.spec.ts): update mouse wheel scroll distance to 800 to improve test reliability
📝 (dropdownComponent.spec.ts): add additional wait time to ensure stability in test execution

* 🔧 (dropdownComponent.spec.ts): remove unnecessary code related to hovering and scrolling in the dropdown component test to improve test readability and maintainability
2024-08-22 07:10:31 -07:00
Cristhian Zanforlin Lousa
8dd85d98b6
fix: auto_login=off error on login and editing a user + FE tests (#3471)
* 🐛 (users.py): Fix issue where user password was not being updated correctly
📝 (constants.ts, authContext.tsx, index.tsx): Add LANGFLOW_REFRESH_TOKEN constant and update related code to support refresh token functionality
📝 (userManagementModal/index.tsx): Update form reset logic and handle input values correctly
📝 (LoginPage/index.tsx, LoginAdminPage/index.tsx): Update login function to include refresh token parameter
📝 (components/index.ts, auth.ts): Update inputHandlerEventType to support boolean values

 (auto-login-off.spec.ts): Add end-to-end test for user login functionality with auto_login set to false, CRUD operations for users, and verification of user flows visibility based on permissions.

*  (auto-login-off.spec.ts): improve test description for better clarity and understanding
📝 (auto-login-off.spec.ts): add comments to clarify the purpose of intercepting requests and performing CRUD operations

* 🐛 (users.py): fix comparison of password to check for None using 'is not None' instead of '!= None' for better accuracy
2024-08-21 15:55:47 +00:00
Cristhian Zanforlin Lousa
4c496496e5
tests: improve tests removing unnecessary timeouts and decreasing some (#3437)
* feat: Add data-testid attribute to main page title

The code changes add a `data-testid` attribute to the main page title in the `PageLayout` component. This attribute can be used for testing purposes.

* refactor: Update page load timeout in end-to-end test

Reduce the page load timeout in the end-to-end test for Basic Prompting to improve test efficiency. The timeout is decreased from 2000ms to 1000ms.

* refactor: Decrease page load timeout in end-to-end test

Reduce the page load timeout in the end-to-end test for Basic Prompting to improve test efficiency. The timeout is decreased from 2000ms to 1000ms.

* refactor: Decrease page load timeout in end-to-end test

* refactor: Update page load timeout in end-to-end test

* refactor: Decrease page load timeout in end-to-end test

* refactor: Decrease page load timeout in end-to-end test

* refactor: Decrease page load timeout in end-to-end test

* refactor: Decrease page load timeout in end-to-end test

* refactor: Decrease page load timeout in end-to-end test

* refactor: Decrease page load timeout in end-to-end test

* refactor: Decrease page load timeout in end-to-end test

Reduce the page load timeout in the end-to-end test for Basic Prompting to improve test efficiency. The timeout is decreased from 2000ms to 1000ms.

* improve tests decreasing and removing time outs
2024-08-19 18:33:40 -03:00
Cristhian Zanforlin Lousa
feb3c18ef2
tests: Reduce Timeout on Tests for Basic Examples Modal (#3429)
* reducing timeout on tests basic examples modal

* reducing timeout on tests basic examples modal

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-08-19 17:11:33 -03:00
Cristhian Zanforlin Lousa
595746e797
fix: Fix api_key missing error when adding a flow in ComposIO + tests (#3432)
* 🐛 (ComposioAPI.py): Fix issue where build_config was not being updated correctly when api_key is not empty

* 🐛 (GenericNode/index.tsx): Fix potential null pointer exception by adding non-null assertion operator to info property access
 (generalBugs-shard-11.spec.ts): Add end-to-end tests to ensure users can use ComposIO without api_key error and connect tools successfully
2024-08-19 19:45:09 +00:00
Cristhian Zanforlin Lousa
66110f24e2
tests: Add Tests for New Auto-Saving Feature (#3428)
*  (index.tsx): Add data-testid attribute to the save button for testing purposes
 (auto-save-off.spec.ts): Add end-to-end test for manually saving a flow when auto_save is off

* ⬆️ (auto-save-off.spec.ts): decrease wait time from 5000ms to 3000ms for improved test efficiency

* moving auto-save-off test to scheduled folder
2024-08-19 16:17:03 -03:00
Cristhian Zanforlin Lousa
08d2d89e4f
tests: add freeze component feature test (#3365)
 (freeze.spec.ts): Add end-to-end test for freezing a component to ensure the functionality works as expected.
2024-08-19 14:15:06 +00:00
Cristhian Zanforlin Lousa
c03677c4fb
tests: add test to stop building feature (#3364)
*  (use-icons-status.tsx): Add data-testid attribute to Loading component for testing purposes
 (index.tsx): Add data-testid attribute to stop building button for testing purposes
 (stop-building.spec.ts): Add end-to-end test to ensure user can stop a building process

*  (stop-building.spec.ts): Add additional tests to ensure the user can stop a building process successfully and verify the button functionality.

* test(stop-building.spec.ts): Comment out wait timeouts

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-08-19 09:22:32 -03:00
Cristhian Zanforlin Lousa
a5cdab68bb
tests: Categorize Tests into CI and Scheduled Groups (#3391)
* categoring tests

*  (actionsMainPage-shard-1.spec.ts): Add end-to-end tests for selecting and deleting items, searching flows, and searching components on the main page to ensure proper functionality and user experience.

* 📝 (frontend/tsconfig.json): update file paths in include section to match the correct directory structure for scheduled-end-to-end tests.

* 🔧 (typescript_test.yml): update path in the command to change directory to run end-to-end tests in the frontend folder
📝 (typescript_test.yml): improve comments for better readability and understanding of the workflow logic

* add yml configuration to choose folder to run CI

* 🔧 (ci.yml): Fix formatting issues and add support for running tests in a specific folder
📝 (ci.yml): Update job dependencies to improve readability and maintainability of the workflow configuration

* ♻️ (typescript_test.yml): refactor matrix values for shardIndex and shardTotal to reduce redundancy and improve readability

* categoring tests

*  (actionsMainPage-shard-1.spec.ts): Add end-to-end tests for selecting and deleting items, searching flows, and searching components on the main page to ensure proper functionality and user experience.

* 📝 (frontend/tsconfig.json): update file paths in include section to match the correct directory structure for scheduled-end-to-end tests.

* 🔧 (typescript_test.yml): update path in the command to change directory to run end-to-end tests in the frontend folder
📝 (typescript_test.yml): improve comments for better readability and understanding of the workflow logic

* add yml configuration to choose folder to run CI

* 🔧 (ci.yml): Fix formatting issues and add support for running tests in a specific folder
📝 (ci.yml): Update job dependencies to improve readability and maintainability of the workflow configuration

* ♻️ (typescript_test.yml): refactor matrix values for shardIndex and shardTotal to reduce redundancy and improve readability

* 🐛 (fileUploadComponent.spec.ts): fix file path for file upload to correctly locate the test file in the assets folder

* changing test_folder

*  (fileUploadComponent.spec.ts): update file path for file upload test to match new file location in the project structure

* fix input on playwright command
2024-08-16 18:13:47 -03:00
Lucas Oliveira
7264028e41
refactor: optimize flow saving functionality and implement manual saving (#3283)
* fixed patch update flow

* fixed update flow patch to receive id by payload

* created save flow hook with auto save and manual save functions

* fix poetry lock

* added auto save check with environment variable

* removed unused user

* separated autosave and put the flow as a creation with nodes and edges

* removed set nodes that skipped saving

* implemented auto save hook

* removed autosave from setNodes and setEdges

* added auto save hook and saved on viewport move and added useEffect to save on nodes and edges changed

* changed type of setNodes

* removed unused var

* removed deletion of empty flow

* Added saving of flow on button when autoSave is disabled

* disable saving when the nodes are empty

* removed save loading as false when the access token is renewed

* implemented useDebounce

* added save loading to save flow hook

* removed setting nodes and edges on fetching, since they are set when the current flow is updated

* removed unused var

* use debounce hook to save flow

* set nodes and edges on current flow id change

* removed useplaygroundeffect

* removed unused import

* put set save loading before the If

* removed flow cleaning and inputs setting, since the inputs and outputs are set on the ResetFlow function

* updated to use ResetFlow function to update everything regarding flow

* removed flow pool get on resetFlow, for it to be fetched only if the user is inside the flow

* updated packagelock

* Changed router to outlet on app.tsx to use createRouter

* Created authSettingsGuard to guard the general settings

* Fixed routes to use createBrowserRouter to allow the use of useBlocker

* Changed index.tsx to use RouterProvider and the router just created

* Changed flowStore to have a local flow state

* Implemented setting the current flow state when saving the flow

* Added the update of current flow when auto saving

* changed current flow to use the current flow from Flow Store instead of Flows Manager Store

* Changed codeTabsComponent Tweaks check to show if its checked

* Removed unused variables

* Removed browser router from context wrapper

* Removed unused console.log

* Changed initialSetup to just run when opening the modal

* changed confirmationModal to have destructiveCancel and to only call onCancel if the other buttons were not pressed

* Created a SaveChangesModal that confirms if the user wants to save their changes

* Get folder by id when folder id changes too

* Changed reset flow calls to store whole flow

* Added check if user is exiting page to prevent him when there are unsaved changes

* Added new types on ConfirmationModalType

* Implement save on clicking the save button on the header

* added save component shortcut to use save shortcut as save flow

* added save component shortcut on shortcutsStore type

* changed save shortcut to save component on node toolbar

* added save shortcut to header menubar

* changed shortcuts name to be compatible with existing ones

* changed shortcuts to be backwards compatible

* changed save to changes to maintain retrocompatibility

* changed save_component to save to maintain retrocompatibility

* Changed time difference to unsaved changes

* changed the toolbar select item to get the right save shortcut

* Changed save flow to use current flow from useFlowStore instead of the previous saved flow

* changed changesNotSaved to include flow name and metadata

* Added way of saving the flow settings just locally instead of directly to database

* Changed shareModal to save flow with hook

* removed old auto saving on connect

* Removed save functions from flowsManagerStore

* refactor: Remove unused imports and state variables in EditFlowSettings component

* use current flow not saved one and refactored page to not receive flow

* added check of isFlowPage to display the menubar

* Added checks to render playground if API key is valid and if Flows exists

* Added check to not display X on chat on playground page

* Updated flows variable to be undefined by start to prevent things from loading before flows initialize

* Implemented log builds parameter to not allow the builds to be logged if user not on flowPage
2024-08-12 22:21:52 +00:00
anovazzi1
48ffdbf760
feat: Add suggestion message to API exception response (#3149)
* feat: suggest updating outdated components in API exception handling

Suggest updating the outdated components in the API exception handling. This commit adds a suggestion message to the API exception response when there are outdated components in the flow. The suggestion message provides the number of outdated components and recommends updating them. The suggestion is generated based on the list of outdated components obtained from the flow data.

* feat: refactor code

* [autofix.ci] apply automated fixes

* Update src/backend/base/langflow/exceptions/api.py

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* Update src/backend/base/langflow/api/utils.py

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* Update src/backend/base/langflow/exceptions/api.py

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* update function name

* [autofix.ci] apply automated fixes

* refactor: fix import casing in langflow.api.utils and langflow.exceptions.api

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* refactor: remove unused code and update exception handling in langflow.api.utils and langflow.exceptions.api

* [autofix.ci] apply automated fixes

* refactor: update exception handling and class  in langflow.api.utils and langflow.exceptions.api

* [autofix.ci] apply automated fixes

* update function name and refactor none flow logic

* [autofix.ci] apply automated fixes

* refactor: fix typo in get_suggestion_message function name

* refactor: improve get_suggestion_message function in langflow.api.utils

* refactor: add unit tests for get_suggestion_message and get_outdated_components functions

* refactor: add unit tests for APIException in langflow.exceptions.api

* refactor: improve test coverage for APIException and related functions

* [autofix.ci] apply automated fixes

* update file name

* refactor: update build_exception_body method in APIException to handle Exception type

* refactor: handle None flow data in get_components_versions

* [autofix.ci] apply automated fixes

* refactor: update useDeleteBuilds function signature in _builds API query

* fix: Fix test changing screen before request ended

---------

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-07 15:26:24 +00:00
Lucas Oliveira
4d66bf351d
refactor: add flow and upload flow functionality (#3200)
* Removed unused function and fixed tags initial value

* Added post save flow

* Added update flow patch

* removed unused import

* created useAddFlow hook to substitute AddFlow function on flowsManager store

* fixed post save flow to handle endpoint name as undefined

* Fixed add flow hook to use post save flow mutation

* removed unused  line

* changed addFlow to use hook in all components that use addFlow

* Removed unused code

* removed addFlow of useDuplicateFlows call

* made newProject default as true

* removed unused variables from addFlow

* fixed url of requests of flows

* passed functions directly

* fix app to display loading on top of the router

* fixed promise of addFlow

* Added upload flow hook with a lot of modularity

* Fixed addFlow naming

* Added helper functions for file uploading

* Changed upload flow to use helper functions

* removed refresh on post

* changed paste function to handle when chatinput node exists on paste

* Used helper function to create input on FileInput

* Used helper function to create input on InputFileComponent

* Used helper function to create input on folder upload, and used uploadFlow hook

* used uploadFlow hook on dropdown options

* used addFlow instead of addComponent on node toolbar

* changed upload flow on headerComponent to use hook

* Changed pageComponent to use uploadFlow hook

* removed useFileDrop dependency

* Fixed onFileDrop to use uploadFlow

* removed useDropdown dependency

* removed unused add and upload functions from flowsManagerStore

* Clean flows and refetch when flow change, added loader when is fetching

* Changed loading to the useQuery isPending

* changed post to add flow

* fixed error when uploading other thing that is not a JSON not appearing

* changed useAddFlow to handle empty params too

* Fixed loading every time we switch tabs

* Fixed unnecessary list and !

* Fixed reference bug

* Inserted cloneDeep to prevent reference bugs

* Fixed tests of drag and drop

* Fixed flows not being refreshed when uploading

* [autofix.ci] apply automated fixes

* fixed folders test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-06 21:52:47 +00:00
Nicolò Boschi
34fe3a8a6a
fix: frozen status is lost after run (#3158)
* fix: frozen status is lost after run

* [autofix.ci] apply automated fixes

* add FE tests to freeze feature

---------

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: Cristhian Zanforlin Lousa <72977554+Cristhianzl@users.noreply.github.com>
2024-08-02 18:04:53 +02:00
Gabriel Luiz Freitas Almeida
51e082933e
feat: add to_frontend_node to Component (#3122)
* refactor: update code references to use _code instead of code

* refactor: add backwards compatible attributes to Component class

* refactor: update Component constructor to pass config params with underscore

Refactored the `Component` class in `component.py` to handle inputs and outputs. Added a new method `map_outputs` to map a list of outputs to the component. Also updated the `__init__` method to properly initialize the inputs, outputs, and other attributes. This change improves the flexibility and extensibility of the `Component` class.

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* refactor: change attribute to use underscore

* refactor: update CustomComponent initialization parameters

Refactored the `instantiate_class` function in `loading.py` to update the initialization parameters for the `CustomComponent` class. Changed the parameter names from `user_id`, `parameters`, `vertex`, and `tracing_service` to `_user_id`, `_parameters`, `_vertex`, and `_tracing_service` respectively. This change ensures consistency and improves code readability.

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* refactor: update BaseComponent to accept UUID for _user_id

Updated the `BaseComponent` class in `base_component.py` to accept a `UUID` type for the `_user_id` attribute. This change improves the type safety and ensures consistency with the usage of `_user_id` throughout the codebase.

* refactor: import nanoid with type annotation

The `nanoid` import in `component.py` has been updated to include a type annotation `# type: ignore`. This change ensures that the type checker ignores any errors related to the `nanoid` import.

* fix(custom_component.py): convert _user_id to string before passing to functions to ensure compatibility with function signatures

* feat(component.py): add method to set output types based on method return type to improve type checking and validation in custom components

* refactor: extract method to get method return type in CustomComponent

* refactor(utils.py): refactor code to use _user_id instead of user_id for consistency and clarity

perf(utils.py): optimize code by reusing cc_instance instead of calling get_component_instance multiple times

* refactor(utils.py, base.py): change parameter name 'add_name' to 'keep_name' for clarity and consistency in codebase

* [autofix.ci] apply automated fixes

* refactor: update schema.py to include Edge related typres

The `schema.py` file in the `src/backend/base/langflow/graph/edge` directory has been updated to include the `TargetHandle` and `SourceHandle` models. These models define the structure and attributes of the target and source handles used in the edge data. This change improves the clarity and consistency of the codebase.

* refactor: update BaseInputMixin to handle invalid field types gracefully

The `BaseInputMixin` class in `input_mixin.py` has been updated to handle invalid field types gracefully. Instead of raising an exception, it now returns `FieldTypes.OTHER` for any invalid field type. This change improves the robustness and reliability of the codebase.

* refactor: update file_types field alias in FileMixin

The `file_types` field in the `FileMixin` class of `input_mixin.py` has been updated to use the `alias` parameter instead of `serialization_alias`. This change ensures consistency and improves the clarity of the codebase.

* refactor(inputs): update field_type declarations in various input classes to use SerializableFieldTypes enum for better type safety and clarity

* refactor(inputs): convert dict to Message object in _validate_value method

* refactor(inputs): convert dict to Message object in _validate_value method

* refactor(inputs): update model_config in BaseInputMixin to enable populating by name

The `model_config` attribute in the `BaseInputMixin` class of `input_mixin.py` has been updated to include the `populate_by_name=True` parameter. This change allows the model configuration to be populated by name, improving the flexibility and usability of the codebase.

* refactor: update _extract_return_type method in CustomComponent to accept Any type

The _extract_return_type method in CustomComponent has been updated to accept the Any type as the return_type parameter. This change improves the flexibility and compatibility of the method, allowing it to handle a wider range of return types.

* refactor(component): add get_input and get_output methods for easier access to input and output values

The `Component` class in `component.py` has been updated to include the `get_input` and `get_output` methods. These methods allow for easier retrieval of input and output values by name, improving the usability and readability of the codebase.

* refactor(vertex): add get_input and get_output methods for easier access to input and output values

* refactor(component): add set_output_value method for easier modification of output values

The `Component` class in `component.py` has been updated to include the `set_output_value` method. This method allows for easier modification of output values by name, improving the usability and flexibility of the codebase.

* feat: add run_until_complete and run_in_thread functions for handling asyncio tasks

The `async_helpers.py` file in the `src/backend/base/langflow/utils` directory has been added. This file includes the `run_until_complete` and `run_in_thread` functions, which provide a way to handle asyncio tasks in different scenarios. The `run_until_complete` function checks if an event loop is already running and either runs the coroutine in a separate event loop in a new thread or creates a new event loop and runs the coroutine. The `run_in_thread` function runs the coroutine in a separate thread and returns the result or raises an exception if one occurs. These functions improve the flexibility and usability of the codebase.

* refactor(component): add _edges attribute to Component class for managing edges

The `Component` class in `component.py` has been updated to include the `_edges` attribute. This attribute is a list of `EdgeData` objects and is used for managing edges in the component. This change improves the functionality and organization of the codebase.

* fix(component.py): fix conditional statement to check if self._vertex is not None before accessing its attributes

* refactor(component): add _get_fallback_input method for handling fallback input

The `Component` class in `component.py` has been updated to include the `_get_fallback_input` method. This method returns an `Input` object with the provided keyword arguments, which is used as a fallback input when needed. This change improves the flexibility and readability of the codebase.

* refactor(component): add TYPE_CHECKING import for Vertex in component.py

* refactor(component): add _map_parameters_on_frontend_node and _map_parameters_on_template and other methods

The `Component` class in `component.py` has been refactored to include the `_map_parameters_on_frontend_node` and `_map_parameters_on_template` methods. These methods are responsible for mapping the parameters of the component onto the frontend node and template, respectively. This change improves the organization and maintainability of the codebase.

* refactor(component): Add map_inputs and map_outputs methods for mapping inputs and outputs

The `Component` class in `component.py` has been updated to include the `map_inputs` and `map_outputs` methods. These methods allow for mapping the given inputs and outputs to the component, improving the functionality and organization of the codebase.

* refactor(component): Add Input, Output, and ComponentFrontendNode imports and run_until_complete function

This commit refactors the `component.py` file in the `src/backend/base/langflow/custom/custom_component` directory. It adds the `Input`, `Output`, and `ComponentFrontendNode` imports, as well as the `run_until_complete` function from the `async_helpers.py` file. These changes improve the functionality and organization of the codebase.

* refactor(component): Add map_inputs and map_outputs methods for mapping inputs and outputs

* refactor(component): Add _process_connection_or_parameter method for handling connections and parameters

The `Component` class in `component.py` has been updated to include the `_process_connection_or_parameter` method. This method is responsible for handling connections and parameters based on the provided key and value. It checks if the value is callable and connects it to the component, otherwise it sets the parameter or attribute. This change improves the functionality and organization of the codebase.

* refactor(frontend_node): Add set_field_value_in_template method for updating field values

The `FrontendNode` class in `base.py` has been updated to include the `set_field_value_in_template` method. This method allows for updating the value of a specific field in the template of the frontend node. It iterates through the fields and sets the value of the field with the provided name. This change improves the flexibility and functionality of the codebase.

* refactor(inputs): Add DefaultPromptField class for default prompt inputs

The `inputs.py` file in the `src/backend/base/langflow/inputs` directory has been refactored to include the `DefaultPromptField` class. This class represents a default prompt input with customizable properties such as name, display name, field type, advanced flag, multiline flag, input types, and value. This change improves the flexibility and functionality of the codebase.

* feat: Add Template.from_dict method for creating Template objects from dictionaries

This commit adds the `from_dict` class method to the `Template` class in `base.py`. This method allows for creating `Template` objects from dictionaries by converting the dictionary keys and values into the appropriate `Template` attributes. This change improves the flexibility and functionality of the codebase.

* refactor(frontend_node): Add from_dict method for creating FrontendNode objects from dictionaries

* refactor: update BaseComponent to use get_template_config method

Refactored the `BaseComponent` class in `base_component.py` to use the `get_template_config` method instead of duplicating the code. This change improves code readability and reduces redundancy.

* feat: add BaseModel class with model_config attribute

A new `BaseModel` class has been added to the `base_model.py` file. This class extends the `PydanticBaseModel` and includes a `model_config` attribute of type `ConfigDict`. This change improves the codebase by providing a base model with a configuration dictionary for models.

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* refactor: update langflow.graph.edge.schema.py

Refactor the `langflow.graph.edge.schema.py` file to include the `TargetHandle` and `SourceHandle` models. This change improves the clarity and consistency of the codebase.

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* refactor: update build_custom_component_template to use add_name instead of keep_name

Refactor the `build_custom_component_template` function in `utils.py` to use the `add_name` parameter instead of the deprecated `keep_name` parameter. This change ensures consistency with the updated method signature and improves code clarity.

* feat(component.py): add method to set output types based on method return type to improve type checking and validation in custom components (#3115)

* feat(component.py): add method to set output types based on method return type to improve type checking and validation in custom components

* refactor: extract method to get method return type in CustomComponent

* refactor: update _extract_return_type method in CustomComponent to accept Any type

The _extract_return_type method in CustomComponent has been updated to accept the Any type as the return_type parameter. This change improves the flexibility and compatibility of the method, allowing it to handle a wider range of return types.

* refactor: add _template_config property to BaseComponent

Add a new `_template_config` property to the `BaseComponent` class in `base_component.py`. This property is used to store the template configuration for the custom component. If the `_template_config` property is empty, it is populated by calling the `build_template_config` method. This change improves the efficiency of accessing the template configuration and ensures that it is only built when needed.

* refactor: add type checking for Output types in add_types method

Improve type checking in the `add_types` method of the `Output` class in `base.py`. Check if the `type_` already exists in the `types` list before adding it. This change ensures that duplicate types are not added to the list.

* update starter projects

* refactor: optimize imports in base.py

Optimize imports in the `base.py` file by removing unused imports and organizing the remaining imports. This change improves code readability and reduces unnecessary clutter.

* fix(base.py): fix condition to check if self.types is not None before checking if type_ is in self.types

* refactor: update build_custom_component_template to use add_name instead of keep_name

* fix(userSettings.spec.ts): update visibility check to ensure the correct element is interacted with in end-to-end test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-02 12:49:09 +00:00
Lucas Oliveira
83e48affb1
refactor: global variables logic (#3144) 2024-08-01 20:26:29 +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
Cristhian Zanforlin Lousa
a811834b93
refactor: change endpoint monitor/builds to use useQuery (#2622)
*  (constants.ts): add BUILDS endpoint to URLs constants
 (index.ts): create index file for builds-related queries
 (use-delete-builds.ts): implement useDeleteFLowPool hook for deleting builds

*  (chatView): integrate useDeleteFlowPool hook for deleting flow pool
♻️ (chatView): refactor clearChat function to use mutateFlowPool for deletion

* ♻️ (use-delete-builds.ts): rename useDeleteFLowPool to useDeleteBuilds for clarity
♻️ (index.tsx): update import and usage of useDeleteFLowPool to useDeleteBuilds

*  (API): add use-get-builds query to fetch build data
 (PageComponent): integrate use-get-builds query for fetching builds
 (flowStore): add setters for inputs, outputs, and hasIO in flowStore

* ♻️ (flowStore.ts): refactor hasIO to derive its value from inputs and outputs
🔥 (flowStore.ts): remove unused resetFlow function to clean up the codebase

* ♻️ (use-get-builds.ts): refactor useGetBuildsQuery to remove unused params
 (PageComponent): add logic to handle flow state, inputs, outputs, and viewport
♻️ (flowStore): refactor and add resetFlow method to handle flow state reset

*  (chatComponent): add data-testid attributes for better testability
 (generalBugs-shard-3.spec.ts): add end-to-end test for playground button state

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-07-29 22:56:54 +00:00
Cristhian Zanforlin Lousa
1710bca2b6
tests: add tests to chat memory component (#3039)
* ♻️ (crud.py): refactor delete_vertex_builds_by_flow_id function to correctly delete vertex builds by flow_id using relationship attribute instead of column comparison.

* 📝 (generalBugs-shard-0.spec.ts): Remove unnecessary test case and add new test case for chat messages clearing functionality
 (generalBugs-shard-8.spec.ts): Add new test case for interacting with API request
 (generalBugs-shard-9.spec.ts): Add new test case for testing chat memory functionality
2024-07-29 21:22:26 +00:00
Nicolò Boschi
58b51d1c56
feat: bedrock access with aws access key (#3032)
* feat: bedrock access with aws access key

* [autofix.ci] apply automated fixes

* chore: ignore type import in AmazonBedrockEmbeddings.py and AmazonBedrockModel.py

---------

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-07-29 21:18:21 +00:00
Igor Carvalho
6fa3c7b17d
refactor: api keys API (#2652)
* feat: create useDeleteApiKey hook to handle api keys delete

* refactor: use mutation to handle delete api key

* [autofix.ci] apply automated fixes

* feat: create useGetApiKeys hook

* refactor: use useGetApiKeysQuery hook to get api keys data

* [autofix.ci] apply automated fixes

* refactor: change interface name

* refactor: remove unnused loading state and use react state instead of react ref to ensure component render

* fix: multiple refreshs when auto_login=false

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-29 19:04:58 +00:00
Sebastián Estévez
cffed2c9be
fix: astra-assistants types (#2881)
* merge

* [autofix.ci] apply automated fixes

* support for MultilineSecretInput

* add support for MultilineSecretInput

* [autofix.ci] apply automated fixes

* ruff

* align eye-icon

* tweaks and modal

* [autofix.ci] apply automated fixes

* textare edit modal hidden text plus eye icon

* fix pydantic serialization warning

* [autofix.ci] apply automated fixes

* chore: Add password visibility toggle to text area components

* [autofix.ci] apply automated fixes

* fix list assistants

* fix: remove extraneous property from is-unicode-supported dependency

* fix: update TextAreaComponent styling for edit node table

Adjust the styling of the TextAreaComponent in the edit node table to fix the positioning of the side-bar button. The right margin of the button was changed from 5.2rem to 4.2rem to align it correctly with the text area. This change improves the visual consistency of the edit node table.

* fix modal not sync with outside state

* add comment for future devs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-07-29 17:56:05 +00:00
Lucas Oliveira
f7ad36b211
fix: ctrl a not working on edit node table (#2992)
* removed console log and fixed nulland

* Fixed ag grid version mismatch

* Fixed unused import

* Fixed ctrl+a not working on edit node and tweaks

* Fixed styling on editnode

* Made it work on mac

*  (generalBugs-shard-7.spec.ts): add end-to-end test for selecting all with ctrl + A on advanced modal to ensure functionality works as expected

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-07-26 19:21:17 +00:00
Lucas Oliveira
a9863a050e
refactor: parameter component, edit node modal and api modal (#2928)
* changed column defs to receive handleOnNewValue and use it to change Advanced variable

* Exported function isTargetHandleConnected

* Refactored types of setNodeClass

* Exported type of handleOnNewValue

* Refactored useHandleNodeClass to only handle changes to node data

* Refactored toggleCellRender to handle advanced values by itself with the handleOnNewValue

* changed setNodeClass types and disabled hook

* changed handleNodeClass on parametercomponent

* changed handleNodeClass on the two components that used it

* refactor: Update handleNodeClass to accept newNodeClass and type only

* Refactor EditNodeModal component to use new handleNodeClass and columnDefs

* Changed columnDefs to receive new handleNodeClass and not receive useless parameters

* changed cellTypeStr to strRender

* Refactored inputFileComponent to use the new handleOnNewValue

* Refactored keypairList to convert values on the fly

* added parameterRenderComponent that renders all parameters in one place

* Exported parameterRenderComponent

* Changed tableNodeCellRender to use ParameterRenderComponent

* changed parameterredercomponent to receive name

* changed strrendercomponent to receive name

* changed nodecellrender to pass name and to check if value is undefined before assigning on templateData

* chore: Refactor use-handle-new-value to handle undefined values in changes

* Used ParameterRenderComponent at parameterComponent

* Refactored parameterRenderComponent to include refresh button

* Created refresh parameter component

* Added nodeId to parameterrendercomponent call

* Removed unused variable

* Refactored refreshButton

* Fixed parameters not showing when they dont have a value

* Created a tweakComplnent that renders the tweak individually, with the same table as the EditNode

* Created tweaks component, that renders all tweaks

* Changed tableNodeCellRender to pass setNode as well

* changed handleOnNewValue to use custom setNode if specified

* added editNodeComponent that handles the table and rowData and columnDefs

* changed editNodeModal to use editNodeComponent instead of table

* changed columndefs type to handle setNode and hideVisibility optional parameters

* changed useRowData to not use myData, and just use nodeClass

* Changed codeTabsPropsType tweaks property to include only the ncessary

* changed codeTabsComponent to use TweaksComponent and handle an internal nodes state

* changed apiModal to handle the tweaks build by finding the differences between old and current node

* fix bug on API modal that refresh tweaks table all the time

* Created new tweaks store type

* Added tweaks store with all of the logic needed to get the tweaks on the API page

* refactored TweakComponent to hold an temporary state to prevent the table from rerendering

* Added TweakComponent into TweaksComponent

* Removed external state on tableAdvancedToggle, making every state come from the Stores

* Removed external state from TableNodeCellRender and added isTweaks to choose which store to use

* Added SetNode type on HandleOnNewValue

* Added custom setNode to handleNodeClass

* Removed unused logic from apiModal

* removed unused old code

* Changed type of getChangesTypes

* Transformed string into object on get codes

* Changed getNodesWithDefaultValue to return nodes that will appear on Tweaks, as well as just the allowed parameters

* added hasTweaks to tabs

* added check of template keys to update the local nodeClass state, allowing the table to be updated just when the number of parameters changes

* passed isTweaks to columnDefs

* removed unused state and passed isTweaks to value getters

* Removed unused state

* updated tabsArrayType with hasTweaks and removed unused types

* Added local nodes tweaks state to the codetabscomponent and refactored conditions of display

* removed unused console.log

* changed advanced toggle to use parameterid given by the value

* changed nodecellrender to use parameter id given by the value

* passed parameter id by value to the renderers

* removed nodeClass from columnDefs definition

* Fixed isTargetHandleConnected returning error if field is undefined

* Fix performance issues on edit node modal

* Fixed scroll overflow issues on tweaksComponent

* Revert "Revert "refactor: update template api, handleonnewvalue and handlenodeclass hooks (#2628)""

This reverts commit 236ae82cabba2fa1128f498d781099facd222b57.

* 📝 (tweaksTest.spec.ts): remove redundant code and improve readability by simplifying the interaction with elements in the test case

* added custom id for tests

*  (frontend): Add unique id prop to input components for better testability and accessibility.

 (Hierarchical Tasks Agent.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (Memory Chatbot.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (Sequential Tasks Agent.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (chatInputOutputUser-shard-0.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (chatInputOutputUser-shard-1.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (chatInputOutputUser-shard-2.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (decisionFlow.spec.ts): Update input list element IDs to improve clarity and consistency
 (decisionFlow.spec.ts): Update prompt area element IDs to improve clarity and consistency
 (decisionFlow.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (freeze-path.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (generalBugs-shard-0.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (generalBugs-shard-1.spec.ts): Update dropdown element IDs to improve clarity and consistency
 (generalBugs-shard-3.spec.ts): Update dropdown element IDs to improve clarity and consistency

🔧 (logs.spec.ts, textInputOutput.spec.ts): update dropdown test selectors to match changes in the frontend codebase

* Fixed prompt not holding the value when validating

* Fixed range spec on int component

* Fixed OpenAI Model max tokens range spec

*  (dropdownComponent.spec.ts): Update dropdown test cases to use more descriptive test IDs for better clarity and maintainability
📝 (fileUploadComponent.spec.ts): Add explicit wait for "Run Flow" button to ensure it is loaded before clicking
📝 (folders.spec.ts): Update file path in readFileSync function to use an absolute path for better reliability
📝 (freeze-path.spec.ts): Refactor test code to remove commented out code and improve readability by using more descriptive test IDs and removing unnecessary code snippets

 (inputListComponent.spec.ts): Update test file to use consistent naming convention for input elements in the InputListComponent
📝 (intComponent.spec.ts): Refactor test file to use consistent naming convention for input elements in the IntComponent

 (nestedComponent.spec.ts): Update test steps and interactions for nestedComponent to improve test coverage and accuracy.

📝 (promptModalComponent.spec.ts): Update test selectors for prompt modal component to improve consistency and readability
📝 (textAreaModalComponent.spec.ts): Update test selectors for text area modal component to improve consistency and readability
📝 (toggleComponent.spec.ts): Update test selectors for toggle component to improve consistency and readability

* 🐛 (intComponent.spec.ts): fix incorrect value comparison in test for IntComponent
🐛 (intComponent.spec.ts): fix missing test step for clicking on a specific element in IntComponent test

* 📝 (Vector Store.spec.ts): increase timeout for waiting for "built successfully" text to improve test reliability and prevent false negatives

* Fixed folders test

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-07-26 18:32:24 +02:00
Cristhian Zanforlin Lousa
44ffe8e6cd
refactor: change downloadFolders requests to use useQuery hook (#2920)
*  (sidebarComponent): Add support for downloading folders in the sidebar component to allow users to download folder data as JSON files
🔧 (sidebarComponent): Remove unused import and function related to downloading folders to clean up the codebase
📝 (use-get-download-folders): Add a new function to handle downloading folders from the API in a separate file for better code organization
♻️ (MainPage/services): Remove unused functions related to downloading and uploading flows from folders to simplify the services file and improve maintainability
🔧 (foldersStore): Remove unused import and function related to uploading flows from folders to clean up the codebase

* 📝 (sideBarFolderButtons/index.tsx): add error handling logic to display error message when downloading folder fails

* update error message

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-07-25 01:25:27 +00:00
Gabriel Luiz Freitas Almeida
a22b76534b
fix: update button role in end-to-end test (#2936)
refactor: update button role in end-to-end test

Update the button role in the end-to-end test to use "Check & Save" instead of "Save".
2024-07-24 17:16:08 -07:00
Cristhian Zanforlin Lousa
544e763c2d
test: improve test to allow any errors checks (#2926)
🐛 (generalBugs-shard-6.spec.ts): fix test assertion to check for error message length greater than 20 instead of 50 for improved accuracy
2024-07-24 18:13:01 +00:00
Cristhian Zanforlin Lousa
c83006e066
bugfix: add returning promises on interceptor errors + tests (#2896)
* 🐛 (generalBugs-shard-5.spec.ts): fix test to wait for elements to be interactable before performing actions to prevent flakiness

* 📝 (API/api.tsx): return error in promise rejection to handle errors properly
📝 (codeAreaModal/index.tsx): add data-testid attribute to title element for testing purposes
 (generalBugs-shard-6.spec.ts): add end-to-end test for error handling in Code Modal

* 📝 (generalBugs-shard-6.spec.ts): update test description for better clarity and grammar
2024-07-23 15:33:48 -03:00
Cristhian Zanforlin Lousa
ae096a3167
test: add new tests based on new basic examples + vector store tests (#2879)
* 🔧 (.github/workflows/typescript_test.yml): add BRAVE_SEARCH_API_KEY secret to workflow environment variables
 (frontend/src/modals/IOModal/components/chatView/chatMessage/index.tsx): add data-testid attribute to div element for testing purposes
 (frontend/tests/end-to-end/Hierarchical Tasks Agent.spec.ts): add end-to-end test for Hierarchical Tasks Agent
 (frontend/tests/end-to-end/Sequential Tasks Agent.spec.ts): add end-to-end test for Sequential Tasks Agent

* updating hierarchical task json

* 🔧 (.github/workflows/typescript_test.yml): add secrets for ASTRA_DB_APPLICATION_TOKEN and ASTRA_DB_API_ENDPOINT
♻️ (playwright.config.ts): refactor timeout value to 3 minutes
📝 (Complex Agent.spec.ts): update test to use BRAVE_SEARCH_API_KEY instead of OPENAI_API_KEY
📝 (Complex Agent.spec.ts): update test to use "apple" instead of "agile"
📝 (Hierarchical Tasks Agent.spec.ts): update test to use "langflow" instead of "agile"
📝 (Sequential Tasks Agent.spec.ts): update test to use waitForTimeout instead of isVisible

 (Vector Store.spec.ts): Add checks to skip tests if required environment variables are not set
🔧 (Vector Store.spec.ts): Update test logic to fill in required environment variables before running tests to ensure proper test execution
2024-07-22 21:30:30 +00:00
Cristhian Zanforlin Lousa
7007c05a08
test: fix output group preview test to be interactive (#2880)
* 🐛 (generalBugs-shard-5.spec.ts): fix test to wait for elements to be interactable before performing actions to prevent flakiness

* change temperature on canvas beside on component
2024-07-22 20:50:07 +00:00
Cristhian Zanforlin Lousa
4b9dc47021
test: Add New Test for Freeze Path Feature and Improve Existing Tests (#2833)
* 📝 (floatComponent/index.tsx): Add data-testid attribute to float input for testing purposes
🐛 (end-to-end tests): Update test selectors to match changes in component names for consistency and accuracy

 (freeze-path.spec.ts): Add end-to-end test for user ability to freeze a path in the application
🐛 (generalBugs-shard-0.spec.ts): Fix outdated component selector in end-to-end test for clearing chat messages
🐛 (generalBugs-shard-1.spec.ts): Fix outdated component selector in end-to-end test for deleting rows from a table message

🐛 (generalBugs-shard-3.spec.ts): Fix outdated component issue by updating the selector for the AlertTriangle icon and the API key input field, and selecting a different model option
🐛 (logs.spec.ts): Fix outdated component issue by updating the selector for the AlertTriangle icon and the API key input field, and selecting a different model option. Also, ensure the "built successfully" text is clicked within a specified timeout
🐛 (textInputOutput.spec.ts): Fix outdated component issue by updating the selector for the AlertTriangle icon and the API key input field, and selecting a different model option

* ⬆️ (typescript_test.yml): increase shardTotal value to 16 to match the updated shardIndex values for better test distribution.

* 📝 (inputComponent.spec.ts): remove unnecessary test case for clicking and checking collection name input field in InputComponent test to improve test focus and readability.

* Revert "refactor: update template api, handleonnewvalue and handlenodeclass hooks (#2628)"

This reverts commit b3c1b941b3.

*  (inputComponent.spec.ts): add test case to check if the input element is checked after clicking on it

*  (multiselectComponent/index.tsx): Refactor value assignment to handle both array and non-array values more efficiently
🔧 (inputComponent.spec.ts, intComponent.spec.ts, saveComponents.spec.ts): Update file paths to point to the correct location of test assets

*  (filterSidebar.spec.ts): comment out two failing test expectations for helpersChat Memory and agentsTool Calling Agent to prevent test failures
📝 (folders.spec.ts): update file path to read collection.json from the correct location
📝 (saveComponents.spec.ts): update file path to read flow_group_test.json from the correct location

* ⬆️ (typescript_test.yml): increase the number of shardIndex values from 16 to 20 to distribute tests more evenly across shards.

* 📝 (folders.spec.ts): update file path to read collection.json file to fix file not found error

* add condition to merge-reports

*  (filterSidebar.spec.ts): update test to check for visibility of agentsCSVAgent element instead of agentsTool Calling Agent element
🐛 (folders.spec.ts): increase timeout for page.waitForTimeout to 5000ms and add a comment suggesting to consider using a more reliable waiting mechanism. Also, add a comment to wait for the target element to be available before evaluation.

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-22 15:15:31 +00:00
Cristhian Zanforlin Lousa
9c9d916d80
test: fix general test and CI (#2839)
🔧 (typescript_test.yml): Remove unnecessary steps and conditions in GitHub Actions workflow file
🔧 (authContext.tsx): Update cookie key from LANGFLOW_ACCESS_TOKEN to LANGFLOW_API_TOKEN for consistency
🔧 (Basic Prompting.spec.ts): Update test to click on correct dropdown option
🔧 (filterEdge-shard-0.spec.ts): Update test to check for correct element
🔧 (filterSidebar.spec.ts): Update test to check for correct elements
🔧 (generalBugs-shard-5.spec.ts): Update test to interact with correct element
🔧 (inputComponent.spec.ts): Update test to interact with correct elements
🔧 (store-shard-1.spec.ts): Update test to interact with correct elements and remove unnecessary code
2024-07-19 18:38:14 +00:00
Cristhian Zanforlin Lousa
dc5ac092fb
test: Add Test to Prevent Bug on Output Inspection for Grouped Components (#2667)
* add new test for bug on output inspection + grouped components

* [autofix.ci] apply automated fixes

* 🔧 (typescript_test.yml): increase shard count from 14 to 15 to distribute tests more evenly
🔧 (typescript_test.yml): fix syntax issues in conditional expressions

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-12 20:10:00 +00:00
Cristhian Zanforlin Lousa
eb0a70f646
fix: adjust function that add incremental name on flows that already exists + tests (#2645)
* 🐛 (reactflowUtils.ts): fix addVersionToDuplicates to exclude the updated flow from existing names to prevent naming conflicts

*  (menuBar): add data-testid to flow configuration button for testing
 (sideBarFolderButtons): add data-testid to delete folder button for testing
 (folders.spec.ts): update test to use new data-testid for delete folder button
 (generalBugs-shard-4.spec.ts): add new end-to-end test for flow operations

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-07-12 17:14:38 +00:00
Nicolò Boschi
eb3420523e
feat: migrate chains and memories to Component syntax (#2528)
* feat: migrate chains and memories to Component syntax

* use base class

* add classes

* [autofix.ci] apply automated fixes

* fix tests

* fix tests

*  (filterSidebar.spec.ts): increase waitForTimeout from 1000ms to 2000ms to ensure elements are fully loaded before interaction

---------

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: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: Cristhian Zanforlin Lousa <72977554+Cristhianzl@users.noreply.github.com>
2024-07-05 16:30:23 +00:00
Cristhian Zanforlin Lousa
2b8d314e30
test: fix test after changes on LLMs components (#2538)
*  (tests): remove redundant test assertions in filterEdge-shard-0.spec.ts
 (tests): add new test assertions and remove redundant ones in filterEdge-shard-1.spec.ts

*  (filterSidebar.spec.ts): add test for visibility of helpersID Generator
♻️ (filterSidebar.spec.ts): remove redundant visibility test for textsplittersCharacterTextSplitter

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-04 18:54:01 +00:00
Cristhian Zanforlin Lousa
fb21fdda5e
fix: spec files cant find .env variable on CI (#2514)
* bugfix: add env import to spec files correctly

* 🔧 (ci.yml): fix indentation for consistency and readability in CI workflow

* ci: add inputs to workflow

* bugfix: improve flaky test general bugs to run smoothier on CI

* ci: add more shards to improve tests on CI
2024-07-04 01:36:07 +00:00
Lucas Oliveira
fe21f90aec
fix: prompt template not being saved on advanced modal (#2488)
* Fixed dbvalue on table node cell renderer

* Added Change Advanced hook

* Added Handle New Value hook

* Added Handle Node Class hook

* Added Node Class handler to TableNodeCellRender

* Removed internal state of EditNode, added internal state for NodeClass and made the rows and columns be updated when NodeClass changes

* Added NodeClass as dependencies on useMemo to update columns when NodeClass changes

* Fixed advanced not changing the node

* feat: updating tests without save btn

* Added Close button on editNode

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-07-03 17:55:52 +00:00
Cristhian Zanforlin Lousa
74845ffae9
fix: memory chat bot name (#2509)
* chore: refresh starter projects components

* format

* bugfix: change memory chatbot to correct name

* bugfix: change memory chatbot to correct name

---------

Co-authored-by: Nicolò Boschi <boschi1997@gmail.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-03 10:34:13 -07:00
Gabriel Luiz Freitas Almeida
a3bf1c4502
ci: update CI workflows and add CI workflow (#2498)
* chore(workflows): update lint-js.yml and lint-py.yml workflows to include support for workflow_call and workflow_dispatch events with optional branch input for checkout

* chore(docs_test.yml): update workflow triggers to include workflow_call and workflow_dispatch events

* ci(python_test.yml): update workflow to trigger on workflow_dispatch event and add support for optional branch input parameter to checkout specific branch for testing

* chore(typescript_test.yml): remove unnecessary pull_request event types to streamline workflow configuration

* feat(ci.yml): add CI workflow for automated testing and linting of backend, frontend, and documentation code

* chore: update release.yml to include CI workflow for automated testing and linting

* chore(typescript_test.yml): remove unnecessary 'if: always()' condition from merge-reports job

* chore(ci): add typescript_test.yml to the list of files included in the frontend job for CI workflow

* chore(ci.yml): fix typo in file path for typescript_test.yml in the frontend job of CI workflow

* chore(ci.yml): update path-filter job in CI workflow to include frontend tests and fix typo in file path for typescript_test.yml

* chore(ci.yml): add concurrency configuration to improve workflow efficiency

fix(ci.yml): include tests output in the filter paths job to run frontend tests when needed

* chore(ci.yml): update CI workflow to remove lint-frontend job

* chore(ci.yml): restructure CI workflow to improve readability and maintainability
feat(ci.yml): add separate jobs for frontend tests, backend linting, and docs build to enhance testing coverage
feat(ci.yml): introduce a final job 'CI Success' to check the status of all previous jobs and provide a summary of the CI pipeline execution

* ci(ci.yml): add dependencies between jobs to ensure proper execution order and avoid unnecessary runs

* chore(ci.yml): reformat YAML file for better readability and consistency in indentation
feat(ci.yml): add support for running backend tests, frontend tests, linting backend code, and testing docs build in CI workflow
feat(ci.yml): introduce a final step 'CI Success' to check the status of all previous jobs and exit with appropriate code based on their results

* chore(ci.yml): Remove concurrency configuration and cancel-in-progress option from lint-js, lint-py, python_test, and style-check-py workflows

* chore(ci.yml): Update pull_request event types in js_autofix.yml workflow to remove auto_merge_enabled

* chore: Remove concurrency configuration and cancel-in-progress option from typescript_test.yml workflow

* refactor: change add store key inside test

* ♻️ (tests): remove hardcoded API key and use environment variable
 (tests): add environment variable check to skip tests if not set

*  (store-shard-2.spec.ts): add test skip condition for STORE_API_KEY
 (store-shard-2.spec.ts): implement test for sharing component with API key

*  (store-shard-2.spec.ts): update navigation step in end-to-end test to click "My Collection" instead of going to home page

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-07-03 08:24:35 -07:00
Cristhian Zanforlin Lousa
871271e69e
fix: update tests FE (#2493)
* bugfix: update tests FE

*  (tests): add end-to-end tests for deleting components and flows
 (tsconfig.json): update tsconfig to include new deleteFlows.spec.ts test file

* ♻️ (dropdownComponent.spec.ts): remove redundant test cases for showendpoint_url to streamline test suite

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-02 18:39:17 -07:00
Nicolò Boschi
2787bec4fb
ci: skip tests with openai key required (#2477)
* ci: skip tests with openai key required

* ci: skip tests with openai key required

* ci: skip tests with openai key required

* [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>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-07-02 06:20:13 -07:00
Cristhian Zanforlin Lousa
e8517e067a
removing duplicate tests from frontend (#2459)
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-01 20:24:28 +00:00
Gabriel Luiz Freitas Almeida
f06657d985 Merge branch 'dev' into dev_to_main 2024-07-01 15:04:56 -03:00
Cristhian Zanforlin Lousa
b0fcb91d35 add a new test for a huge flow -> decisionFlow (#2456)
* add test to decision flow

* add test to decision flow

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-07-01 13:53:55 -03:00
cristhianzl
3ecb223c87 fix: Remove unused code in textInputOutput.spec.ts
``
2024-07-01 13:53:55 -03:00