Commit graph

1,871 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
464ba02de8 🔄 refactor(schema.py): rename 'user_created' field to 'user_name' for better clarity and consistency 2023-10-23 21:25:20 -03:00
Gabriel Luiz Freitas Almeida
c695a4fd61 🔧 chore(store.py): add "user_created.name" and "is_component" fields to the list of fields returned by list_components() function
🔒 refactor(store.py): refactor the logic to handle the case when store_api_Key is not provided
2023-10-23 21:19:28 -03:00
Gabriel Luiz Freitas Almeida
6e8a98d6e3 🔧 chore(schema.py): add 'is_component' field to StoreComponentCreate schema for better data modeling and flexibility 2023-10-23 20:43:13 -03:00
Gabriel Luiz Freitas Almeida
b968fae19e 🔥 refactor(store.py): remove unused code and endpoint 'fork_component' to improve code readability and maintainability 2023-10-23 20:42:45 -03:00
Gabriel Luiz Freitas Almeida
ee0c11b4a6 🐛 fix(store.py): add missing import for FlowCreate and FlowRead models
 feat(store.py): add support for fetching specific fields when listing components
 feat(store.py): add support for forking components from the store
 feat(store.py): add support for searching components with various filters and sorting options
🐛 fix(schema.py): add missing parent field to ComponentResponse and StoreComponentCreate models
2023-10-23 17:15:19 -03:00
Gabriel Luiz Freitas Almeida
f060155fe6 🔧 chore(utils.py): refactor setup_superuser and teardown_superuser functions to improve readability and remove unnecessary code duplication
🔧 chore(utils.py): update teardown_superuser function to only remove default superuser if AUTO_LOGIN is set to False
2023-10-20 18:25:42 -03:00
Gabriel Luiz Freitas Almeida
09d4ee43cf 🔧 fix(store.py): remove duplicate list_components endpoint to avoid conflicts and improve code organization
 feat(store.py): add new list_components endpoint to retrieve a paginated list of components from the store
2023-10-20 11:26:08 -03:00
Gabriel Luiz Freitas Almeida
4c8550579d 🐛 fix(service.py): remove unnecessary try-except block and improve error handling in GET request 2023-10-20 11:08:38 -03:00
Gabriel Luiz Freitas Almeida
3b14cdbe9f 🐛 fix(service.py): catch all exceptions when raising ValueError in the search method to provide more informative error message 2023-10-20 11:06:16 -03:00
Gabriel Luiz Freitas Almeida
b7aa3274f8 🐛 fix(service.py): improve error handling in StoreService search method
 feat(service.py): change default sort parameter in StoreService search method to sort by likes in descending order
2023-10-20 11:02:38 -03:00
Gabriel Luiz Freitas Almeida
5667dd4540 🐛 fix(service.py): remove redundant assignment to params variable to fix incorrect behavior 2023-10-20 07:54:19 -03:00
Gabriel Luiz Freitas Almeida
51929df2b0 🐛 fix(service.py): remove redundant assignment to params variable
The redundant assignment to the params variable was removed to prevent overwriting the initial assignment.
2023-10-20 07:53:11 -03:00
Gabriel Luiz Freitas Almeida
4c6dc748a0 updates to colliding endpoints and search 2023-10-19 22:52:38 -03:00
Gabriel Luiz Freitas Almeida
09a1e332a5 update download method 2023-10-19 22:15:44 -03:00
Gabriel Luiz Freitas Almeida
54c2535b95 update schema for store endpoints 2023-10-19 22:14:45 -03:00
Gabriel Luiz Freitas Almeida
717334841f add guard in case api key is a str 2023-10-19 22:14:11 -03:00
Gabriel Luiz Freitas Almeida
062a709151 fix fields and likes count 2023-10-19 22:13:39 -03:00
Gabriel Luiz Freitas Almeida
a3bede0187 Add store schema 2023-10-19 22:12:49 -03:00
Gabriel Luiz Freitas Almeida
5aed852bb0 🔧 chore(service.py): add aggregation parameter to store service API call to retrieve count of likes for each component 2023-10-19 18:14:56 -03:00
Gabriel Luiz Freitas Almeida
242f741567 🔧 refactor(store.py): remove unused imports and variables to improve code readability and maintainability
🔒 chore(store.py): add dependency injection for store API key retrieval to improve code modularity and testability
🔒 chore(store.py): add error handling for missing store API key to provide better user feedback
🔒 chore(store.py): refactor create_component, read_component, and list_components to use store API key from dependency injection instead of user object
2023-10-19 18:14:56 -03:00
Gabriel Luiz Freitas Almeida
cc6da7626e 🐛 fix(store.py): add validation to check if user has a store API key set before creating a component 2023-10-19 16:40:15 -03:00
Gabriel Luiz Freitas Almeida
ce955a82fe 🔨 refactor(store.py): change parameter name from 'component' to 'component_create' for clarity and consistency
🔨 refactor(store.py): change type annotation of 'component' parameter from 'Flow' to 'FlowCreate' to match the expected type
2023-10-19 16:34:19 -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
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
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
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
8cc955c147 code format 2023-10-18 20:10: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
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
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
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
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
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
Gabriel Luiz Freitas Almeida
2653bbc70e First draft of MarketplaceService 2023-10-18 09:18:16 -03:00