Add pinned state to CustomComponent and FrontendNode
This commit is contained in:
parent
cb4fe92e9b
commit
16018c1d6f
2 changed files with 19 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ from uuid import UUID
|
|||
import yaml
|
||||
from cachetools import TTLCache, cachedmethod
|
||||
from fastapi import HTTPException
|
||||
|
||||
from langflow.interface.custom.code_parser.utils import (
|
||||
extract_inner_type_from_generic_alias,
|
||||
extract_union_types_from_generic_alias,
|
||||
|
|
@ -35,6 +36,8 @@ class CustomComponent(Component):
|
|||
"""The field configuration of the component. Defaults to an empty dictionary."""
|
||||
field_order: Optional[List[str]] = None
|
||||
"""The field order of the component. Defaults to an empty list."""
|
||||
pinned: Optional[bool] = False
|
||||
"""The default pinned state of the component. Defaults to False."""
|
||||
code_class_base_inheritance: ClassVar[str] = "CustomComponent"
|
||||
function_entrypoint_name: ClassVar[str] = "build"
|
||||
function: Optional[Callable] = None
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import re
|
|||
from collections import defaultdict
|
||||
from typing import ClassVar, Dict, List, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, Field, field_serializer, model_serializer
|
||||
|
||||
from langflow.template.field.base import TemplateField
|
||||
from langflow.template.frontend_node.constants import (
|
||||
CLASSES_TO_REMOVE,
|
||||
|
|
@ -10,7 +12,6 @@ from langflow.template.frontend_node.constants import (
|
|||
from langflow.template.frontend_node.formatter import field_formatters
|
||||
from langflow.template.template.base import Template
|
||||
from langflow.utils import constants
|
||||
from pydantic import BaseModel, Field, field_serializer, model_serializer
|
||||
|
||||
|
||||
class FieldFormatters(BaseModel):
|
||||
|
|
@ -44,17 +45,31 @@ class FieldFormatters(BaseModel):
|
|||
class FrontendNode(BaseModel):
|
||||
_format_template: bool = True
|
||||
template: Template
|
||||
"""Template for the frontend node."""
|
||||
description: Optional[str] = None
|
||||
"""Description of the frontend node."""
|
||||
icon: Optional[str] = None
|
||||
"""Icon of the frontend node."""
|
||||
is_composition: Optional[bool] = None
|
||||
"""Whether the frontend node is used for composition."""
|
||||
base_classes: List[str]
|
||||
"""List of base classes for the frontend node."""
|
||||
name: str = ""
|
||||
"""Name of the frontend node."""
|
||||
display_name: Optional[str] = ""
|
||||
"""Display name of the frontend node."""
|
||||
documentation: str = ""
|
||||
"""Documentation of the frontend node."""
|
||||
custom_fields: Optional[Dict] = defaultdict(list)
|
||||
"""Custom fields of the frontend node."""
|
||||
output_types: List[str] = []
|
||||
"""List of output types for the frontend node."""
|
||||
full_path: Optional[str] = None
|
||||
"""Full path of the frontend node."""
|
||||
field_formatters: FieldFormatters = Field(default_factory=FieldFormatters)
|
||||
"""Field formatters for the frontend node."""
|
||||
pinned: bool = False
|
||||
"""Whether the frontend node is pinned."""
|
||||
|
||||
beta: bool = False
|
||||
error: Optional[str] = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue