refactor: Update field_type in HandleInput to use SerializableFieldTypes enum
This commit is contained in:
parent
969deae5e1
commit
fb1595e4b0
2 changed files with 2 additions and 8 deletions
|
|
@ -26,7 +26,7 @@ SerializableFieldTypes = Annotated[FieldTypes, PlainSerializer(lambda v: v.value
|
|||
class BaseInputMixin(BaseModel, validate_assignment=True):
|
||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
|
||||
field_type: Optional[SerializableFieldTypes | str] = Field(default=FieldTypes.TEXT)
|
||||
field_type: Optional[SerializableFieldTypes] = Field(default=FieldTypes.TEXT)
|
||||
|
||||
required: bool = False
|
||||
"""Specifies if the field is required. Defaults to False."""
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from typing import Any, Callable, Optional, Union
|
||||
|
||||
from pydantic import Field, field_validator, model_validator
|
||||
from pydantic import Field, field_validator
|
||||
|
||||
from langflow.inputs.validators import StrictBoolean
|
||||
from langflow.schema.data import Data
|
||||
|
|
@ -22,12 +22,6 @@ class HandleInput(BaseInputMixin, ListableInputMixin):
|
|||
input_types: list[str] = Field(default_factory=list)
|
||||
field_type: Optional[SerializableFieldTypes] = FieldTypes.OTHER
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_model_type(self):
|
||||
# FieldType should be a string
|
||||
self.field_type = " | ".join(self.input_types)
|
||||
return self
|
||||
|
||||
|
||||
class PromptInput(BaseInputMixin, ListableInputMixin):
|
||||
field_type: Optional[SerializableFieldTypes] = FieldTypes.PROMPT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue