-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
I've a simple custom component,
Before building:
After building:
Look how the User ID output is unlinked?
which extracts the chat input, splits it, and outputs 2 items. With 1.6.4, I'm following the group_output=True and connect the 2 outputs to next prompt component.
When I build the individual component (or the entire flow), the 1st output from my custom component gets unlinked.
Reproduction
Custom component code is below,
Expand/Collapse
from langflow.custom import Component
from langflow.io import MessageTextInput, Output
#from langflow.inputs import MessageTextInput
from langflow.schema import Data
from langflow.field_typing import Text
from langflow.schema.message import Message
class ExtractUserData(Component):
display_name = "Extract User Data"
description = "custom component that extracts user data from the user chat."
documentation: str = "https://docs.langflow.org/components-custom-components"
icon = "split"
name = "extract_user_data"
inputs = [
MessageTextInput(
name="user_input_data",
display_name="User Input Data",
info="This is auto extracted session_id/user_id + user typed message from the chat input",
required=True,
),
]
outputs = [
Output(display_name="User ID", name="user_id", method="extract_user_id", group_outputs=True),
Output(display_name="User Message", name="user_msg", method="extract_user_msg", group_outputs=True),
]
async def extract_user_id(self) -> Message:
"""Extracts the user id from the user input data."""
try:
if self.user_input_data:
data = self.user_input_data.split('||')
if not data or len(data) < 1:
raise ValueError("User ID within Input Data is empty")
else:
uid = data[0]
self.log(f"Extracted User ID: {uid}")
return Message(text=uid)
else:
raise ValueError("User Input Data is empty")
except Exception as e:
err_msg = f"Error extracting user id: {str(e)}"
self.log(err_msg)
raise ValueError(err_msg)
async def extract_user_msg(self) -> Message:
"""Extracts the user message from the user input data."""
try:
if self.user_input_data:
data = self.user_input_data.split('||')
if not data or len(data) < 2:
raise ValueError("Current Page within Input Data is empty")
else:
umsg = data[1]
self.log(f"Extracted User Message: {umsg}")
return Message(text=umsg)
else:
raise ValueError("User Input Data is empty")
except Exception as e:
err_msg = f"Error extracting user message: {str(e)}"
self.log(err_msg)
raise ValueError(err_msg)
Expected behavior
It should just be linked to next component
Who can help?
No response
Operating System
Ubuntu Linux 24.04
Langflow Version
1.6.4
Python Version
3.12
Screenshot
No response
Flow File
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working