Commit graph

1,261 commits

Author SHA1 Message Date
gustavoschaedler
580b439b80 🔧 chore(users.py): refactor and improve code readability in users.py
 feat(users.py): add docstrings to API endpoints for better documentation
🔥 chore(users.py): remove unnecessary code and comments
🐛 fix(users.py): fix return type hints in API endpoints
2023-08-11 03:52:02 +01:00
gustavoschaedler
0a5026a6ed 🔧 fix(auth.py): change refresh token expiration time from 180 minutes to 70 minutes for better security
🔧 fix(auth.py): change SECRET_KEY comment from "TODO" to "JUST FOR TEST" for clarity
🔧 fix(auth.py): change create_access_token function name to create_token for consistency
🔧 fix(auth.py): change create_refresh_token function to accept refresh_token parameter instead of data dictionary
🔧 fix(auth.py): change create_refresh_token function to decode and validate refresh_token before creating new user tokens
🔧 fix(auth.py): change authenticate_user function to use get_user_by_username instead of get_user
🔧 fix(auth.py): change get_current_user function to use get_user_by_username instead of get_user
🔧 fix(auth.py): change get_user function name to get_user_by_username for clarity
🔧 fix(users.py): change get_password_hash function to be inside the router scope for better encapsulation
🔧 fix(users.py): change add_user function to return UserListModel instead of User
🔧 fix(users.py): change update_user function to update user data based on UserPatchModel fields
🔧 fix(users.py): change update_user function to handle username conflicts and update user's updated_at field
🔧 fix(users.py): change delete_user function to delete user based on user_id
 feat(login.py): add refresh_token endpoint to refresh access token using refresh token
 feat(login.py): add refresh_token function to create new user tokens based on refresh token
 feat(login.py): add refresh_token endpoint to refresh access token using refresh token
 feat(login.py): add refresh_token function to create new user tokens based on refresh token
 feat(login.py): add refresh_token endpoint to refresh access token using refresh token
 feat(login.py): add refresh_token function to create new user tokens based on refresh token
 feat(login.py): add refresh_token endpoint to refresh access token using refresh token
 feat(login.py): add refresh_token function to create new user tokens based on refresh token
 feat(login.py): add refresh_token endpoint to refresh access token using refresh token
 feat(login.py): add refresh_token function to create new user tokens based on refresh token
 feat(login.py): add refresh_token endpoint to refresh access token using refresh token
 feat(login.py): add refresh
2023-08-11 03:13:08 +01:00
gustavoschaedler
f0f061ab46 🔒 chore(auth.py): increase access token expiration time to 60 minutes for better user experience
🔒 chore(auth.py): add refresh token functionality with expiration time of 180 minutes
🔒 chore(login.py): change token endpoint URL from /token to /login for better semantics
🔒 chore(login.py): add refresh token creation to login endpoint to provide a refresh token along with the access token
2023-08-10 19:05:11 +01:00
Gabriel Luiz Freitas Almeida
83631606d3 🐛 fix(manager.py): fix undefined variable 'database_url' error in _create_engine method
 feat(manager.py): add support for SQLite database by setting connect_args in create_engine method
