This commit is contained in:
italojohnny 2024-06-13 12:30:20 -03:00
commit 5f14aece1a
2 changed files with 4 additions and 4 deletions

View file

@ -65,9 +65,8 @@ def serialize_field(value):
return value
def get_artifact_type(custom_component, build_result) -> str:
def get_artifact_type(value, build_result) -> str:
result = ArtifactType.UNKNOWN
value = custom_component.repr_value
match value:
case Record():
result = ArtifactType.RECORD

View file

@ -132,11 +132,12 @@ async def instantiate_custom_component(params, user_id, vertex, fallback_to_env_
raw = custom_component.repr_value
if hasattr(raw, "data") and raw is not None:
raw = raw.data
elif hasattr(raw, "model_dump") and raw is not None:
raw = raw.model_dump()
if raw is None and isinstance(build_result, (dict, Record, str)):
raw = build_result.data if isinstance(build_result, Record) else build_result
artifact_type = get_artifact_type(custom_component, build_result)
artifact_type = get_artifact_type(custom_component.repr_value or raw, build_result)
raw = post_process_raw(raw, artifact_type)
artifact = {"repr": custom_repr, "raw": raw, "type": artifact_type}
return custom_component, build_result, artifact