Replies: 2 comments
-
Hey @bro-xuan! I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer. Let's tackle this together! To create a custom component that acts as a "yes" or "no" operator, passing the value to the next component if the input is "True" and ending the process if the input is "False", you can use the following code as a reference: from langflow.custom import Component
from langflow.io import BoolInput, MessageTextInput, Output
from langflow.schema.message import Message
class YesNoOperatorComponent(Component):
display_name = "Yes/No Operator"
description = "Passes the value if the input is True, ends the process if the input is False."
icon = "toggle-on"
inputs = [
BoolInput(
name="input_value",
display_name="Input Value",
info="Boolean input to evaluate.",
),
MessageTextInput(
name="value_to_pass",
display_name="Value to Pass",
info="The value to pass if the input is True.",
),
]
outputs = [
Output(display_name="Passed Output", name="passed_output", method="pass_through"),
]
def pass_through(self) -> Message:
input_value = self.input_value
value_to_pass = self.value_to_pass
if input_value:
self.status = value_to_pass
return Message(text=value_to_pass)
else:
self.stop()
return Message() This component evaluates the boolean input value. If the input is |
Beta Was this translation helpful? Give feedback.
-
Hi! 👋 We are using other channels as our official means of communication with users. We apologize for the delayed response. Thank you for your understanding. Best regards, |
Beta Was this translation helpful? Give feedback.
-
How do I write a component that acts as a "yes" or "no" operator, that if text input is "True", then pass the value to next component, if "FALSE" then end
Beta Was this translation helpful? Give feedback.
All reactions