fix: fixes date time issue, which was blocking run flow execution of agent flows (#5866)
* fixes PydanticSerializationError
fixes:
PydanticSerializationError: Error calling function `serialize_model`: TypeError: tz_convert() takes exactly 2 positional arguments (1 given)
* format
* [autofix.ci] apply automated fixes
* Update src/backend/base/langflow/api/v1/schemas.py
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
cfe265337a
commit
8108d6fc13
2 changed files with 8 additions and 5 deletions
|
|
@ -287,7 +287,7 @@ class ResultDataResponse(BaseModel):
|
|||
return f"{obj[:max_length]}... [truncated]"
|
||||
return obj
|
||||
if isinstance(obj, datetime):
|
||||
return obj.astimezone().isoformat()
|
||||
return obj.replace(tzinfo=timezone.utc).isoformat()
|
||||
if isinstance(obj, Decimal):
|
||||
return float(obj)
|
||||
if isinstance(obj, UUID):
|
||||
|
|
|
|||
|
|
@ -86,6 +86,9 @@ def serialize_field(value):
|
|||
if hasattr(value, "to_json"):
|
||||
return value.to_json()
|
||||
return value.dict()
|
||||
# Handle datetime objects
|
||||
if hasattr(value, "isoformat"):
|
||||
return value.isoformat()
|
||||
return str(value)
|
||||
|
||||
|
||||
|
|
@ -182,10 +185,10 @@ async def log_vertex_build(
|
|||
id=vertex_id,
|
||||
valid=valid,
|
||||
params=str(params) if params else None,
|
||||
# ugly hack to get the model dump with weird datatypes
|
||||
data=json.loads(data.model_dump_json()),
|
||||
# ugly hack to get the model dump with weird datatypes
|
||||
artifacts=json.loads(json.dumps(artifacts, default=str)),
|
||||
# Serialize data using our custom serializer
|
||||
data=serialize_field(data),
|
||||
# Serialize artifacts using our custom serializer
|
||||
artifacts=serialize_field(artifacts) if artifacts else None,
|
||||
)
|
||||
async with session_getter(get_db_service()) as session:
|
||||
inserted = await crud_log_vertex_build(session, vertex_build)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue