Commit graph

3,242 commits

Author SHA1 Message Date
Cristhian Zanforlin Lousa
8c763d798e 🐛 fix(PaginatorComponent): add useEffect to update maxPageIndex when totalRowsCount changes
 feat(ApiKeysPage): add Header component to the page layout for better organization and structure
🐛 fix(ApiKeysPage): fix import order to follow convention and improve readability
🐛 fix(ApiKeysPage): fix indentation and formatting issues for better code readability
 feat(ApiKeysPage): add conditional rendering for displaying a message when user has no assigned keys
🐛 fix(ApiKeysPage): fix indentation and formatting issues for better code readability
 feat(ApiKeysPage): add table component to display the list of keys with their details
🐛 fix(ApiKeysPage): fix indentation and formatting issues for better code readability
 feat(ApiKeysPage): add ConfirmationModal component for deleting keys with appropriate title and content
🐛 fix(ApiKeysPage): fix indentation and formatting issues for better code readability
2023-08-25 20:02:16 -03:00
Cristhian Zanforlin Lousa
d546647518 Merge branch 'login' of https://github.com/logspace-ai/langflow into login 2023-08-25 19:50:43 -03:00
Cristhian Zanforlin Lousa
9509edb66d 🔧 fix(App.tsx): remove unused imports and variables for better code cleanliness
 feat(authContext.tsx): move autoLogin logic from App component to AuthProvider to improve separation of concerns
🔧 fix(index.tsx): reorder context providers to ensure correct execution order
🔧 fix(tabsContext.tsx): add comment to clarify the purpose of the useEffect hook
🔧 fix(typesContext.tsx): add comment to clarify the purpose of the useEffect hook
🔧 fix(routes.tsx): rename ProtectedAdminRoute to ProtectedRoute for consistency
2023-08-25 19:50:38 -03:00
anovazzi1
8fda2e207c refactor(ApiKeysPage): update the message displayed when there are no keys assigned to the user for better clarity and user experience 2023-08-25 19:31:24 -03:00
anovazzi1
c296fc18af removed id column from api keys table 2023-08-25 19:29:43 -03:00
Cristhian Zanforlin Lousa
6867811626 Merge branch 'login' of https://github.com/logspace-ai/langflow into login 2023-08-25 19:08:44 -03:00
Cristhian Zanforlin Lousa
89d69af7f8 🐛 fix(authContext.tsx): initialize accessToken and refreshToken with values from cookies to maintain user session
 feat(authContext.tsx): add support for process.env.PORT environment variable to be able to run app on a configurable port
