Update TemplateField class in base.py
This commit is contained in:
parent
108d0b2e12
commit
ec1fe03974
1 changed files with 5 additions and 2 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
from typing import Any, Callable, Optional, Union
|
from typing import Any, Callable, Optional, Union
|
||||||
|
|
||||||
from pydantic import BaseModel, ConfigDict, Field, field_serializer
|
|
||||||
|
|
||||||
from langflow.field_typing.range_spec import RangeSpec
|
from langflow.field_typing.range_spec import RangeSpec
|
||||||
|
from pydantic import BaseModel, ConfigDict, Field, field_serializer
|
||||||
|
|
||||||
|
|
||||||
class TemplateField(BaseModel):
|
class TemplateField(BaseModel):
|
||||||
model_config = ConfigDict()
|
model_config = ConfigDict()
|
||||||
|
|
||||||
field_type: str = Field(default="str", serialization_alias="type")
|
field_type: str = Field(default="str", serialization_alias="type")
|
||||||
"""The type of field this is. Default is a string."""
|
"""The type of field this is. Default is a string."""
|
||||||
|
|
||||||
|
|
@ -64,6 +64,9 @@ class TemplateField(BaseModel):
|
||||||
range_spec: Optional[RangeSpec] = Field(default=None, serialization_alias="rangeSpec")
|
range_spec: Optional[RangeSpec] = Field(default=None, serialization_alias="rangeSpec")
|
||||||
"""Range specification for the field. Defaults to None."""
|
"""Range specification for the field. Defaults to None."""
|
||||||
|
|
||||||
|
load_from_db: bool = False
|
||||||
|
"""Specifies if the field should be loaded from the database. Defaults to False."""
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return self.model_dump(by_alias=True, exclude_none=True)
|
return self.model_dump(by_alias=True, exclude_none=True)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue