return artifact type to front
This commit is contained in:
parent
0f195b59e1
commit
9c9a7f4aa1
4 changed files with 10 additions and 5 deletions
|
|
@ -171,7 +171,7 @@ async def build_vertex(
|
|||
result_dict,
|
||||
log_message,
|
||||
valid,
|
||||
_,
|
||||
log_type,
|
||||
vertex,
|
||||
) = await graph.build_vertex(
|
||||
lock=lock,
|
||||
|
|
@ -186,6 +186,7 @@ async def build_vertex(
|
|||
except Exception as exc:
|
||||
logger.exception(f"Error building vertex: {exc}")
|
||||
log_message = format_exception_message(exc)
|
||||
log_type = type(exc).__name__
|
||||
valid = False
|
||||
result_data_response = ResultDataResponse(results={})
|
||||
|
||||
|
|
@ -193,7 +194,7 @@ async def build_vertex(
|
|||
# we need to clear the cache
|
||||
await chat_service.clear_cache(flow_id_str)
|
||||
|
||||
log_object = Log(message=log_message)
|
||||
log_object = Log(message=log_message, type=log_type)
|
||||
result_data_response.logs.append(log_object)
|
||||
|
||||
# Log the vertex build
|
||||
|
|
|
|||
|
|
@ -247,6 +247,7 @@ class VerticesOrderResponse(BaseModel):
|
|||
|
||||
class Log(TypedDict):
|
||||
message: str
|
||||
type: str
|
||||
|
||||
|
||||
class ResultDataResponse(BaseModel):
|
||||
|
|
|
|||
|
|
@ -735,16 +735,16 @@ class Graph:
|
|||
|
||||
if vertex.result is not None:
|
||||
params = vertex._built_object_repr()
|
||||
log_type = vertex.artifacts_type
|
||||
valid = True
|
||||
result_dict = vertex.result
|
||||
artifacts = vertex.artifacts
|
||||
else:
|
||||
raise ValueError(f"No result found for vertex {vertex_id}")
|
||||
|
||||
next_runnable_vertices, top_level_vertices = await self.get_next_and_top_level_vertices(
|
||||
lock, set_cache_coro, vertex
|
||||
)
|
||||
return next_runnable_vertices, top_level_vertices, result_dict, params, valid, artifacts, vertex
|
||||
return next_runnable_vertices, top_level_vertices, result_dict, params, valid, log_type, vertex
|
||||
except Exception as exc:
|
||||
logger.exception(f"Error building vertex: {exc}")
|
||||
raise exc
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from typing import TYPE_CHECKING, Any, AsyncIterator, Callable, Dict, Iterator,
|
|||
from loguru import logger
|
||||
|
||||
from langflow.graph.schema import INPUT_COMPONENTS, OUTPUT_COMPONENTS, InterfaceComponentTypes, ResultData
|
||||
from langflow.graph.utils import UnbuiltObject, UnbuiltResult
|
||||
from langflow.graph.utils import UnbuiltObject, UnbuiltResult, ArtifactType
|
||||
from langflow.graph.vertex.utils import log_transaction
|
||||
from langflow.interface.initialize import loading
|
||||
from langflow.interface.listing import lazy_load_dict
|
||||
|
|
@ -63,6 +63,7 @@ class Vertex:
|
|||
self._built_result = None
|
||||
self._built = False
|
||||
self.artifacts: Dict[str, Any] = {}
|
||||
self.artifacts_type: Optional[str] = None
|
||||
self.steps: List[Callable] = [self._build]
|
||||
self.steps_ran: List[Callable] = []
|
||||
self.task_id: Optional[str] = None
|
||||
|
|
@ -625,6 +626,8 @@ class Vertex:
|
|||
self._built_object, self.artifacts = result
|
||||
elif len(result) == 3:
|
||||
self._custom_component, self._built_object, self.artifacts = result
|
||||
self.artifacts_type = self.artifacts.get("type") or ArtifactType.UNKNOWN.value
|
||||
|
||||
else:
|
||||
self._built_object = result
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue