Commit graph

4,616 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
59a08cd645 🔧 chore(crud.py): change return type of check_key function from bool to Optional[ApiKey] to provide more information about the API key
🔧 chore(crud.py): rename api_key variable to api_key_object in check_key function for better clarity
🔧 chore(crud.py): change return value of check_key function from True to api_key_object.user to provide the associated user with the API key
2023-08-28 07:01:01 -03:00
Gabriel Luiz Freitas Almeida
ed9796e473 🐛 fix(api_key.py): change variable name from 'e' to 'exc' for better readability and semantics
🐛 fix(endpoints.py): add 'api_key' parameter to 'process_flow' function to fix missing dependency error
🐛 fix(endpoints.py): add exception chaining to HTTPException in 'process_flow' function for better error handling
🐛 fix(utils.py): change return type of 'api_key_security' function to Optional[ApiKey] for better type hinting
🐛 fix(utils.py): change variable name from 'e' to 'exc' for better readability and semantics
2023-08-28 07:00:45 -03:00
Gabriel Luiz Freitas Almeida
4bc4a39e5e 🔒 chore(api_key.py): refactor mask_api_key validator to improve readability and maintainability
🔒 chore(api_key.py): update api_key field in ApiKeyRead model to remove index=True and unique=True constraints
2023-08-28 06:48:38 -03:00
Gabriel Luiz Freitas Almeida
5605b2aa44 🔥 refactor(alembic): remove flowstyles table migration
🔥 refactor(alembic): remove add_flow_table migration

 feat(alembic): add adds_tables migration to create user and apikey tables

🔥 chore(alembic): remove unnecessary alembic migration files

The following alembic migration files were removed:
- `5512e39b4012_add_apikey_table.py`
- `6384181fb7e8_update_api_key.py`
- `d3749cf7ac7e_update_all_tables.py`

These files are no longer needed as they are no longer relevant to the current state of the database schema. Removing them helps to keep the project's codebase clean and organized.
2023-08-27 20:04:15 -03:00
Gabriel Luiz Freitas Almeida
d06ea50674 🐛 fix(env.py): enable batch rendering for migrations to improve performance 2023-08-27 19:55:32 -03:00
Gabriel Luiz Freitas Almeida
19653858be 🔧 chore(utils.py): refactor create_super_user function to accept optional username and password parameters for flexibility
🔒 fix(utils.py): use the provided username and password parameters if available when creating the super user, instead of relying solely on the settings manager
2023-08-27 19:55:20 -03:00
Gabriel Luiz Freitas Almeida
7d3a3db7e3 🔧 chore(__main__.py): refactor imports to improve readability and maintainability
 feat(__main__.py): add 'superuser' command to create a superuser with provided username and password
2023-08-27 19:55:09 -03:00
Gabriel Luiz Freitas Almeida
b70d5501a2 🐛 fix(ApiKeysPage): handle cases where keysList.current is null or undefined to prevent errors
 feat(ApiKeysPage): add conditional rendering for keysList.current to display appropriate messages when there are no keys assigned or when loading keys
2023-08-27 19:54:59 -03:00
Gabriel Luiz Freitas Almeida
048ea7f743 🔧 chore(Makefile): update pytest command to run tests in parallel using pytest-xdist plugin
📦 deps(pyproject.toml): add pytest-xdist as a development dependency to enable parallel test execution
2023-08-27 19:16:51 -03:00
Gabriel Luiz Freitas Almeida
ea4cd294c1 🔧 fix(test_endpoints.py): fix typo in function name 'created_api_key' to 'create_api_key' for consistency
 feat(test_endpoints.py): add test case for handling invalid API key in 'test_process_flow_invalid_api_key' function
 feat(test_endpoints.py): add test case for handling invalid flow ID in 'test_process_flow_invalid_id' function
 feat(test_endpoints.py): add test case for handling flow not found in 'test_process_flow_invalid_id' function
 feat(test_endpoints.py): add test case for testing process flow without autologin in 'test_process_flow_without_autologin' function
2023-08-27 19:16:39 -03:00
Gabriel Luiz Freitas Almeida
a700ab1f71 🐛 fix(endpoints.py): handle specific exceptions when processing flow to provide more informative error messages 2023-08-27 19:16:30 -03:00
Gabriel Luiz Freitas Almeida
7c2bbad5ab 🐛 fix(api_key.py): fix delete_api_key_route URL path by removing double slashes 2023-08-26 17:40:02 -03:00
Gabriel Luiz Freitas Almeida
e850c0cbc6 🔧 fix(api_key/crud.py): remove unused import statement for get_password_hash function
 feat(api_key/crud.py): prepend 'lf-' to generated API key for better identification and readability
 feat(api_key/crud.py): add check_key function to validate API key and update total uses and last used at timestamp
2023-08-26 17:39:22 -03:00
Gabriel Luiz Freitas Almeida
9c77cc1875 🔧 fix(endpoints.py): update import statement for get_current_active_user function to match the new location
🔧 fix(endpoints.py): update import statement for api_key_security function to match the new location
🔧 fix(endpoints.py): update dependencies argument in router.post calls to use a list instead of multiple lines for better readability
🔧 fix(endpoints.py): remove valid argument from process_flow function as it is no longer needed
🔧 fix(api_key.py): remove hashed_api_key field as it is no longer used
🔧 fix(api_key.py): add total_uses field to track the number of times the API key has been used
🔧 fix(api_key.py): add is_active field to track the status of the API key
2023-08-26 17:39:08 -03:00
Gabriel Luiz Freitas Almeida
f687599ecc 🐛 fix(api_key.py): fix incorrect route prefix in APIRouter declaration 2023-08-26 17:38:56 -03:00
Gabriel Luiz Freitas Almeida
0f3bf9192d 🔒 chore(utils.py): refactor import statements and remove unused imports for better code organization and readability
🔒 chore(utils.py): refactor auth_scheme_dependency to use OAuth2PasswordBearer for better security
🔒 chore(utils.py): refactor validate_api_key to use check_key function from crud module for better code reuse
🔒 chore(utils.py): add api_key_security function to handle API key authentication logic
🔒 chore(utils.py): refactor get_current_user to use oauth2_login dependency for better security
🔒 chore(utils.py): remove unused validate_api_key function
🔒 chore(auth.py): remove unused oauth2_scheme variable for better code organization
2023-08-26 17:38:43 -03:00
Gabriel Luiz Freitas Almeida
ed06c3b4d9 🐛 fix(conftest.py): import missing Flow model in tests/conftest.py to fix NameError
 feat(conftest.py): add fixture 'flow' to create a test flow in tests/conftest.py
🐛 fix(test_endpoints.py): import missing get_settings_manager function in tests/test_endpoints.py to fix NameError
 feat(test_endpoints.py): add test case 'test_process_flow_without_autologin' to test flow processing without auto login
🐛 fix(test_endpoints.py): fix incorrect endpoint URL in test case 'test_process_flow_without_autologin' in tests/test_endpoints.py
 feat(test_endpoints.py): add test case 'test_process_flow_fails_autologin_off' to test flow processing failure when auto login is off
2023-08-26 17:38:21 -03:00
Gabriel Luiz Freitas Almeida
96c7d4c897 🔧 chore(api_key.py): remove index and unique constraints from api_key field in UnmaskedApiKeyRead model to align with database schema changes 2023-08-25 20:12:49 -03:00
Cristhian Zanforlin Lousa
512be8b9a7 Merge branch 'login' of https://github.com/logspace-ai/langflow into login 2023-08-25 20:06:16 -03:00
Cristhian Zanforlin Lousa
be0c7ce368 🐛 fix(ApiKeysPage): handle case when last_used_at date is invalid to prevent error in moment.js formatting
🎨 style(ApiKeysPage): improve table header className logic for better readability
2023-08-25 20:06:11 -03:00
Gabriel Luiz Freitas Almeida
3d82647b4f 🐛 fix(api_key/crud.py): update create_api_key function to return the generated API key instead of the unmasked API key 2023-08-25 20:05:47 -03:00
Gabriel Luiz Freitas Almeida
2151f1e63f 📦 chore(pyproject.toml): add pytest-mock as a development dependency for better testing capabilities 2023-08-25 20:03:16 -03:00
Gabriel Luiz Freitas Almeida
282e6b0c18 🐛 fix(endpoints.py): import validate_api_key function from auth.utils to fix missing dependency
 feat(endpoints.py): add validation of API key in process_flow endpoint to ensure only valid requests are processed
🔧 chore(utils.py): add validate_api_key function to validate API key against database
🔧 chore(test_endpoints.py): add test case for process_flow endpoint to test API key validation and processing
2023-08-25 20:03:15 -03:00
Gabriel Luiz Freitas Almeida
dc20de76b5 🔧 chore(api_key.py): improve error handling in delete_api_key_route function
🔧 chore(add_apikey_table.py): add hashed_api_key column to apikey table
🔧 chore(update_api_key.py): add migration script to update apikey table with hashed_api_key column
2023-08-25 20:03:14 -03:00
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
812864eded 🔧 fix(test_agents_template.py): update test functions to include logged_in_headers parameter to test authenticated requests
🔧 fix(test_chains_template.py): update test functions to include logged_in_headers parameter to test authenticated requests
🔧 fix(test_endpoints.py): update test_get_all function to include logged_in_headers parameter to test authenticated requests
🔧 fix(test_llms_template.py): update test functions to include logged_in_headers parameter to test authenticated requests
🔧 fix(test_prompts_template.py): update test functions to include logged_in_headers parameter to test authenticated requests
🔧 fix(test_vectorstore_template.py): update test functions to include logged_in_headers parameter to test authenticated requests
2023-08-25 16:30:01 -03:00
Gabriel Luiz Freitas Almeida
1364fa0e0f 🔧 chore(conftest.py): change scope of client fixture to module and add autouse=True to ensure it is automatically used by all tests in the module 2023-08-25 16:29:51 -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