feat: Add ComponentFrontendNode to CustomComponent
This commit adds the `ComponentFrontendNode` class to the `CustomComponent` module. The `ComponentFrontendNode` class defines a new frontend node for the `Component` type. It includes a template with a code input field. This change enhances the functionality and flexibility of the `CustomComponent` module.
This commit is contained in:
parent
b0432c3802
commit
b7de1ff3bd
7 changed files with 105 additions and 31 deletions
20
tests/data/component_nested_call.py
Normal file
20
tests/data/component_nested_call.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from langflow.custom import CustomComponent
|
||||
from langflow.template.field.base import Input, Output
|
||||
from random import randint
|
||||
|
||||
|
||||
class MultipleOutputsComponent(CustomComponent):
|
||||
inputs = [
|
||||
Input(display_name="Input", name="input", field_type=str),
|
||||
Input(display_name="Number", name="number", field_type=int),
|
||||
]
|
||||
outputs = [
|
||||
Output(name="Certain Output", method="certain_output"),
|
||||
Output(name="Other Output", method="other_output"),
|
||||
]
|
||||
|
||||
def certain_output(self) -> int:
|
||||
return randint(0, self.number)
|
||||
|
||||
def other_output(self) -> int:
|
||||
return self.certain_output()
|
||||
Loading…
Add table
Add a link
Reference in a new issue