Spaces:
Running
Running
Download src/backend/base/langflow/components/processing/combine_text.py from opendigital/agent-flow: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/opendigital/agent-flow/resolve/main/src/backend/base/langflow/components/processing/combine_text.py
- Command line
-
hf download hf://spaces/opendigital/agent-flow/src/backend/base/langflow/components/processing/combine_text.py
-
curl -L -o combine_text.py https://huggingface.co/spaces/opendigital/agent-flow/resolve/main/src/backend/base/langflow/components/processing/combine_text.py
1.21 kB
| from langflow.custom import Component | |
| from langflow.io import MessageTextInput, Output | |
| from langflow.schema.message import Message | |
| class CombineTextComponent(Component): | |
| display_name = "Combine Text" | |
| description = "Concatenate two text sources into a single text chunk using a specified delimiter." | |
| icon = "merge" | |
| name = "CombineText" | |
| inputs = [ | |
| MessageTextInput( | |
| name="text1", | |
| display_name="First Text", | |
| info="The first text input to concatenate.", | |
| ), | |
| MessageTextInput( | |
| name="text2", | |
| display_name="Second Text", | |
| info="The second text input to concatenate.", | |
| ), | |
| MessageTextInput( | |
| name="delimiter", | |
| display_name="Delimiter", | |
| info="A string used to separate the two text inputs. Defaults to a whitespace.", | |
| value=" ", | |
| ), | |
| ] | |
| outputs = [ | |
| Output(display_name="Combined Text", name="combined_text", method="combine_texts"), | |
| ] | |
| def combine_texts(self) -> Message: | |
| combined = self.delimiter.join([self.text1, self.text2]) | |
| self.status = combined | |
| return Message(text=combined) | |