2023-08-10 11:30:06 -03:00
gustavoschaedler
f065a46950 Merge remote-tracking branch 'origin/dev' into authentication 2023-08-09 21:46:08 +01:00
Gabriel Luiz Freitas Almeida
be14d45589 🐛 fix(utils.py): handle CommandError when running migrations and delete alembic_version table if wrong revision in DB 2023-08-09 10:28:41 -03:00
Gabriel Luiz Freitas Almeida
61bee4424f
Add zip_path and workspace_url fields (#729) 2023-08-09 09:18:30 -03:00
Melvin Hillsman
f4ad8572e7 Add zip_path and workspace_url fields
As noted in the
[documentation](https://python.langchain.com/docs/integrations/document_loaders/slack)
for this plugin zip_path is the first named parameter not file_path and
workspace_url is the second with zip_path being required and
workspace_url being optional.

Fixes #695

Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
2023-08-08 21:01:34 -05:00
gustavoschaedler
056ce51ad0 🐛 fix(login.py): change argument type of create_user_token function from str to User to improve type safety and clarity
🐛 fix(login.py): remove unnecessary type ignore comment in create_user_token function
🐛 fix(login.py): remove unnecessary type ignore comment in return statement of login_to_get_access_token function
🐛 fix(users.py): remove unnecessary async keyword from read_current_user function
🐛 fix(users.py): remove unnecessary async keyword from read_all_users function
🐛 fix(users.py): remove unnecessary async keyword from add_user function
🐛 fix(users.py): remove unnecessary async keyword from add_super_user_to_testing_purposes function
2023-08-08 22:20:53 +01:00
gustavoschaedler
3c6d46021d 🔧 chore(user.py): remove unnecessary line breaks and import formatting for better code readability
🔧 chore(main.py): fix indentation and remove unnecessary line breaks for better code readability
🔧 chore(login.py): fix indentation and add missing line breaks for better code readability
2023-08-08 22:09:38 +01:00
gustavoschaedler
1c28979766 🔀 refactor(users.py): rename router prefix from "/users" to "Login" to improve clarity and consistency 2023-08-08 22:08:51 +01:00
gustavoschaedler
4af08d99fc Merge remote-tracking branch 'origin/dev' into authentication 2023-08-08 22:05:23 +01:00
gustavoschaedler
59a55b4371 🔧 fix(auth.py): update import statements to reflect new file structure in langflow package
🔧 fix(auth.py): fix typo in verify_password function call
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect new file structure in langflow package
🔧 fix(auth.py): update get_current_user function signature to match the annotated type
🔧 fix(auth.py): update get_user function call to reflect
2023-08-08 21:19:22 +01:00
Gabriel Luiz Freitas Almeida
4b47f9f196 🐛 fix(endpoints.py): add check to skip empty custom_component_dict to prevent potential errors 2023-08-08 16:35:15 -03:00
Gabriel Luiz Freitas Almeida
a6cacbf377 Merge branch 'dev' into migrations_service 2023-08-08 16:13:32 -03:00
Gabriel Luiz Freitas Almeida
b8d8ed8283 Revert "Revert "Fixes flows without input_keys not being runnable" (#731)"
This reverts commit 352e74cbc7, reversing
changes made to 3f531a1157.
2023-08-08 15:12:37 -03:00
Gabriel Luiz Freitas Almeida
f9b392d5b8
Revert "Fixes flows without input_keys not being runnable" 2023-08-08 15:02:16 -03:00
Gabriel Luiz Freitas Almeida
f61d265e77 🔧 chore(vector_store.py): refactor initialize_chroma function to remove unnecessary if conditions and improve code readability
🔧 chore(vector_store.py): remove chroma_server_ keys from params dictionary if not needed to avoid potential conflicts
2023-08-07 18:52:19 -03:00
Gabriel Luiz Freitas Almeida
239811dbff 🐛 fix(chat.py): change "input_keys" value from an empty dictionary to None to improve readability and reduce redundancy 2023-08-07 18:46:13 -03:00
Gabriel Luiz Freitas Almeida
9ee76fd18f 🐛 fix(manager.py): change default value of chat_inputs from empty string to empty dictionary to improve data consistency and prevent potential errors
🐛 fix(utils.py): handle case when chat_inputs.message is None by assigning an empty dictionary to it to prevent potential errors
2023-08-07 18:37:49 -03:00
Gabriel Luiz Freitas Almeida
9fcc96e767 🔀 refactor(manager.py): update import statement for models in database manager to improve readability and maintainability 2023-08-07 14:18:07 -03:00
Gabriel Luiz Freitas Almeida
71012ac47b 🔥 chore(alembic): remove flowstyles table
 feat(alembic): add migration to remove flowstyles table

🔥 chore(alembic): remove old migration file for removing flowstyles table

🐛 fix(database): import Flow model to avoid unused import warning
2023-08-07 14:09:27 -03:00
Gabriel Luiz Freitas Almeida
96dfb9b324 🐛 fix(main.py): fix condition to setup static files only if static_files_dir is not None 2023-08-07 12:08:16 -03:00
Gabriel Luiz Freitas Almeida
1601745ed9 🔀 refactor(alembic/env.py): update import statement for SQLModel in env.py to reflect new location in manager module
🔀 refactor(interface/custom/custom_component.py): update import statement for session_getter in custom_component.py to reflect new location in utils module

🔀 refactor(main.py): update import statement for initialize_database in main.py to reflect new location in utils module

🔀 refactor(database/factory.py): update import statement for DatabaseManager in factory.py to reflect new location in manager module
2023-08-07 12:00:58 -03:00
Gabriel Luiz Freitas Almeida
8436c66aa7 📦 chore(manager.py): add DatabaseManager class to handle database operations
📦 chore(utils.py): add initialize_database function and session_getter context manager to handle database initialization and session management
2023-08-07 12:00:27 -03:00
Gabriel Luiz Freitas Almeida
d75fb49bf2 🔥 chore(alembic): remove FlowStyles table
This commit removes the FlowStyles table from the database. The table was no longer needed and has been dropped. The corresponding indexes and foreign key constraints have also been removed.

Downgrade functionality has been implemented to recreate the FlowStyles table and its associated indexes and foreign key constraints if needed.
2023-08-07 10:25:46 -03:00
Gabriel Luiz Freitas Almeida
b7861ac77f 🔧 chore(alembic.ini): update sqlalchemy.url to dynamically set the path to the database in the root of the project 2023-08-07 10:24:28 -03:00
Gabriel Luiz Freitas Almeida
e2e14d8c93 🔥 refactor(router.py): remove unused flow_styles_router import to improve code cleanliness and reduce unused code
🔥 refactor(test_database.py): remove unused flow_style related tests to improve code cleanliness and reduce unused code
2023-08-07 10:24:02 -03:00
Gabriel Luiz Freitas Almeida
4547edef0f 🔥 refactor(api): remove unused flow_styles module and related code
🔥 refactor(api): remove unused flow_styles router and related endpoints
🔥 refactor(api): remove unused FlowStyle model and related code
🔥 refactor(api): remove unused FlowStyleCreate, FlowStyleRead, and FlowStyleUpdate models
🔥 refactor(api): remove unused style relationship from Flow model
🔥 refactor(api): remove unused FlowReadWithStyle model
🔥 refactor(api): remove unused flow_styles_id parameter from read_flow_style endpoint
🔥 refactor(api): remove unused update_flow_style endpoint
🔥 refactor(api): remove unused delete_flow_style endpoint
🔥 refactor(api): remove unused flow_id parameter from delete_flow_style endpoint
🔥 refactor(api): remove unused style parameter from create_flow_style endpoint
🔥 refactor(api): remove unused read_flow_styles endpoint
🔥 refactor(api): remove unused flow_styles_id parameter from read_flow_styles endpoint
🔥 refactor(api): remove unused flow_style_id parameter from update_flow_style endpoint
🔥 refactor(api): remove unused flow_style parameter from update_flow_style endpoint
🔥 refactor(api): remove unused flow_style parameter from create_flow_style endpoint
🔥 refactor(api): remove unused flow_styles_router import
🔥 refactor(api): remove unused flow_styles_router variable
🔥 refactor(api): remove unused flow_styles_router prefix and tags
2023-08-07 10:13:40 -03:00
Gabriel Luiz Freitas Almeida
76362da42b 🔧 chore(main.py): refactor setup_app function to add support for backend_only flag
 feat(main.py): add backend_only flag to setup_app function to allow running the app without serving static files
2023-08-07 09:44:45 -03:00
Gabriel Luiz Freitas Almeida
709c4a1749 🔧 chore(__main__.py): refactor serve function to improve readability and maintainability
 feat(__main__.py): add support for custom components directory path as an environment variable
 feat(__main__.py): set default value for config option to be the config.yaml file in the same directory as the script
 feat(__main__.py): add support for specifying an .env file containing environment variables
 feat(__main__.py): add backend_only option to run only the backend server without the frontend
🔧 chore(__main__.py): refactor setup_app function to pass backend_only option to the app setup
 feat(__main__.py): add check to skip server startup if running in pytest environment
🔧 chore(__main__.py): refactor serve function to improve readability and maintainability
 feat(__main__.py): add support for running the server using uvicorn on Windows
2023-08-07 09:44:11 -03:00
Gabriel Luiz Freitas Almeida
a0aa88f039 🔀 chore(types.py): import merge_nested_dicts_with_renaming from langflow.api.utils to use it in build_langchain_custom_component_list_from_path function
🐛 fix(types.py): replace `merge_nested_dicts` with `merge_nested_dicts_with_renaming` in `build_langchain_custom_component_list_from_path` function to fix a bug
2023-08-06 12:28:05 -03:00
Gabriel Luiz Freitas Almeida
a9db2da6bf 🐛 fix(base.py): use db_manager.engine instead of DatabaseManager.engine to access the database engine
🐛 fix(conftest.py): add TYPE_CHECKING import to fix type hinting error
🐛 fix(conftest.py): pass db_manager to blank_session_getter fixture to fix session creation error
2023-08-06 12:15:29 -03:00
Gabriel Luiz Freitas Almeida
f9112facda 🐛 fix(custom_component.py): import get_db_manager function from langflow.services.utils to fix NameError
🐛 fix(factory.py): raise ValueError if no database URL provided in settings
🐛 fix(manager.py): change return type annotation of load_settings_from_yaml method to "SettingsManager" instead of "Settings"
🐛 fix(utils.py): import service_manager and ServiceType to fix NameError
2023-08-05 23:27:38 -03:00
Gabriel Luiz Freitas Almeida
6ca7308e3c updates imports to use settings_manager 2023-08-05 23:20:35 -03:00
Gabriel Luiz Freitas Almeida
f72a42213c 🔥 refactor(base.py): remove unused imports and code related to database engine creation and session handling
🔥 refactor(base.py): remove unused code related to loading settings from YAML file
2023-08-05 23:19:14 -03:00
Gabriel Luiz Freitas Almeida
2fcbfa25a5 🎉 feat(utils.py): add new utility function get_settings_manager() to retrieve the settings manager from the service manager
🎉 feat(utils.py): add new utility function `get_session()` to retrieve a session from the database manager
2023-08-05 23:18:31 -03:00
Gabriel Luiz Freitas Almeida
d43236fb98 🔧 chore(__main__.py): import get_settings_manager function from langflow.services.utils module to improve code organization and readability
🔧 chore(__main__.py): remove unused import of settings module from langflow.settings package to clean up code
🔧 chore(__main__.py): update references to settings object to use settings_manager.settings for better encapsulation and modularity
2023-08-05 23:18:00 -03:00
Gabriel Luiz Freitas Almeida
3442521f64 🎉 feat(lazy_load.py): add LazyLoadDictBase class to provide lazy loading of a dictionary of all types
🐛 fix(lazy_load.py): implement _build_dict() and get_type_dict() methods to avoid NotImplementedError
2023-08-05 23:13:51 -03:00
Gabriel Luiz Freitas Almeida
8a2358dae0 🔧 fix(custom_component.py): fix import paths for session_getter and Flow models in custom_component.py file
🔧 fix(test_cache_manager.py): fix import path for CacheManager in test_cache_manager.py file
🔧 fix(test_custom_component.py): fix import path for Flow and FlowCreate models in test_custom_component.py file
🔧 fix(test_database.py): fix import path for Flow, FlowCreate, and FlowUpdate models in test_database.py file
🔧 fix(test_websocket.py): fix import path for WebSocketDisconnect in test_websocket.py file
2023-08-05 22:18:20 -03:00
Gabriel Luiz Freitas Almeida
0a8ca3b908 🔧 fix(chat.py): update import statements to reflect changes in module structure
🔧 fix(components.py): update import statements to reflect changes in module structure
🔧 fix(endpoints.py): update import statements to reflect changes in module structure
🔧 fix(flow_styles.py): update import statements to reflect changes in module structure
🔧 fix(flows.py): update import statements to reflect changes in module structure
🔧 fix(schemas.py): update import statements to reflect changes in module structure
🔧 fix(run.py): update import statements to reflect changes in module structure
🔧 fix(utils.py): update import statements to reflect changes in module structure
2023-08-05 22:17:41 -03:00
Gabriel Luiz Freitas Almeida
029e06c033 🔀 chore(alembic/env.py): update import statement for SQLModel to reflect new file location 2023-08-05 22:17:10 -03:00
Gabriel Luiz Freitas Almeida
c9ae251f85 🔧 chore(main.py): refactor imports and remove unused code for better organization and readability
 feat(main.py): add initialization functions for services and database on app startup to ensure proper setup and configuration
2023-08-05 22:16:41 -03:00
Gabriel Luiz Freitas Almeida
be8be07a62 🔥 refactor(__init__.py): deactivate cache manager for now to improve performance and simplify code 2023-08-05 22:16:14 -03:00
Gabriel Luiz Freitas Almeida
d51aa7ecb2 📦 chore(database): add database related files and models
📦 chore(database): add database manager and factory

📦 chore(database): add flow and flow style models
2023-08-05 22:14:22 -03:00
Gabriel Luiz Freitas Almeida
b451ad9bdd 📦 chore(settings): add new files for managing settings in the backend
📄 feat(settings/__init__.py): add __init__.py file to expose factory and manager modules

📄 feat(settings/base.py): add base settings class with default values and validators

📄 feat(settings/factory.py): add factory class for creating and configuring a SettingsManager

📄 feat(settings/manager.py): add manager class for loading settings from YAML file and initializing SettingsManager

📦 chore(settings.py): add settings.py file to the backend/langflow/services/settings directory
 feat(settings.py): add support for loading settings from a YAML file and updating settings from keyword arguments
🔒 chore(settings.py): add validation and logging to the settings module for improved reliability and debugging
🔧 chore(settings.py): add utility functions for saving and loading settings from a YAML file
2023-08-05 22:13:48 -03:00
Gabriel Luiz Freitas Almeida
7b1f99b1e0 📝 chore(chat): add chat module files
📝 chore(chat): add ChatConfig class to handle chat configuration

📝 chore(chat): add ChatManagerFactory class to create and configure ChatManager

📝 chore(chat): add ChatManager class to handle chat functionality

📝 chore(chat): add ChatHistory class to manage chat history

📝 chore(chat): add process_graph function to process chat inputs and generate result and thought
2023-08-05 22:13:10 -03:00
Gabriel Luiz Freitas Almeida
d5ad152250 📦 chore(cache): add cache module with cache manager, factory, base cache, and in-memory cache implementations
 feat(utils.py): add cache utility functions for memoization and file saving
🐛 fix(utils.py): fix cache folder creation to use the correct cache directory
🔧 chore(utils.py): refactor code to improve readability and remove unused imports
2023-08-05 22:12:27 -03:00
Gabriel Luiz Freitas Almeida
63a9b01bbc feat(services): add support for service manager and service schema
- Added `__init__.py` file to the `services` directory to make it a package.
- Created `Service` class in `base.py` to serve as a base class for different services.
- Implemented `ServiceFactory` class in `factory.py` to create instances of services.
- Implemented `ServiceManager` class in `manager.py` to manage the creation and retrieval of services.
- Created `ServiceType` enum in `schema.py` to define the different types of services that can be registered with the service manager.
- Added `initialize_services` function in `manager.py` to initialize all the services needed.

The purpose of these changes is to provide a modular and extensible architecture for managing different services in the application. The `ServiceManager` allows for easy creation and retrieval of services, while the `ServiceType` enum provides a standardized way to refer to different types of services. The `Service` base class and `ServiceFactory` class provide a foundation for creating and managing specific services.
2023-08-05 22:10:24 -03:00
Gabriel Luiz Freitas Almeida
d566a86ed0 🔥 refactor(cache): remove unused cache files and classes
The following files and classes were removed:

- `src/backend/langflow/cache/__init__.py`: Removed unused import statements and `__all__` variable.
- `src/backend/langflow/cache/base.py`: Removed unused `BaseCache` class.
- `src/backend/langflow/cache/flow.py`: Removed unused `InMemoryCache` class.
- `src/backend/langflow/cache/manager.py`: Removed unused `Subject`, `AsyncSubject`, and `CacheManager` classes.

These files and classes were removed to clean up the codebase and remove unused functionality.

🔥 refactor(utils.py): remove unused code and dependencies in utils.py module
🔥 refactor(chat): remove unused chat module and its configuration class

🔥 refactor(chat/manager.py): remove unused imports and classes from chat manager module
🔥 refactor(chat/utils.py): remove unused imports and function from chat utils module
🔥 refactor(database/__init__.py): remove empty file

🔥 refactor(database): remove unused database files and models

🔥 refactor(database): remove unused database files and models to improve code organization and reduce clutter
2023-08-05 22:03:56 -03:00