Skip to content

Commit

Permalink
fix frozen
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoloboschi committed Aug 2, 2024
1 parent ddc6ab4 commit 7b8f5ec
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/backend/base/langflow/graph/graph/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,15 +880,11 @@ async def build_vertex(
try:
params = ""
if vertex.frozen:
# Check the cache for the vertex
cached_result = await chat_service.get_cache(key=vertex.id) if chat_service else CacheMiss
if isinstance(cached_result, CacheMiss):
await vertex.build(
user_id=user_id, inputs=inputs_dict, fallback_to_env_vars=fallback_to_env_vars, files=files
)
if chat_service:
await chat_service.set_cache(key=vertex.id, data=vertex)
if chat_service:
cached_result = await chat_service.get_cache(key=vertex.id)
else:
cached_result = None
if cached_result and not isinstance(cached_result, CacheMiss):
cached_vertex = cached_result["result"]
# Now set update the vertex with the cached vertex
vertex._built = cached_vertex._built
Expand All @@ -899,7 +895,12 @@ async def build_vertex(
vertex._custom_component = cached_vertex._custom_component
if vertex.result is not None:
vertex.result.used_frozen_result = True

else:
await vertex.build(
user_id=user_id, inputs=inputs_dict, fallback_to_env_vars=fallback_to_env_vars, files=files
)
if chat_service:
await chat_service.set_cache(key=vertex.id, data=vertex)
else:
await vertex.build(
user_id=user_id, inputs=inputs_dict, fallback_to_env_vars=fallback_to_env_vars, files=files
Expand Down

0 comments on commit 7b8f5ec

Please sign in to comment.