Formatting

This commit is contained in:
Lucas Oliveira 2023-11-29 13:44:41 -03:00
commit 766fd2b08f
2 changed files with 4 additions and 14 deletions

View file

@ -3,8 +3,7 @@ from collections import defaultdict
from typing import ClassVar, DefaultDict, Dict, List, Optional
from langflow.template.field.base import TemplateField
from langflow.template.frontend_node.constants import (CLASSES_TO_REMOVE,
FORCE_SHOW_FIELDS)
from langflow.template.frontend_node.constants import CLASSES_TO_REMOVE, FORCE_SHOW_FIELDS
from langflow.template.frontend_node.formatter import field_formatters
from langflow.template.template.base import Template
from langflow.utils import constants
@ -136,11 +135,7 @@ class FrontendNode(BaseModel):
if "dict" in _type.lower() and field.name == "dict_":
field.field_type = "file"
field.file_types = [".json", ".yaml", ".yml"]
elif (
_type.startswith("Dict")
or _type.startswith("Mapping")
or _type.startswith("dict")
):
elif _type.startswith("Dict") or _type.startswith("Mapping") or _type.startswith("dict"):
field.field_type = "dict"
return _type

View file

@ -4,8 +4,7 @@ from typing import ClassVar, Dict, Optional
from langflow.template.field.base import TemplateField
from langflow.template.frontend_node.constants import FORCE_SHOW_FIELDS
from langflow.template.frontend_node.formatter.base import FieldFormatter
from langflow.utils.constants import (ANTHROPIC_MODELS, CHAT_OPENAI_MODELS,
OPENAI_MODELS)
from langflow.utils.constants import ANTHROPIC_MODELS, CHAT_OPENAI_MODELS, OPENAI_MODELS
class OpenAIAPIKeyFormatter(FieldFormatter):
@ -150,9 +149,5 @@ class DictCodeFileFormatter(FieldFormatter):
if "dict" in _type.lower() and key == "dict_":
field.field_type = "file"
field.file_types = [".json", ".yaml", ".yml"]
elif (
_type.startswith("Dict")
or _type.startswith("Mapping")
or _type.startswith("dict")
):
elif _type.startswith("Dict") or _type.startswith("Mapping") or _type.startswith("dict"):
field.field_type = "dict"