🐛 fix(tabsContext.tsx): import missing AuthContext and use getAuthentication function to conditionally fetch data
🐛 fix(typesContext.tsx): import missing AuthContext and use getAuthentication function to conditionally fetch data
🐛 fix(api.tsx): add check to not refresh token if refreshToken is "auto"
2023-08-25 19:08:38 -03:00
anovazzi1
5efdde4aca fix(API): remove unused user_id parameter in getApiKey function
fix(API): remove unused user_id parameter in createApiKey function and add name parameter
fix(API): change deleteApiKey parameter from user_id to api_key
fix(SecretKeyModal): change createApiKey parameter from data to apiKeyName
fix(ApiKeysPage): remove unused user_id parameter in getApiKey function and add console.log for debugging
2023-08-25 18:50:37 -03:00
Gabriel Luiz Freitas Almeida
a31d1f104d 🐛 fix(api_key.py): add hashed_api_key field to ApiKey model to store hashed version of api_key
🐛 fix(crud.py): update create_api_key function to use hashed version of generated_api_key and mask the api_key for security reasons
2023-08-25 18:35:08 -03:00
anovazzi1
927379b245 fix(manager.py): catch all exceptions instead of just TypeError when loading JSON payload to handle any parsing errors
feat(index.tsx): add authentication token to WebSocket URL to authenticate the user
2023-08-25 18:15:59 -03:00
Cristhian Zanforlin Lousa
38eb1a2d79 Merge branch 'login' of https://github.com/logspace-ai/langflow into login 2023-08-25 17:54:57 -03:00
Cristhian Zanforlin Lousa
1f42910c55 🐛 fix(tabsContext.tsx): add delay to refreshFlows function to prevent race condition with API call
🐛 fix(typesContext.tsx): add delay to useEffect to prevent race condition with API call
2023-08-25 17:54:37 -03:00
igorrCarvalho
928d696751 Merge branch 'login' of github.com:logspace-ai/langflow into login 2023-08-25 17:49:08 -03:00
igorrCarvalho
10ba3381e0 Refactor: Move github stars context to darkContext 2023-08-25 17:48:39 -03:00
anovazzi1
d2f5a5d564 moved api interceptor 2023-08-25 17:21:54 -03:00
anovazzi1
17cbc64273 update browser route context location 2023-08-25 17:17:09 -03:00
Cristhian Zanforlin Lousa
1ed89cbbad merge fix 2023-08-25 17:10:54 -03:00
Gabriel Luiz Freitas Almeida
4e1710bcc7 🐛 fix(chat.py): add missing import statement for Query from fastapi
🐛 fix(chat.py): add missing import statement for Session from sqlmodel
🐛 fix(chat.py): add missing import statement for get_session from langflow.services.utils
🐛 fix(chat.py): add missing import statement for get_current_user from langflow.services.auth.utils
🐛 fix(chat.py): add missing import statement for HTTPException from fastapi
🐛 fix(chat.py): add missing import statement for get_current_active_user from langflow.services.auth.utils
🐛 fix(chat.py): add missing import statement for WebSocket from fastapi
🐛 fix(chat.py): add missing import statement for WebSocketException from fastapi
🐛 fix(chat.py): add missing import statement for status from fastapi
🐛 fix(chat.py): add missing import statement for APIRouter from fastapi
🐛 fix(chat.py): add missing import statement for Depends from fastapi
🐛 fix(chat.py): add missing import statement for HTTPException from fastapi
🐛 fix(chat.py): add missing import statement for get_current_active_user from langflow.services.auth.utils
🐛 fix(chat.py): add missing import statement for get_current_user from langflow.services.auth.utils
🐛 fix(chat.py): add missing import statement for get_session from langflow.services.utils
🐛 fix(chat.py): add missing import statement for Session from sqlmodel
🐛 fix(chat.py): add missing import statement for HTTPException from fastapi
🐛 fix(chat.py): add missing import statement for get_current_user from langflow.services.auth.utils
🐛 fix(chat.py): add missing import statement for HTTPException from fastapi
🐛 fix(chat.py): add missing import statement for get_current_user from langflow.services.auth.utils
🐛 fix(chat.py): add missing import statement for HTTPException from fastapi
🐛 fix(chat.py): add missing import statement for get_current_user from langflow.services.auth.utils
🐛 fix(chat.py): add missing import statement for HTTPException from fastapi
🐛 fix(chat.py): add missing import statement for get_current_user from langflow.services.auth.utils
🐛 fix(chat.py): add missing import statement for HTTPException from fastapi
🐛 fix(chat.py): add missing import statement for get_current_user from langflow
2023-08-25 17:01:32 -03:00
Gabriel Luiz Freitas Almeida
fc32ee63e1 🐛 fix(alembic): change "user_id" column in "flow" table to be nullable to handle existing data without a user_id 2023-08-25 16:31:24 -03:00
Gabriel Luiz Freitas Almeida
a290a68605 🔧 chore(update_all_tables.py): remove unused code block to improve code readability and maintainability 2023-08-25 16:30:16 -03:00
Gabriel Luiz Freitas Almeida
aa633ff2de 🐛 fix(utils.py): change auth_scheme_dependency function to be async to match its usage in get_current_user function 2023-08-25 16:29:43 -03:00
Gabriel Luiz Freitas Almeida
e2122567be 🐛 fix(base.py): remove unnecessary user_id parameter from _build_each_node_in_params_dict() method call in Vertex class 2023-08-25 16:29:34 -03:00
Gabriel Luiz Freitas Almeida
89ea8e45f6 🔧 chore(login.py): import get_current_active_user function to improve code readability and maintainability
 feat(login.py): add current_user dependency to refresh_token endpoint to ensure only authenticated users can refresh their tokens
2023-08-25 16:29:24 -03:00
Gabriel Luiz Freitas Almeida
132642347f 🔧 fix(endpoints.py): add current_user dependency to get_all endpoint to enforce authentication and authorization
🚀 feat(endpoints.py): import User model and get_current_active_user function to enable authentication and authorization in get_all endpoint
2023-08-25 16:29:15 -03:00
Gabriel Luiz Freitas Almeida
2af4508e5e feat(main.py): add health endpoint to check the status of the application 2023-08-25 16:28:56 -03:00
Gabriel Luiz Freitas Almeida
648bb25b3f 🔧 chore(update_all_tables.py): add missing index and foreign key constraints to apikey table
🔧 chore(update_all_tables.py): add missing index and foreign key constraints to flow table
2023-08-25 15:31:16 -03:00
Gabriel Luiz Freitas Almeida
8b99cc06c4 🔧 fix(update_all_tables.py): handle potential OperationalError when adding columns to 'apikey' table
 feat(update_all_tables.py): add support for 'user_id' column in 'apikey' table
 feat(update_all_tables.py): add support for 'created_at' column in 'apikey' table
 feat(update_all_tables.py): add support for index on 'name' column in 'apikey' table
 feat(update_all_tables.py): add support for index on 'user_id' column in 'apikey' table
 feat(update_all_tables.py): add foreign key constraint on 'user_id' column in 'apikey' table
🔧 fix(update_all_tables.py): handle potential OperationalError when dropping 'create_at' column from 'apikey' table
 feat(update_all_tables.py): add support for 'user_id' column in 'flow' table
 feat(update_all_tables.py): add support for index on 'user_id' column in 'flow' table
 feat(update_all_tables.py): add foreign key constraint on 'user_id' column in 'flow' table
🔧 fix(update_all_tables.py): handle potential OperationalError when dropping foreign key constraint from 'flow' table
🔧 fix(update_all_tables.py): handle potential OperationalError when dropping index on 'user_id' column from 'flow' table
🔧 fix(update_all_tables.py): handle potential OperationalError when dropping 'user_id' column from 'flow' table
🔧 fix(update_all_tables.py): handle potential OperationalError when adding 'create_at' column to 'apikey' table
🔧 fix(update_all_tables.py): handle potential OperationalError when dropping foreign key constraint from 'apikey' table
🔧 fix(update_all_tables.py): handle potential OperationalError when dropping index on 'user_id' column from 'apikey' table
🔧 fix(update_all_tables.py): handle potential OperationalError when dropping index on 'name' column from 'apikey' table
🔧 fix(update_all_tables.py): handle potential OperationalError when altering 'name' column in 'apikey' table
🔧 fix(update_all_tables.py): handle potential OperationalError when dropping 'user_id' column from 'apikey' table
🔧 fix(update_all_tables.py): handle potential OperationalError when dropping 'created_at' column from 'apikey' table
2023-08-25 15:28:49 -03:00
Gabriel Luiz Freitas Almeida
706cdc0874 🚀 feat(alembic): add migration script to update all tables
This commit adds a new migration script to update all tables in the database. The script includes the following changes:

- Added columns 'created_at' and 'user_id' to the 'apikey' table
- Altered the 'name' column in the 'apikey' table to allow null values
- Created indexes on the 'name' and 'user_id' columns in the 'apikey' table
- Created a foreign key constraint between the 'apikey' table and the 'user' table
- Added the 'user_id' column to the 'flow' table
- Created an index on the 'user_id' column in the 'flow' table
- Created a foreign key constraint between the 'flow' table and the 'user' table
- Removed the 'create_at' column from the 'apikey' table

This migration script is designed to be used with Alembic for database schema updates.
2023-08-25 15:26:24 -03:00
Gabriel Luiz Freitas Almeida
853ce351c9 🐛 fix(chat.py): add missing import statement for get_current_active_user function
 feat(chat.py): add current_user dependency to chat and init_build endpoints to enforce authentication and authorization
🔧 refactor(chat.py): pass user_id to vertex.build() method in stream_build endpoint to associate the build with the current user
2023-08-25 15:26:24 -03:00
Gabriel Luiz Freitas Almeida
b41b3038f3 🔄 refactor(login.py): update import statement for Token model to match new location in schemas module 2023-08-25 15:26:23 -03:00
Gabriel Luiz Freitas Almeida
3d650c8491 feat(schemas.py): add Token schema to represent access and refresh tokens in API responses 2023-08-25 15:26:22 -03:00
Gabriel Luiz Freitas Almeida
d8f5efabad 🐛 fix(loading.py): add type hinting for TYPE_CHECKING to improve code readability
🐛 fix(loading.py): add optional user_id parameter to instantiate_class and instantiate_based_on_type functions to support user-specific custom components
 feat(loading.py): modify instantiate_custom_component function to use user_id parameter and improve code readability
2023-08-25 15:26:21 -03:00
Gabriel Luiz Freitas Almeida
1a50bcd183 🐛 fix(base.py): change return type of generator_build method to Generator[Vertex, None, None] for better type hinting and clarity
🐛 fix(base.py): add optional user_id parameter to _build and _build_list_of_nodes_and_update_params methods in Vertex class to support building with user-specific data
🐛 fix(base.py): add optional user_id parameter to _get_and_instantiate_class method in Vertex class to support building with user-specific data
🐛 fix(custom_component.py): add user_id attribute to CustomComponent class to store the user ID associated with the component
🐛 fix(custom_component.py): add user_id parameter to list_flows method in CustomComponent class to filter flows by user ID
🐛 fix(custom_component.py): add user_id parameter to get_flow method in CustomComponent class to filter flows by user ID
🐛 fix(conftest.py): add client parameter to active_user fixture in tests to fix missing dependency error
2023-08-25 15:26:21 -03:00
Gabriel Luiz Freitas Almeida
c268b2be17 🔥 refactor(models): remove Token model and references to it to simplify the codebase and remove unused code
🔥 refactor(test_custom_component.py): remove unused fixture and imports to clean up the test file
🔧 chore(test_custom_component.py): update component fixture to include user_id parameter for testing purposes
2023-08-25 15:26:20 -03:00
anovazzi1
82826d6b44 fix(constants.ts): update BASE_URL_API to "/api/v1/" to match backend API endpoint
fix(API/index.ts): update API endpoints to use BASE_URL_API instead of hardcoding "/api/v1/"
2023-08-25 15:15:19 -03:00
Gabriel Luiz Freitas Almeida
00e5f70fe1 🔀 chore(user.py): add relationship to flows in User model 2023-08-25 12:49:46 -03:00
Gabriel Luiz Freitas Almeida
b5e4df9943 🐛 fix(flows.py): add missing import statement for User model
🐛 fix(flows.py): add missing import statement for TYPE_CHECKING
 feat(flows.py): add user_id field to FlowCreate model to allow specifying the user for a new flow
 feat(flows.py): add user_id field to FlowRead model to include the user_id in the response
 feat(flows.py): add user_id field to Flow model and create a relationship with User model
 feat(flows.py): add current_user dependency to create_flow endpoint to set the user_id for a new flow
 feat(flows.py): add current_user dependency to read_flows endpoint to filter flows by current user
 feat(flows.py): add current_user dependency to read_flow endpoint to filter flow by current user
 feat(flows.py): add current_user dependency to update_flow endpoint to filter flow by current user
 feat(flows.py): add current_user dependency to delete_flow endpoint to filter flow by current user
 feat(flows.py): add current_user dependency to create_flows endpoint to set the user_id for new flows
 feat(flows.py): add current_user dependency to upload_file endpoint to set the user_id for new flows
 feat(flows.py): add current_user dependency to download_file endpoint to filter flows by current user
🐛 fix(flow.py): add missing import statement for User model
 feat(flow.py): add user_id field to Flow model to associate a flow with a user
2023-08-25 12:49:24 -03:00
Gabriel Luiz Freitas Almeida
16695c8241
Merge branch 'login' into authentication 2023-08-25 15:23:22 +00:00
Gabriel Luiz Freitas Almeida
a4aeff6d79 🔧 fix(api_key.py): import missing dependencies and fix type annotations in api_key.py
🔧 fix(api_key.py): fix type annotations and import in api_key.py
🔧 fix(api_key.py): fix type annotations and
2023-08-25 12:21:14 -03:00
Gabriel Luiz Freitas Almeida
950b9d179b 🔥 refactor(user/utils.py): remove unused code and imports from user/utils.py module
 feat(test_api_key.py): add tests for API key creation, retrieval, and deletion
 feat(test_user.py): remove unused fixtures and imports from test_user.py module
