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
30.4k stars 3.83k forks source link

Flows imported via LANGFLOW_LOAD_FLOWS_PATH don't show up in the Langflow UI #4010

Open jblang opened 2 hours ago

jblang commented 2 hours ago

Bug Description

Flows imported using the LANGFLOW_LOAD_FLOWS_PATH environment variable do not show up in the Langflow UI. Debug logs show the files being imported, but they do not appear in the UI.

Reproduction

  1. Use the example from https://github.com/DataStax-Examples/langflow-demo-prod
  2. Apply the following diff:

    diff --git a/Dockerfile b/Dockerfile
    index 9fa635e..741872d 100644
    --- a/Dockerfile
    +++ b/Dockerfile
    @@ -20,14 +20,15 @@
     # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     # SOFTWARE.**
    
    -FROM langflowai/langflow:1.0.14
    +FROM langflowai/langflow:1.0.16
    
     WORKDIR /app
    
     COPY flows /app/flows
    
     ENV LANGFLOW_LOAD_FLOWS_PATH=/app/flows
    +ENV LANGFLOW_LOG_LEVEL=debug
    
     EXPOSE 7860
    
    -CMD ["langflow", "run", "--backend-only", "--host", "0.0.0.0", "--port", "7860"]
    +CMD ["langflow", "run", "--host", "0.0.0.0", "--port", "7860"]
  3. Build the image: docker build -t mylangflow:latest -f Dockerfile .
  4. Run the container: docker run -p 7860:7860 mylangflow:latest
  5. Notice that the log shows the flows being loaded:
    INFO     2024-10-03 16:58:11 - INFO     - setup setup.py:512
             - Loading flow from file:
             BasicMemoryChatbot.json
    INFO     2024-10-03 16:58:11 - INFO     - setup setup.py:533
             - Creating new flow:
             84e55d35-ffd9-4f02-8e63-d33d25cb65d3
             with endpoint name
             basic-memory-chatbot
    /app/.venv/lib/python3.12/site-packages/langflow/initial_setup/setup.py:536: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    flow.updated_at = datetime.utcnow()
    INFO     2024-10-03 16:58:11 - INFO     - setup setup.py:512
             - Loading flow from file:
             ResearchPaperDigest.json
    INFO     2024-10-03 16:58:11 - INFO     - setup setup.py:533
             - Creating new flow:
             cc90bbe5-2ac0-46d2-b5f5-2c92a07d87ef
             with endpoint name
             research-paper-digest
    INFO     2024-10-03 16:58:11 - INFO     - setup setup.py:512
             - Loading flow from file:
             PiratePrompt.json
    INFO     2024-10-03 16:58:11 - INFO     - setup setup.py:533
             - Creating new flow:
             ebc064b8-24a0-42bc-82d7-052ff8494566
             with endpoint name pirate-prompt
    INFO     2024-10-03 16:58:11 - INFO     - setup setup.py:512
             - Loading flow from file:
             AstraMemoryChatbot.json
    INFO     2024-10-03 16:58:11 - INFO     - setup setup.py:533
             - Creating new flow:
             b82a60f2-ca42-42ff-a61a-fde2f9d32375
             with endpoint name
             astra-memory-chatbot
  6. Browse to the UI at http://localhost:7860/all
  7. Notice that the flows that were imported are not visible in the UI
  8. Manually upload one of the flows through the UI
  9. Notice that the flow name has a (1) appended to it, suggesting that a flow with the same name already exists but for some reason is not being shown in the UI.

Expected behavior

Imported flows should be visible in the UI.

Who can help?

@jordanrfrazier

Operating System

Docker image on macOS 14.6.1

Langflow Version

1.0.16

Python Version

3.12

Screenshot

image image

Flow File

https://github.com/DataStax-Examples/langflow-demo-prod

dosubot[bot] commented 2 hours ago

Hey @jblang! I'm here to help you with any bugs, questions, or contributions. Let's get this sorted out together!

I found a similar closed issue regarding flows not being visible in the Langflow UI [1]. The suggested solution was to ensure that the update_build_config method is called at the appropriate time in the component lifecycle. This method is necessary to populate the flow names in the UI. You should check the component's initialization code or any event handlers that should trigger the update. If the method is not being called, you can manually call it after the component is initialized or when the flow names need to be updated. Additionally, ensure that the build_config method is correctly defined to include the flow_name field with the necessary options and refresh capabilities.

In your case, since the logs indicate that the flows are being loaded but not displayed, it might be worth checking if the update_build_config method is being triggered correctly in your setup. If the issue persists, it might be UI-related, and you may need to wait for an update or fix from the development team.

To continue talking to Dosu, mention @dosu.

jordanrfrazier commented 58 minutes ago

Confirmed this still exists on 1.0.18. I do see the correct flows being returned from the api/v1/flows request though. Going to go see what's going on in the FE.