-
I created a custom component and I try to rename it. But after changing the name and display_name it still shows as "Custom Component" which makes it hard to differentiate from other custom components. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey @menzelma! I'm here to assist you with any bugs, questions, or contributions you have. Just let me know how I can help! Dosu To rename a custom component so that it no longer shows as "Custom Component" after changing the name and from langflow.custom import CustomComponent
from langchain.schema import Document
class DocumentProcessor(CustomComponent):
display_name = "Document Processor"
description = "This component processes a document"
def build_config(self) -> dict:
options = ["Uppercase", "Lowercase", "Titlecase"]
return {
"function": {"options": options,
"value": options[0],
"display_name": "Function"},
"document": {"display_name": "Document"}
}
def build(self, document: Document, function: str) -> Document:
if isinstance(document, list):
document = document[0]
page_content = document.page_content
if function == "Uppercase":
page_content = page_content.upper()
elif function == "Lowercase":
page_content = page_content.lower()
elif function == "Titlecase":
page_content = page_content.title()
self.repr_value = f"Result of {function} function: {page_content}"
return Document(page_content=page_content) Ensure that the |
Beta Was this translation helpful? Give feedback.
The reason your custom component still appears as "Custom Component" in the canvas even after setting the
display_name
attribute is likely because thedisplay_name
attribute is not being properly utilized or referenced in the code that renders the component on the canvas.In the provided code, the
display_name
attribute is set correctly within theCustomComponent
class: