Merge branch 'python_custom_node_component' of personal:logspace-ai/langflow into python_custom_node_component

This commit is contained in:
anovazzi1 2023-07-27 09:47:20 -03:00
commit 3baa3a1ca5
2 changed files with 8 additions and 4 deletions

View file

@ -141,14 +141,17 @@ class CustomComponent(Component, extra=Extra.allow):
def get_function(self):
return validate.create_function(self.code, self.function_entrypoint_name)
def load_flow(self, flow_id: str):
def load_flow(self, flow_id: str, tweaks: Optional[dict] = None):
from langflow.processing.process import build_sorted_vertices_with_caching
from langflow.processing.process import process_tweaks
with session_getter() as session:
data_graph = flow.data if (flow := session.get(Flow, flow_id)) else None
if not data_graph:
graph_data = flow.data if (flow := session.get(Flow, flow_id)) else None
if not graph_data:
raise ValueError(f"Flow {flow_id} not found")
return build_sorted_vertices_with_caching(data_graph)
if tweaks:
graph_data = process_tweaks(graph_data=graph_data, tweaks=tweaks)
return build_sorted_vertices_with_caching(graph_data)
def list_flows(self):
with session_getter() as session:

View file

@ -98,6 +98,7 @@ def add_new_custom_field(
display_name = field_config.pop("display_name", field_name)
field_type = field_config.pop("field_type", field_type)
field_type = process_type(field_type)
field_value = field_config.pop("value", field_value)
if "name" in field_config:
warnings.warn(