Merge branch 'python_custom_node_component' of personal:logspace-ai/langflow into python_custom_node_component
This commit is contained in:
commit
3baa3a1ca5
2 changed files with 8 additions and 4 deletions
|
|
@ -141,14 +141,17 @@ class CustomComponent(Component, extra=Extra.allow):
|
||||||
def get_function(self):
|
def get_function(self):
|
||||||
return validate.create_function(self.code, self.function_entrypoint_name)
|
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 build_sorted_vertices_with_caching
|
||||||
|
from langflow.processing.process import process_tweaks
|
||||||
|
|
||||||
with session_getter() as session:
|
with session_getter() as session:
|
||||||
data_graph = flow.data if (flow := session.get(Flow, flow_id)) else None
|
graph_data = flow.data if (flow := session.get(Flow, flow_id)) else None
|
||||||
if not data_graph:
|
if not graph_data:
|
||||||
raise ValueError(f"Flow {flow_id} not found")
|
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):
|
def list_flows(self):
|
||||||
with session_getter() as session:
|
with session_getter() as session:
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ def add_new_custom_field(
|
||||||
display_name = field_config.pop("display_name", field_name)
|
display_name = field_config.pop("display_name", field_name)
|
||||||
field_type = field_config.pop("field_type", field_type)
|
field_type = field_config.pop("field_type", field_type)
|
||||||
field_type = process_type(field_type)
|
field_type = process_type(field_type)
|
||||||
|
field_value = field_config.pop("value", field_value)
|
||||||
|
|
||||||
if "name" in field_config:
|
if "name" in field_config:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue