implement routing and next_vertex_to_build
This commit is contained in:
parent
0003e4b7e9
commit
94c40aa91a
1 changed files with 8 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ from langflow.api.v1.schemas import (
|
||||||
VerticesOrderResponse,
|
VerticesOrderResponse,
|
||||||
)
|
)
|
||||||
from langflow.graph.graph.base import Graph
|
from langflow.graph.graph.base import Graph
|
||||||
|
from langflow.graph.vertex.types import RoutingVertex
|
||||||
from langflow.services.auth.utils import (
|
from langflow.services.auth.utils import (
|
||||||
get_current_active_user,
|
get_current_active_user,
|
||||||
get_current_user_for_websocket,
|
get_current_user_for_websocket,
|
||||||
|
|
@ -161,6 +162,12 @@ async def build_vertex(
|
||||||
artifacts = vertex.artifacts
|
artifacts = vertex.artifacts
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"No result found for vertex {vertex_id}")
|
raise ValueError(f"No result found for vertex {vertex_id}")
|
||||||
|
if isinstance(vertex, RoutingVertex):
|
||||||
|
if vertex._built_object is True:
|
||||||
|
next_vertex_id = next(graph.next_vertex_to_build())
|
||||||
|
else:
|
||||||
|
next_vertex_id = None
|
||||||
|
|
||||||
chat_service.set_cache(flow_id, graph)
|
chat_service.set_cache(flow_id, graph)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
params = str(exc)
|
params = str(exc)
|
||||||
|
|
@ -189,7 +196,7 @@ async def build_vertex(
|
||||||
vertex.add_build_time(timedelta)
|
vertex.add_build_time(timedelta)
|
||||||
|
|
||||||
return VertexBuildResponse(
|
return VertexBuildResponse(
|
||||||
successors=vertex.successors_ids,
|
next_vertex_id=next_vertex_id,
|
||||||
valid=valid,
|
valid=valid,
|
||||||
params=params,
|
params=params,
|
||||||
id=vertex.id,
|
id=vertex.id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue