✨ 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
🔒 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
🔧 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
🔧 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
🔧 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
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.