fix: deepcopy component output to avoid overriding previous outputs (#3698)
* Fixes copy of component outputs * Fix issue with copying outputs in custom components - Update loop to iterate over `_outputs.values()` instead of `outputs` to ensure correct attribute setting. * Refactor output handling in custom component to use dictionary values - Updated methods to iterate over `_outputs.values()` instead of `outputs`. - Ensured consistent access to output values across various methods. - Fixed potential issues with output value resetting and state model building. * Fix incorrect attribute reference in set_output_value method * Add missing import for CustomComponent in test_custom_component.py * Refactor `test_read_flow` to generate unique flow names for each test run * Refactor: Rename `_outputs` to `_outputs_map` in custom component - Updated all references of `_outputs` to `_outputs_map` in `component.py` to improve clarity and consistency. - Adjusted related methods and attributes in `base.py` to align with the new naming convention. * Fix output handling in custom component - Moved `_reset_all_output_values` call to ensure outputs are reset after initialization. - Updated attribute access to use `_outputs_map` instead of `_outputs` for consistency. --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
1e334335d1
commit
3643d962b9
5 changed files with 28 additions and 24 deletions
|
|
@ -400,6 +400,7 @@ def test_custom_component_get_function_entrypoint_args_no_args():
|
|||
the CustomComponent class with a build method with no arguments.
|
||||
"""
|
||||
my_code = """
|
||||
from langflow.custom import CustomComponent
|
||||
class MyMainClass(CustomComponent):
|
||||
def build():
|
||||
pass"""
|
||||
|
|
|
|||
|
|
@ -73,10 +73,11 @@ def test_read_flows(client: TestClient, json_flow: str, active_user, logged_in_h
|
|||
assert len(response.json()) > 0
|
||||
|
||||
|
||||
def test_read_flow(client: TestClient, json_flow: str, active_user, logged_in_headers):
|
||||
def test_read_flow(client: TestClient, json_flow: str, logged_in_headers):
|
||||
flow = orjson.loads(json_flow)
|
||||
data = flow["data"]
|
||||
flow = FlowCreate(name="Test Flow", description="description", data=data)
|
||||
unique_name = str(uuid4())
|
||||
flow = FlowCreate(name=unique_name, description="description", data=data)
|
||||
response = client.post("api/v1/flows/", json=flow.model_dump(), headers=logged_in_headers)
|
||||
flow_id = response.json()["id"] # flow_id should be a UUID but is a string
|
||||
# turn it into a UUID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue