Add CombineTextComponent to concatenate multiple text sources
This commit is contained in:
parent
775fa87f92
commit
acb1fa9997
1 changed files with 22 additions and 0 deletions
22
src/backend/base/langflow/components/helpers/CombineText.py
Normal file
22
src/backend/base/langflow/components/helpers/CombineText.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
from langflow.interface.custom.custom_component import CustomComponent
|
||||
from langflow.field_typing import Text
|
||||
|
||||
|
||||
class CombineTextComponent(CustomComponent):
|
||||
display_name = "Combine Text"
|
||||
description = "Concatenate multiple text sources into a single text chunk using a specified delimiter."
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
"texts": {
|
||||
"display_name": "Texts",
|
||||
"info": "Multiple text inputs to concatenate.",
|
||||
},
|
||||
"delimiter": {
|
||||
"display_name": "Delimiter",
|
||||
"info": "A string used to separate each text input. Defaults to a whitespace.",
|
||||
},
|
||||
}
|
||||
|
||||
def build(self, texts: str, delimiter: str = " ") -> Text:
|
||||
return delimiter.join(texts)
|
||||
Loading…
Add table
Add a link
Reference in a new issue