feat: add new categories endpoint (#4184)
* ✨ (endpoints.py): Add new endpoint to retrieve sidebar categories for the frontend application. * 📝 (schemas.py): add SidebarCategory and SidebarCategoriesResponse models to define sidebar categories and response structure for API endpoint. * ✨ (constants.py): Add sidebar categories with display names, names, icons, and beta status for different components to enhance the user interface and navigation experience. * 📝 (constants.py): Update icons names to use proper casing for consistency and clarity in the code.
This commit is contained in:
parent
eedfe43e69
commit
a6b684f139
3 changed files with 154 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ from langflow.api.v1.schemas import (
|
|||
InputValueRequest,
|
||||
ProcessResponse,
|
||||
RunResponse,
|
||||
SidebarCategoriesResponse,
|
||||
SimplifiedAPIRequest,
|
||||
TaskStatusResponse,
|
||||
UpdateCustomComponentRequest,
|
||||
|
|
@ -49,6 +50,7 @@ from langflow.services.deps import (
|
|||
from langflow.services.session.service import SessionService
|
||||
from langflow.services.telemetry.schema import RunPayload
|
||||
from langflow.services.telemetry.service import TelemetryService
|
||||
from langflow.utils.constants import SIDEBAR_CATEGORIES
|
||||
from langflow.utils.version import get_version_info
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -640,3 +642,8 @@ def get_config():
|
|||
return settings_service.settings.model_dump()
|
||||
except Exception as exc:
|
||||
raise HTTPException(status_code=500, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@router.get("/sidebar_categories", response_model=SidebarCategoriesResponse)
|
||||
def get_sidebar_categories():
|
||||
return SidebarCategoriesResponse(categories=SIDEBAR_CATEGORIES)
|
||||
|
|
|
|||
|
|
@ -355,3 +355,14 @@ class ConfigResponse(BaseModel):
|
|||
auto_saving_interval: int
|
||||
health_check_max_retries: int
|
||||
max_file_size_upload: int
|
||||
|
||||
|
||||
class SidebarCategory(BaseModel):
|
||||
display_name: str
|
||||
name: str
|
||||
icon: str
|
||||
beta: bool
|
||||
|
||||
|
||||
class SidebarCategoriesResponse(BaseModel):
|
||||
categories: list[SidebarCategory]
|
||||
|
|
|
|||
|
|
@ -175,3 +175,139 @@ MESSAGE_SENDER_NAME_AI = "AI"
|
|||
MESSAGE_SENDER_NAME_USER = "User"
|
||||
|
||||
MAX_TEXT_LENGTH = 99999
|
||||
|
||||
|
||||
SIDEBAR_CATEGORIES = [
|
||||
{
|
||||
"display_name": "Saved",
|
||||
"name": "saved_components",
|
||||
"icon": "GradientSave",
|
||||
"beta": False,
|
||||
},
|
||||
{
|
||||
"display_name": "Inputs",
|
||||
"name": "inputs",
|
||||
"icon": "Download",
|
||||
"beta": False,
|
||||
},
|
||||
{
|
||||
"display_name": "Outputs",
|
||||
"name": "outputs",
|
||||
"icon": "Upload",
|
||||
"beta": False,
|
||||
},
|
||||
{
|
||||
"display_name": "Prompts",
|
||||
"name": "prompts",
|
||||
"icon": "TerminalSquare",
|
||||
"beta": False,
|
||||
},
|
||||
{
|
||||
"display_name": "Data",
|
||||
"name": "data",
|
||||
"icon": "Database",
|
||||
"beta": False,
|
||||
},
|
||||
{
|
||||
"display_name": "Models",
|
||||
"name": "models",
|
||||
"icon": "BrainCircuit",
|
||||
"beta": False,
|
||||
},
|
||||
{
|
||||
"display_name": "Helpers",
|
||||
"name": "helpers",
|
||||
"icon": "Wand2",
|
||||
"beta": False,
|
||||
},
|
||||
{
|
||||
"display_name": "Vector Stores",
|
||||
"name": "vectorstores",
|
||||
"icon": "Layers",
|
||||
"beta": False,
|
||||
},
|
||||
{
|
||||
"display_name": "Embeddings",
|
||||
"name": "embeddings",
|
||||
"icon": "Binary",
|
||||
"beta": False,
|
||||
},
|
||||
{
|
||||
"display_name": "Agents",
|
||||
"name": "agents",
|
||||
"icon": "Bot",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Astra Assistants",
|
||||
"name": "astra_assistants",
|
||||
"icon": "Sparkles",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Chains",
|
||||
"name": "chains",
|
||||
"icon": "Link",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Loaders",
|
||||
"name": "documentloaders",
|
||||
"icon": "Paperclip",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Utilities",
|
||||
"name": "langchain_utilities",
|
||||
"icon": "PocketKnife",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Link Extractors",
|
||||
"name": "link_extractors",
|
||||
"icon": "Link2",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Memories",
|
||||
"name": "memories",
|
||||
"icon": "Cpu",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Output Parsers",
|
||||
"name": "output_parsers",
|
||||
"icon": "Compass",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Prototypes",
|
||||
"name": "prototypes",
|
||||
"icon": "FlaskConical",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Retrievers",
|
||||
"name": "retrievers",
|
||||
"icon": "FileSearch",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Text Splitters",
|
||||
"name": "textsplitters",
|
||||
"icon": "Scissors",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Toolkits",
|
||||
"name": "toolkits",
|
||||
"icon": "Package2",
|
||||
"beta": True,
|
||||
},
|
||||
{
|
||||
"display_name": "Tools",
|
||||
"name": "tools",
|
||||
"icon": "Hammer",
|
||||
"beta": True,
|
||||
},
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue