feat: Update SQLModel dependency and improve UUID handling (#4891)

* Update sqlmodel dependency to version 0.0.20 in pyproject.toml

* Handle UUID conversion for message IDs in memory update logic

* Refactor Alembic migrations to use `sa.inspect` and update GUID to Uuid type

* refactor: Change flow_id parameter type from str to uuid.UUID in graph building functions

* refactor: Ensure UUID handling for flow_id and user_id across various services and models

* refactor: improve UUID handling and graph caching for compatibility with sqlmodel 0.0.20

* fix: update message assertion in component events test

* chore: update sqlmodel dependency to version 0.0.22 in uv.lock and pyproject.toml

* fix: enhance flow_id validation to ensure valid UUID format in MessageBase model

* fix: add error handling for cache directory cleanup

* refactor: improve flow_id type handling in message storage

* refactor: enhance flow_id handling in message functions to support UUID type

* refactor: integrate Properties into message creation in component event tests

* update test durations

* fix: correct flow_id parameter in database query

* refactor: update session_id and flow_id parameters to support UUID type across message handling functions and models

* fix: handle message data update in SQLModel update method

* refactor: improve flow_id assignment in message update method to enhance UUID handling
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-12-12 09:58:27 -03:00 • committed by GitHub
commit 3de42f4575
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 1035 additions and 898 deletions

View file

@ -6,6 +6,7 @@ from langchain_core.messages import AIMessage, HumanMessage
from langchain_core.prompts.chat import ChatPromptTemplate
from langflow.schema.message import Message
from langflow.utils.constants import MESSAGE_SENDER_AI, MESSAGE_SENDER_USER
from loguru import logger
from platformdirs import user_cache_dir
@ -176,4 +177,7 @@ def cleanup():
# Clean up the real cache directory after tests
cache_dir = Path(user_cache_dir("langflow"))
if cache_dir.exists():
shutil.rmtree(str(cache_dir))
try:
shutil.rmtree(str(cache_dir))
except OSError as exc:
logger.error(f"Error cleaning up cache directory: {exc}")