Commit graph

4,859 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
5b6c732213 🔧 chore(manager.py): refactor load_session method to use a more descriptive variable name 'key' instead of 'session_id' for better readability
🔧 chore(manager.py): refactor generate_key method to use a separate build_key method for better separation of concerns
🔧 chore(manager.py): refactor update_session method to use the build_key method for better separation of concerns
🔧 chore(manager.py): refactor clear_session method to use the build_key method for better separation of concerns
🔧 chore(manager.py): add type hinting for cache_manager parameter in the __init__ method for better code clarity
2023-09-05 12:24:07 -03:00
Gabriel Luiz Freitas Almeida
8c8e26472d 🐛 fix(process.py): add missing else statement to properly assign session_id when not generating a new key 2023-09-05 12:23:33 -03:00
Gabriel Luiz Freitas Almeida
6309de1654 🚀 feat: add Basic Chat with Prompt and History (2) node
ℹ️ This commit adds a new node called "Basic Chat with Prompt and History (2)" to the chat application. This node is responsible for creating a simple chat interface with a custom prompt template and a conversational memory buffer.

The node configuration includes various properties such as callbacks, cache, client, max_retries, max_tokens, metadata, model_kwargs, model_name, n, openai_api_base, openai_api_key, openai_organization, openai_proxy, and more.

This new node enhances the chat functionality by providing a more interactive and dynamic chat experience for users.

📝 chore(tests): add BasicChatwithPromptandHistory.json test data file for testing purposes

🔧 fix(test_endpoints.py): remove unused imports and trailing whitespace
 test(test_endpoints.py): add test for basic chat in process endpoint to verify correct response and session_id generation
 test(test_endpoints.py): add test for basic chat with different session_ids to verify correct response
 test(test_endpoints.py): add test for basic chat with two session_ids and names to verify correct response
2023-09-05 11:55:53 -03:00
Gabriel Luiz Freitas Almeida
a61b2bbe1d 🔧 chore(conftest.py): import orjson library for JSON handling
🔧 chore(conftest.py): add pytest fixture for loading JSON flow with prompt and history
🔧 chore(conftest.py): add pytest fixture for adding a flow with prompt and history to the database
2023-09-05 11:55:39 -03:00
Gabriel Luiz Freitas Almeida
c68b9e39c7 🚀 feat(session): add session_id_generator utility function to generate a random session ID
🐛 fix(session): generate a 5 character session ID if session_id is None to ensure a unique key is created
2023-09-05 11:55:19 -03:00
Gabriel Luiz Freitas Almeida
e1800ff682 🔧 chore(api_key/crud.py): remove unused imports and variables for cleaner code
🐛 fix(api_key/crud.py): update_total_uses function now uses the same session as the caller to avoid thread safety issues
2023-09-05 11:54:53 -03:00
Gabriel Luiz Freitas Almeida
a6e9cce02f 🐛 fix(process.py): fix session_id assignment logic to ensure it is generated if not provided 2023-09-05 11:53:54 -03:00
Gabriel Luiz Freitas Almeida
f7e5a3d422 🔧 chore(test.yml): update POETRY_VERSION environment variable to "1.5.0" to use the latest version of Poetry
🔒 chore(test.yml): add OPENAI_API_KEY environment variable to securely store the OpenAI API key
2023-09-05 11:53:30 -03:00
Gabriel Luiz Freitas Almeida
f3d866f0b6 🐛 fix(test_endpoints.py): fix import statements and add missing import for crud module
 feat(test_endpoints.py): add mock function for update_total_uses to fix test_process_flow_invalid_api_key
 feat(test_endpoints.py): add mock function for update_total_uses to fix test_process_flow_without_autologin
 feat(test_endpoints.py): add mock function for update_total_uses to fix test_process_flow_fails_autologin_off
2023-09-05 09:34:57 -03:00
Gabriel Luiz Freitas Almeida
ae2e993680 🐛 fix(manager.py): fix import statement to include Dict in typing module
 feat(manager.py): refactor check_table method in DatabaseManager class to use list comprehension for improved readability and performance
2023-09-05 09:34:45 -03:00
Gabriel Luiz Freitas Almeida
2e09d53ced Merge remote-tracking branch 'origin/dev' into celery 2023-09-05 08:19:40 -03:00
Cristhian Zanforlin Lousa
e50b593681 🐛 fix(API/index.ts): handle potential undefined response object properties to prevent errors 2023-09-04 20:18:10 -03:00
Lucas Oliveira
5df8b11d9f Changed autocomplete to only fill when on form 2023-09-04 16:37:43 -03:00
anovazzi1
82368bbe76
Login enhancements (#847)
This pull request introduces a series of enhancements to our recently
revamped login page, streamlining the user experience. These changes
were meticulously designed and developed to ensure a seamless login
process for our users while adhering to the highest standards of
usability and privacy.
2023-09-04 16:20:18 -03:00
anovazzi1
2112f6152e Merge remote-tracking branch 'origin/dev' into login_improvements 2023-09-04 16:19:13 -03:00
Gabriel Luiz Freitas Almeida
4efab50916
Replace logging with loguru (#863) 2023-09-04 19:18:50 +00:00
Gabriel Luiz Freitas Almeida
e8846fc568
Merge branch 'dev' into implement_loguru 2023-09-04 19:17:21 +00:00
Gabriel Luiz Freitas Almeida
28b487dc33 🔧 fix(manager.py): change logger.warn to logger.warning for consistency and clarity
🔧 fix(logger.py): change log_file parameter type annotation to Optional[Path] to indicate that it is an optional argument
2023-09-04 16:15:41 -03:00
Gabriel Luiz Freitas Almeida
7e336bbee6 🐛 fix(logger.py): change log_level variable to uppercase to improve consistency and semantics 2023-09-04 16:13:01 -03:00
Gabriel Luiz Freitas Almeida
3c153c8b1b
Improves endpoint dependency usage (#862) 2023-09-04 19:06:31 +00:00
Gabriel Luiz Freitas Almeida
58c3e5e9dc refactor: replace loggers with loguru 2023-09-04 11:38:39 -03:00
Gabriel Luiz Freitas Almeida
87eb8b1a95 🔧 chore(logger.py): refactor logger configuration to use loguru library and improve log formatting 2023-09-04 11:35:22 -03:00
Gabriel Luiz Freitas Almeida
5f98f0bbd9 📦 chore(pyproject.toml): add loguru package as a dependency for improved logging capabilities 2023-09-04 11:34:38 -03:00
Gabriel Luiz Freitas Almeida
2ab3fcb28a 🐛 fix(base.py): set default value of frontend_node to None in ValidatePromptRequest class to avoid potential NoneType errors
🐛 fix(validate.py): set frontend_node to None instead of an empty dictionary in post_validate_prompt function to align with the default value in ValidatePromptRequest class
2023-09-04 10:04:21 -03:00
Gabriel Luiz Freitas Almeida
7cb1dbf226 🐛 fix(test_endpoints.py): change header key from 'api-key' to 'x-api-key' to align with API key header convention
 feat(test_endpoints.py): change mock_process_graph_cached function to be async and return a Result object instead of a tuple to improve code readability and maintainability
2023-09-04 09:56:27 -03:00
Gabriel Luiz Freitas Almeida
320bc96a7a 🔧 fix(schemas.py): add session_id field to ProcessResponse schema to support session-based processing
🔧 fix(process.py): add Result dataclass to encapsulate result and session_id for session-based processing

🔧 fix(manager.py): remove unused method clear_session in SessionManager
2023-09-04 09:56:17 -03:00
Gabriel Luiz Freitas Almeida
8d484eb046 feat(task backends): add support for AnyIO backend
📦 chore(task backends): add base class for task backends
📦 chore(task backends): add support for Celery backend
2023-09-04 09:38:07 -03:00
Gabriel Luiz Freitas Almeida
e303881155 🔧 fix(endpoints.py): import TaskManager from the correct module to fix import error
🔧 fix(endpoints.py): add missing import statement for TaskManager
🔧 fix(endpoints.py): add missing import statement for sync parameter
2023-09-04 09:37:18 -03:00
Gabriel Luiz Freitas Almeida
dc1a5c81a1
added missing backslashes to api key request definition and bugfix to migration script (#858) 2023-09-04 12:36:17 +00:00
root
b1c24054c6 added indent to index dropping on non-existing table 2023-09-04 11:41:34 +00:00
Gabriel Luiz Freitas Almeida
53c5a3ccde 🐛 fix(base.py): make frontend_node field in PromptValidationResponse optional to handle cases where it is not provided 2023-09-04 07:05:10 -03:00
Gabriel Luiz Freitas Almeida
833fb4ad8f 🔀 chore(utils.py): add type hint for get_session() function to indicate it returns a generator instead of a Session object 2023-09-04 07:01:05 -03:00
Gabriel Luiz Freitas Almeida
43864904ef 🔧 chore(Makefile): update mypy command to only check files in src/backend/langflow directory to improve performance and reduce noise in the output 2023-09-04 07:00:38 -03:00
Gabriel Luiz Freitas Almeida
37ebbf4e65 Formatting 2023-09-04 06:42:41 -03:00
Gabriel Luiz Freitas Almeida
84a0d3acb3 🔧 fix(chat.py): remove unused imports and type hints to improve code readability
 feat(chat.py): add dependency injection for ChatManager in chat and init_build routes to improve modularity and testability
🔧 fix(chat.py): remove duplicate instantiation of ChatManager in chat and init_build routes to improve efficiency
🔧 fix(chat.py): remove duplicate instantiation of ChatManager in stream_build route to improve efficiency
🔧 fix(utils.py): add missing import for ChatManager in get_chat_manager function
2023-09-04 06:42:01 -03:00
Gabriel Luiz Freitas Almeida
2bbbf44b39 🐛 fix(endpoints.py): change get_all function signature to include settings_manager as a dependency to improve code readability
🐛 fix(flows.py): change update_flow function signature to include settings_manager as a dependency to improve code readability
🐛 fix(login.py): change auto_login function signature to include settings_manager as a dependency to improve code readability
🐛 fix(users.py): change add_user function signature to include session as a dependency to improve code readability
🐛 fix(users.py): change read_all_users function signature to include session as a dependency to improve code readability
🐛 fix(users.py): change patch_user function signature to include session as a dependency to improve code readability
🐛 fix(users.py): change delete_user function signature to include session as a dependency to improve code readability
🐛 fix(users.py): change add_super_user_for_testing_purposes_delete_me_before_merge_into_dev function signature to include session as a dependency to improve code readability
2023-09-04 06:41:34 -03:00
root
6d6ab9a874 added missing backslashes to api key request definition 2023-09-02 21:36:49 +00:00
Gabriel Luiz Freitas Almeida
f656b71173 🐛 fix(utils.py): fix logger warning message to correctly display the CACHE_TYPE or LANGCHAIN_CACHE variable instead of CACHE variable 2023-09-01 17:22:40 -03:00
Gabriel Luiz Freitas Almeida
e26d61fcfe 🐛 fix(endpoints.py): import missing get_task_manager function to fix NameError
 feat(endpoints.py): add support for launching tasks using task manager to improve task management
🐛 fix(endpoints.py): change process_graph_cached_task function call to use task_manager.launch_task to fix AttributeError
🐛 fix(endpoints.py): change process_flow function to use task_manager.get_task to fix AttributeError
🐛 fix(endpoints.py): change get_task_status function to use task_manager.get_task to fix AttributeError
🐛 fix(process.py): change process_graph_cached function to be async to fix TypeError
2023-09-01 17:22:30 -03:00
Gabriel Luiz Freitas Almeida
bd6655b0db 🐛 fix(manager.py): handle None service in teardown loop to prevent potential errors
 feat(manager.py): add support for task manager service in the service manager initialization process
 feat(schema.py): add task manager service type to the ServiceType enum
2023-09-01 17:22:14 -03:00
Gabriel Luiz Freitas Almeida
6418d5e56c 🔀 chore(utils.py): add type hints to imported modules for better code readability and maintainability
 feat(utils.py): add get_task_manager() function to retrieve the TaskManager instance from the service manager
2023-09-01 17:22:01 -03:00
Gabriel Luiz Freitas Almeida
0cd90bf133 🐛 fix(utils.py): update API_KEY_NAME from "api-key" to "x-api-key" to align with naming conventions and improve clarity 2023-09-01 17:21:54 -03:00
Gabriel Luiz Freitas Almeida
d508a1407c 🔨 refactor(base.py): remove inheritance of Service class from BaseCacheManager to simplify class hierarchy
🔨 refactor(factory.py): add type hinting for settings_manager parameter in create method of CacheManagerFactory

🔨 refactor(manager.py): remove inheritance of Service class from InMemoryCache and RedisCache to simplify class hierarchy
2023-09-01 17:21:40 -03:00
Gabriel Luiz Freitas Almeida
b6fa053291 🐛 fix(locustfile.py): update host URL to include correct port number
 feat(locustfile.py): add x-api-key header to requests for authentication
🐛 fix(locustfile.py): provide default value for FLOW_ID environment variable to prevent errors
2023-09-01 17:21:26 -03:00
Gabriel Luiz Freitas Almeida
7f2f8d1b0a 🔧 chore(base.py): rename CACHE variable to CACHE_TYPE for better clarity and consistency
🔧 chore(base.py): add LANGCHAIN_CACHE variable to specify the cache type for langchain
2023-09-01 17:21:18 -03:00
Gabriel Luiz Freitas Almeida
54cfca3dd6 🐛 fix(api_key/crud.py): fix session concurrency issue when updating total uses and last used at fields 2023-09-01 17:20:55 -03:00
Gabriel Luiz Freitas Almeida
8faad70917 feat(task): add TaskManagerFactory class to create and configure a TaskManager
🐛 fix(task): update get_task_status function in TaskManager class to return the correct task status
🔧 chore(task): add AsyncIOTaskResult class to handle asyncio tasks and get their status and result
🔧 chore(task): add get_celery_worker_status function to get the status of the Celery worker
2023-09-01 17:20:40 -03:00
Gabriel Luiz Freitas Almeida
5c258d08f0 Merge remote-tracking branch 'origin/dev' into celery 2023-09-01 15:24:07 -03:00
Cristhian Zanforlin Lousa
1b317ee4c9 Merge branch 'dev' of https://github.com/logspace-ai/langflow into dev 2023-08-31 16:07:53 -03:00
Cristhian Zanforlin Lousa
d16456d795 🎨 style(headerComponent): add cursor-pointer class to admin page and logout menu items for better user experience 2023-08-31 16:07:48 -03:00