Merge remote-tracking branch 'origin/dev' into merge

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-12-12 15:45:53 -03:00
commit e3a2abacae
231 changed files with 22158 additions and 6728 deletions

16
tests/data/component.py Normal file
View file

@ -0,0 +1,16 @@
import random
from langflow import CustomComponent
class TestComponent(CustomComponent):
def refresh_values(self):
# This is a function that will be called every time the component is updated
# and should return a list of random strings
return [f"Random {random.randint(1, 100)}" for _ in range(5)]
def build_config(self):
return {"param": {"display_name": "Param", "options": self.refresh_values}}
def build(self, param: int):
return param

View file

@ -0,0 +1,17 @@
import random
from langflow import CustomComponent
from langflow.field_typing import TemplateField
class TestComponent(CustomComponent):
def refresh_values(self):
# This is a function that will be called every time the component is updated
# and should return a list of random strings
return [f"Random {random.randint(1, 100)}" for _ in range(5)]
def build_config(self):
return {"param": TemplateField(display_name="Param", options=self.refresh_values)}
def build(self, param: int):
return param