langflow-ai / langflow

⛓️ Langflow is a visual framework for building multi-agent and RAG applications. It's open-source, Python-powered, fully customizable, model and vector store agnostic.

Home Page:http://www.langflow.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Component do not display

liujichengs opened this issue · comments

I have defined why only one Document component is displayed on the UI page, as if there is mutual overlap between the two components. For example, when I delete one component, the other one is displayed

the code is:
A、BookLoaderComponent

class BookLoaderComponent(CustomComponent):
    display_name: str = "BookLoader"
    description: str = ""

    def build_config(self) -> Dict[str, Any]:
        return {
            "token": {
                "display_name": "Token",
                "required": "true",
            },
            "code": {"show": "true"},
        }

    def build(
            self,
            token: str,
            team_code: str,
            knowledge_code: str
    ) -> List[Document]:
        docs = collect(token)
        metadata = {"title": "title", "source": ""}
        return [Document(page_content=docs, metadata=metadata)]

B、DocComponent

class DocComponent(CustomComponent):
    display_name: str = "DocLoader"
    description: str = ""

    def build_config(self) -> Dict[str, Any]:
        return {
            "token": {
                "display_name": "Token",
                "required": "true",
            },
            "team_code": {
                "display_name": "TeamCode",
                "required": "true",
            },
            "code": {"show": "true"},
        }

    def build(
            self,
            token: str,
            team_code: str,
    ) -> List[Document]:
        docs = get_doc_detail_by_code(team_code, token)
        metadata = {"title": "ue", "source": ""}
        return [Document(page_content=docs, metadata=metadata)]

Both files are in the documentloaders folder

my langflow version is v0.6.10

help

Hey @liujichengs

Both components work on the frontend?

This might be a bug in the main, version.

I'll take a look at this later today. Thanks for the report!