langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
27.06k stars 3.58k forks source link

Run Flow, Flow as Tool, Sub Flow components do not show flows in drop down box for flow name #2972

Closed Arron-Clague closed 1 month ago

Arron-Clague commented 1 month ago

Bug Description

Run Flow, Flow as Tool, Sub Flow components do not show flows in drop down box for flow name

Reproduction

Place components on canvas attempt to set flow name from dropdown

Expected behavior

Should show flows from collection

Who can help?

@anovazzi1 @Cristhianzl @lucaseduoli

Operating System

Ubuntu Linux 22.04

Langflow Version

1.10 to 1.12 at least

Python Version

3.10

Screenshot

Screenshot 2024-07-26 at 08 44 05

Flow File

No response

dosubot[bot] commented 1 month ago

The issue with the "Run Flow," "Flow as Tool," and "Sub Flow" components not displaying flows in the dropdown box for selecting a flow name is likely due to the update_build_config method not being called or the list_flows method not returning any flows. The update_build_config method updates the build_config with available flow names by calling get_flow_names, which in turn calls list_flows to retrieve the flow data.

Here is the relevant code snippet from the FlowToolComponent class:

class FlowToolComponent(CustomComponent):
    # ... other methods and attributes ...

    def get_flow_names(self) -> List[str]:
        flow_datas = self.list_flows()
        return [flow_data.data["name"] for flow_data in flow_datas]

    def update_build_config(self, build_config: dotdict, field_value: Any, field_name: str | None = None):
        logger.debug(f"Updating build config with field value {field_value} and field name {field_name}")
        if field_name == "flow_name":
            build_config["flow_name"]["options"] = self.get_flow_names()

        return build_config

To resolve this issue, ensure that:

  1. The update_build_config method is being called appropriately.
  2. The list_flows method is correctly implemented and returning the available flows.

Additionally, the "Flow as Tool," "Run Flow," and "Sub Flow" components have a Flow Name parameter with options that should list the available flows. These components also support real-time refresh and have a refresh button to update the list of flows. Make sure these features are enabled and functioning correctly to ensure the dropdown box is populated with the available flows [1][2][3].

To continue talking to Dosu, mention @dosu.

laura-y7860 commented 1 month ago

Encountering the same issue here too.

severfire commented 1 month ago

Same error here 1.12,

YamonBot commented 1 month ago

It was resolved in v1.0.13.

Arron-Clague commented 1 month ago

Hi @YamonBot it appears not fixed : only the run as flow tool shows items in its dropdown box, and attempting to use the component always produced the error : "Error building Component Run Flow: 'in ' requires string as left operand, not NoneType". I am on 1.0.13. Thanks : Arron

lucaseduoli commented 1 month ago

Hello!

I will be fixing this issue today.

Thanks!