Update ResultDict to ResultData in build_vertex function
This commit is contained in:
parent
90cf166ef6
commit
0eaed5bbcb
1 changed files with 11 additions and 4 deletions
|
|
@ -3,7 +3,7 @@ from typing import Callable
|
||||||
|
|
||||||
import socketio
|
import socketio
|
||||||
from langflow.api.utils import format_elapsed_time
|
from langflow.api.utils import format_elapsed_time
|
||||||
from langflow.api.v1.schemas import ResultDict, VertexBuildResponse
|
from langflow.api.v1.schemas import ResultData, VertexBuildResponse
|
||||||
from langflow.graph.graph.base import Graph
|
from langflow.graph.graph.base import Graph
|
||||||
from langflow.graph.vertex.base import StatelessVertex
|
from langflow.graph.vertex.base import StatelessVertex
|
||||||
from langflow.services.database.models.flow.model import Flow
|
from langflow.services.database.models.flow.model import Flow
|
||||||
|
|
@ -73,11 +73,16 @@ async def build_vertex(
|
||||||
artifacts = vertex.artifacts
|
artifacts = vertex.artifacts
|
||||||
timedelta = time.perf_counter() - start_time
|
timedelta = time.perf_counter() - start_time
|
||||||
duration = format_elapsed_time(timedelta)
|
duration = format_elapsed_time(timedelta)
|
||||||
result_dict = ResultDict(results=result_dict, artifacts=artifacts, duration=duration, timedelta=timedelta)
|
result_dict = ResultData(
|
||||||
|
results=result_dict,
|
||||||
|
artifacts=artifacts,
|
||||||
|
duration=duration,
|
||||||
|
timedelta=timedelta,
|
||||||
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
params = str(exc)
|
params = str(exc)
|
||||||
valid = False
|
valid = False
|
||||||
result_dict = ResultDict(results={})
|
result_dict = ResultData(results={})
|
||||||
artifacts = {}
|
artifacts = {}
|
||||||
set_cache(flow_id, graph)
|
set_cache(flow_id, graph)
|
||||||
await log_vertex_build(
|
await log_vertex_build(
|
||||||
|
|
@ -90,7 +95,9 @@ async def build_vertex(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Emit the vertex build response
|
# Emit the vertex build response
|
||||||
response = VertexBuildResponse(valid=valid, params=params, id=vertex.id, data=result_dict)
|
response = VertexBuildResponse(
|
||||||
|
valid=valid, params=params, id=vertex.id, data=result_dict
|
||||||
|
)
|
||||||
await sio.emit("vertex_build", data=response.model_dump(), to=sid)
|
await sio.emit("vertex_build", data=response.model_dump(), to=sid)
|
||||||
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue