🐛 fix(endpoints.py): handle ImportError when importing langflow.worker.process_graph_cached_task to prevent crash when Celery is not installed
🔥 chore(endpoints.py): remove unused import of langflow.worker.process_graph_cached_task 🔀 chore(endpoints.py): refactor process_flow function to handle different result types from task_service.launch_task
This commit is contained in:
parent
9c6cfc07ab
commit
c7fc8444ea
1 changed files with 13 additions and 2 deletions
|
|
@ -30,7 +30,15 @@ from langflow.interface.types import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from langflow.services.utils import get_session
|
from langflow.services.utils import get_session
|
||||||
|
|
||||||
|
try:
|
||||||
from langflow.worker import process_graph_cached_task
|
from langflow.worker import process_graph_cached_task
|
||||||
|
except ImportError:
|
||||||
|
|
||||||
|
def process_graph_cached_task(*args, **kwargs):
|
||||||
|
raise NotImplementedError("Celery is not installed")
|
||||||
|
|
||||||
|
|
||||||
from sqlmodel import Session
|
from sqlmodel import Session
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -143,6 +151,9 @@ async def process_flow(
|
||||||
clear_cache,
|
clear_cache,
|
||||||
session_id,
|
session_id,
|
||||||
)
|
)
|
||||||
|
if isinstance(result, dict) and "result" in result:
|
||||||
|
task_result = result["result"]
|
||||||
|
else:
|
||||||
task_result = result.result
|
task_result = result.result
|
||||||
session_id = result.session_id
|
session_id = result.session_id
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue