Refactor Template class in base.py
This commit is contained in:
parent
42dd851ab6
commit
7953950f14
1 changed files with 2 additions and 2 deletions
|
|
@ -1,9 +1,8 @@
|
||||||
from typing import Callable, Union
|
from typing import Callable, Union
|
||||||
|
|
||||||
from pydantic import BaseModel, model_serializer
|
|
||||||
|
|
||||||
from langflow.template.field.base import TemplateField
|
from langflow.template.field.base import TemplateField
|
||||||
from langflow.utils.constants import DIRECT_TYPES
|
from langflow.utils.constants import DIRECT_TYPES
|
||||||
|
from pydantic import BaseModel, model_serializer
|
||||||
|
|
||||||
|
|
||||||
class Template(BaseModel):
|
class Template(BaseModel):
|
||||||
|
|
@ -31,6 +30,7 @@ class Template(BaseModel):
|
||||||
for field in self.fields:
|
for field in self.fields:
|
||||||
result[field.name] = field.model_dump(by_alias=True, exclude_none=True)
|
result[field.name] = field.model_dump(by_alias=True, exclude_none=True)
|
||||||
result["_type"] = result.pop("type_name")
|
result["_type"] = result.pop("type_name")
|
||||||
|
result.pop("field_order", None)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# For backwards compatibility
|
# For backwards compatibility
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue