🔥 chore(endpoints.py): remove unused custom_component endpoint
The custom_component endpoint was commented out and unused. It has been removed to improve code readability and maintainability.
This commit is contained in:
parent
2f5d721ba8
commit
47494dd9a8
1 changed files with 0 additions and 43 deletions
|
|
@ -13,7 +13,6 @@ from langflow.api.v1.schemas import (
|
||||||
|
|
||||||
from langflow.interface.types import (
|
from langflow.interface.types import (
|
||||||
build_langchain_types_dict,
|
build_langchain_types_dict,
|
||||||
build_langchain_template_custom_component,
|
|
||||||
)
|
)
|
||||||
from langflow.database.base import get_session
|
from langflow.database.base import get_session
|
||||||
from sqlmodel import Session
|
from sqlmodel import Session
|
||||||
|
|
@ -84,45 +83,3 @@ def get_version():
|
||||||
from langflow import __version__
|
from langflow import __version__
|
||||||
|
|
||||||
return {"version": __version__}
|
return {"version": __version__}
|
||||||
|
|
||||||
|
|
||||||
# @router.post("/custom_component", response_model=CustomComponentResponse, status_code=200)
|
|
||||||
@router.post("/custom_component", status_code=200)
|
|
||||||
def custom_component(
|
|
||||||
code: CustomComponentCode,
|
|
||||||
session: Session = Depends(get_session),
|
|
||||||
):
|
|
||||||
code_test = """
|
|
||||||
from langflow.interface.chains.base import ChainCreator
|
|
||||||
from langflow.interface.tools.base import ToolCreator
|
|
||||||
|
|
||||||
|
|
||||||
class MyPythonClass():
|
|
||||||
def __init__(self, title: str, author: str, year_published: int):
|
|
||||||
self.title = title
|
|
||||||
self.author = author
|
|
||||||
self.year_published = year_published
|
|
||||||
|
|
||||||
def get_details(self):
|
|
||||||
return f"Title: {self.title}, Author: {self.author}, Year Published: {self.year_published}"
|
|
||||||
|
|
||||||
def update_year_published(self, new_year: int):
|
|
||||||
self.year_published = new_year
|
|
||||||
print(f"The year of publication has been updated to {new_year}.")
|
|
||||||
|
|
||||||
def build(self, name: str, id: int, other: str) -> ChainCreator:
|
|
||||||
return ChainCreator()
|
|
||||||
"""
|
|
||||||
|
|
||||||
extractor = ClassCodeExtractor(code_test)
|
|
||||||
data = extractor.extract_class_info()
|
|
||||||
is_valid_class_template(data)
|
|
||||||
|
|
||||||
(
|
|
||||||
function_args,
|
|
||||||
function_return_type,
|
|
||||||
) = extractor.get_entrypoint_function_args_and_return_type()
|
|
||||||
|
|
||||||
return build_langchain_template_custom_component(
|
|
||||||
code_test, function_args, function_return_type
|
|
||||||
)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue