langflow
langflow copied to clipboard
fix: add data field to returned object on flowheader if flow is a component
This pull request includes several changes to improve the code readability and functionality in the langflow
backend. The most important changes include reformatting imports, updating the read_flows
function to use FlowHeader.model_validate
, adding model_validator
to FlowHeader
, and reformatting the FlowBase
and Flow
classes for better readability.
Code readability improvements:
-
src/backend/base/langflow/api/v1/flows.py
: Reformatted imports to a single line for better readability. -
src/backend/base/langflow/services/database/models/flow/model.py
: Reformatted theFlowBase
andFlow
classes to improve readability by breaking long lines into multiple lines. [1] [2]
Functionality improvements:
-
src/backend/base/langflow/api/v1/flows.py
: Updated theread_flows
function to useFlowHeader.model_validate
for validating flow headers, simplifying the code. -
src/backend/base/langflow/services/database/models/flow/model.py
: Addedmodel_validator
to theFlowHeader
class to ensuredata
is set toNone
ifis_component
isFalse
.
Import enhancements:
-
src/backend/base/langflow/services/database/models/flow/model.py
: Addedmodel_validator
import frompydantic
to support the new validation inFlowHeader
.