Commit graph

5,828 commits

Author SHA1 Message Date
anovazzi1
2d3490c047 refactor(types): change isComponent property to is_component in FlowType and NodeType to follow naming convention
refactor(utils): change isComponent property to is_component in createFlowComponent function to match updated naming convention
2023-10-19 16:16:43 -03:00
anovazzi1
2963bbdf53 fix(typesContext.tsx): import createFlowComponent function from reactflowUtils to fix compilation error
fix(typesContext.tsx): update assignment of custom_components in data object to use correct property name
fix(typesContext.tsx): update assignment of custom_components in data object to use correct property value
fix(typesContext.tsx): update assignment of components in savedComponentsJSON to use createFlowComponent function
fix(typesContext.tsx): update setData function to use functional update to avoid stale state
fix(entities/index.ts): update type of components property in localStorageUserType to use FlowType
fix(flow/index.ts): update property name isNode to isComponent in FlowType
fix(reactflowUtils.ts): update property name isNode to isComponent in createFlowComponent function
2023-10-19 16:08:29 -03:00
Gabriel Luiz Freitas Almeida
2a25865340 🐛 fix(flow.py): make 'is_component' field nullable to allow for optional values 2023-10-19 16:05:54 -03:00
anovazzi1
9c6930bd0f Merge remote-tracking branch 'origin/dev' into saveComponent 2023-10-19 15:17:12 -03:00
anovazzi1
3e8384eff9 update package json 2023-10-19 15:16:13 -03:00
anovazzi1
337f0f8794 fix(parameterComponent): update readonly condition to only check for data.node?.flow
fix(promptComponent): prevent update from prompt template after group node if prompt is wrongly marked as not dynamic
fix(EditNodeModal): update readonly condition to only check for myData.current.node?.flow
2023-10-19 15:02:32 -03:00
anovazzi1
5a5ed630ed
update har file getAll content (#1075) 2023-10-19 14:42:22 -03:00
anovazzi1
b0bbe39c89 update har file getAll content 2023-10-19 14:40:27 -03:00
Gabriel Luiz Freitas Almeida
b19c75dc3c 🐛 fix(api_key.py): rename api_key parameter to api_key_request in save_store_api_key function for clarity and consistency 2023-10-19 14:28:48 -03:00
Gabriel Luiz Freitas Almeida
c5262f39f2 🔒 refactor(api_key.py): update encrypt_api_key function call to pass settings_service as a keyword argument for clarity and maintainability 2023-10-19 14:08:51 -03:00
Gabriel Luiz Freitas Almeida
68e5cb4cce Merge remote-tracking branch 'origin/main' into dev 2023-10-19 11:04:09 -03:00
Gabriel Luiz Freitas Almeida
218788d5df 🔧 chore(Makefile): exclude alembic directory from ruff linting to avoid unnecessary errors
🔧 chore(Makefile): add exclusion of alembic directory from ruff linting to improve linting process
2023-10-19 10:59:44 -03:00
Gabriel Luiz Freitas Almeida
f080c75d6a 🐛 fix(utils.py): add padding to SECRET_KEY before initializing Fernet to ensure it has the correct length 2023-10-19 10:57:52 -03:00
Gabriel Luiz Freitas Almeida
0286353695 🐛 fix(base.py): include vertex ID in error message to provide more context when building a node fails 2023-10-19 09:25:53 -03:00
cristhianzl
2fbb68d6a6 fix(keyPairListComponent.spec.ts): fix typo in test case description
fix(keyPairListComponent.spec.ts): update test case to fill input field with a value containing spaces for better coverage
fix(keyPairListComponent.spec.ts): add assertion to check if input field value with spaces is correctly filled
fix(keyPairListComponent.spec.ts): update test case to fill input field with a value containing spaces for better coverage
fix(keyPairListComponent.spec.ts): update assertion to check if input field value with spaces is correctly filled
2023-10-18 23:58:09 -03:00
cristhianzl
64aea7f589 feat(API): add function to add an API key to the API key store
This commit adds a new function `addApiKeyStore` to the API controller. This function is used to add an API key to the API key store by making a POST request to the `/api_key/store` endpoint with the provided key. If the request is successful (status code 200), the function returns the response data. If there is an error, it is logged to the console and re-thrown.
2023-10-18 23:33:22 -03:00
Cristhian Zanforlin Lousa
c939edbb2b
Fix no space no keyPairList (#1072)
fix(reactflowUtils.t): modify convertValuesToNumbers function to
correctly handle values that are numbers represented as strings
feat(reactflowUtils.ts): add check to convertValuesToNumbers function to
only convert values that are valid numbers represented as strings
2023-10-18 23:31:53 -03:00
Gabriel Luiz Freitas Almeida
d66944ae7e 🔧 chore(alembic): add store updates migration script
🔧 chore(alembic): add user id can be null in flow migration script
🔧 chore(flow.py): make is_component field nullable in Flow model
🔧 chore(flow.py): make user_id field nullable in Flow model
🔧 chore(service.py): add schema health check after running migrations and handle autogenerate diffs detected case
2023-10-18 23:23:10 -03:00
Gabriel Luiz Freitas Almeida
08bd16b8f2 🔧 chore(OpenAIConversationalAgent.py): enable handling of parsing errors in ConversationalAgent class 2023-10-18 22:14:14 -03:00
anovazzi1
6c6127203f test(saveComponents.spec.ts): add test case to make front work without backend
test(saveComponents.spec.ts): add test case to save default component and delete it
2023-10-18 21:56:53 -03:00
anovazzi1
0f92dacb65 test(saveComponents.spec.ts): refactor saveComponent function to improve code readability and reusability
test(saveComponents.spec.ts): add test case to save the same component multiple times and verify the count of saved components
2023-10-18 21:38:57 -03:00
anovazzi1
cd5204b566 fix(extraSidebarComponent): remove unnecessary empty line
fix(extraSidebarComponent): remove unused variable
feat(extraSidebarComponent): add sectionName prop to SidebarDraggableComponent for better component identification
fix(sideBarDraggableComponent): add sectionName prop to SidebarDraggableComponent for better component identification
test(saveComponents.spec): rename test case to "save group component tests"
test(saveComponents.spec): add test case for saving default component with custom values
2023-10-18 21:15:51 -03:00
anovazzi1
8cc955c147 code format 2023-10-18 20:10:51 -03:00
anovazzi1
dae7ee9b70 fix(extraSidebarComponent): import 'set' function from lodash to fix compilation error
fix(extraSidebarComponent): include display_name property in search filter condition to improve search functionality
fix(extraSidebarComponent): add 'data' dependency to useEffect to ensure proper re-rendering
feat(extraSidebarComponent): add support for process.env.PORT environment variable to be able to run app on a configurable port
test(onlyFront/saveComponents.spec): add test for saving a component in the frontend
test(onlyFront/saveComponents.spec): simulate dropping a file and assert that the flow is displayed
test(onlyFront/saveComponents.spec): simulate grouping elements and assert that the group is created
test(onlyFront/saveComponents.spec): simulate typing and saving a flow component
2023-10-18 20:08:51 -03:00
Gabriel Luiz Freitas Almeida
a497eebab1 🔧 fix(__main__.py): set "no_proxy" environment variable to "*" to avoid error with gunicorn in macos 2023-10-18 19:57:28 -03:00
Gabriel Luiz Freitas Almeida
d41798f192 feat(test_store.py): add test for search_components function in StoreService class
The test covers the search_components function in the StoreService class. It mocks the response from the HTTP GET request and asserts that the request was made with the correct parameters. It also asserts that the search method returns a list of ComponentResponse objects.
2023-10-18 19:56:49 -03:00
Gabriel Luiz Freitas Almeida
a65086c8e4 🐛 fix(alembic): add exception handling to prevent migration failure if columns already exist 2023-10-18 18:30:10 -03:00
anovazzi1
92a109b65c Merge remote-tracking branch 'origin/dev' into saveComponent 2023-10-18 18:23:34 -03:00
Gabriel Luiz Freitas Almeida
52900503de 🔧 chore(alembic): make changes for the store
🔧 chore(api_key.py): remove unused imports and update save_store_api_key endpoint to use ApiKeyCreateRequest model

🔧 chore(schemas.py): add ApiKeyCreateRequest model

🔧 chore(store.py): remove unused imports and update imports in store.py
2023-10-18 18:09:24 -03:00
anovazzi1
3cf800d12f
Create test ToogleComponent, IntComponent, FloatComponent, InputComponent (#1031)
This pull request introduces unit tests for four different components:
ToggleComponent, IntComponent, FloatComponent, and InputComponent. The
tests ensure that these components function as expected and help
maintain code quality.

Changes Made:
  Added a test suite for ToggleComponent to verify its functionality.
  Added a test suite for IntComponent to verify its functionality.
  Added a test suite for FloatComponent to verify its functionality.
  Added a test suite for InputComponent to verify its functionality.
2023-10-18 18:03:32 -03:00
Gabriel Luiz Freitas Almeida
986f7202d2 🔧 chore(api_key.py): remove unused import 'httpx.get' to improve code cleanliness and reduce potential confusion
🐛 fix(api_key.py): fix import statement for 'get_current_active_user' function in 'auth_utils' module to resolve import error
2023-10-18 17:47:32 -03:00
Gabriel Luiz Freitas Almeida
f3c9e20bcc 🔧 refactor(store.py): remove unnecessary import and type hinting for StoreService
🔧 refactor(store.py): remove unnecessary type hinting for StoreService in create_component function signature
2023-10-18 17:46:56 -03:00
Gabriel Luiz Freitas Almeida
c30bb79d64 🐛 fix(deps.py): fix typo in get_store_service function to return the correct service type 2023-10-18 17:46:38 -03:00
Gabriel Luiz Freitas Almeida
215bc0d079 🔄 refactor(schema.py): rename MARKETPLACE_SERVICE enum value to STORE_SERVICE for consistency and clarity 2023-10-18 17:46:13 -03:00
Gabriel Luiz Freitas Almeida
67dddd7d75 🔧 fix(base.py): rename MARKETPLACE_URL to STORE_URL for better clarity and consistency in settings
🔧 fix(service.py): update reference to MARKETPLACE_URL to STORE_URL in StoreService class to reflect the change in settings
2023-10-18 17:44:57 -03:00
anovazzi1
ff650a13fb chore(run-tests.sh): increase sleep duration to 25 seconds to allow more time for the backend to start before running tests 2023-10-18 17:32:08 -03:00
Gabriel Luiz Freitas Almeida
0fadad6f7d 🔧 fix(utils.py): import and add store_factory to the list of factories and dependencies 2023-10-18 17:16:42 -03:00
anovazzi1
75c613c97e updated input component test 2023-10-18 17:07:44 -03:00
Gabriel Luiz Freitas Almeida
596fc8ed41 🔧 fix(api_key.py): import missing dependencies and fix import paths for auth_utils and get_current_active_user
 feat(api_key.py): add new route to save store API key for a user
2023-10-18 17:03:53 -03:00
Gabriel Luiz Freitas Almeida
878e158ac8 🔧 chore(alembic): add migration script for changes related to the store
🔧 chore(flow.py): add new field 'is_component' to the Flow model to support store functionality
🔧 chore(user.py): add new field 'store_api_key' to the User model to support store functionality
2023-10-18 17:03:15 -03:00
Gabriel Luiz Freitas Almeida
eded928bf4 🔄 refactor(router.py): rename component_router to store_router for better clarity and consistency
🔄 refactor(__init__.py): update import statements and references to component_router to store_router for consistency with the renamed router
2023-10-18 17:03:00 -03:00
Gabriel Luiz Freitas Almeida
6e6e514837 🔒 chore(utils.py): add encryption and decryption functions for API key using Fernet encryption algorithm 2023-10-18 17:02:03 -03:00
Gabriel Luiz Freitas Almeida
4d7b66a4e2 🔥 refactor(components.py): remove unused code and endpoints related to components
 feat(store.py): add new endpoints for creating, reading, and listing components in the store
2023-10-18 17:01:54 -03:00
Gabriel Luiz Freitas Almeida
7b158c6ae6 📝 chore(.env.example): add LANGFLOW_STORE_URL variable to the example file for configuring the store URL
🐛 fix(Makefile): add --env-file .env option to the 'backend' target to load environment variables from .env file
2023-10-18 17:00:39 -03:00
anovazzi1
5fd7cbdcb2 feat(tests): add toggleComponent.spec.ts to test the functionality of the ToggleComponent
The toggleComponent.spec.ts file contains a test case that verifies the functionality of the ToggleComponent. The test case performs the following actions:

1. Routes network requests from a HAR file, disabling updates for URLs matching "**/api/v1/**".
2. Routes a specific network request to return a JSON response with a status of 201.
3. Navigates to "http://localhost:3000/".
4. Waits for 2000 milliseconds.
5. Clicks on an element with the id "new-project-btn".
6. Waits for 2000 milliseconds.
7. Clicks on an element with the placeholder text "Search" and fills it with "directoryLoader".
8. Waits for 2000 milliseconds.
9. Drags an element with the id "sideDirectoryLoader" to another element with the id "react-flow-id".
10. Performs a series of click actions on various elements to test their functionality.
11. Verifies the state of toggle buttons using the isChecked() method.
12. Clicks on an element with the id "saveChangesBtn".
13. Performs additional click actions and verifications.
14. Clicks on an element with the id "saveChangesBtn".
15. Performs additional click actions and verifications.
16. Clicks on an element with the id "saveChangesBtn".
17. Performs additional click actions and verifications.
18. Clicks on an element with the id "saveChangesBtn".
19. Performs additional click actions and verifications.
20. Clicks on an element with the id "saveChangesBtn".
21. Performs additional click actions and verifications.
22. Verifies the count of elements matching the locator "//*[@id="toggle-1"]" and performs additional actions based on the count.

This test case is added to ensure that the ToggleComponent functions as expected and that the toggle buttons behave correctly.
2023-10-18 16:56:44 -03:00
anovazzi1
2fba3427fc sorting fields to keep the same order always and fixed group component tests' 2023-10-18 16:27:35 -03:00
Gabriel Luiz Freitas Almeida
3e5eb62c5c 🔄 refactor(deps.py): rename MarketplaceService to StoreService for better naming consistency and clarity
🔄 refactor(schema.py): rename `MARKETPLACE_SERVICE` enum value to `STORE_SERVICE` to match the renamed service
2023-10-18 16:24:05 -03:00
Gabriel Luiz Freitas Almeida
c5ef201755 feat(store): add store service to integrate langflow with the store
This commit adds the necessary files to implement the store service in langflow. The store service allows searching, getting, posting, and downloading components from the store. The store service is integrated with a Directus instance.

The following files were added:
- `src/backend/langflow/services/store/__init__.py`: Initializes the store service.
- `src/backend/langflow/services/store/factory.py`: Implements the store service factory.
- `src/backend/langflow/services/store/schema.py`: Defines the schema for the component response.
- `src/backend/langflow/services/store/service.py`: Implements the store service, including methods for searching, listing components, downloading, and uploading components.

The store service requires the `SettingsService` to be passed during initialization. The base URL and components URL are retrieved from the `MARKETPLACE_URL` setting.

The store service provides the following methods:
- `search`: Searches for components in the store based on various parameters.
- `list_components`: Lists components from the store.
- `download`: Downloads a specific component from the store.
- `upload`: Uploads a new component to the store.

The store service uses the `httpx` library to perform HTTP requests to the store API. The `_get` method is a utility method to perform GET requests with optional API key and parameters.

The `ComponentResponse` schema defines the structure of the component response from the store. It includes various properties such as name, description, id, status, sort, user_created, date_created, user_updated, date_updated, is_component, likes, tags, data, and documentation.

The `get_api_key` method is not implemented and will be completed in a future commit.
2023-10-18 16:22:24 -03:00
anovazzi1
fcafd995ef moved group tests to only front 2023-10-18 16:18:46 -03:00
cristhianzl
1845149647 Merge branch 'feat-testComps' of https://github.com/logspace-ai/langflow into feat-testComps 2023-10-18 15:53:25 -03:00