🐛 (loading.py): Fix bug where custom component outputs and results were not properly assigned
🐛 (base.py): Fix issue where outputs were not initialized causing potential errors
This commit is contained in:
parent
ba835dc16f
commit
01027cb7a3
2 changed files with 4 additions and 2 deletions
|
|
@ -60,6 +60,7 @@ class Vertex:
|
||||||
self.graph = graph
|
self.graph = graph
|
||||||
self._data = data
|
self._data = data
|
||||||
self.base_type: Optional[str] = base_type
|
self.base_type: Optional[str] = base_type
|
||||||
|
self.outputs: List[Dict] = []
|
||||||
self._parse_data()
|
self._parse_data()
|
||||||
self._built_object = UnbuiltObject()
|
self._built_object = UnbuiltObject()
|
||||||
self._built_result = None
|
self._built_result = None
|
||||||
|
|
@ -190,6 +191,7 @@ class Vertex:
|
||||||
else:
|
else:
|
||||||
self.outputs = self.data["node"].get("outputs", [])
|
self.outputs = self.data["node"].get("outputs", [])
|
||||||
self.output = self.data["node"]["base_classes"]
|
self.output = self.data["node"]["base_classes"]
|
||||||
|
|
||||||
self.display_name = self.data["node"].get("display_name", self.id.split("-")[0])
|
self.display_name = self.data["node"].get("display_name", self.id.split("-")[0])
|
||||||
|
|
||||||
self.description = self.data["node"].get("description", "")
|
self.description = self.data["node"].get("description", "")
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
import inspect
|
import inspect
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import warnings
|
|
||||||
from typing import TYPE_CHECKING, Any, Type
|
from typing import TYPE_CHECKING, Any, Type
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from pydantic import PydanticDeprecatedSince20
|
|
||||||
|
|
||||||
from langflow.custom.eval import eval_custom_component_code
|
from langflow.custom.eval import eval_custom_component_code
|
||||||
from langflow.schema import Data
|
from langflow.schema import Data
|
||||||
|
|
@ -164,4 +162,6 @@ async def build_custom_component(params: dict, custom_component: "CustomComponen
|
||||||
artifact_type = get_artifact_type(custom_component.repr_value or raw, build_result)
|
artifact_type = get_artifact_type(custom_component.repr_value or raw, build_result)
|
||||||
raw = post_process_raw(raw, artifact_type)
|
raw = post_process_raw(raw, artifact_type)
|
||||||
artifact = {"repr": custom_repr, "raw": raw, "type": artifact_type}
|
artifact = {"repr": custom_repr, "raw": raw, "type": artifact_type}
|
||||||
|
custom_component._artifacts = {custom_component.vertex.outputs[0].get("name"): artifact}
|
||||||
|
custom_component._results = {custom_component.vertex.outputs[0].get("name"): build_result}
|
||||||
return custom_component, build_result, artifact
|
return custom_component, build_result, artifact
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue