fix: Refactor JSON serialization in build_flow and log_vertex_build (#5189)
* refactor(langflow): Update JSON serialization in build_flow and log_vertex_build * Refactor JSON serialization in build_flow and log_vertex_build functions * Refactor JSON serialization in build_flow and log_vertex_build functions
This commit is contained in:
parent
2c0991f9cf
commit
0531084e35
2 changed files with 7 additions and 0 deletions
|
|
@ -176,6 +176,7 @@ async def log_vertex_build(
|
|||
try:
|
||||
if not get_settings_service().settings.vertex_builds_storage_enabled:
|
||||
return
|
||||
|
||||
vertex_build = VertexBuildBase(
|
||||
flow_id=flow_id,
|
||||
id=vertex_id,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
from fastapi.encoders import jsonable_encoder
|
||||
from pydantic import BaseModel, field_serializer
|
||||
from pydantic.v1 import BaseModel as V1BaseModel
|
||||
from pydantic_core import PydanticSerializationError
|
||||
|
||||
from langflow.schema.log import LoggableType
|
||||
|
||||
|
|
@ -24,4 +26,8 @@ class Log(BaseModel):
|
|||
return value.to_json()
|
||||
if isinstance(value, BaseModel):
|
||||
return value.model_dump(exclude_none=True)
|
||||
try:
|
||||
value = jsonable_encoder(value)
|
||||
except PydanticSerializationError:
|
||||
return str(value)
|
||||
return value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue