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
35.9k stars 4.25k forks source link

Chat session in Playground does not refresh. #4780

Open greenmotion opened 6 days ago

greenmotion commented 6 days ago

Bug Description

The chat session in the playground does not automatically refresh. I can submit a question to the chatbot and hit send, but the chat session will not show me the response, until I switch to another window and switch back and/or close playground and re-open it. In other words, it seems it only refreshes when the browser window gets refocused. Tried this on Mozilla and Brave (chrome)

Reproduction

  1. In a chatbot workflow, open playground
  2. type a question, hit send
  3. one the send button stops showing "stop", no response is displayed in the chat.
  4. Navigate away and go back to your browser window and/or leave playground and go back in, and now you can see the response.

Expected behavior

Upon hitting send, a response should automatically be displayed in the chat session.

Who can help?

No response

Operating System

Ubuntu LTS 20.24

Langflow Version

1.1.0

Python Version

3.12

Screenshot

No response

Flow File

No response

dosubot[bot] commented 6 days ago

The issue you're experiencing with the chat session not automatically refreshing in the Langflow Playground might be related to how the frontend handles real-time updates or re-renders. Langflow uses WebSocket communication to update the chat interface in real-time. The handleWsMessage function processes incoming WebSocket messages and updates the chat history, which should trigger re-renders of the chat interface [1].

Additionally, there is an event listener for visibility changes in the browser that resets certain states when the tab becomes visible again [2]. This might be affecting the refresh behavior you're observing.

To troubleshoot, you might want to check if the WebSocket connection is being established correctly and if the handleWsMessage function is processing messages as expected. Also, ensure that there are no issues with the state management that could prevent the chat interface from updating in real-time.

To continue talking to Dosu, mention @dosu.

anovazzi1 commented 2 days ago

hey @greenmotion, I've tried the main branch and couldn't reproduce the issue, how are you running langflow exactly? are you using docker or something similar?