2023-08-25 12:05:54 -03:00
Gabriel Luiz Freitas Almeida
ba081e81b6 🔀 chore(user.py): add type hinting for ApiKey import to improve code readability
🔀 chore(user.py): add relationship between User and ApiKey models to establish a one-to-many relationship
2023-08-25 12:05:20 -03:00
Gabriel Luiz Freitas Almeida
7783f4532e 📦 chore(user/crud.py): add CRUD operations for User model in database
🔒 fix(user/crud.py): add validation to prevent duplicate usernames during user update
🔄 refactor(user/crud.py): update user attributes and last_login_at timestamp during user update
🐛 fix(user/crud.py): handle IntegrityError during user update and rollback transaction
2023-08-25 12:04:51 -03:00
Gabriel Luiz Freitas Almeida
e42686738c 📦 chore(api_key/crud.py): add CRUD functions for managing API keys in the database
This commit adds the following functions to the `api_key/crud.py` file:
- `get_api_keys`: Retrieves a list of API keys associated with a specific user ID from the database.
- `create_api_key`: Generates a random API key, hashes it, and creates a new `ApiKey` object in the database.
- `delete_api_key`: Deletes an API key from the database based on its ID.

These functions provide the necessary functionality for managing API keys in the application's database.
2023-08-25 12:04:20 -03:00
Gabriel Luiz Freitas Almeida
82fbeace06 🔀 chore(api_key): update import and export names in __init__.py for better clarity and consistency
🔀 chore(api_key): add UnmaskedApiKeyRead model to represent an unmasked API key

🔀 chore(api_key): add user relationship to ApiKey model for easier access to associated user

🔀 chore(api_key): add user_id field to ApiKeyBase and ApiKeyCreate models for easier user association

🔀 chore(api_key): add mask_api_key validator to ApiKeyRead model to mask the API key for security reasons
2023-08-25 12:03:51 -03:00
Gabriel Luiz Freitas Almeida
edd58705e4 🔨 refactor(schemas.py): update import statement for ApiKeyRead to reflect new file structure
🔨 refactor(schemas.py): update import statement for ApiKeyRead to reflect
2023-08-25 12:03:03 -03:00
Gabriel Luiz Freitas Almeida
eb02220aad feat(api_key.py): add GET and POST routes for retrieving and creating API keys
🐛 fix(api_key.py): fix delete_api_key route to use correct dependencies and handle exceptions properly
2023-08-25 12:02:32 -03:00
Gabriel Luiz Freitas Almeida
8d1e1b8710 🔒 chore(api_key.py): update hardcoded API key value to improve security
🔒 chore(api_key.py): update hardcoded API key value to improve security by removing the actual key from the code and adding a placeholder comment
2023-08-25 10:25:28 -03:00
Gabriel Luiz Freitas Almeida
81816baada 🔧 fix(login.py): update import statement from sqlalchemy.orm to sqlmodel.Session for Session class
🔧 fix(users.py): update type annotation for current_user parameter from Session to User
🔧 fix(utils.py): update import statement from sqlalchemy.orm to sqlmodel.Session
🔧 fix(utils.py): update type annotation for token parameter from Annotated to Union[Coroutine, str]
🔧 fix(utils.py): update type annotation for get_user_by_username function return type from User to Union[User, None]
🔧 fix(utils.py): update type annotation for get_user_by_id function return type from User to Union[User, None]
🔧 fix(manager.py): update type annotation for dependencies parameter in register_factory method from List to Optional[List]
2023-08-25 10:24:01 -03:00
Gabriel Luiz Freitas Almeida
7e3d329df9 🔧 chore(auth.py): add API_V1_STR constant to improve code readability and maintainability
🐛 fix(auth.py): update tokenUrl in oauth2_scheme to use API_V1_STR constant for consistency
2023-08-25 10:17:25 -03:00
Gabriel Luiz Freitas Almeida
92a7ae6be7 🐛 fix(utils.py): remove unnecessary type casting in get_user_by_username and get_user_by_id functions
🐛 fix(utils.py): fix update_user function to correctly update user attributes and handle username conflicts
2023-08-25 10:16:04 -03:00